# HG changeset patch # User Marcus Lundblad # Date 1267743776 0 # Node ID b0cb194dc139de7092302a0ac64c0ea81f626838 # Parent 9f6a657af95747426426e0fc783cb1255909991e Enable setting mood message with the global mood selection UI, when the connection supports it. diff -r 9f6a657af957 -r b0cb194dc139 libpurple/protocols/jabber/presence.c --- 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; } diff -r 9f6a657af957 -r b0cb194dc139 pidgin/gtkblist.c --- 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),