Mercurial > pidgin
comparison libpurple/protocols/msn/notification.c @ 27065:caaeb149126d
Check network type, and send an FQY if necessary, when modifying the allow
and block lists. Before, users who were not added by you (i.e. spammers)
would have no network type and cause disconnects. This should fix it.
Fixes #8977.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Sun, 07 Jun 2009 07:51:50 +0000 |
parents | 175dd2627727 |
children | b9c64694999d |
comparison
equal
deleted
inserted
replaced
27064:175dd2627727 | 27065:caaeb149126d |
---|---|
1971 } | 1971 } |
1972 | 1972 |
1973 g_hash_table_destroy(table); | 1973 g_hash_table_destroy(table); |
1974 } | 1974 } |
1975 | 1975 |
1976 /************************************************************************** | |
1977 * Dispatch server list management | |
1978 **************************************************************************/ | |
1979 typedef struct MsnAddRemoveListData { | |
1980 MsnCmdProc *cmdproc; | |
1981 MsnUser *user; | |
1982 MsnListOp list_op; | |
1983 gboolean add; | |
1984 } MsnAddRemoveListData; | |
1985 | |
1986 static void | |
1987 modify_unknown_buddy_on_list(MsnSession *session, const char *passport, | |
1988 MsnNetwork network, gpointer data) | |
1989 { | |
1990 MsnAddRemoveListData *addrem = data; | |
1991 MsnCmdProc *cmdproc; | |
1992 xmlnode *node; | |
1993 char *payload; | |
1994 int payload_len; | |
1995 | |
1996 cmdproc = addrem->cmdproc; | |
1997 | |
1998 /* Update user first */ | |
1999 msn_user_set_network(addrem->user, network); | |
2000 | |
2001 node = xmlnode_new("ml"); | |
2002 node->child = NULL; | |
2003 | |
2004 msn_add_contact_xml(session, node, passport, | |
2005 addrem->list_op, network); | |
2006 | |
2007 payload = xmlnode_to_str(node, &payload_len); | |
2008 xmlnode_free(node); | |
2009 | |
2010 if (addrem->add) | |
2011 msn_notification_post_adl(cmdproc, payload, payload_len); | |
2012 else | |
2013 msn_notification_post_rml(cmdproc, payload, payload_len); | |
2014 | |
2015 g_free(payload); | |
2016 g_free(addrem); | |
2017 } | |
2018 | |
1976 void | 2019 void |
1977 msn_notification_add_buddy_to_list(MsnNotification *notification, MsnListId list_id, | 2020 msn_notification_add_buddy_to_list(MsnNotification *notification, MsnListId list_id, |
1978 MsnUser *user) | 2021 MsnUser *user) |
1979 { | 2022 { |
2023 MsnAddRemoveListData *addrem; | |
1980 MsnCmdProc *cmdproc; | 2024 MsnCmdProc *cmdproc; |
1981 MsnListOp list_op = 1 << list_id; | 2025 MsnListOp list_op = 1 << list_id; |
1982 xmlnode *adl_node; | 2026 xmlnode *adl_node; |
1983 char *payload; | 2027 char *payload; |
1984 int payload_len; | 2028 int payload_len; |
1992 list_op, user->networkid); | 2036 list_op, user->networkid); |
1993 | 2037 |
1994 payload = xmlnode_to_str(adl_node, &payload_len); | 2038 payload = xmlnode_to_str(adl_node, &payload_len); |
1995 xmlnode_free(adl_node); | 2039 xmlnode_free(adl_node); |
1996 | 2040 |
1997 msn_notification_post_adl(cmdproc, payload, payload_len); | 2041 if (user->networkid != MSN_NETWORK_UNKNOWN) { |
2042 msn_notification_post_adl(cmdproc, payload, payload_len); | |
2043 | |
2044 } else { | |
2045 addrem = g_new(MsnAddRemoveListData, 1); | |
2046 addrem->cmdproc = cmdproc; | |
2047 addrem->user = user; | |
2048 addrem->list_op = list_op; | |
2049 addrem->add = TRUE; | |
2050 | |
2051 msn_notification_send_fqy(notification->session, payload, payload_len, | |
2052 modify_unknown_buddy_on_list, addrem); | |
2053 } | |
2054 | |
1998 g_free(payload); | 2055 g_free(payload); |
1999 } | 2056 } |
2000 | 2057 |
2001 void | 2058 void |
2002 msn_notification_rem_buddy_from_list(MsnNotification *notification, MsnListId list_id, | 2059 msn_notification_rem_buddy_from_list(MsnNotification *notification, MsnListId list_id, |
2003 MsnUser *user) | 2060 MsnUser *user) |
2004 { | 2061 { |
2062 MsnAddRemoveListData *addrem; | |
2005 MsnCmdProc *cmdproc; | 2063 MsnCmdProc *cmdproc; |
2006 MsnListOp list_op = 1 << list_id; | 2064 MsnListOp list_op = 1 << list_id; |
2007 xmlnode *rml_node; | 2065 xmlnode *rml_node; |
2008 char *payload; | 2066 char *payload; |
2009 int payload_len; | 2067 int payload_len; |
2017 list_op, user->networkid); | 2075 list_op, user->networkid); |
2018 | 2076 |
2019 payload = xmlnode_to_str(rml_node, &payload_len); | 2077 payload = xmlnode_to_str(rml_node, &payload_len); |
2020 xmlnode_free(rml_node); | 2078 xmlnode_free(rml_node); |
2021 | 2079 |
2022 msn_notification_post_rml(cmdproc, payload, payload_len); | 2080 if (user->networkid != MSN_NETWORK_UNKNOWN) { |
2081 msn_notification_post_rml(cmdproc, payload, payload_len); | |
2082 | |
2083 } else { | |
2084 addrem = g_new(MsnAddRemoveListData, 1); | |
2085 addrem->cmdproc = cmdproc; | |
2086 addrem->user = user; | |
2087 addrem->list_op = list_op; | |
2088 addrem->add = FALSE; | |
2089 | |
2090 msn_notification_send_fqy(notification->session, payload, payload_len, | |
2091 modify_unknown_buddy_on_list, addrem); | |
2092 } | |
2023 | 2093 |
2024 g_free(payload); | 2094 g_free(payload); |
2025 } | 2095 } |
2026 | 2096 |
2027 /************************************************************************** | 2097 /************************************************************************** |