Mercurial > pidgin
annotate libpurple/plugins/autoaccept.c @ 31083:dd2f19faee14
Stu points out that removing this old pref could be a problem for users sharing .purple directories.
| author | John Bailey <rekkanoryo@rekkanoryo.org> |
|---|---|
| date | Thu, 30 Dec 2010 02:43:47 +0000 |
| parents | 40e5d8c3acca |
| children | 8c6a1fa21f43 |
| rev | line source |
|---|---|
|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1 /* |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2 * Autoaccept - Auto-accept file transfers from selected users |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3 * Copyright (C) 2006 |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
4 * |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
5 * This program is free software; you can redistribute it and/or |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
6 * modify it under the terms of the GNU General Public License as |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation; either version 2 of the |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
8 * License, or (at your option) any later version. |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
9 * |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
10 * This program is distributed in the hope that it will be useful, but |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
11 * WITHOUT ANY WARRANTY; without even the implied warranty of |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
13 * General Public License for more details. |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
14 * |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
16 * along with this program; if not, write to the Free Software |
|
19681
44b4e8bd759b
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19567
diff
changeset
|
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
44b4e8bd759b
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19567
diff
changeset
|
18 * 02111-1301, USA. |
|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
19 */ |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
20 #include "internal.h" |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
21 |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
22 #define PLUGIN_ID "core-plugin_pack-autoaccept" |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
23 #define PLUGIN_NAME N_("Autoaccept") |
|
25490
ea62e934c80b
Fix some more mis-identified plugins, like 3b3526a0...
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24314
diff
changeset
|
24 #define PLUGIN_STATIC_NAME Autoaccept |
|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
25 #define PLUGIN_SUMMARY N_("Auto-accept file transfer requests from selected users.") |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
26 #define PLUGIN_DESCRIPTION N_("Auto-accept file transfer requests from selected users.") |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
27 #define PLUGIN_AUTHOR "Sadrul H Chowdhury <sadrul@users.sourceforge.net>" |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
28 |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
29 /* System headers */ |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
30 #include <glib.h> |
|
29082
39716f7d2c93
Kill off unneeded GLIB_CHECK_VERSION checks in libpurple. Refs #10024.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
25947
diff
changeset
|
31 #include <glib/gstdio.h> |
|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
32 |
| 15822 | 33 /* Purple headers */ |
|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
34 #include <plugin.h> |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
35 #include <version.h> |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
36 |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
37 #include <blist.h> |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
38 #include <conversation.h> |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
39 #include <ft.h> |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
40 #include <request.h> |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
41 #include <notify.h> |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
42 #include <util.h> |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
43 |
| 16430 | 44 #define PREF_PREFIX "/plugins/core/" PLUGIN_ID |
|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
45 #define PREF_PATH PREF_PREFIX "/path" |
|
31079
5f4329c3eafe
Add additional options to the autoaccept plugin. Fixes #11459.
rok.mandeljc@gmail.com
parents:
29082
diff
changeset
|
46 #define PREF_STRANGER PREF_PREFIX "/stranger" |
|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
47 #define PREF_NOTIFY PREF_PREFIX "/notify" |
|
23537
ad0d0efa30dd
Allow not creating a different directory for each user. Closes #5997.
Luke Bratch <l_bratch@yahoo.co.uk>
parents:
21783
diff
changeset
|
48 #define PREF_NEWDIR PREF_PREFIX "/newdir" |
|
31079
5f4329c3eafe
Add additional options to the autoaccept plugin. Fixes #11459.
rok.mandeljc@gmail.com
parents:
29082
diff
changeset
|
49 #define PREF_ESCAPE PREF_PREFIX "/escape" |
|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
50 |
|
31080
40e5d8c3acca
Migrate the pref the previous commit dropped. Refs #11459.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31079
diff
changeset
|
51 #define PREF_STRANGER_OLD PREF_PREFIX "/reject_stranger" |
|
40e5d8c3acca
Migrate the pref the previous commit dropped. Refs #11459.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31079
diff
changeset
|
52 |
|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
53 typedef enum |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
54 { |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
55 FT_ASK, |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
56 FT_ACCEPT, |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
57 FT_REJECT |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
58 } AutoAcceptSetting; |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
59 |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
60 static gboolean |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
61 ensure_path_exists(const char *dir) |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
62 { |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
63 if (!g_file_test(dir, G_FILE_TEST_IS_DIR)) |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
64 { |
| 15822 | 65 if (purple_build_dir(dir, S_IRUSR | S_IWUSR | S_IXUSR)) |
|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
66 return FALSE; |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
67 } |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
68 |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
69 return TRUE; |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
70 } |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
71 |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
72 static void |
| 15822 | 73 auto_accept_complete_cb(PurpleXfer *xfer, PurpleXfer *my) |
|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
74 { |
| 15822 | 75 if (xfer == my && purple_prefs_get_bool(PREF_NOTIFY) && |
| 76 !purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, xfer->who, xfer->account)) | |
|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
77 { |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
78 char *message = g_strdup_printf(_("Autoaccepted file transfer of \"%s\" from \"%s\" completed."), |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
79 xfer->filename, xfer->who); |
| 15822 | 80 purple_notify_info(NULL, _("Autoaccept complete"), message, NULL); |
|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
81 g_free(message); |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
82 } |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
83 } |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
84 |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
85 static void |
| 15822 | 86 file_recv_request_cb(PurpleXfer *xfer, gpointer handle) |
|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
87 { |
| 15822 | 88 PurpleAccount *account; |
| 89 PurpleBlistNode *node; | |
|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
90 const char *pref; |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
91 char *filename; |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
92 char *dirname; |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
93 |
|
31079
5f4329c3eafe
Add additional options to the autoaccept plugin. Fixes #11459.
rok.mandeljc@gmail.com
parents:
29082
diff
changeset
|
94 int accept_setting; |
|
5f4329c3eafe
Add additional options to the autoaccept plugin. Fixes #11459.
rok.mandeljc@gmail.com
parents:
29082
diff
changeset
|
95 |
|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
96 account = xfer->account; |
|
25827
0e08c847517d
Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@wiktel.com>
parents:
24314
diff
changeset
|
97 node = PURPLE_BLIST_NODE(purple_find_buddy(account, xfer->who)); |
|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
98 |
|
31079
5f4329c3eafe
Add additional options to the autoaccept plugin. Fixes #11459.
rok.mandeljc@gmail.com
parents:
29082
diff
changeset
|
99 /* If person is on buddy list, use the buddy setting; otherwise, use the |
|
5f4329c3eafe
Add additional options to the autoaccept plugin. Fixes #11459.
rok.mandeljc@gmail.com
parents:
29082
diff
changeset
|
100 stranger setting. */ |
|
5f4329c3eafe
Add additional options to the autoaccept plugin. Fixes #11459.
rok.mandeljc@gmail.com
parents:
29082
diff
changeset
|
101 if (node) { |
|
5f4329c3eafe
Add additional options to the autoaccept plugin. Fixes #11459.
rok.mandeljc@gmail.com
parents:
29082
diff
changeset
|
102 node = purple_blist_node_get_parent(node); |
|
5f4329c3eafe
Add additional options to the autoaccept plugin. Fixes #11459.
rok.mandeljc@gmail.com
parents:
29082
diff
changeset
|
103 g_return_if_fail(PURPLE_BLIST_NODE_IS_CONTACT(node)); |
|
5f4329c3eafe
Add additional options to the autoaccept plugin. Fixes #11459.
rok.mandeljc@gmail.com
parents:
29082
diff
changeset
|
104 accept_setting = purple_blist_node_get_int(node, "autoaccept"); |
|
5f4329c3eafe
Add additional options to the autoaccept plugin. Fixes #11459.
rok.mandeljc@gmail.com
parents:
29082
diff
changeset
|
105 } else { |
|
5f4329c3eafe
Add additional options to the autoaccept plugin. Fixes #11459.
rok.mandeljc@gmail.com
parents:
29082
diff
changeset
|
106 accept_setting = purple_prefs_get_int(PREF_STRANGER); |
|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
107 } |
|
31079
5f4329c3eafe
Add additional options to the autoaccept plugin. Fixes #11459.
rok.mandeljc@gmail.com
parents:
29082
diff
changeset
|
108 |
|
5f4329c3eafe
Add additional options to the autoaccept plugin. Fixes #11459.
rok.mandeljc@gmail.com
parents:
29082
diff
changeset
|
109 switch (accept_setting) |
|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
110 { |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
111 case FT_ASK: |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
112 break; |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
113 case FT_ACCEPT: |
|
31079
5f4329c3eafe
Add additional options to the autoaccept plugin. Fixes #11459.
rok.mandeljc@gmail.com
parents:
29082
diff
changeset
|
114 pref = purple_prefs_get_string(PREF_PATH); |
|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
115 if (ensure_path_exists(pref)) |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
116 { |
|
21783
3b1d7caddc27
Do not overwrite an existing file. Closes #3982.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21782
diff
changeset
|
117 int count = 1; |
|
3b1d7caddc27
Do not overwrite an existing file. Closes #3982.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21782
diff
changeset
|
118 const char *escape; |
|
24070
f23d1643808e
Uniquify auto-accepted file names to foo-2.tar.gz, not foo.tar.gz-2.
Will Thompson <will.thompson@collabora.co.uk>
parents:
23537
diff
changeset
|
119 gchar **name_and_ext; |
|
f23d1643808e
Uniquify auto-accepted file names to foo-2.tar.gz, not foo.tar.gz-2.
Will Thompson <will.thompson@collabora.co.uk>
parents:
23537
diff
changeset
|
120 const gchar *name; |
|
f23d1643808e
Uniquify auto-accepted file names to foo-2.tar.gz, not foo.tar.gz-2.
Will Thompson <will.thompson@collabora.co.uk>
parents:
23537
diff
changeset
|
121 gchar *ext; |
|
23537
ad0d0efa30dd
Allow not creating a different directory for each user. Closes #5997.
Luke Bratch <l_bratch@yahoo.co.uk>
parents:
21783
diff
changeset
|
122 |
|
ad0d0efa30dd
Allow not creating a different directory for each user. Closes #5997.
Luke Bratch <l_bratch@yahoo.co.uk>
parents:
21783
diff
changeset
|
123 if (purple_prefs_get_bool(PREF_NEWDIR)) |
|
ad0d0efa30dd
Allow not creating a different directory for each user. Closes #5997.
Luke Bratch <l_bratch@yahoo.co.uk>
parents:
21783
diff
changeset
|
124 dirname = g_build_filename(pref, purple_normalize(account, xfer->who), NULL); |
|
ad0d0efa30dd
Allow not creating a different directory for each user. Closes #5997.
Luke Bratch <l_bratch@yahoo.co.uk>
parents:
21783
diff
changeset
|
125 else |
|
ad0d0efa30dd
Allow not creating a different directory for each user. Closes #5997.
Luke Bratch <l_bratch@yahoo.co.uk>
parents:
21783
diff
changeset
|
126 dirname = g_build_filename(pref, NULL); |
|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
127 |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
128 if (!ensure_path_exists(dirname)) |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
129 { |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
130 g_free(dirname); |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
131 break; |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
132 } |
|
21782
bacb8c59230a
Normalize and escape the filename when auto-accepting a file. References #3982.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21560
diff
changeset
|
133 |
|
31079
5f4329c3eafe
Add additional options to the autoaccept plugin. Fixes #11459.
rok.mandeljc@gmail.com
parents:
29082
diff
changeset
|
134 /* Escape filename (if escaping is turned on) */ |
|
5f4329c3eafe
Add additional options to the autoaccept plugin. Fixes #11459.
rok.mandeljc@gmail.com
parents:
29082
diff
changeset
|
135 if (purple_prefs_get_bool(PREF_ESCAPE)) { |
|
5f4329c3eafe
Add additional options to the autoaccept plugin. Fixes #11459.
rok.mandeljc@gmail.com
parents:
29082
diff
changeset
|
136 escape = purple_escape_filename(xfer->filename); |
|
5f4329c3eafe
Add additional options to the autoaccept plugin. Fixes #11459.
rok.mandeljc@gmail.com
parents:
29082
diff
changeset
|
137 } else { |
|
5f4329c3eafe
Add additional options to the autoaccept plugin. Fixes #11459.
rok.mandeljc@gmail.com
parents:
29082
diff
changeset
|
138 escape = xfer->filename; |
|
5f4329c3eafe
Add additional options to the autoaccept plugin. Fixes #11459.
rok.mandeljc@gmail.com
parents:
29082
diff
changeset
|
139 } |
|
21783
3b1d7caddc27
Do not overwrite an existing file. Closes #3982.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21782
diff
changeset
|
140 filename = g_build_filename(dirname, escape, NULL); |
|
3b1d7caddc27
Do not overwrite an existing file. Closes #3982.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21782
diff
changeset
|
141 |
|
24070
f23d1643808e
Uniquify auto-accepted file names to foo-2.tar.gz, not foo.tar.gz-2.
Will Thompson <will.thompson@collabora.co.uk>
parents:
23537
diff
changeset
|
142 /* Split at the first dot, to avoid uniquifying "foo.tar.gz" to "foo.tar-2.gz" */ |
|
f23d1643808e
Uniquify auto-accepted file names to foo-2.tar.gz, not foo.tar.gz-2.
Will Thompson <will.thompson@collabora.co.uk>
parents:
23537
diff
changeset
|
143 name_and_ext = g_strsplit(escape, ".", 2); |
|
f23d1643808e
Uniquify auto-accepted file names to foo-2.tar.gz, not foo.tar.gz-2.
Will Thompson <will.thompson@collabora.co.uk>
parents:
23537
diff
changeset
|
144 name = name_and_ext[0]; |
|
f23d1643808e
Uniquify auto-accepted file names to foo-2.tar.gz, not foo.tar.gz-2.
Will Thompson <will.thompson@collabora.co.uk>
parents:
23537
diff
changeset
|
145 g_return_if_fail(name != NULL); |
|
f23d1643808e
Uniquify auto-accepted file names to foo-2.tar.gz, not foo.tar.gz-2.
Will Thompson <will.thompson@collabora.co.uk>
parents:
23537
diff
changeset
|
146 if (name_and_ext[1] != NULL) { |
|
f23d1643808e
Uniquify auto-accepted file names to foo-2.tar.gz, not foo.tar.gz-2.
Will Thompson <will.thompson@collabora.co.uk>
parents:
23537
diff
changeset
|
147 /* g_strsplit does not include the separator in each chunk. */ |
|
f23d1643808e
Uniquify auto-accepted file names to foo-2.tar.gz, not foo.tar.gz-2.
Will Thompson <will.thompson@collabora.co.uk>
parents:
23537
diff
changeset
|
148 ext = g_strdup_printf(".%s", name_and_ext[1]); |
|
f23d1643808e
Uniquify auto-accepted file names to foo-2.tar.gz, not foo.tar.gz-2.
Will Thompson <will.thompson@collabora.co.uk>
parents:
23537
diff
changeset
|
149 } else { |
|
f23d1643808e
Uniquify auto-accepted file names to foo-2.tar.gz, not foo.tar.gz-2.
Will Thompson <will.thompson@collabora.co.uk>
parents:
23537
diff
changeset
|
150 ext = g_strdup(""); |
|
f23d1643808e
Uniquify auto-accepted file names to foo-2.tar.gz, not foo.tar.gz-2.
Will Thompson <will.thompson@collabora.co.uk>
parents:
23537
diff
changeset
|
151 } |
|
f23d1643808e
Uniquify auto-accepted file names to foo-2.tar.gz, not foo.tar.gz-2.
Will Thompson <will.thompson@collabora.co.uk>
parents:
23537
diff
changeset
|
152 |
|
21783
3b1d7caddc27
Do not overwrite an existing file. Closes #3982.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21782
diff
changeset
|
153 /* Make sure the file doesn't exist. Do we want some better checking than this? */ |
|
24070
f23d1643808e
Uniquify auto-accepted file names to foo-2.tar.gz, not foo.tar.gz-2.
Will Thompson <will.thompson@collabora.co.uk>
parents:
23537
diff
changeset
|
154 /* FIXME: There is a race here: if the newly uniquified file name gets created between |
|
f23d1643808e
Uniquify auto-accepted file names to foo-2.tar.gz, not foo.tar.gz-2.
Will Thompson <will.thompson@collabora.co.uk>
parents:
23537
diff
changeset
|
155 * this g_file_test and the transfer starting, the file created in the meantime |
|
f23d1643808e
Uniquify auto-accepted file names to foo-2.tar.gz, not foo.tar.gz-2.
Will Thompson <will.thompson@collabora.co.uk>
parents:
23537
diff
changeset
|
156 * will be clobbered. But it's not at all straightforward to fix. |
|
f23d1643808e
Uniquify auto-accepted file names to foo-2.tar.gz, not foo.tar.gz-2.
Will Thompson <will.thompson@collabora.co.uk>
parents:
23537
diff
changeset
|
157 */ |
|
21783
3b1d7caddc27
Do not overwrite an existing file. Closes #3982.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21782
diff
changeset
|
158 while (g_file_test(filename, G_FILE_TEST_EXISTS)) { |
|
24070
f23d1643808e
Uniquify auto-accepted file names to foo-2.tar.gz, not foo.tar.gz-2.
Will Thompson <will.thompson@collabora.co.uk>
parents:
23537
diff
changeset
|
159 char *file = g_strdup_printf("%s-%d%s", name, count++, ext); |
|
21783
3b1d7caddc27
Do not overwrite an existing file. Closes #3982.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21782
diff
changeset
|
160 g_free(filename); |
|
3b1d7caddc27
Do not overwrite an existing file. Closes #3982.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21782
diff
changeset
|
161 filename = g_build_filename(dirname, file, NULL); |
|
3b1d7caddc27
Do not overwrite an existing file. Closes #3982.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21782
diff
changeset
|
162 g_free(file); |
|
3b1d7caddc27
Do not overwrite an existing file. Closes #3982.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21782
diff
changeset
|
163 } |
|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
164 |
| 15822 | 165 purple_xfer_request_accepted(xfer, filename); |
|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
166 |
|
24070
f23d1643808e
Uniquify auto-accepted file names to foo-2.tar.gz, not foo.tar.gz-2.
Will Thompson <will.thompson@collabora.co.uk>
parents:
23537
diff
changeset
|
167 g_strfreev(name_and_ext); |
|
f23d1643808e
Uniquify auto-accepted file names to foo-2.tar.gz, not foo.tar.gz-2.
Will Thompson <will.thompson@collabora.co.uk>
parents:
23537
diff
changeset
|
168 g_free(ext); |
|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
169 g_free(dirname); |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
170 g_free(filename); |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
171 } |
|
21782
bacb8c59230a
Normalize and escape the filename when auto-accepting a file. References #3982.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21560
diff
changeset
|
172 |
| 15822 | 173 purple_signal_connect(purple_xfers_get_handle(), "file-recv-complete", handle, |
| 174 PURPLE_CALLBACK(auto_accept_complete_cb), xfer); | |
|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
175 break; |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
176 case FT_REJECT: |
| 15822 | 177 xfer->status = PURPLE_XFER_STATUS_CANCEL_LOCAL; |
|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
178 break; |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
179 } |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
180 } |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
181 |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
182 static void |
| 15822 | 183 save_cb(PurpleBlistNode *node, int choice) |
|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
184 { |
| 15822 | 185 if (PURPLE_BLIST_NODE_IS_BUDDY(node)) |
|
24314
0d0088b03745
Hide the blistnode, buddy, contact, group, and chat structs
Gary Kramlich <grim@reaperworld.com>
parents:
24070
diff
changeset
|
186 node = purple_blist_node_get_parent(node); |
| 15822 | 187 g_return_if_fail(PURPLE_BLIST_NODE_IS_CONTACT(node)); |
| 188 purple_blist_node_set_int(node, "autoaccept", choice); | |
|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
189 } |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
190 |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
191 static void |
| 15822 | 192 set_auto_accept_settings(PurpleBlistNode *node, gpointer plugin) |
|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
193 { |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
194 char *message; |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
195 |
| 15822 | 196 if (PURPLE_BLIST_NODE_IS_BUDDY(node)) |
|
24314
0d0088b03745
Hide the blistnode, buddy, contact, group, and chat structs
Gary Kramlich <grim@reaperworld.com>
parents:
24070
diff
changeset
|
197 node = purple_blist_node_get_parent(node); |
| 15822 | 198 g_return_if_fail(PURPLE_BLIST_NODE_IS_CONTACT(node)); |
|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
199 |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
200 message = g_strdup_printf(_("When a file-transfer request arrives from %s"), |
| 15822 | 201 purple_contact_get_alias((PurpleContact *)node)); |
|
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
202 purple_request_choice(plugin, _("Set Autoaccept Setting"), message, |
| 15822 | 203 NULL, purple_blist_node_get_int(node, "autoaccept"), |
|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
204 _("_Save"), G_CALLBACK(save_cb), |
|
16439
08db93bbd798
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evan.s@dreskin.net>
parents:
16430
diff
changeset
|
205 _("_Cancel"), NULL, |
|
08db93bbd798
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evan.s@dreskin.net>
parents:
16430
diff
changeset
|
206 NULL, NULL, NULL, |
|
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
207 node, |
|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
208 _("Ask"), FT_ASK, |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
209 _("Auto Accept"), FT_ACCEPT, |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
210 _("Auto Reject"), FT_REJECT, |
|
16439
08db93bbd798
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evan.s@dreskin.net>
parents:
16430
diff
changeset
|
211 NULL, purple_contact_get_alias((PurpleContact *)node), NULL, |
|
19894
fa06f943abd3
Adding hints to libpurple/plugins/autoaccept.c
Gabriel Schulhof <nix@go-nix.ca>
parents:
19893
diff
changeset
|
212 NULL); |
|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
213 g_free(message); |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
214 } |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
215 |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
216 static void |
| 15822 | 217 context_menu(PurpleBlistNode *node, GList **menu, gpointer plugin) |
|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
218 { |
| 15822 | 219 PurpleMenuAction *action; |
|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
220 |
|
18415
aed9eceb7b0f
Don't allow setting auto-accept preferences for blist nodes that won't be
Stu Tomlinson <stu@nosnilmot.com>
parents:
16666
diff
changeset
|
221 if (!PURPLE_BLIST_NODE_IS_BUDDY(node) && !PURPLE_BLIST_NODE_IS_CONTACT(node) && |
|
aed9eceb7b0f
Don't allow setting auto-accept preferences for blist nodes that won't be
Stu Tomlinson <stu@nosnilmot.com>
parents:
16666
diff
changeset
|
222 !(purple_blist_node_get_flags(node) & PURPLE_BLIST_NODE_FLAG_NO_SAVE)) |
|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
223 return; |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
224 |
| 15822 | 225 action = purple_menu_action_new(_("Autoaccept File Transfers..."), |
| 226 PURPLE_CALLBACK(set_auto_accept_settings), plugin, NULL); | |
|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
227 (*menu) = g_list_prepend(*menu, action); |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
228 } |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
229 |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
230 static gboolean |
| 15822 | 231 plugin_load(PurplePlugin *plugin) |
|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
232 { |
|
31080
40e5d8c3acca
Migrate the pref the previous commit dropped. Refs #11459.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31079
diff
changeset
|
233 /* migrate the old pref (we should only care if the plugin is actually *used*) */ |
|
31083
dd2f19faee14
Stu points out that removing this old pref could be a problem for users sharing .purple directories.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31080
diff
changeset
|
234 if(purple_prefs_get_bool(PREF_STRANGER_OLD)) |
|
31080
40e5d8c3acca
Migrate the pref the previous commit dropped. Refs #11459.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31079
diff
changeset
|
235 purple_prefs_set_int(PREF_STRANGER, FT_REJECT); |
|
40e5d8c3acca
Migrate the pref the previous commit dropped. Refs #11459.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31079
diff
changeset
|
236 |
| 15822 | 237 purple_signal_connect(purple_xfers_get_handle(), "file-recv-request", plugin, |
| 238 PURPLE_CALLBACK(file_recv_request_cb), plugin); | |
| 239 purple_signal_connect(purple_blist_get_handle(), "blist-node-extended-menu", plugin, | |
| 240 PURPLE_CALLBACK(context_menu), plugin); | |
|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
241 return TRUE; |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
242 } |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
243 |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
244 static gboolean |
| 15822 | 245 plugin_unload(PurplePlugin *plugin) |
|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
246 { |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
247 return TRUE; |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
248 } |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
249 |
| 15822 | 250 static PurplePluginPrefFrame * |
| 251 get_plugin_pref_frame(PurplePlugin *plugin) | |
|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
252 { |
| 15822 | 253 PurplePluginPrefFrame *frame; |
| 254 PurplePluginPref *pref; | |
|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
255 |
| 15822 | 256 frame = purple_plugin_pref_frame_new(); |
|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
257 |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
258 /* XXX: Is there a better way than this? There really should be. */ |
| 15822 | 259 pref = purple_plugin_pref_new_with_name_and_label(PREF_PATH, _("Path to save the files in\n" |
|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
260 "(Please provide the full path)")); |
| 15822 | 261 purple_plugin_pref_frame_add(frame, pref); |
|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
262 |
| 15822 | 263 pref = purple_plugin_pref_new_with_name_and_label(PREF_STRANGER, |
|
31079
5f4329c3eafe
Add additional options to the autoaccept plugin. Fixes #11459.
rok.mandeljc@gmail.com
parents:
29082
diff
changeset
|
264 _("When a file-transfer request arrives from a user who is\n" |
|
5f4329c3eafe
Add additional options to the autoaccept plugin. Fixes #11459.
rok.mandeljc@gmail.com
parents:
29082
diff
changeset
|
265 "*not* on your buddy list:")); |
|
5f4329c3eafe
Add additional options to the autoaccept plugin. Fixes #11459.
rok.mandeljc@gmail.com
parents:
29082
diff
changeset
|
266 purple_plugin_pref_set_type(pref, PURPLE_PLUGIN_PREF_CHOICE); |
|
5f4329c3eafe
Add additional options to the autoaccept plugin. Fixes #11459.
rok.mandeljc@gmail.com
parents:
29082
diff
changeset
|
267 purple_plugin_pref_add_choice(pref, _("Ask"), GINT_TO_POINTER(FT_ASK)); |
|
5f4329c3eafe
Add additional options to the autoaccept plugin. Fixes #11459.
rok.mandeljc@gmail.com
parents:
29082
diff
changeset
|
268 purple_plugin_pref_add_choice(pref, _("Auto Accept"), GINT_TO_POINTER(FT_ACCEPT)); |
|
5f4329c3eafe
Add additional options to the autoaccept plugin. Fixes #11459.
rok.mandeljc@gmail.com
parents:
29082
diff
changeset
|
269 purple_plugin_pref_add_choice(pref, _("Auto Reject"), GINT_TO_POINTER(FT_REJECT)); |
| 15822 | 270 purple_plugin_pref_frame_add(frame, pref); |
|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
271 |
| 15822 | 272 pref = purple_plugin_pref_new_with_name_and_label(PREF_NOTIFY, |
|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
273 _("Notify with a popup when an autoaccepted file transfer is complete\n" |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
274 "(only when there's no conversation with the sender)")); |
| 15822 | 275 purple_plugin_pref_frame_add(frame, pref); |
|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
276 |
|
23537
ad0d0efa30dd
Allow not creating a different directory for each user. Closes #5997.
Luke Bratch <l_bratch@yahoo.co.uk>
parents:
21783
diff
changeset
|
277 pref = purple_plugin_pref_new_with_name_and_label(PREF_NEWDIR, |
|
ad0d0efa30dd
Allow not creating a different directory for each user. Closes #5997.
Luke Bratch <l_bratch@yahoo.co.uk>
parents:
21783
diff
changeset
|
278 _("Create a new directory for each user")); |
|
ad0d0efa30dd
Allow not creating a different directory for each user. Closes #5997.
Luke Bratch <l_bratch@yahoo.co.uk>
parents:
21783
diff
changeset
|
279 purple_plugin_pref_frame_add(frame, pref); |
|
ad0d0efa30dd
Allow not creating a different directory for each user. Closes #5997.
Luke Bratch <l_bratch@yahoo.co.uk>
parents:
21783
diff
changeset
|
280 |
|
31079
5f4329c3eafe
Add additional options to the autoaccept plugin. Fixes #11459.
rok.mandeljc@gmail.com
parents:
29082
diff
changeset
|
281 pref = purple_plugin_pref_new_with_name_and_label(PREF_ESCAPE, |
|
5f4329c3eafe
Add additional options to the autoaccept plugin. Fixes #11459.
rok.mandeljc@gmail.com
parents:
29082
diff
changeset
|
282 _("Escape the filenames")); |
|
5f4329c3eafe
Add additional options to the autoaccept plugin. Fixes #11459.
rok.mandeljc@gmail.com
parents:
29082
diff
changeset
|
283 purple_plugin_pref_frame_add(frame, pref); |
|
5f4329c3eafe
Add additional options to the autoaccept plugin. Fixes #11459.
rok.mandeljc@gmail.com
parents:
29082
diff
changeset
|
284 |
|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
285 return frame; |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
286 } |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
287 |
| 15822 | 288 static PurplePluginUiInfo prefs_info = { |
|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
289 get_plugin_pref_frame, |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
290 0, |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
291 NULL, |
|
16666
5205dd2bd035
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16439
diff
changeset
|
292 |
|
5205dd2bd035
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16439
diff
changeset
|
293 /* padding */ |
|
5205dd2bd035
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16439
diff
changeset
|
294 NULL, |
|
5205dd2bd035
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16439
diff
changeset
|
295 NULL, |
|
5205dd2bd035
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16439
diff
changeset
|
296 NULL, |
|
5205dd2bd035
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16439
diff
changeset
|
297 NULL |
|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
298 }; |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
299 |
| 15822 | 300 static PurplePluginInfo info = { |
| 301 PURPLE_PLUGIN_MAGIC, /* Magic */ | |
| 302 PURPLE_MAJOR_VERSION, /* Purple Major Version */ | |
| 303 PURPLE_MINOR_VERSION, /* Purple Minor Version */ | |
| 304 PURPLE_PLUGIN_STANDARD, /* plugin type */ | |
|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
305 NULL, /* ui requirement */ |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
306 0, /* flags */ |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
307 NULL, /* dependencies */ |
| 15822 | 308 PURPLE_PRIORITY_DEFAULT, /* priority */ |
|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
309 |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
310 PLUGIN_ID, /* plugin id */ |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
311 PLUGIN_NAME, /* name */ |
|
21030
3cc856ca2338
Add a --with-extraversion option to ./configure so packagers can fine tune
Stu Tomlinson <stu@nosnilmot.com>
parents:
19681
diff
changeset
|
312 DISPLAY_VERSION, /* version */ |
|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
313 PLUGIN_SUMMARY, /* summary */ |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
314 PLUGIN_DESCRIPTION, /* description */ |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
315 PLUGIN_AUTHOR, /* author */ |
| 15822 | 316 PURPLE_WEBSITE, /* website */ |
|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
317 |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
318 plugin_load, /* load */ |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
319 plugin_unload, /* unload */ |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
320 NULL, /* destroy */ |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
321 |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
322 NULL, /* ui_info */ |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
323 NULL, /* extra_info */ |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
324 &prefs_info, /* prefs_info */ |
|
16666
5205dd2bd035
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16439
diff
changeset
|
325 NULL, /* actions */ |
|
5205dd2bd035
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16439
diff
changeset
|
326 |
|
5205dd2bd035
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16439
diff
changeset
|
327 /* padding */ |
|
5205dd2bd035
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16439
diff
changeset
|
328 NULL, |
|
5205dd2bd035
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16439
diff
changeset
|
329 NULL, |
|
5205dd2bd035
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16439
diff
changeset
|
330 NULL, |
|
5205dd2bd035
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16439
diff
changeset
|
331 NULL |
|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
332 }; |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
333 |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
334 static void |
| 15822 | 335 init_plugin(PurplePlugin *plugin) { |
|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
336 char *dirname; |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
337 |
| 15822 | 338 dirname = g_build_filename(purple_user_dir(), "autoaccept", NULL); |
| 339 purple_prefs_add_none(PREF_PREFIX); | |
| 340 purple_prefs_add_string(PREF_PATH, dirname); | |
|
31079
5f4329c3eafe
Add additional options to the autoaccept plugin. Fixes #11459.
rok.mandeljc@gmail.com
parents:
29082
diff
changeset
|
341 purple_prefs_add_int(PREF_STRANGER, FT_ASK); |
| 15822 | 342 purple_prefs_add_bool(PREF_NOTIFY, TRUE); |
|
23537
ad0d0efa30dd
Allow not creating a different directory for each user. Closes #5997.
Luke Bratch <l_bratch@yahoo.co.uk>
parents:
21783
diff
changeset
|
343 purple_prefs_add_bool(PREF_NEWDIR, TRUE); |
|
31079
5f4329c3eafe
Add additional options to the autoaccept plugin. Fixes #11459.
rok.mandeljc@gmail.com
parents:
29082
diff
changeset
|
344 purple_prefs_add_bool(PREF_ESCAPE, TRUE); |
|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
345 g_free(dirname); |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
346 } |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
347 |
| 15822 | 348 PURPLE_INIT_PLUGIN(PLUGIN_STATIC_NAME, init_plugin, info) |
