soc.2009.vulture: 9f6308dd: Can now initiate conversations from the ...
gdick at soc.pidgin.im
gdick at soc.pidgin.im
Wed Jun 24 15:15:32 EDT 2009
-----------------------------------------------------------------
Revision: 9f6308dd9a9810a34d68090fb7e02c43cd30c59c
Ancestor: d86ddf2f000915a9966391e75fa5809b25de2eda
Author: gdick at soc.pidgin.im
Date: 2009-06-24T19:05:46
Branch: im.pidgin.soc.2009.vulture
URL: http://d.pidgin.im/viewmtn/revision/info/9f6308dd9a9810a34d68090fb7e02c43cd30c59c
Modified files:
vulture/purpleblist.c vulture/purpleblist.h
vulture/purplequeue.c vulture/purplequeue.h
vulture/vultureblist.c
ChangeLog:
Can now initiate conversations from the buddy-list.
-------------- next part --------------
============================================================
--- vulture/purpleblist.c 52f22504086c2db722d41854f2d5c28ed2385455
+++ vulture/purpleblist.c d5ba7b569dbe333f7cec2bdb728fd9aa593c3de0
@@ -220,3 +220,25 @@ void VultureBListNodeRelease(VULTURE_BLI
g_free(lpvblnode);
}
}
+
+
+/**
+ * Performs the processing required when a buddy-list node has been double-
+ * clicked. A close cousin of Pidgin's gtk_blist_row_activated_cb.
+ *
+ * @param lpvbn Node.
+ */
+void PurpleBListNodeDoubleClicked(VULTURE_BLIST_NODE *lpvbn)
+{
+ if(PURPLE_BLIST_NODE_IS_CONTACT(lpvbn->lpblistnode) || PURPLE_BLIST_NODE_IS_BUDDY(lpvbn->lpblistnode))
+ {
+ PurpleBuddy *lpbuddy;
+
+ if(PURPLE_BLIST_NODE_IS_CONTACT(lpvbn->lpblistnode))
+ lpbuddy = purple_contact_get_priority_buddy((PurpleContact*)lpvbn->lpblistnode);
+ else
+ lpbuddy = (PurpleBuddy*)lpvbn->lpblistnode;
+
+ purple_conversation_new(PURPLE_CONV_TYPE_IM, lpbuddy->account, lpbuddy->name);
+ }
+}
============================================================
--- vulture/purpleblist.h 4b08869ad7f594ac3de578dbb753447e4c9f538a
+++ vulture/purpleblist.h fbda4cdf6dedd4b37c00831b80d6f7d50683e308
@@ -46,6 +46,7 @@ void VultureBListNodeRelease(VULTURE_BLI
void PurpleBlistUpdateNode(PurpleBuddyList *lpbuddylist, PurpleBlistNode *lpblistnode);
void PurpleBlistRemoveNode(PurpleBuddyList *lpbuddylist, PurpleBlistNode *lpblistnode);
void VultureBListNodeRelease(VULTURE_BLIST_NODE *lpvblnode);
+void PurpleBListNodeDoubleClicked(VULTURE_BLIST_NODE *lpvbn);
static INLINE void VultureBListNodeAddRef(VULTURE_BLIST_NODE *lpvblnode) { InterlockedIncrement(&lpvblnode->lRefCount); }
============================================================
--- vulture/purplequeue.c 892fd73e86b64eb6d22dc4b36d959a6fb04455d6
+++ vulture/purplequeue.c bb128a7f3f9fe6c1904289573425bd77b5015295
@@ -30,6 +30,7 @@
#include "purpleacct.h"
#include "vultureconv.h"
#include "purpleconv.h"
+#include "purpleblist.h"
/** Queue node representing a libpurple call. */
@@ -207,6 +208,10 @@ static void DispatchPurpleCall(PURPLE_CA
break;
+ case PC_BLISTNODEDBLCLKED:
+ PurpleBListNodeDoubleClicked((VULTURE_BLIST_NODE*)lppurplecall->lpvParam);
+ break;
+
case PC_QUIT:
purple_core_quit();
g_main_loop_quit(g_lpgmainloop);
============================================================
--- vulture/purplequeue.h b587a91f6135f57a5b453d7e8aff4f5ae4659184
+++ vulture/purplequeue.h 49db1f3aced7010812056bc9485184c8c6b15dbb
@@ -59,6 +59,9 @@ enum PURPLE_CALL_ID
/* (LPTSTR*) Used to return address of buffer. */
PC_GETSTATUSMSG,
+
+ /* (VULTURE_BLIST_NODE*) Node double-clicked. */
+ PC_BLISTNODEDBLCLKED,
};
============================================================
--- vulture/vultureblist.c 20c6fa07494e76cc71a60f752110e9eccbc9b646
+++ vulture/vultureblist.c 8e4cf470aa3ac52f9deffd32b806b339f2c8c326
@@ -518,6 +518,42 @@ static INT_PTR CALLBACK BuddyListDlgProc
}
return TRUE;
+
+ case WM_NOTIFY:
+ {
+ LPNMHDR lpnmhdr = (LPNMHDR)lParam;
+
+ if(lpnmhdr->idFrom == IDC_TREE_BLIST)
+ {
+ switch(lpnmhdr->code)
+ {
+ case NM_RETURN:
+ case NM_DBLCLK:
+ {
+ TVITEM tvitem;
+
+ /* We double-clicked or pressed
+ * enter. If we have children,
+ * don't do anything special.
+ */
+ if((tvitem.hItem = TreeView_GetSelection(lpnmhdr->hwndFrom)) &&
+ !TreeView_GetChild(lpnmhdr->hwndFrom, tvitem.hItem))
+ {
+ tvitem.mask = TVIF_PARAM;
+ TreeView_GetItem(lpnmhdr->hwndFrom, &tvitem);
+
+ VultureEnqueueAsyncPurpleCall(PC_BLISTNODEDBLCLKED, (VULTURE_BLIST_NODE*)tvitem.lParam);
+
+ return TRUE;
+ }
+ }
+
+ break;
+ }
+ }
+ }
+
+ break;
}
return FALSE;
More information about the Commits
mailing list