Mercurial > pidgin
changeset 31079:5f4329c3eafe
Add additional options to the autoaccept plugin. Fixes #11459.
committer: John Bailey <rekkanoryo@rekkanoryo.org>
author | rok.mandeljc@gmail.com |
---|---|
date | Thu, 30 Dec 2010 00:42:24 +0000 |
parents | 3a94faf350c7 |
children | 40e5d8c3acca |
files | COPYRIGHT ChangeLog libpurple/plugins/autoaccept.c |
diffstat | 3 files changed, 38 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/COPYRIGHT Wed Dec 29 02:32:10 2010 +0000 +++ b/COPYRIGHT Thu Dec 30 00:42:24 2010 +0000 @@ -306,6 +306,7 @@ Sulabh Mahajan Willian T. Mahan Jonathan Maltz +Rok Mandeljc Tobias Markmann Kris Marsh Fidel Martinez
--- a/ChangeLog Wed Dec 29 02:32:10 2010 +0000 +++ b/ChangeLog Thu Dec 30 00:42:24 2010 +0000 @@ -13,6 +13,10 @@ Plugins: * The Voice/Video Settings plugin no longer resets selected devices to defaults. (Jakub Adam) (#13044) + * The Autoaccept plugin now allows disabling filename escaping. (Rok + Mandeljc) (half of #11459) + * The Autoaccept plugin now allows choosing Reject/Ask/Accept for + non-buddies. (Rok Mandeljc) (half of #11459) QQ: * QQ2008 is now the default protocol version. (Michael Terry) (#11635)
--- a/libpurple/plugins/autoaccept.c Wed Dec 29 02:32:10 2010 +0000 +++ b/libpurple/plugins/autoaccept.c Thu Dec 30 00:42:24 2010 +0000 @@ -43,9 +43,10 @@ #define PREF_PREFIX "/plugins/core/" PLUGIN_ID #define PREF_PATH PREF_PREFIX "/path" -#define PREF_STRANGER PREF_PREFIX "/reject_stranger" +#define PREF_STRANGER PREF_PREFIX "/stranger" #define PREF_NOTIFY PREF_PREFIX "/notify" #define PREF_NEWDIR PREF_PREFIX "/newdir" +#define PREF_ESCAPE PREF_PREFIX "/escape" typedef enum { @@ -88,25 +89,27 @@ char *filename; char *dirname; + int accept_setting; + account = xfer->account; node = PURPLE_BLIST_NODE(purple_find_buddy(account, xfer->who)); - if (!node) - { - if (purple_prefs_get_bool(PREF_STRANGER)) - xfer->status = PURPLE_XFER_STATUS_CANCEL_LOCAL; - return; + /* If person is on buddy list, use the buddy setting; otherwise, use the + stranger setting. */ + if (node) { + node = purple_blist_node_get_parent(node); + g_return_if_fail(PURPLE_BLIST_NODE_IS_CONTACT(node)); + accept_setting = purple_blist_node_get_int(node, "autoaccept"); + } else { + accept_setting = purple_prefs_get_int(PREF_STRANGER); } - - node = purple_blist_node_get_parent(node); - g_return_if_fail(PURPLE_BLIST_NODE_IS_CONTACT(node)); - - pref = purple_prefs_get_string(PREF_PATH); - switch (purple_blist_node_get_int(node, "autoaccept")) + + switch (accept_setting) { case FT_ASK: break; case FT_ACCEPT: + pref = purple_prefs_get_string(PREF_PATH); if (ensure_path_exists(pref)) { int count = 1; @@ -126,7 +129,12 @@ break; } - escape = purple_escape_filename(xfer->filename); + /* Escape filename (if escaping is turned on) */ + if (purple_prefs_get_bool(PREF_ESCAPE)) { + escape = purple_escape_filename(xfer->filename); + } else { + escape = xfer->filename; + } filename = g_build_filename(dirname, escape, NULL); /* Split at the first dot, to avoid uniquifying "foo.tar.gz" to "foo.tar-2.gz" */ @@ -247,7 +255,12 @@ purple_plugin_pref_frame_add(frame, pref); pref = purple_plugin_pref_new_with_name_and_label(PREF_STRANGER, - _("Automatically reject from users not in buddy list")); + _("When a file-transfer request arrives from a user who is\n" + "*not* on your buddy list:")); + purple_plugin_pref_set_type(pref, PURPLE_PLUGIN_PREF_CHOICE); + purple_plugin_pref_add_choice(pref, _("Ask"), GINT_TO_POINTER(FT_ASK)); + purple_plugin_pref_add_choice(pref, _("Auto Accept"), GINT_TO_POINTER(FT_ACCEPT)); + purple_plugin_pref_add_choice(pref, _("Auto Reject"), GINT_TO_POINTER(FT_REJECT)); purple_plugin_pref_frame_add(frame, pref); pref = purple_plugin_pref_new_with_name_and_label(PREF_NOTIFY, @@ -259,6 +272,10 @@ _("Create a new directory for each user")); purple_plugin_pref_frame_add(frame, pref); + pref = purple_plugin_pref_new_with_name_and_label(PREF_ESCAPE, + _("Escape the filenames")); + purple_plugin_pref_frame_add(frame, pref); + return frame; } @@ -315,9 +332,10 @@ dirname = g_build_filename(purple_user_dir(), "autoaccept", NULL); purple_prefs_add_none(PREF_PREFIX); purple_prefs_add_string(PREF_PATH, dirname); - purple_prefs_add_bool(PREF_STRANGER, TRUE); + purple_prefs_add_int(PREF_STRANGER, FT_ASK); purple_prefs_add_bool(PREF_NOTIFY, TRUE); purple_prefs_add_bool(PREF_NEWDIR, TRUE); + purple_prefs_add_bool(PREF_ESCAPE, TRUE); g_free(dirname); }