Mercurial > pidgin.yaz
diff libpurple/protocols/jabber/usermood.c @ 32178:979bab4c3bca
jabber: Check for empty string when setting mood.
The xmlnode API didn't check for the empty string ("") as
node name, which leads to...broken XML. I added those
checks to xmlnode, and fixed this occurrence in usermood.
Fixes #14342
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Mon, 27 Jun 2011 05:24:53 +0000 |
parents | 5e7ff3ed7ad0 |
children | 2ec94166be43 |
line wrap: on
line diff
--- a/libpurple/protocols/jabber/usermood.c Sun Jun 26 20:37:03 2011 +0000 +++ b/libpurple/protocols/jabber/usermood.c Mon Jun 27 05:24:53 2011 +0000 @@ -177,12 +177,12 @@ 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"); - if (mood) { + if (mood && *mood) { /* if mood is NULL, set an empty mood node, meaning: unset mood */ xmlnode_new_child(moodnode, mood); } - if (text && text[0] != '\0') { + if (text && *text) { xmlnode *textnode = xmlnode_new_child(moodnode, "text"); xmlnode_insert_data(textnode, text, -1); } @@ -195,4 +195,4 @@ PurpleMood *jabber_get_moods(PurpleAccount *account) { return moods; -} \ No newline at end of file +}