diff libpurple/protocols/jabber/usermood.c @ 29887:1c6c2f5ecf53

Allow unsetting mood in mood selector, works with XMPP... Oscar is not yet updated, so it might break there...
author Marcus Lundblad <ml@update.uu.se>
date Thu, 25 Feb 2010 22:47:28 +0000
parents 7e150a194aef
children 6bcf405d5c63
line wrap: on
line diff
--- a/libpurple/protocols/jabber/usermood.c	Thu Feb 25 21:36:32 2010 +0000
+++ b/libpurple/protocols/jabber/usermood.c	Thu Feb 25 22:47:28 2010 +0000
@@ -239,13 +239,14 @@
 void jabber_mood_set(JabberStream *js, const char *mood, const char *text) {
 	xmlnode *publish, *moodnode;
 
-	g_return_if_fail(mood != NULL);
-
 	publish = xmlnode_new("publish");
 	xmlnode_set_attrib(publish,"node","http://jabber.org/protocol/mood");
 	moodnode = xmlnode_new_child(xmlnode_new_child(publish, "item"), "mood");
 	xmlnode_set_namespace(moodnode, "http://jabber.org/protocol/mood");
-	xmlnode_new_child(moodnode, mood);
+	if (mood) {
+		/* if mood is NULL, set an empty mood node, meaning: unset mood */
+	    xmlnode_new_child(moodnode, mood);
+	}
 
 	if (text && text[0] != '\0') {
 		xmlnode *textnode = xmlnode_new_child(moodnode, "text");