diff libpurple/protocols/jabber/jabber.c @ 26957:373141b35c52

Avoid an assertion failure and add an error case.
author Paul Aurich <paul@darkrain42.org>
date Wed, 27 May 2009 03:45:21 +0000
parents 1dcee141997d
children c41698323c2f
line wrap: on
line diff
--- 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");