comparison libpurple/protocols/jabber/usermood.c @ 29890:08ceb05e9fe9

merged with im.pidgin.pidgin
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Sun, 28 Feb 2010 06:13:14 +0900
parents 1c6c2f5ecf53
children 6bcf405d5c63
comparison
equal deleted inserted replaced
29881:0fe3f0bc0695 29890:08ceb05e9fe9
73 {"humbled", N_("Humbled"), NULL}, 73 {"humbled", N_("Humbled"), NULL},
74 {"humiliated", N_("Humiliated"), NULL}, 74 {"humiliated", N_("Humiliated"), NULL},
75 {"hungry", N_("Hungry"), NULL}, 75 {"hungry", N_("Hungry"), NULL},
76 {"hurt", N_("Hurt"), NULL}, 76 {"hurt", N_("Hurt"), NULL},
77 {"impressed", N_("Impressed"), NULL}, 77 {"impressed", N_("Impressed"), NULL},
78 {"in_awe", N_("In_awe"), NULL}, 78 {"in_awe", N_("In awe"), NULL},
79 {"in_love", N_("In_love"), NULL}, 79 {"in_love", N_("In love"), NULL},
80 {"indignant", N_("Indignant"), NULL}, 80 {"indignant", N_("Indignant"), NULL},
81 {"interested", N_("Interested"), NULL}, 81 {"interested", N_("Interested"), NULL},
82 {"intoxicated", N_("Intoxicated"), NULL}, 82 {"intoxicated", N_("Intoxicated"), NULL},
83 {"invincible", N_("Invincible"), NULL}, 83 {"invincible", N_("Invincible"), NULL},
84 {"jealous", N_("Jealous"), NULL}, 84 {"jealous", N_("Jealous"), NULL},
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 }