changeset 17579:af833a3204bb

Fixed usermood memory management and removed publishing empty <text/>s.
author Andreas Monitzer <pidgin@monitzer.com>
date Fri, 15 Jun 2007 21:09:22 +0000
parents 460b4bf797e7
children 7754d39d70c5
files libpurple/protocols/jabber/usermood.c
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/usermood.c	Fri Jun 15 11:00:46 2007 +0000
+++ b/libpurple/protocols/jabber/usermood.c	Fri Jun 15 21:09:22 2007 +0000
@@ -94,7 +94,7 @@
 static void jabber_mood_cb(JabberStream *js, const char *from, xmlnode *items) {
 	/* it doesn't make sense to have more than one item here, so let's just pick the first one */
 	xmlnode *item = xmlnode_get_child(items, "item");
-	char *newmood;
+	const char *newmood;
 	char *moodtext = NULL;
 	JabberBuddy *buddy = jabber_buddy_find(js, from, FALSE);
 	xmlnode *moodinfo, *mood;
@@ -202,12 +202,12 @@
 	xmlnode_set_namespace(moodnode, "http://jabber.org/protocol/mood");
 	xmlnode_new_child(moodnode, mood);
 
-	if (text) {
+	if (text && text[0] != '\0') {
 		xmlnode *textnode = xmlnode_new_child(moodnode, "text");
 		xmlnode_insert_data(textnode, text, -1);
 	}
 	
 	jabber_pep_publish(js, publish);
-	
-	xmlnode_free(publish);
+	/* publish is freed by jabber_pep_publish -> jabber_iq_send -> jabber_iq_free
+	   (yay for well-defined memory management rules) */
 }