pidgin: d225b7ae: Merged two buddy blocking methods in Gad...

tomkiewicz at cpw.pidgin.im tomkiewicz at cpw.pidgin.im
Fri Jul 1 10:17:34 EDT 2011


----------------------------------------------------------------------
Revision: d225b7ae359aa9448f679e2386a1f75326487b2e
Parent:   b1dfad7fa45e394c213a97053d7ed5926c69901d
Author:   tomkiewicz at cpw.pidgin.im
Date:     07/01/11 10:12:00
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/d225b7ae359aa9448f679e2386a1f75326487b2e

Changelog: 

Merged two buddy blocking methods in Gadu-Gadu protocol. Fixes #5303

Changes against parent b1dfad7fa45e394c213a97053d7ed5926c69901d

  patched  ChangeLog
  patched  libpurple/protocols/gg/gg.c

-------------- next part --------------
============================================================
--- ChangeLog	5958d409f9ee845d76b0ff4450bf95e7a43e13ad
+++ ChangeLog	5886d302069f9683e87b1766e7b96691f3b02c5c
@@ -5,6 +5,7 @@ version 2.9.1 (MM/DD/YYYY):
 	* Fixed searching for buddies in public directory. (Tomasz Wasilczyk)
 	  (#5242)
 	* Better status message handling. (Tomasz Wasilczyk) (#14314)
+	* Merged two buddy blocking methods. (Tomasz Wasilczyk) (#5303)
 
 	XMPP:
 	* Do not generate malformed XML ("</>") when setting an empty mood.
============================================================
--- libpurple/protocols/gg/gg.c	6e47c30552adb2a7ec0c0a0f217d1198dcdbbd4a
+++ libpurple/protocols/gg/gg.c	8f2cf612e96f37d3b6358cc3b699e406b03e5431
@@ -877,30 +877,26 @@ static void ggp_bmenu_add_to_chat(Purple
 
 /* ----- BLOCK BUDDIES -------------------------------------------------- */
 
-static void ggp_bmenu_block(PurpleBlistNode *node, gpointer ignored)
+static void ggp_add_deny(PurpleConnection *gc, const char *who)
 {
-	PurpleConnection *gc;
-	PurpleBuddy *buddy;
-	GGPInfo *info;
-	uin_t uin;
+	GGPInfo *info = gc->proto_data;
+	uin_t uin = ggp_str_to_uin(who);
+	
+	purple_debug_info("gg", "ggp_add_deny: %u\n", uin);
+	
+	gg_remove_notify_ex(info->session, uin, GG_USER_NORMAL);
+	gg_add_notify_ex(info->session, uin, GG_USER_BLOCKED);
+}
 
-	buddy = (PurpleBuddy *)node;
-	gc = purple_account_get_connection(purple_buddy_get_account(buddy));
-	info = gc->proto_data;
-
-	uin = ggp_str_to_uin(purple_buddy_get_name(buddy));
-
-	if (purple_blist_node_get_bool(node, "blocked")) {
-		purple_blist_node_set_bool(node, "blocked", FALSE);
-		gg_remove_notify_ex(info->session, uin, GG_USER_BLOCKED);
-		gg_add_notify_ex(info->session, uin, GG_USER_NORMAL);
-		purple_debug_info("gg", "send: uin=%d; mode=NORMAL\n", uin);
-	} else {
-		purple_blist_node_set_bool(node, "blocked", TRUE);
-		gg_remove_notify_ex(info->session, uin, GG_USER_NORMAL);
-		gg_add_notify_ex(info->session, uin, GG_USER_BLOCKED);
-		purple_debug_info("gg", "send: uin=%d; mode=BLOCKED\n", uin);
-	}
+static void ggp_rem_deny(PurpleConnection *gc, const char *who)
+{
+	GGPInfo *info = gc->proto_data;
+	uin_t uin = ggp_str_to_uin(who);
+	
+	purple_debug_info("gg", "ggp_rem_deny: %u\n", uin);
+	
+	gg_remove_notify_ex(info->session, uin, GG_USER_BLOCKED);
+	gg_add_notify_ex(info->session, uin, GG_USER_NORMAL);
 }
 
 /* ---------------------------------------------------------------------- */
@@ -2074,20 +2070,6 @@ static GList *ggp_blist_node_menu(Purple
 		m = g_list_append(m, act);
 	}
 
-	/* Using a blist node boolean here is also wrong.
-	 * Once the Block and Unblock actions are added to the core,
-	 * this will have to go. -- rlaager */
-	if (purple_blist_node_get_bool(node, "blocked")) {
-		act = purple_menu_action_new(_("Unblock"),
-		                           PURPLE_CALLBACK(ggp_bmenu_block),
-		                           NULL, NULL);
-	} else {
-		act = purple_menu_action_new(_("Block"),
-		                           PURPLE_CALLBACK(ggp_bmenu_block),
-		                           NULL, NULL);
-	}
-	m = g_list_append(m, act);
-
 	return m;
 }
 
@@ -2684,9 +2666,9 @@ static PurplePluginProtocolInfo prpl_inf
 	ggp_remove_buddy,		/* remove_buddy */
 	NULL,				/* remove_buddies */
 	NULL,				/* add_permit */
-	NULL,				/* add_deny */
+	ggp_add_deny,			/* add_deny */
 	NULL,				/* rem_permit */
-	NULL,				/* rem_deny */
+	ggp_rem_deny,			/* rem_deny */
 	NULL,				/* set_permit_deny */
 	ggp_join_chat,			/* join_chat */
 	NULL,				/* reject_chat */


More information about the Commits mailing list