Mercurial > pidgin.yaz
annotate libpurple/plugins/autoaccept.c @ 25438:4b8c4870b13a
propagate from branch 'im.pidgin.pidgin.next.minor' (head 7305b29db7bd00d3261f348c71674c93aa31b327)
to branch 'im.pidgin.pidgin' (head d8c03c68d591d9392607d954942ee58b8618d946)
| author | Elliott Sales de Andrade <qulogic@pidgin.im> |
|---|---|
| date | Mon, 02 Mar 2009 04:18:40 +0000 |
| parents | 0e08c847517d ea62e934c80b |
| children | 39716f7d2c93 |
| rev | line source |
|---|---|
|
15374
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 |
|
19680
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. |
|
15374
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") |
|
25124
ea62e934c80b
Fix some more mis-identified plugins, like 3b3526a0...
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24256
diff
changeset
|
24 #define PLUGIN_STATIC_NAME Autoaccept |
|
15374
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> |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
31 #if GLIB_CHECK_VERSION(2,6,0) |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
32 # include <glib/gstdio.h> |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
33 #else |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
34 # include <sys/types.h> |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
35 # include <sys/stat.h> |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
36 # define g_mkdir mkdir |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
37 #endif |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
38 |
| 15823 | 39 /* Purple headers */ |
|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
40 #include <plugin.h> |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
41 #include <version.h> |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
42 |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
43 #include <blist.h> |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
44 #include <conversation.h> |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
45 #include <ft.h> |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
46 #include <request.h> |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
47 #include <notify.h> |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
48 #include <util.h> |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
49 |
| 16433 | 50 #define PREF_PREFIX "/plugins/core/" PLUGIN_ID |
|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
51 #define PREF_PATH PREF_PREFIX "/path" |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
52 #define PREF_STRANGER PREF_PREFIX "/reject_stranger" |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
53 #define PREF_NOTIFY PREF_PREFIX "/notify" |
|
23582
ad0d0efa30dd
Allow not creating a different directory for each user. Closes #5997.
Luke Bratch <l_bratch@yahoo.co.uk>
parents:
21783
diff
changeset
|
54 #define PREF_NEWDIR PREF_PREFIX "/newdir" |
|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
55 |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
56 typedef enum |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
57 { |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
58 FT_ASK, |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
59 FT_ACCEPT, |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
60 FT_REJECT |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
61 } AutoAcceptSetting; |
|
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 static gboolean |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
64 ensure_path_exists(const char *dir) |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
65 { |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
66 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
|
67 { |
| 15823 | 68 if (purple_build_dir(dir, S_IRUSR | S_IWUSR | S_IXUSR)) |
|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
69 return FALSE; |
|
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 return TRUE; |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
73 } |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
74 |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
75 static void |
| 15823 | 76 auto_accept_complete_cb(PurpleXfer *xfer, PurpleXfer *my) |
|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
77 { |
| 15823 | 78 if (xfer == my && purple_prefs_get_bool(PREF_NOTIFY) && |
| 79 !purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, xfer->who, xfer->account)) | |
|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
80 { |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
81 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
|
82 xfer->filename, xfer->who); |
| 15823 | 83 purple_notify_info(NULL, _("Autoaccept complete"), message, NULL); |
|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
84 g_free(message); |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
85 } |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
86 } |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
87 |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
88 static void |
| 15823 | 89 file_recv_request_cb(PurpleXfer *xfer, gpointer handle) |
|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
90 { |
| 15823 | 91 PurpleAccount *account; |
| 92 PurpleBlistNode *node; | |
|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
93 const char *pref; |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
94 char *filename; |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
95 char *dirname; |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
96 |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
97 account = xfer->account; |
|
25318
0e08c847517d
Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@wiktel.com>
parents:
24256
diff
changeset
|
98 node = PURPLE_BLIST_NODE(purple_find_buddy(account, xfer->who)); |
|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
99 |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
100 if (!node) |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
101 { |
| 15823 | 102 if (purple_prefs_get_bool(PREF_STRANGER)) |
| 103 xfer->status = PURPLE_XFER_STATUS_CANCEL_LOCAL; | |
|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
104 return; |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
105 } |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
106 |
|
24256
0d0088b03745
Hide the blistnode, buddy, contact, group, and chat structs
Gary Kramlich <grim@reaperworld.com>
parents:
24001
diff
changeset
|
107 node = purple_blist_node_get_parent(node); |
| 15823 | 108 g_return_if_fail(PURPLE_BLIST_NODE_IS_CONTACT(node)); |
|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
109 |
| 15823 | 110 pref = purple_prefs_get_string(PREF_PATH); |
| 111 switch (purple_blist_node_get_int(node, "autoaccept")) | |
|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
112 { |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
113 case FT_ASK: |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
114 break; |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
115 case FT_ACCEPT: |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
116 if (ensure_path_exists(pref)) |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
117 { |
|
21783
3b1d7caddc27
Do not overwrite an existing file. Closes #3982.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21782
diff
changeset
|
118 int count = 1; |
|
3b1d7caddc27
Do not overwrite an existing file. Closes #3982.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21782
diff
changeset
|
119 const char *escape; |
|
24001
f23d1643808e
Uniquify auto-accepted file names to foo-2.tar.gz, not foo.tar.gz-2.
Will Thompson <will.thompson@collabora.co.uk>
parents:
23582
diff
changeset
|
120 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:
23582
diff
changeset
|
121 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:
23582
diff
changeset
|
122 gchar *ext; |
|
23582
ad0d0efa30dd
Allow not creating a different directory for each user. Closes #5997.
Luke Bratch <l_bratch@yahoo.co.uk>
parents:
21783
diff
changeset
|
123 |
|
ad0d0efa30dd
Allow not creating a different directory for each user. Closes #5997.
Luke Bratch <l_bratch@yahoo.co.uk>
parents:
21783
diff
changeset
|
124 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
|
125 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
|
126 else |
|
ad0d0efa30dd
Allow not creating a different directory for each user. Closes #5997.
Luke Bratch <l_bratch@yahoo.co.uk>
parents:
21783
diff
changeset
|
127 dirname = g_build_filename(pref, NULL); |
|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
128 |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
129 if (!ensure_path_exists(dirname)) |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
130 { |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
131 g_free(dirname); |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
132 break; |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
133 } |
|
21782
bacb8c59230a
Normalize and escape the filename when auto-accepting a file. References #3982.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21560
diff
changeset
|
134 |
|
21783
3b1d7caddc27
Do not overwrite an existing file. Closes #3982.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21782
diff
changeset
|
135 escape = purple_escape_filename(xfer->filename); |
|
3b1d7caddc27
Do not overwrite an existing file. Closes #3982.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21782
diff
changeset
|
136 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
|
137 |
|
24001
f23d1643808e
Uniquify auto-accepted file names to foo-2.tar.gz, not foo.tar.gz-2.
Will Thompson <will.thompson@collabora.co.uk>
parents:
23582
diff
changeset
|
138 /* 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:
23582
diff
changeset
|
139 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:
23582
diff
changeset
|
140 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:
23582
diff
changeset
|
141 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:
23582
diff
changeset
|
142 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:
23582
diff
changeset
|
143 /* 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:
23582
diff
changeset
|
144 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:
23582
diff
changeset
|
145 } 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:
23582
diff
changeset
|
146 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:
23582
diff
changeset
|
147 } |
|
f23d1643808e
Uniquify auto-accepted file names to foo-2.tar.gz, not foo.tar.gz-2.
Will Thompson <will.thompson@collabora.co.uk>
parents:
23582
diff
changeset
|
148 |
|
21783
3b1d7caddc27
Do not overwrite an existing file. Closes #3982.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21782
diff
changeset
|
149 /* Make sure the file doesn't exist. Do we want some better checking than this? */ |
|
24001
f23d1643808e
Uniquify auto-accepted file names to foo-2.tar.gz, not foo.tar.gz-2.
Will Thompson <will.thompson@collabora.co.uk>
parents:
23582
diff
changeset
|
150 /* 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:
23582
diff
changeset
|
151 * 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:
23582
diff
changeset
|
152 * 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:
23582
diff
changeset
|
153 */ |
|
21783
3b1d7caddc27
Do not overwrite an existing file. Closes #3982.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21782
diff
changeset
|
154 while (g_file_test(filename, G_FILE_TEST_EXISTS)) { |
|
24001
f23d1643808e
Uniquify auto-accepted file names to foo-2.tar.gz, not foo.tar.gz-2.
Will Thompson <will.thompson@collabora.co.uk>
parents:
23582
diff
changeset
|
155 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
|
156 g_free(filename); |
|
3b1d7caddc27
Do not overwrite an existing file. Closes #3982.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21782
diff
changeset
|
157 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
|
158 g_free(file); |
|
3b1d7caddc27
Do not overwrite an existing file. Closes #3982.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21782
diff
changeset
|
159 } |
|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
160 |
| 15823 | 161 purple_xfer_request_accepted(xfer, filename); |
|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
162 |
|
24001
f23d1643808e
Uniquify auto-accepted file names to foo-2.tar.gz, not foo.tar.gz-2.
Will Thompson <will.thompson@collabora.co.uk>
parents:
23582
diff
changeset
|
163 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:
23582
diff
changeset
|
164 g_free(ext); |
|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
165 g_free(dirname); |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
166 g_free(filename); |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
167 } |
|
21782
bacb8c59230a
Normalize and escape the filename when auto-accepting a file. References #3982.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21560
diff
changeset
|
168 |
| 15823 | 169 purple_signal_connect(purple_xfers_get_handle(), "file-recv-complete", handle, |
| 170 PURPLE_CALLBACK(auto_accept_complete_cb), xfer); | |
|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
171 break; |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
172 case FT_REJECT: |
| 15823 | 173 xfer->status = PURPLE_XFER_STATUS_CANCEL_LOCAL; |
|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
174 break; |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
175 } |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
176 } |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
177 |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
178 static void |
| 15823 | 179 save_cb(PurpleBlistNode *node, int choice) |
|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
180 { |
| 15823 | 181 if (PURPLE_BLIST_NODE_IS_BUDDY(node)) |
|
24256
0d0088b03745
Hide the blistnode, buddy, contact, group, and chat structs
Gary Kramlich <grim@reaperworld.com>
parents:
24001
diff
changeset
|
182 node = purple_blist_node_get_parent(node); |
| 15823 | 183 g_return_if_fail(PURPLE_BLIST_NODE_IS_CONTACT(node)); |
| 184 purple_blist_node_set_int(node, "autoaccept", choice); | |
|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
185 } |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
186 |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
187 static void |
| 15823 | 188 set_auto_accept_settings(PurpleBlistNode *node, gpointer plugin) |
|
15374
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 char *message; |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
191 |
| 15823 | 192 if (PURPLE_BLIST_NODE_IS_BUDDY(node)) |
|
24256
0d0088b03745
Hide the blistnode, buddy, contact, group, and chat structs
Gary Kramlich <grim@reaperworld.com>
parents:
24001
diff
changeset
|
193 node = purple_blist_node_get_parent(node); |
| 15823 | 194 g_return_if_fail(PURPLE_BLIST_NODE_IS_CONTACT(node)); |
|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
195 |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
196 message = g_strdup_printf(_("When a file-transfer request arrives from %s"), |
| 15823 | 197 purple_contact_get_alias((PurpleContact *)node)); |
|
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
198 purple_request_choice(plugin, _("Set Autoaccept Setting"), message, |
| 15823 | 199 NULL, purple_blist_node_get_int(node, "autoaccept"), |
|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
200 _("_Save"), G_CALLBACK(save_cb), |
|
16442
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:
16433
diff
changeset
|
201 _("_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:
16433
diff
changeset
|
202 NULL, NULL, NULL, |
|
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
203 node, |
|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
204 _("Ask"), FT_ASK, |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
205 _("Auto Accept"), FT_ACCEPT, |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
206 _("Auto Reject"), FT_REJECT, |
|
16442
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:
16433
diff
changeset
|
207 NULL, purple_contact_get_alias((PurpleContact *)node), NULL, |
|
19848
fa06f943abd3
Adding hints to libpurple/plugins/autoaccept.c
Gabriel Schulhof <nix@go-nix.ca>
parents:
19847
diff
changeset
|
208 NULL); |
|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
209 g_free(message); |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
210 } |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
211 |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
212 static void |
| 15823 | 213 context_menu(PurpleBlistNode *node, GList **menu, gpointer plugin) |
|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
214 { |
| 15823 | 215 PurpleMenuAction *action; |
|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
216 |
|
18415
aed9eceb7b0f
Don't allow setting auto-accept preferences for blist nodes that won't be
Stu Tomlinson <stu@nosnilmot.com>
parents:
16674
diff
changeset
|
217 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:
16674
diff
changeset
|
218 !(purple_blist_node_get_flags(node) & PURPLE_BLIST_NODE_FLAG_NO_SAVE)) |
|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
219 return; |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
220 |
| 15823 | 221 action = purple_menu_action_new(_("Autoaccept File Transfers..."), |
| 222 PURPLE_CALLBACK(set_auto_accept_settings), plugin, NULL); | |
|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
223 (*menu) = g_list_prepend(*menu, action); |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
224 } |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
225 |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
226 static gboolean |
| 15823 | 227 plugin_load(PurplePlugin *plugin) |
|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
228 { |
| 15823 | 229 purple_signal_connect(purple_xfers_get_handle(), "file-recv-request", plugin, |
| 230 PURPLE_CALLBACK(file_recv_request_cb), plugin); | |
| 231 purple_signal_connect(purple_blist_get_handle(), "blist-node-extended-menu", plugin, | |
| 232 PURPLE_CALLBACK(context_menu), plugin); | |
|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
233 return TRUE; |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
234 } |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
235 |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
236 static gboolean |
| 15823 | 237 plugin_unload(PurplePlugin *plugin) |
|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
238 { |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
239 return TRUE; |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
240 } |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
241 |
| 15823 | 242 static PurplePluginPrefFrame * |
| 243 get_plugin_pref_frame(PurplePlugin *plugin) | |
|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
244 { |
| 15823 | 245 PurplePluginPrefFrame *frame; |
| 246 PurplePluginPref *pref; | |
|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
247 |
| 15823 | 248 frame = purple_plugin_pref_frame_new(); |
|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
249 |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
250 /* XXX: Is there a better way than this? There really should be. */ |
| 15823 | 251 pref = purple_plugin_pref_new_with_name_and_label(PREF_PATH, _("Path to save the files in\n" |
|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
252 "(Please provide the full path)")); |
| 15823 | 253 purple_plugin_pref_frame_add(frame, pref); |
|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
254 |
| 15823 | 255 pref = purple_plugin_pref_new_with_name_and_label(PREF_STRANGER, |
|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
256 _("Automatically reject from users not in buddy list")); |
| 15823 | 257 purple_plugin_pref_frame_add(frame, pref); |
|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
258 |
| 15823 | 259 pref = purple_plugin_pref_new_with_name_and_label(PREF_NOTIFY, |
|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
260 _("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
|
261 "(only when there's no conversation with the sender)")); |
| 15823 | 262 purple_plugin_pref_frame_add(frame, pref); |
|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
263 |
|
23582
ad0d0efa30dd
Allow not creating a different directory for each user. Closes #5997.
Luke Bratch <l_bratch@yahoo.co.uk>
parents:
21783
diff
changeset
|
264 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
|
265 _("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
|
266 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
|
267 |
|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
268 return frame; |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
269 } |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
270 |
| 15823 | 271 static PurplePluginUiInfo prefs_info = { |
|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
272 get_plugin_pref_frame, |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
273 0, |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
274 NULL, |
|
16674
5205dd2bd035
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16442
diff
changeset
|
275 |
|
5205dd2bd035
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16442
diff
changeset
|
276 /* padding */ |
|
5205dd2bd035
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16442
diff
changeset
|
277 NULL, |
|
5205dd2bd035
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16442
diff
changeset
|
278 NULL, |
|
5205dd2bd035
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16442
diff
changeset
|
279 NULL, |
|
5205dd2bd035
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16442
diff
changeset
|
280 NULL |
|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
281 }; |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
282 |
| 15823 | 283 static PurplePluginInfo info = { |
| 284 PURPLE_PLUGIN_MAGIC, /* Magic */ | |
| 285 PURPLE_MAJOR_VERSION, /* Purple Major Version */ | |
| 286 PURPLE_MINOR_VERSION, /* Purple Minor Version */ | |
| 287 PURPLE_PLUGIN_STANDARD, /* plugin type */ | |
|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
288 NULL, /* ui requirement */ |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
289 0, /* flags */ |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
290 NULL, /* dependencies */ |
| 15823 | 291 PURPLE_PRIORITY_DEFAULT, /* priority */ |
|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
292 |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
293 PLUGIN_ID, /* plugin id */ |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
294 PLUGIN_NAME, /* name */ |
|
21030
3cc856ca2338
Add a --with-extraversion option to ./configure so packagers can fine tune
Stu Tomlinson <stu@nosnilmot.com>
parents:
19680
diff
changeset
|
295 DISPLAY_VERSION, /* version */ |
|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
296 PLUGIN_SUMMARY, /* summary */ |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
297 PLUGIN_DESCRIPTION, /* description */ |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
298 PLUGIN_AUTHOR, /* author */ |
| 15823 | 299 PURPLE_WEBSITE, /* website */ |
|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
300 |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
301 plugin_load, /* load */ |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
302 plugin_unload, /* unload */ |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
303 NULL, /* destroy */ |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
304 |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
305 NULL, /* ui_info */ |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
306 NULL, /* extra_info */ |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
307 &prefs_info, /* prefs_info */ |
|
16674
5205dd2bd035
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16442
diff
changeset
|
308 NULL, /* actions */ |
|
5205dd2bd035
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16442
diff
changeset
|
309 |
|
5205dd2bd035
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16442
diff
changeset
|
310 /* padding */ |
|
5205dd2bd035
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16442
diff
changeset
|
311 NULL, |
|
5205dd2bd035
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16442
diff
changeset
|
312 NULL, |
|
5205dd2bd035
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16442
diff
changeset
|
313 NULL, |
|
5205dd2bd035
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16442
diff
changeset
|
314 NULL |
|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
315 }; |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
316 |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
317 static void |
| 15823 | 318 init_plugin(PurplePlugin *plugin) { |
|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
319 char *dirname; |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
320 |
| 15823 | 321 dirname = g_build_filename(purple_user_dir(), "autoaccept", NULL); |
| 322 purple_prefs_add_none(PREF_PREFIX); | |
| 323 purple_prefs_add_string(PREF_PATH, dirname); | |
| 324 purple_prefs_add_bool(PREF_STRANGER, TRUE); | |
| 325 purple_prefs_add_bool(PREF_NOTIFY, TRUE); | |
|
23582
ad0d0efa30dd
Allow not creating a different directory for each user. Closes #5997.
Luke Bratch <l_bratch@yahoo.co.uk>
parents:
21783
diff
changeset
|
326 purple_prefs_add_bool(PREF_NEWDIR, TRUE); |
|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
327 g_free(dirname); |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
328 } |
|
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
329 |
| 15823 | 330 PURPLE_INIT_PLUGIN(PLUGIN_STATIC_NAME, init_plugin, info) |
