summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElliott Sales de Andrade <qulogic@pidgin.im>2009-06-07 07:51:50 +0000
committerElliott Sales de Andrade <qulogic@pidgin.im>2009-06-07 07:51:50 +0000
commit33b115fe3fa2637deaf872ce8ee83a9455bb2069 (patch)
tree7af4717e5fcec8576b6e07da9d315231167c8c6e
parentd5d6d5b136a5751b087cd9a25707a9d3d0a22b03 (diff)
downloadpidgin-33b115fe3fa2637deaf872ce8ee83a9455bb2069.tar.gz
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.
-rw-r--r--ChangeLog3
-rw-r--r--libpurple/protocols/msn/notification.c74
2 files changed, 75 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 2b6d2093d4..433fcd7b2a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -20,6 +20,9 @@ version 2.6.0 (??/??/2009):
moved to a new network and the old servers are not accessible.
* Gadu-Gadu accounts can specify a server to which to connect.
(Krzysztof "kreez" Tobola)
+ * Modifying the MSN privacy list for buddies not added by you (i.e.
+ spammers and other generally unwanted users) should no longer cause
+ a 240 error and disconnection.
XMPP:
* Voice & Video support with Jingle (XEP-0166, 0167, 0176, & 0177), voice
diff --git a/libpurple/protocols/msn/notification.c b/libpurple/protocols/msn/notification.c
index 9bfb94ffaf..2967c7bd28 100644
--- a/libpurple/protocols/msn/notification.c
+++ b/libpurple/protocols/msn/notification.c
@@ -1973,10 +1973,54 @@ system_msg(MsnCmdProc *cmdproc, MsnMessage *msg)
g_hash_table_destroy(table);
}
+/**************************************************************************
+ * Dispatch server list management
+ **************************************************************************/
+typedef struct MsnAddRemoveListData {
+ MsnCmdProc *cmdproc;
+ MsnUser *user;
+ MsnListOp list_op;
+ gboolean add;
+} MsnAddRemoveListData;
+
+static void
+modify_unknown_buddy_on_list(MsnSession *session, const char *passport,
+ MsnNetwork network, gpointer data)
+{
+ MsnAddRemoveListData *addrem = data;
+ MsnCmdProc *cmdproc;
+ xmlnode *node;
+ char *payload;
+ int payload_len;
+
+ cmdproc = addrem->cmdproc;
+
+ /* Update user first */
+ msn_user_set_network(addrem->user, network);
+
+ node = xmlnode_new("ml");
+ node->child = NULL;
+
+ msn_add_contact_xml(session, node, passport,
+ addrem->list_op, network);
+
+ payload = xmlnode_to_str(node, &payload_len);
+ xmlnode_free(node);
+
+ if (addrem->add)
+ msn_notification_post_adl(cmdproc, payload, payload_len);
+ else
+ msn_notification_post_rml(cmdproc, payload, payload_len);
+
+ g_free(payload);
+ g_free(addrem);
+}
+
void
msn_notification_add_buddy_to_list(MsnNotification *notification, MsnListId list_id,
MsnUser *user)
{
+ MsnAddRemoveListData *addrem;
MsnCmdProc *cmdproc;
MsnListOp list_op = 1 << list_id;
xmlnode *adl_node;
@@ -1994,7 +2038,20 @@ msn_notification_add_buddy_to_list(MsnNotification *notification, MsnListId list
payload = xmlnode_to_str(adl_node, &payload_len);
xmlnode_free(adl_node);
- msn_notification_post_adl(cmdproc, payload, payload_len);
+ if (user->networkid != MSN_NETWORK_UNKNOWN) {
+ msn_notification_post_adl(cmdproc, payload, payload_len);
+
+ } else {
+ addrem = g_new(MsnAddRemoveListData, 1);
+ addrem->cmdproc = cmdproc;
+ addrem->user = user;
+ addrem->list_op = list_op;
+ addrem->add = TRUE;
+
+ msn_notification_send_fqy(notification->session, payload, payload_len,
+ modify_unknown_buddy_on_list, addrem);
+ }
+
g_free(payload);
}
@@ -2002,6 +2059,7 @@ void
msn_notification_rem_buddy_from_list(MsnNotification *notification, MsnListId list_id,
MsnUser *user)
{
+ MsnAddRemoveListData *addrem;
MsnCmdProc *cmdproc;
MsnListOp list_op = 1 << list_id;
xmlnode *rml_node;
@@ -2019,7 +2077,19 @@ msn_notification_rem_buddy_from_list(MsnNotification *notification, MsnListId li
payload = xmlnode_to_str(rml_node, &payload_len);
xmlnode_free(rml_node);
- msn_notification_post_rml(cmdproc, payload, payload_len);
+ if (user->networkid != MSN_NETWORK_UNKNOWN) {
+ msn_notification_post_rml(cmdproc, payload, payload_len);
+
+ } else {
+ addrem = g_new(MsnAddRemoveListData, 1);
+ addrem->cmdproc = cmdproc;
+ addrem->user = user;
+ addrem->list_op = list_op;
+ addrem->add = FALSE;
+
+ msn_notification_send_fqy(notification->session, payload, payload_len,
+ modify_unknown_buddy_on_list, addrem);
+ }
g_free(payload);
}