Mercurial > pidgin
changeset 29490: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 | fddded5ee514 |
files | libpurple/protocols/jabber/usermood.c pidgin/gtkblist.c |
diffstat | 2 files changed, 11 insertions(+), 5 deletions(-) [+] |
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");
--- a/pidgin/gtkblist.c Thu Feb 25 21:36:32 2010 +0000 +++ b/pidgin/gtkblist.c Thu Feb 25 22:47:28 2010 +0000 @@ -7828,7 +7828,7 @@ const char *mood = purple_request_field_list_get_data(f, l->data); PurpleAccount *account = purple_connection_get_account(gc); - if (mood != NULL) { + if (mood != NULL && !purple_strequal(mood, "")) { purple_account_set_status(account, "mood", TRUE, PURPLE_MOOD_NAME, mood, NULL); @@ -7851,7 +7851,7 @@ PurpleConnection *gc = purple_account_get_connection(account); PurplePluginProtocolInfo *prpl_info; PurpleMood *mood; - + g_return_if_fail(gc->prpl != NULL); prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); @@ -7869,6 +7869,11 @@ g_free(na_fn); + /* first item is an empty one for unsetting the mood */ + purple_request_field_list_add(f, "", ""); + if (purple_strequal(current_mood, "")) + purple_request_field_list_add_selected(f, ""); + /* TODO: rlaager wants this sorted. */ for (mood = prpl_info->get_moods(account); mood->mood != NULL ; mood++) {