Mercurial > pidgin
changeset 31723:f8cc6922b296
Merged two buddy blocking methods in Gadu-Gadu protocol. Fixes #5303
author | tomkiewicz@cpw.pidgin.im |
---|---|
date | Fri, 01 Jul 2011 14:12:00 +0000 |
parents | afb58f3ee8f0 |
children | 563746dba96d |
files | ChangeLog libpurple/protocols/gg/gg.c |
diffstat | 2 files changed, 22 insertions(+), 39 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Mon Jun 27 07:01:10 2011 +0000 +++ b/ChangeLog Fri Jul 01 14:12:00 2011 +0000 @@ -5,6 +5,7 @@ * 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.
--- a/libpurple/protocols/gg/gg.c Mon Jun 27 07:01:10 2011 +0000 +++ b/libpurple/protocols/gg/gg.c Fri Jul 01 14:12:00 2011 +0000 @@ -877,30 +877,26 @@ /* ----- 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; - - 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); - } + 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); +} + +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 @@ 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 @@ 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 */