pidgin: baa654e8: Add additional options to the autoaccept...
rekkanoryo at pidgin.im
rekkanoryo at pidgin.im
Wed Dec 29 20:31:19 EST 2010
----------------------------------------------------------------------
Revision: baa654e872c8567c315bbf44cc88345faa9a8ac8
Parent: 1d5b0e623a9d1e2514a76266fb2bd5fd60537bd3
Author: rok.mandeljc at gmail.com
Date: 12/29/10 19:42:24
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/baa654e872c8567c315bbf44cc88345faa9a8ac8
Changelog:
Add additional options to the autoaccept plugin. Fixes #11459.
Changes against parent 1d5b0e623a9d1e2514a76266fb2bd5fd60537bd3
patched COPYRIGHT
patched ChangeLog
patched libpurple/plugins/autoaccept.c
-------------- next part --------------
============================================================
--- ChangeLog 246a642e7db83d77e9052331bbadb0c5365bac10
+++ ChangeLog f9c98e7df9b9b56f14e81a0783da83ea9851e705
@@ -13,6 +13,10 @@ version 2.7.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)
============================================================
--- COPYRIGHT 812c94fb5ec9d6dd8129be5796aa664ee90f6365
+++ COPYRIGHT 815f2a68fae77c33f6d31d1c09425a6271e99e4f
@@ -306,6 +306,7 @@ Jonathan Maltz
Sulabh Mahajan
Willian T. Mahan
Jonathan Maltz
+Rok Mandeljc
Tobias Markmann
Kris Marsh
Fidel Martinez
============================================================
--- libpurple/plugins/autoaccept.c 02d82ceced83994ed19e7493b2abb03370d5f2b3
+++ libpurple/plugins/autoaccept.c 7772d3305f0c097bfa4bc082c0a9a828522ed4c5
@@ -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 @@ file_recv_request_cb(PurpleXfer *xfer, g
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 @@ file_recv_request_cb(PurpleXfer *xfer, g
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 @@ get_plugin_pref_frame(PurplePlugin *plug
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 @@ get_plugin_pref_frame(PurplePlugin *plug
_("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 @@ init_plugin(PurplePlugin *plugin) {
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);
}
More information about the Commits
mailing list