Mercurial > pidgin.yaz
changeset 29931:b0cb194dc139
Enable setting mood message with the global mood selection UI, when the
connection supports it.
author | Marcus Lundblad <ml@update.uu.se> |
---|---|
date | Thu, 04 Mar 2010 23:02:56 +0000 |
parents | 9f6a657af957 |
children | 406c2e1ef7ce |
files | libpurple/protocols/jabber/presence.c pidgin/gtkblist.c |
diffstat | 2 files changed, 28 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/jabber/presence.c Thu Mar 04 22:35:32 2010 +0000 +++ b/libpurple/protocols/jabber/presence.c Thu Mar 04 23:02:56 2010 +0000 @@ -137,7 +137,9 @@ if (purple_status_type_get_primitive(purple_status_get_type(status)) == PURPLE_STATUS_MOOD) { const char *mood = purple_status_get_attr_string(status, PURPLE_MOOD_NAME); - jabber_mood_set(js, mood, NULL); + const char *mood_text = + purple_status_get_attr_string(status, PURPLE_MOOD_COMMENT); + jabber_mood_set(js, mood, mood_text); return; }
--- a/pidgin/gtkblist.c Thu Mar 04 22:35:32 2010 +0000 +++ b/pidgin/gtkblist.c Thu Mar 04 23:02:56 2010 +0000 @@ -7818,20 +7818,29 @@ static void edit_mood_cb(PurpleConnection *gc, PurpleRequestFields *fields) { - PurpleRequestField *f; + PurpleRequestField *mood_field, *text_field; GList *l; - f = purple_request_fields_get_field(fields, "mood"); - l = purple_request_field_list_get_selected(f); + mood_field = purple_request_fields_get_field(fields, "mood"); + text_field = purple_request_fields_get_field(fields, "text"); + l = purple_request_field_list_get_selected(mood_field); if (l) { - const char *mood = purple_request_field_list_get_data(f, l->data); + const char *mood = purple_request_field_list_get_data(mood_field, l->data); + const char *text = purple_request_field_string_get_value(text_field); PurpleAccount *account = purple_connection_get_account(gc); if (mood != NULL && !purple_strequal(mood, "")) { - purple_account_set_status(account, "mood", TRUE, - PURPLE_MOOD_NAME, mood, - NULL); + if (text) { + purple_account_set_status(account, "mood", TRUE, + PURPLE_MOOD_NAME, mood, + PURPLE_MOOD_COMMENT, text, + NULL); + } else { + purple_account_set_status(account, "mood", TRUE, + PURPLE_MOOD_NAME, mood, + NULL); + } } else { purple_account_set_status(account, "mood", FALSE, NULL); } @@ -7884,6 +7893,15 @@ purple_request_fields_add_group(fields, g); + /* if the connection allows setting a mood message */ + if (gc->flags & PURPLE_CONNECTION_SUPPORT_MOOD_MESSAGES) { + g = purple_request_field_group_new(NULL); + f = purple_request_field_string_new("text", + _("Message (optional)"), NULL, FALSE); + purple_request_field_group_add_field(g, f); + purple_request_fields_add_group(fields, g); + } + purple_request_fields(gc, _("Edit User Mood"), _("Edit User Mood"), NULL, fields, _("OK"), G_CALLBACK(edit_mood_cb),