soc.2009.vulture: b2df2172: Respond to changes in status messages in...
gdick at soc.pidgin.im
gdick at soc.pidgin.im
Fri Jul 3 16:05:26 EDT 2009
-----------------------------------------------------------------
Revision: b2df217243688331bb65fc6bbb4c8dfd9607a9be
Ancestor: 2d23aff53f2376d6741362fcfc4a9eb8cd4b7242
Author: gdick at soc.pidgin.im
Date: 2009-07-02T12:00:58
Branch: im.pidgin.soc.2009.vulture
URL: http://d.pidgin.im/viewmtn/revision/info/b2df217243688331bb65fc6bbb4c8dfd9607a9be
Modified files:
vulture/purpleblist.c vulture/purpleblist.h
vulture/purplemain.c vulture/purplemain.h
vulture/vultureblist.c vulture/vultureconv.c
ChangeLog:
Respond to changes in status messages in IM windows.
-------------- next part --------------
============================================================
--- vulture/purpleblist.c a52e8a43bf3e4d8db45746d170786b02d79d1486
+++ vulture/purpleblist.c 0b9e817d256f83b768dcea8c94aa71ef44604af6
@@ -273,3 +273,22 @@ LPTSTR PurpleBuddyGetStatusText(PurpleBu
return NULL;
}
+
+
+/**
+ * Called in response to buddy-status-changed signal.
+ *
+ * @param lpbuddy Buddy.
+ * @param lpstatusOld Old status.
+ * @param lpstatusNew New status.
+ */
+void PurpleBuddyStatusChanged(PurpleBuddy *lpbuddy, PurpleStatus *lpstatusOld, PurpleStatus *lpstatusNew)
+{
+ /* Are we speaking to this buddy? */
+ PurpleConversation *lpconv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, lpbuddy->name, lpbuddy->account);
+
+ /* If so, tell the UI to update the status message in the conversation.
+ */
+ if(lpconv)
+ VulturePostUIMessage(g_hwndMain, VUIMSG_UPDATEIMSTATUSTEXT, lpconv->ui_data);
+}
============================================================
--- vulture/purpleblist.h 6eceabbc34b41174cecb6563cdb8e15376fa4612
+++ vulture/purpleblist.h 2fb47b93d38fe9e0418bb9bb99d657da6ec30b65
@@ -48,6 +48,7 @@ LPTSTR PurpleBuddyGetStatusText(PurpleBu
void VultureBListNodeRelease(VULTURE_BLIST_NODE *lpvblnode);
void PurpleBListNodeDoubleClicked(VULTURE_BLIST_NODE *lpvbn);
LPTSTR PurpleBuddyGetStatusText(PurpleBuddy *lpbuddy);
+void PurpleBuddyStatusChanged(PurpleBuddy *lpbuddy, PurpleStatus *lpstatusOld, PurpleStatus *lpstatusNew);
static INLINE void VultureBListNodeAddRef(VULTURE_BLIST_NODE *lpvblnode) { InterlockedIncrement(&lpvblnode->lRefCount); }
============================================================
--- vulture/purplemain.c d6de3d72dcb08c440369a68d85e50624048945f7
+++ vulture/purplemain.c 85fe69a4692757bb5877c7107efc7307d345487b
@@ -209,6 +209,7 @@ static void InitUI(void)
purple_signal_connect(purple_savedstatuses_get_handle(), "savedstatus-changed", GINT_TO_POINTER(VSH_STATUS), PURPLE_CALLBACK(PurpleStatusChanged), NULL);
purple_signal_connect(purple_conversations_get_handle(), "conversation-updated", GINT_TO_POINTER(VSH_CONV), PURPLE_CALLBACK(PurpleConvChanged), NULL);
+ purple_signal_connect(purple_blist_get_handle(), "buddy-status-changed", GINT_TO_POINTER(VSH_BLIST), PURPLE_CALLBACK(PurpleBuddyStatusChanged), NULL);
/* Create and load libpurple's buddy-list. */
purple_set_blist(purple_blist_new());
============================================================
--- vulture/purplemain.h a063f6b257d9786f690110e36a27ed53f05c0db8
+++ vulture/purplemain.h 90032a5dbd4f119d66d22621ec897d4ad07986ab
@@ -59,6 +59,9 @@ enum ENUM_VULTURE_UI_MESSAGES
/* (VULTURE_CONV_CHANGED*) */
VUIMSG_CONVCHANGED,
+
+ /* (VULTURE_CONVERSATION*) */
+ VUIMSG_UPDATEIMSTATUSTEXT,
};
/* HandlEs for reigistering signal handlERs. */
@@ -66,6 +69,7 @@ enum ENUM_VULTURE_SIGNAL_HANDLES
{
VSH_STATUS = 1,
VSH_CONV,
+ VSH_BLIST
};
void VultureInitLibpurple(HANDLE *lphthread);
============================================================
--- vulture/vultureblist.c ce01eedb1741802397587d515eba3aaee76fce11
+++ vulture/vultureblist.c bc32bb2ebe383cff669d95674a43bf1939fef665
@@ -316,6 +316,10 @@ static LRESULT CALLBACK MainWndProc(HWND
hwndForward = ((VULTURE_CONV_CHANGED*)lParam)->lpvconv->hwndContainer;
break;
+ case VUIMSG_UPDATEIMSTATUSTEXT:
+ hwndForward = ((VULTURE_CONVERSATION*)lParam)->hwndConv;
+ break;
+
case VUIMSG_QUIT:
DestroyWindow(hwnd);
break;
============================================================
--- vulture/vultureconv.c 4e0de7f9f4a408d0691fb6ef519b558f86f8075a
+++ vulture/vultureconv.c 0166ee8132a5b39263a6904197a9ed2169fe4818
@@ -60,6 +60,7 @@ static void SetConvTitle(VULTURE_CONVERS
static LRESULT CALLBACK InputBoxSubclassProc(HWND hwnd, UINT uiMsg, WPARAM wParam, LPARAM lParam);
static void EnableAppropriateConvWindow(CONVCONTAINERDATA *lpccd);
static void SetConvTitle(VULTURE_CONVERSATION *lpvconv, HWND hwndTabs, LPTSTR szTitle);
+static void UpdateIMStatusText(HWND hwndDlg, VULTURE_CONVERSATION *lpvconv);
/**
@@ -410,14 +411,15 @@ static INT_PTR CALLBACK IMDlgProc(HWND h
switch(uiMsg)
{
case WM_INITDIALOG:
- {
- VULTURE_CONV_GET_STRING vcgetstring;
+ UpdateIMStatusText(hwndDlg, (VULTURE_CONVERSATION*)lParam);
+ break;
- /* Set the status text. */
- vcgetstring.lpvconv = (VULTURE_CONVERSATION*)lParam;
- VultureSingleSyncPurpleCall(PC_IMGETSTATUSMSG, &vcgetstring);
- SetDlgItemText(hwndDlg, IDC_STATIC_STATUS, vcgetstring.sz ? vcgetstring.sz : TEXT(""));
- if(vcgetstring.sz) g_free(vcgetstring.sz);
+ case WM_PURPLEUIMSG:
+ switch(wParam)
+ {
+ case VUIMSG_UPDATEIMSTATUSTEXT:
+ UpdateIMStatusText(hwndDlg, (VULTURE_CONVERSATION*)lParam);
+ break;
}
break;
@@ -780,3 +782,21 @@ static void SetConvTitle(VULTURE_CONVERS
TabCtrl_SetItem(hwndTabs, lpvconv->iTabIndex, &tcitem);
SetDlgItemText(lpvconv->hwndConv, IDC_STATIC_NAME, szTitle);
}
+
+
+/**
+ * Refreshes the status text in an IM window.
+ *
+ * @param hwndDlg IM dialogue.
+ * @param lpvconv Conversation.
+ */
+static void UpdateIMStatusText(HWND hwndDlg, VULTURE_CONVERSATION *lpvconv)
+{
+ VULTURE_CONV_GET_STRING vcgetstring;
+
+ /* Set the status text. */
+ vcgetstring.lpvconv = lpvconv;
+ VultureSingleSyncPurpleCall(PC_IMGETSTATUSMSG, &vcgetstring);
+ SetDlgItemText(hwndDlg, IDC_STATIC_STATUS, vcgetstring.sz ? vcgetstring.sz : TEXT(""));
+ if(vcgetstring.sz) g_free(vcgetstring.sz);
+}
More information about the Commits
mailing list