Mercurial > pidgin
changeset 12849:c0fbdea8828b
[gaim-migrate @ 15199]
SF Patch #1230429 from Jean-Yves Lefort
"Block instant messages in core if a prpl does not
support privacy."
I modified this to use the gaim_privacy_check() Sadrul added a while back. I
also cleaned up the loose end, rather than leaving a function that always
returned TRUE. Finally, I added the same check to the chat invite handler.
committer: Tailor Script <tailor@pidgin.im>
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Thu, 12 Jan 2006 06:44:23 +0000 |
parents | d26e3314c650 |
children | 49b2347863b2 |
files | COPYRIGHT ChangeLog plugins/ChangeLog.API src/gtkblist.c src/gtkprivacy.c src/gtkprivacy.h src/server.c |
diffstat | 7 files changed, 18 insertions(+), 36 deletions(-) [+] |
line wrap: on
line diff
--- a/COPYRIGHT Thu Jan 12 06:12:03 2006 +0000 +++ b/COPYRIGHT Thu Jan 12 06:44:23 2006 +0000 @@ -138,6 +138,7 @@ Daniel Larsson Peter Lawler Ho-seok Lee +Jean-Yves Lefort Moses Lei Ambrose C. Li Nicolas Lichtmaier
--- a/ChangeLog Thu Jan 12 06:12:03 2006 +0000 +++ b/ChangeLog Thu Jan 12 06:44:23 2006 +0000 @@ -142,6 +142,8 @@ * The last used directory is remembered for opening or saving files and buddy icons * Add an SVG version of our desktop icon, gaim.svg (John Oyler) + * If a given protocol don't support privacy, we now handle blocking in + the core. (Jean-Yves Lefort) Preference Changes: * Preferences have been substantially reorganized and cleaned up
--- a/plugins/ChangeLog.API Thu Jan 12 06:12:03 2006 +0000 +++ b/plugins/ChangeLog.API Thu Jan 12 06:44:23 2006 +0000 @@ -136,6 +136,8 @@ * GaimConversationUiOps.updated: use the conversation-updated signal * GAIM_SUBTYPE_CONV_WINDOW: windows are now only represented in the UI, so GAIM_TYPE_BOXED is used for the signal types + * gaim_gtk_privacy_is_showable(): We do fallback privacy in the core + now, so this would always be TRUE now. Added: * gaim_prefs_disconnect_by_handle()
--- a/src/gtkblist.c Thu Jan 12 06:12:03 2006 +0000 +++ b/src/gtkblist.c Thu Jan 12 06:44:23 2006 +0000 @@ -3250,7 +3250,6 @@ gtk_widget_set_sensitive(widget, (gaim_connections_get_all() != NULL)); widget = gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools/Privacy")); - gtk_widget_set_sensitive(widget, gaim_gtk_privacy_is_showable()); widget = gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools/Room List")); gtk_widget_set_sensitive(widget, gaim_gtk_roomlist_is_showable());
--- a/src/gtkprivacy.c Thu Jan 12 06:12:03 2006 +0000 +++ b/src/gtkprivacy.c Thu Jan 12 06:44:23 2006 +0000 @@ -349,33 +349,6 @@ gaim_gtk_privacy_dialog_hide(); } -static gboolean -check_account_func(GaimAccount *account) -{ - GaimConnection *gc = gaim_account_get_connection(account); - GaimPluginProtocolInfo *prpl_info = NULL; - - prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); - - return (prpl_info->set_permit_deny != NULL); -} - -gboolean -gaim_gtk_privacy_is_showable() -{ - GList *c; - GaimConnection *gc; - - for (c = gaim_connections_get_all(); c != NULL; c = c->next) { - gc = c->data; - - if (check_account_func(gaim_connection_get_account(gc))) - return TRUE; - } - - return FALSE; -} - static GaimGtkPrivacyDialog * privacy_dialog_new(void) {
--- a/src/gtkprivacy.h Thu Jan 12 06:12:03 2006 +0000 +++ b/src/gtkprivacy.h Thu Jan 12 06:44:23 2006 +0000 @@ -33,14 +33,6 @@ void gaim_gtk_privacy_init(void); /** - * Determine if showing the privacy dialog is a valid action. - * - * @return TRUE if there are accounts online that support privacy. - * Otherwise return FALSE. - */ -gboolean gaim_gtk_privacy_is_showable(void); - -/** * Shows the privacy dialog. */ void gaim_gtk_privacy_dialog_show(void);
--- a/src/server.c Thu Jan 12 06:12:03 2006 +0000 +++ b/src/server.c Thu Jan 12 06:44:23 2006 +0000 @@ -27,6 +27,7 @@ #include "log.h" #include "notify.h" #include "prefs.h" +#include "privacy.h" #include "prpl.h" #include "request.h" #include "signals.h" @@ -440,6 +441,13 @@ g_return_if_fail(msg != NULL); account = gaim_connection_get_account(gc); + + if (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->set_permit_deny == NULL) { + /* protocol does not support privacy, handle it ourselves */ + if (!gaim_privacy_check(account, who)) + return; + } + presence = gaim_account_get_presence(account); /* @@ -669,6 +677,11 @@ int plugin_return; account = gaim_connection_get_account(gc); + if (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->set_permit_deny == NULL) { + /* protocol does not support privacy, handle it ourselves */ + if (!gaim_privacy_check(account, who)) + return; + } plugin_return = GPOINTER_TO_INT(gaim_signal_emit_return_1( gaim_conversations_get_handle(),