pidgin: 83e6600f: Apply khc's patch for 241 error. Tested ...

qulogic at pidgin.im qulogic at pidgin.im
Tue Sep 23 01:35:44 EDT 2008


-----------------------------------------------------------------
Revision: 83e6600ffffbfc65ace650330df3f1888e33cb97
Ancestor: e1e9bf66d0fd0c83e28c2fc6c3795595f7297f29
Author: qulogic at pidgin.im
Date: 2008-09-17T04:10:43
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/83e6600ffffbfc65ace650330df3f1888e33cb97

Modified files:
        libpurple/protocols/msn/notification.c

ChangeLog: 

Apply khc's patch for 241 error. Tested it out myself. Cleaned up the 
message a little bit to be more user friendly. I'm not sure if it's a 
good idea to be putting up a dialog without a way for the user to fix 
the problem, so I'm not going to say it fixes the ticket, but you 
should be able to login at least.

References #6702.

-------------- next part --------------
============================================================
--- libpurple/protocols/msn/notification.c	8093da1b906ea26715afe144a60993d44f7ff59a
+++ libpurple/protocols/msn/notification.c	f58711b120adc1b46870873f5670c919c6e3421b
@@ -771,6 +771,53 @@ static void
 }
 
 static void
+adl_241_error_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload,
+	size_t len)
+{
+	/* khc: some googling suggests that error 241 means the buddy is somehow
+	   in the local list, but not the server list, and that we should add
+	   those buddies to the addressbook. For now I will just notify the user
+	   about the raw payload, because I am lazy */
+	MsnSession *session;
+	PurpleAccount *account;
+	PurpleConnection *gc;
+	xmlnode *adl;
+	xmlnode *domain;
+	GString *emails;
+
+	session = cmdproc->session;
+	account = session->account;
+	gc = purple_account_get_connection(account);
+
+	adl = xmlnode_from_str(payload, len);
+	emails = g_string_new(NULL);
+
+	domain = xmlnode_get_child(adl, "d");
+	while (domain) {
+		const char *domain_str = xmlnode_get_attrib(domain, "n");
+		xmlnode *contact = xmlnode_get_child(domain, "c");
+		while (contact) {
+			g_string_append_printf(emails, "%s@%s\n",
+				xmlnode_get_attrib(contact, "n"), domain_str);
+			contact = xmlnode_get_next_twin(contact);
+		}
+		domain = xmlnode_get_next_twin(domain);
+	}
+
+	purple_notify_error(gc, NULL,
+		_("The following users are missing from your addressbook"), emails->str);
+	g_string_free(emails, TRUE);
+	xmlnode_free(adl);
+}
+
+static void
+adl_241_error_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
+{
+	cmdproc->last_cmd->payload_cb = adl_241_error_cmd_post;
+	cmd->payload_len = atoi(cmd->params[1]);
+}
+
+static void
 fqy_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload,
 			 size_t len)
 {
@@ -1958,6 +2005,8 @@ msn_notification_init(void)
 
 	msn_table_add_cmd(cbs_table, "fallback", "XFR", xfr_cmd);
 
+	msn_table_add_cmd(cbs_table, NULL, "241", adl_241_error_cmd);
+
 	msn_table_add_error(cbs_table, "ADD", add_error);
 	msn_table_add_error(cbs_table, "ADL", adl_error);
 	msn_table_add_error(cbs_table, "REG", reg_error);


More information about the Commits mailing list