Avoid an assertion failure and add an error case.

Wed, 27 May 2009 03:45:21 +0000

author
Paul Aurich <darkrain42@pidgin.im>
date
Wed, 27 May 2009 03:45:21 +0000
changeset 27181
1a3c15400f3e
parent 27180
8c91f83b617d
child 27182
641a77b2ee97

Avoid an assertion failure and add an error case.

libpurple/protocols/jabber/jabber.c file | annotate | diff | comparison | revisions
--- a/libpurple/protocols/jabber/jabber.c	Wed May 27 03:23:07 2009 +0000
+++ b/libpurple/protocols/jabber/jabber.c	Wed May 27 03:45:21 2009 +0000
@@ -1665,7 +1665,6 @@
 		xmlnode *error, *x;
 		result = jabber_iq_new(js, JABBER_IQ_ERROR);
 		xmlnode_set_attrib(result->node, "id", id);
-		xmlnode_set_attrib(result->node, "to", from);
 
 		error = xmlnode_new_child(result->node, "error");
 		xmlnode_set_attrib(error, "type", "cancel");
@@ -1687,6 +1686,19 @@
 		while (account->deny != NULL) {
 			purple_privacy_deny_remove(account, account->deny->data, TRUE);
 		}
+	} else if (item == NULL) {
+		/* An empty <block/> is bogus */
+		xmlnode *error, *x;
+		result = jabber_iq_new(js, JABBER_IQ_ERROR);
+		xmlnode_set_attrib(result->node, "id", id);
+
+		error = xmlnode_new_child(result->node, "error");
+		xmlnode_set_attrib(error, "type", "modify");
+		x = xmlnode_new_child(error, "bad-request");
+		xmlnode_set_namespace(x, "urn:ietf:params:xml:ns:xmpp-stanzas");
+
+		jabber_iq_send(result);
+		return;
 	} else {
 		for ( ; item; item = xmlnode_get_next_twin(item)) {
 			const char *jid = xmlnode_get_attrib(item, "jid");

mercurial