soc.2009.vulture: 4bca5a64: Added ability to block buddies.

gdick at soc.pidgin.im gdick at soc.pidgin.im
Fri Aug 21 19:40:42 EDT 2009


-----------------------------------------------------------------
Revision: 4bca5a64e01b8e6bb0a670915c353cb0f123a547
Ancestor: 65ab3cd9ade773fa58857f8790bb99009eb853b1
Author: gdick at soc.pidgin.im
Date: 2009-08-21T20:24:00
Branch: im.pidgin.soc.2009.vulture
URL: http://d.pidgin.im/viewmtn/revision/info/4bca5a64e01b8e6bb0a670915c353cb0f123a547

Modified files:
        vulture/purpleblist.c vulture/purplequeue.c
        vulture/purplequeue.h vulture/vulture-res.rc
        vulture/vultureblist.c

ChangeLog: 

Added ability to block buddies.

-------------- next part --------------
============================================================
--- vulture/purpleblist.c	5154d3d7a5fbd9ee8e94cea4b35aa9c7436e86a5
+++ vulture/purpleblist.c	f9863e3759b62a498692cd980585bd1b5179ca8e
@@ -436,6 +436,7 @@ void PurpleMakeBuddyMenu(HMENU hmenu, Pu
 
 	/* Enable/disable/check stuff as appropriate. */
 	CheckMenuItem(hmenu, IDM_BLIST_CONTEXT_SHOWOFFLINE, purple_blist_node_get_bool(lpblistnode, "show_offline") ? MF_CHECKED : MF_UNCHECKED);
+	CheckMenuItem(hmenu, IDM_BLIST_CONTEXT_BLOCK, purple_privacy_check(purple_buddy_get_account((PurpleBuddy*)lpblistnode), purple_buddy_get_name((PurpleBuddy*)lpblistnode)) ? MF_UNCHECKED : MF_CHECKED);
 }
 
 
============================================================
--- vulture/purplequeue.c	7e4106c7d061e444d597f9cde5f2405a6144e1d8
+++ vulture/purplequeue.c	4bf53fa39c2ed327000591728bfddcc2c7b21760
@@ -497,6 +497,25 @@ static void DispatchPurpleCall(PURPLE_CA
 
 		break;
 
+	case PC_TOGGLEBLOCK:
+		{
+			PurpleBuddy *lpbuddy = (PurpleBuddy*)EFFECTIVE_BUDDY(((VULTURE_BLIST_NODE*)lppurplecall->lpvParam)->lpblistnode);
+
+			if(lpbuddy)
+			{
+				PurpleAccount *lpaccount = purple_buddy_get_account(lpbuddy);
+				LPCSTR szName = purple_buddy_get_name(lpbuddy);
+
+				/* Toggle whether the user is blocked. */
+				if(purple_privacy_check(lpaccount, szName))
+					purple_privacy_deny(lpaccount, szName, FALSE, FALSE);
+				else
+					purple_privacy_allow(lpaccount, szName, FALSE, FALSE);
+			}
+		}
+
+		break;
+
 	case PC_QUIT:
 		purple_core_quit();
 		g_main_loop_quit(g_lpgmainloop);
============================================================
--- vulture/purplequeue.h	b22dceb98860f0ae6649d10713cd82d490a67836
+++ vulture/purplequeue.h	7229c5bc69deb316d4b205c2d347ddf89b576f64
@@ -143,6 +143,9 @@ enum PURPLE_CALL_ID
 
 	/* (VULTURE_BLIST_NODE_GET_ACCOUNT*) */
 	PC_GETBLISTCHATNODEACCOUNT,
+
+	/* (VULTURE_BLIST_NODE*) */
+	PC_TOGGLEBLOCK,
 };
 
 
============================================================
--- vulture/vulture-res.rc	4a1c676638f2e0f78961ad6e53dd7db948719fa2
+++ vulture/vulture-res.rc	d865dab6d7310af76033fcae83940084c3894a45
@@ -90,7 +90,7 @@ IDM_CONV MENU
 	\
 	MENUITEM "", 0, MFT_SEPARATOR \
 	\
-	MENUITEM "&Block", IDM_BLIST_CONTEXT_BLOCK, MFT_STRING, MFS_GRAYED \
+	MENUITEM "&Block", IDM_BLIST_CONTEXT_BLOCK, MFT_STRING \
 	MENUITEM "Show when &offline", IDM_BLIST_CONTEXT_SHOWOFFLINE, MFT_STRING
 
 #define CONTEXT_CUSTOMICON \
============================================================
--- vulture/vultureblist.c	2cfea1b0f443065a65658984d471e0bc05e1954f
+++ vulture/vultureblist.c	9a25b6157e3d91cb5a0b6d4b633b6f0241695286
@@ -1261,6 +1261,11 @@ static void RunBuddyMenuCmd(HWND hwndBud
 		UpdateBListNode(hwndBuddies, lpvblistnode);
 
 		break;
+
+	case IDM_BLIST_CONTEXT_BLOCK:
+		VultureSingleSyncPurpleCall(PC_TOGGLEBLOCK, lpvblistnode);
+		UpdateBListNode(hwndBuddies, lpvblistnode);
+		break;
 	}
 }
 


More information about the Commits mailing list