Mercurial > pidgin.yaz
comparison libpurple/protocols/gg/gg.c @ 32181: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 | 3e98b34853ee |
children | e17b5aab37d0 |
comparison
equal
deleted
inserted
replaced
32180:afb58f3ee8f0 | 32181:f8cc6922b296 |
---|---|
875 g_free(msg); | 875 g_free(msg); |
876 } | 876 } |
877 | 877 |
878 /* ----- BLOCK BUDDIES -------------------------------------------------- */ | 878 /* ----- BLOCK BUDDIES -------------------------------------------------- */ |
879 | 879 |
880 static void ggp_bmenu_block(PurpleBlistNode *node, gpointer ignored) | 880 static void ggp_add_deny(PurpleConnection *gc, const char *who) |
881 { | 881 { |
882 PurpleConnection *gc; | 882 GGPInfo *info = gc->proto_data; |
883 PurpleBuddy *buddy; | 883 uin_t uin = ggp_str_to_uin(who); |
884 GGPInfo *info; | 884 |
885 uin_t uin; | 885 purple_debug_info("gg", "ggp_add_deny: %u\n", uin); |
886 | 886 |
887 buddy = (PurpleBuddy *)node; | 887 gg_remove_notify_ex(info->session, uin, GG_USER_NORMAL); |
888 gc = purple_account_get_connection(purple_buddy_get_account(buddy)); | 888 gg_add_notify_ex(info->session, uin, GG_USER_BLOCKED); |
889 info = gc->proto_data; | 889 } |
890 | 890 |
891 uin = ggp_str_to_uin(purple_buddy_get_name(buddy)); | 891 static void ggp_rem_deny(PurpleConnection *gc, const char *who) |
892 | 892 { |
893 if (purple_blist_node_get_bool(node, "blocked")) { | 893 GGPInfo *info = gc->proto_data; |
894 purple_blist_node_set_bool(node, "blocked", FALSE); | 894 uin_t uin = ggp_str_to_uin(who); |
895 gg_remove_notify_ex(info->session, uin, GG_USER_BLOCKED); | 895 |
896 gg_add_notify_ex(info->session, uin, GG_USER_NORMAL); | 896 purple_debug_info("gg", "ggp_rem_deny: %u\n", uin); |
897 purple_debug_info("gg", "send: uin=%d; mode=NORMAL\n", uin); | 897 |
898 } else { | 898 gg_remove_notify_ex(info->session, uin, GG_USER_BLOCKED); |
899 purple_blist_node_set_bool(node, "blocked", TRUE); | 899 gg_add_notify_ex(info->session, uin, GG_USER_NORMAL); |
900 gg_remove_notify_ex(info->session, uin, GG_USER_NORMAL); | |
901 gg_add_notify_ex(info->session, uin, GG_USER_BLOCKED); | |
902 purple_debug_info("gg", "send: uin=%d; mode=BLOCKED\n", uin); | |
903 } | |
904 } | 900 } |
905 | 901 |
906 /* ---------------------------------------------------------------------- */ | 902 /* ---------------------------------------------------------------------- */ |
907 /* ----- INTERNAL CALLBACKS --------------------------------------------- */ | 903 /* ----- INTERNAL CALLBACKS --------------------------------------------- */ |
908 /* ---------------------------------------------------------------------- */ | 904 /* ---------------------------------------------------------------------- */ |
2072 PURPLE_CALLBACK(ggp_bmenu_add_to_chat), | 2068 PURPLE_CALLBACK(ggp_bmenu_add_to_chat), |
2073 NULL, NULL); | 2069 NULL, NULL); |
2074 m = g_list_append(m, act); | 2070 m = g_list_append(m, act); |
2075 } | 2071 } |
2076 | 2072 |
2077 /* Using a blist node boolean here is also wrong. | |
2078 * Once the Block and Unblock actions are added to the core, | |
2079 * this will have to go. -- rlaager */ | |
2080 if (purple_blist_node_get_bool(node, "blocked")) { | |
2081 act = purple_menu_action_new(_("Unblock"), | |
2082 PURPLE_CALLBACK(ggp_bmenu_block), | |
2083 NULL, NULL); | |
2084 } else { | |
2085 act = purple_menu_action_new(_("Block"), | |
2086 PURPLE_CALLBACK(ggp_bmenu_block), | |
2087 NULL, NULL); | |
2088 } | |
2089 m = g_list_append(m, act); | |
2090 | |
2091 return m; | 2073 return m; |
2092 } | 2074 } |
2093 | 2075 |
2094 static GList *ggp_chat_info(PurpleConnection *gc) | 2076 static GList *ggp_chat_info(PurpleConnection *gc) |
2095 { | 2077 { |
2682 ggp_add_buddy, /* add_buddy */ | 2664 ggp_add_buddy, /* add_buddy */ |
2683 NULL, /* add_buddies */ | 2665 NULL, /* add_buddies */ |
2684 ggp_remove_buddy, /* remove_buddy */ | 2666 ggp_remove_buddy, /* remove_buddy */ |
2685 NULL, /* remove_buddies */ | 2667 NULL, /* remove_buddies */ |
2686 NULL, /* add_permit */ | 2668 NULL, /* add_permit */ |
2687 NULL, /* add_deny */ | 2669 ggp_add_deny, /* add_deny */ |
2688 NULL, /* rem_permit */ | 2670 NULL, /* rem_permit */ |
2689 NULL, /* rem_deny */ | 2671 ggp_rem_deny, /* rem_deny */ |
2690 NULL, /* set_permit_deny */ | 2672 NULL, /* set_permit_deny */ |
2691 ggp_join_chat, /* join_chat */ | 2673 ggp_join_chat, /* join_chat */ |
2692 NULL, /* reject_chat */ | 2674 NULL, /* reject_chat */ |
2693 ggp_get_chat_name, /* get_chat_name */ | 2675 ggp_get_chat_name, /* get_chat_name */ |
2694 NULL, /* chat_invite */ | 2676 NULL, /* chat_invite */ |