diff options
author | paradox <devnull@localhost> | 2018-03-08 00:03:29 -0600 |
---|---|---|
committer | paradox <devnull@localhost> | 2018-03-08 00:03:29 -0600 |
commit | 13bb31b96d695a8d50e5133eefd4a5e0fb20ec16 (patch) | |
tree | 329c32ca04e69911e700472532da4793d96032fb | |
parent | fb59333599408d8d810f452ad036c0f10d590f75 (diff) | |
download | pidgin-13bb31b96d695a8d50e5133eefd4a5e0fb20ec16.tar.gz |
Don't allow adding a buddy to prpls that don't have an add_buddy callback. Fixes #4061
-rw-r--r-- | COPYRIGHT | 1 | ||||
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | pidgin/gtkblist.c | 13 | ||||
-rw-r--r-- | pidgin/gtkconv.c | 2 |
4 files changed, 15 insertions, 2 deletions
@@ -409,6 +409,7 @@ Nathan Owens (pianocomp81) John Oyler Matt Pandina Laszlo Pandy +Paradox Giulio 'Twain28' Pascali Ricardo Fernandez Pascual Riley Patterson @@ -38,6 +38,7 @@ version 2.13.0 (??/??/????): * Fix matching unicode smilies. (#17232 gnubfx PR #262 Daniel Kamil Kozar) * Correctly update mute/unmute status when the remote side mutes/unmutes us. (#17273 PR #302 David Woodhouse) * Rework the status icon blinking to not used deprecated API. (#17174 zelch PR #264 Daniel Kamil Kozar) + * Don't allow adding a buddy to protocols that don't have an add_buddy callback. (#4061 Paradox) Finch: * Fix handling of search results (#17238 David Woodhouse) diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c index 746da67efb..f200eb4fd5 100644 --- a/pidgin/gtkblist.c +++ b/pidgin/gtkblist.c @@ -935,6 +935,17 @@ pidgin_blist_update_privacy_cb(PurpleBuddy *buddy) } static gboolean +add_buddy_account_filter_func(PurpleAccount *account) +{ + PurpleConnection *gc = purple_account_get_connection(account); + PurplePluginProtocolInfo *prpl_info = NULL; + + prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); + + return (prpl_info->add_buddy != NULL); +} + +static gboolean chat_account_filter_func(PurpleAccount *account) { PurpleConnection *gc = purple_account_get_connection(account); @@ -7098,7 +7109,7 @@ pidgin_blist_request_add_buddy(PurpleAccount *account, const char *username, account, _("Add Buddy"), "add_buddy", _("Add a buddy.\n"), - G_CALLBACK(add_buddy_select_account_cb), NULL, + G_CALLBACK(add_buddy_select_account_cb), add_buddy_account_filter_func, G_CALLBACK(add_buddy_cb)); gtk_dialog_add_buttons(GTK_DIALOG(data->rq_data.window), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index d04997e682..dcafac6739 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -1685,7 +1685,7 @@ create_chat_menu(PurpleConversation *conv, const char *who, PurpleConnection *gc g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free); } - if (!is_me && prpl_info && !(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) { + if (!is_me && prpl_info && !(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME) && (prpl_info->add-buddy != NULL)) { if ((buddy = purple_find_buddy(conv->account, who)) != NULL) button = pidgin_new_item_from_stock(menu, _("Remove"), GTK_STOCK_REMOVE, G_CALLBACK(menu_chat_add_remove_cb), PIDGIN_CONVERSATION(conv), 0, 0, NULL); |