soc.2009.vulture: 65f37a3a: Toggle show_offline from the buddy list.
gdick at soc.pidgin.im
gdick at soc.pidgin.im
Mon Jul 20 15:33:12 EDT 2009
-----------------------------------------------------------------
Revision: 65f37a3a2dbc57bb2fc85358a7c5d17eb4d9bf9c
Ancestor: d77da136d3f1c1fc9b4d0d39956c609a4caeb9ee
Author: gdick at soc.pidgin.im
Date: 2009-07-20T14:09:06
Branch: im.pidgin.soc.2009.vulture
URL: http://d.pidgin.im/viewmtn/revision/info/65f37a3a2dbc57bb2fc85358a7c5d17eb4d9bf9c
Modified files:
vulture/purpleblist.c vulture/purplequeue.c
vulture/purplequeue.h vulture/vulture-res.rc
vulture/vultureblist.c
ChangeLog:
Toggle show_offline from the buddy list.
-------------- next part --------------
============================================================
--- vulture/purpleblist.c 3bd807fd44abe6dc95ad476ea8cb5fa4ee24bb01
+++ vulture/purpleblist.c ee0a98c0e8ed7d9a8d121fad883ba73c35ff27b6
@@ -302,7 +302,8 @@ void PurpleBuddyStatusChanged(PurpleBudd
*
* @param[in,out] hmenu Basic menu loaded from the resources,
* which will be augmented.
- * @param lpblistnode Buddy-list node.
+ * @param lpblistnode Buddy-list node for a buddy (not
+ * contact).
* @param[out] lplpglistVMA Used to return a list populated with
* pointers to item-data for the menu
* items that we add, which the caller
@@ -315,7 +316,7 @@ void PurpleMakeBuddyMenu(HMENU hmenu, Pu
{
GList *lpglistPMA;
PurplePluginProtocolInfo *lpprplinfo;
- PurpleConnection *lpconnection = ((PurpleBuddy*)lpblistnode)->account->gc;
+ PurpleConnection *lpconnection;
UINT uiNextID = IDM_DYNAMIC_FIRST;
*lplpglistVMA = NULL;
@@ -323,6 +324,8 @@ void PurpleMakeBuddyMenu(HMENU hmenu, Pu
if(!lpblistnode)
return;
+ lpconnection = ((PurpleBuddy*)lpblistnode)->account->gc;
+
if(lpconnection &&
(lpprplinfo = PURPLE_PLUGIN_PROTOCOL_INFO(lpconnection->prpl)) &&
lpprplinfo->blist_node_menu)
@@ -337,4 +340,7 @@ void PurpleMakeBuddyMenu(HMENU hmenu, Pu
lpglistPMA = purple_blist_node_get_extended_menu(lpblistnode);
PurpleInsertDynamicMenu(hmenu, VultureGetMenuPosFromID(hmenu, IDM_BLIST_CONTEXT_BLOCK), &uiNextID, lpglistPMA, lplpglistVMA, lpblistnode);
g_list_free(lpglistPMA);
+
+ /* Enable/disable/check stuff as appropriate. */
+ CheckMenuItem(hmenu, IDM_BLIST_CONTEXT_SHOWOFFLINE, purple_blist_node_get_bool(lpblistnode, "show_offline") ? MF_CHECKED : MF_UNCHECKED);
}
============================================================
--- vulture/purplequeue.c 2da33c94be517bd531d0af12f824f61744d64018
+++ vulture/purplequeue.c 8ac28ebf299e397b7fe61b714bc1e6cd4b8563b7
@@ -65,6 +65,11 @@ static gboolean QueueDispatch(GSource *l
static gboolean QueueDispatch(GSource *lpgsource, GSourceFunc gsfCallback, gpointer lpvData);
+#define EFFECTIVE_BUDDY(lpblistnode) \
+ ((lpblistnode) && PURPLE_BLIST_NODE_IS_CONTACT(lpblistnode) ? \
+ (PurpleBlistNode*)purple_contact_get_priority_buddy((PurpleContact*)(lpblistnode)) : \
+ (lpblistnode))
+
#define ASYNC_QUEUE_PRIORITY G_PRIORITY_DEFAULT
#define SYNC_QUEUE_PRIORITY (G_PRIORITY_DEFAULT - 1)
@@ -271,7 +276,8 @@ static void DispatchPurpleCall(PURPLE_CA
case PC_MAKEBUDDYMENU:
{
VULTURE_MAKE_CONTEXT_MENU *lpvmcm = lppurplecall->lpvParam;
- PurpleMakeBuddyMenu(lpvmcm->hmenu, lpvmcm->lpvblistnode->lpblistnode, lpvmcm->lplpglistVMA);
+
+ PurpleMakeBuddyMenu(lpvmcm->hmenu, EFFECTIVE_BUDDY(lpvmcm->lpvblistnode->lpblistnode), lpvmcm->lplpglistVMA);
}
break;
@@ -285,6 +291,19 @@ static void DispatchPurpleCall(PURPLE_CA
break;
+ case PC_TOGGLESHOWOFFLINE:
+ {
+ PurpleBlistNode *lpblistnodeBuddy = EFFECTIVE_BUDDY(((VULTURE_BLIST_NODE*)lppurplecall->lpvParam)->lpblistnode);
+
+ if(lpblistnodeBuddy)
+ {
+ purple_blist_node_set_bool(lpblistnodeBuddy, "show_offline", !purple_blist_node_get_bool(lpblistnodeBuddy, "show_offline"));
+ PurpleBlistUpdateNode(NULL, lpblistnodeBuddy);
+ }
+ }
+
+ break;
+
case PC_QUIT:
purple_core_quit();
g_main_loop_quit(g_lpgmainloop);
============================================================
--- vulture/purplequeue.h 22435e1cfa7ab70997628402e0139fb8b0336b6b
+++ vulture/purplequeue.h 611ad85182c54db2595a9d9aface8d9e6e44d6fa
@@ -88,6 +88,9 @@ enum PURPLE_CALL_ID
/* (VULTURE_MENU_ACTION*) */
PC_PERFORMMENUACTION,
+
+ /* (VULTURE_BLIST_NODE*) Buddy or contact node. */
+ PC_TOGGLESHOWOFFLINE,
};
============================================================
--- vulture/vulture-res.rc 9f8cced84f786de0e1d44e3838c22809e8e94f56
+++ vulture/vulture-res.rc f37b20b28b6f682e20099ac92e6183869f404eef
@@ -53,7 +53,7 @@ IDM_CONV MENU
MENUITEM "", 0, MFT_SEPARATOR \
\
MENUITEM "&Block", IDM_BLIST_CONTEXT_BLOCK, MFT_STRING, MFS_GRAYED \
- MENUITEM "Show when &offline", IDM_BLIST_CONTEXT_SHOWOFFLINE, MFT_STRING, MFS_GRAYED
+ MENUITEM "Show when &offline", IDM_BLIST_CONTEXT_SHOWOFFLINE, MFT_STRING
#define CONTACT_TAIL \
MENUITEM "", 0, MFT_SEPARATOR \
============================================================
--- vulture/vultureblist.c 721550e925f3c11a4d0c6bcd9d27333e568e03b7
+++ vulture/vultureblist.c 83ff5e22679d56dda403501c5136289a9c24a733
@@ -682,7 +682,9 @@ static INT_PTR CALLBACK BuddyListDlgProc
g_list_foreach(lpglistVMA, (GFunc)g_free, NULL);
g_list_free(lpglistVMA);
- /* Allow default right-click processing. */
+ /* Prevent spurious right-click messages being sent
+ * elsewhere.
+ */
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, TRUE);
return TRUE;
@@ -923,6 +925,10 @@ static void RunBuddyMenuCmd(VULTURE_BLIS
VultureEnqueueAsyncPurpleCall(PC_BLISTNODEACTIVATED, lpvblistnode);
break;
+ case IDM_BLIST_CONTEXT_SHOWOFFLINE:
+ VultureEnqueueAsyncPurpleCall(PC_TOGGLESHOWOFFLINE, lpvblistnode);
+ break;
+
default:
/* Not a static command that we recongise; might be a dynamic
* command.
More information about the Commits
mailing list