Mercurial > pidgin.yaz
comparison 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 |
comparison
equal
deleted
inserted
replaced
29886:7e150a194aef | 29887:1c6c2f5ecf53 |
---|---|
237 } | 237 } |
238 | 238 |
239 void jabber_mood_set(JabberStream *js, const char *mood, const char *text) { | 239 void jabber_mood_set(JabberStream *js, const char *mood, const char *text) { |
240 xmlnode *publish, *moodnode; | 240 xmlnode *publish, *moodnode; |
241 | 241 |
242 g_return_if_fail(mood != NULL); | |
243 | |
244 publish = xmlnode_new("publish"); | 242 publish = xmlnode_new("publish"); |
245 xmlnode_set_attrib(publish,"node","http://jabber.org/protocol/mood"); | 243 xmlnode_set_attrib(publish,"node","http://jabber.org/protocol/mood"); |
246 moodnode = xmlnode_new_child(xmlnode_new_child(publish, "item"), "mood"); | 244 moodnode = xmlnode_new_child(xmlnode_new_child(publish, "item"), "mood"); |
247 xmlnode_set_namespace(moodnode, "http://jabber.org/protocol/mood"); | 245 xmlnode_set_namespace(moodnode, "http://jabber.org/protocol/mood"); |
248 xmlnode_new_child(moodnode, mood); | 246 if (mood) { |
247 /* if mood is NULL, set an empty mood node, meaning: unset mood */ | |
248 xmlnode_new_child(moodnode, mood); | |
249 } | |
249 | 250 |
250 if (text && text[0] != '\0') { | 251 if (text && text[0] != '\0') { |
251 xmlnode *textnode = xmlnode_new_child(moodnode, "text"); | 252 xmlnode *textnode = xmlnode_new_child(moodnode, "text"); |
252 xmlnode_insert_data(textnode, text, -1); | 253 xmlnode_insert_data(textnode, text, -1); |
253 } | 254 } |