Mon, 06 Sep 2010 19:36:31 +0000
ChangeLog the Google relay stuff
| 15230 | 1 | /* |
| 2 | * Autoaccept - Auto-accept file transfers from selected users | |
| 3 | * Copyright (C) 2006 | |
| 4 | * | |
| 5 | * This program is free software; you can redistribute it and/or | |
| 6 | * modify it under the terms of the GNU General Public License as | |
| 7 | * published by the Free Software Foundation; either version 2 of the | |
| 8 | * License, or (at your option) any later version. | |
| 9 | * | |
| 10 | * This program is distributed in the hope that it will be useful, but | |
| 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 13 | * General Public License for more details. | |
| 14 | * | |
| 15 | * You should have received a copy of the GNU General Public License | |
| 16 | * along with this program; if not, write to the Free Software | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19733
diff
changeset
|
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19733
diff
changeset
|
18 | * 02111-1301, USA. |
| 15230 | 19 | */ |
| 20 | #include "internal.h" | |
| 21 | ||
| 22 | #define PLUGIN_ID "core-plugin_pack-autoaccept" | |
|
15418
bf287f742a5a
[gaim-migrate @ 18149]
Luke Schierer <lschiere@pidgin.im>
parents:
15230
diff
changeset
|
23 | #define PLUGIN_NAME N_("Autoaccept") |
|
25633
feee0c7e503f
Fix some more mis-identified plugins, like 3b3526a0...
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24531
diff
changeset
|
24 | #define PLUGIN_STATIC_NAME Autoaccept |
|
15418
bf287f742a5a
[gaim-migrate @ 18149]
Luke Schierer <lschiere@pidgin.im>
parents:
15230
diff
changeset
|
25 | #define PLUGIN_SUMMARY N_("Auto-accept file transfer requests from selected users.") |
|
bf287f742a5a
[gaim-migrate @ 18149]
Luke Schierer <lschiere@pidgin.im>
parents:
15230
diff
changeset
|
26 | #define PLUGIN_DESCRIPTION N_("Auto-accept file transfer requests from selected users.") |
| 15230 | 27 | #define PLUGIN_AUTHOR "Sadrul H Chowdhury <sadrul@users.sourceforge.net>" |
| 28 | ||
| 29 | /* System headers */ | |
| 30 | #include <glib.h> | |
|
29491
31c1d615772e
Kill off unneeded GLIB_CHECK_VERSION checks in libpurple. Refs #10024.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
25911
diff
changeset
|
31 | #include <glib/gstdio.h> |
| 15230 | 32 | |
| 15884 | 33 | /* Purple headers */ |
| 15230 | 34 | #include <plugin.h> |
| 35 | #include <version.h> | |
| 36 | ||
| 37 | #include <blist.h> | |
| 38 | #include <conversation.h> | |
| 39 | #include <ft.h> | |
| 40 | #include <request.h> | |
| 41 | #include <notify.h> | |
| 42 | #include <util.h> | |
| 43 | ||
| 16481 | 44 | #define PREF_PREFIX "/plugins/core/" PLUGIN_ID |
| 15230 | 45 | #define PREF_PATH PREF_PREFIX "/path" |
| 46 | #define PREF_STRANGER PREF_PREFIX "/reject_stranger" | |
| 47 | #define PREF_NOTIFY PREF_PREFIX "/notify" | |
|
23849
020974bf1759
Allow not creating a different directory for each user. Closes #5997.
Luke Bratch <l_bratch@yahoo.co.uk>
parents:
21897
diff
changeset
|
48 | #define PREF_NEWDIR PREF_PREFIX "/newdir" |
| 15230 | 49 | |
| 50 | typedef enum | |
| 51 | { | |
| 52 | FT_ASK, | |
| 53 | FT_ACCEPT, | |
| 54 | FT_REJECT | |
| 55 | } AutoAcceptSetting; | |
| 56 | ||
| 57 | static gboolean | |
| 58 | ensure_path_exists(const char *dir) | |
| 59 | { | |
| 60 | if (!g_file_test(dir, G_FILE_TEST_IS_DIR)) | |
| 61 | { | |
| 15884 | 62 | if (purple_build_dir(dir, S_IRUSR | S_IWUSR | S_IXUSR)) |
| 15230 | 63 | return FALSE; |
| 64 | } | |
| 65 | ||
| 66 | return TRUE; | |
| 67 | } | |
| 68 | ||
| 69 | static void | |
| 15884 | 70 | auto_accept_complete_cb(PurpleXfer *xfer, PurpleXfer *my) |
| 15230 | 71 | { |
| 15884 | 72 | if (xfer == my && purple_prefs_get_bool(PREF_NOTIFY) && |
| 73 | !purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, xfer->who, xfer->account)) | |
| 15230 | 74 | { |
| 75 | char *message = g_strdup_printf(_("Autoaccepted file transfer of \"%s\" from \"%s\" completed."), | |
| 76 | xfer->filename, xfer->who); | |
| 15884 | 77 | purple_notify_info(NULL, _("Autoaccept complete"), message, NULL); |
| 15230 | 78 | g_free(message); |
| 79 | } | |
| 80 | } | |
| 81 | ||
| 82 | static void | |
| 15884 | 83 | file_recv_request_cb(PurpleXfer *xfer, gpointer handle) |
| 15230 | 84 | { |
| 15884 | 85 | PurpleAccount *account; |
| 86 | PurpleBlistNode *node; | |
| 15230 | 87 | const char *pref; |
| 88 | char *filename; | |
| 89 | char *dirname; | |
| 90 | ||
| 91 | account = xfer->account; | |
|
24974
a81952e9babb
Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@pidgin.im>
parents:
24531
diff
changeset
|
92 | node = PURPLE_BLIST_NODE(purple_find_buddy(account, xfer->who)); |
| 15230 | 93 | |
| 94 | if (!node) | |
| 95 | { | |
| 15884 | 96 | if (purple_prefs_get_bool(PREF_STRANGER)) |
| 97 | xfer->status = PURPLE_XFER_STATUS_CANCEL_LOCAL; | |
| 15230 | 98 | return; |
| 99 | } | |
| 100 | ||
|
24531
76e72697f7d6
Hide the blistnode, buddy, contact, group, and chat structs
Gary Kramlich <grim@reaperworld.com>
parents:
24266
diff
changeset
|
101 | node = purple_blist_node_get_parent(node); |
| 15884 | 102 | g_return_if_fail(PURPLE_BLIST_NODE_IS_CONTACT(node)); |
| 15230 | 103 | |
| 15884 | 104 | pref = purple_prefs_get_string(PREF_PATH); |
| 105 | switch (purple_blist_node_get_int(node, "autoaccept")) | |
| 15230 | 106 | { |
| 107 | case FT_ASK: | |
| 108 | break; | |
| 109 | case FT_ACCEPT: | |
| 110 | if (ensure_path_exists(pref)) | |
| 111 | { | |
|
21897
6de6b77176ac
Do not overwrite an existing file. Closes #3982.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21895
diff
changeset
|
112 | int count = 1; |
|
6de6b77176ac
Do not overwrite an existing file. Closes #3982.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21895
diff
changeset
|
113 | const char *escape; |
|
24266
d44f9c32397f
Uniquify auto-accepted file names to foo-2.tar.gz, not foo.tar.gz-2.
Will Thompson <resiak@pidgin.im>
parents:
23849
diff
changeset
|
114 | gchar **name_and_ext; |
|
d44f9c32397f
Uniquify auto-accepted file names to foo-2.tar.gz, not foo.tar.gz-2.
Will Thompson <resiak@pidgin.im>
parents:
23849
diff
changeset
|
115 | const gchar *name; |
|
d44f9c32397f
Uniquify auto-accepted file names to foo-2.tar.gz, not foo.tar.gz-2.
Will Thompson <resiak@pidgin.im>
parents:
23849
diff
changeset
|
116 | gchar *ext; |
|
23849
020974bf1759
Allow not creating a different directory for each user. Closes #5997.
Luke Bratch <l_bratch@yahoo.co.uk>
parents:
21897
diff
changeset
|
117 | |
|
020974bf1759
Allow not creating a different directory for each user. Closes #5997.
Luke Bratch <l_bratch@yahoo.co.uk>
parents:
21897
diff
changeset
|
118 | if (purple_prefs_get_bool(PREF_NEWDIR)) |
|
020974bf1759
Allow not creating a different directory for each user. Closes #5997.
Luke Bratch <l_bratch@yahoo.co.uk>
parents:
21897
diff
changeset
|
119 | dirname = g_build_filename(pref, purple_normalize(account, xfer->who), NULL); |
|
020974bf1759
Allow not creating a different directory for each user. Closes #5997.
Luke Bratch <l_bratch@yahoo.co.uk>
parents:
21897
diff
changeset
|
120 | else |
|
020974bf1759
Allow not creating a different directory for each user. Closes #5997.
Luke Bratch <l_bratch@yahoo.co.uk>
parents:
21897
diff
changeset
|
121 | dirname = g_build_filename(pref, NULL); |
| 15230 | 122 | |
| 123 | if (!ensure_path_exists(dirname)) | |
| 124 | { | |
| 125 | g_free(dirname); | |
| 126 | break; | |
| 127 | } | |
|
21895
26a49c68b5b6
Normalize and escape the filename when auto-accepting a file. References #3982.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21630
diff
changeset
|
128 | |
|
21897
6de6b77176ac
Do not overwrite an existing file. Closes #3982.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21895
diff
changeset
|
129 | escape = purple_escape_filename(xfer->filename); |
|
6de6b77176ac
Do not overwrite an existing file. Closes #3982.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21895
diff
changeset
|
130 | filename = g_build_filename(dirname, escape, NULL); |
|
6de6b77176ac
Do not overwrite an existing file. Closes #3982.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21895
diff
changeset
|
131 | |
|
24266
d44f9c32397f
Uniquify auto-accepted file names to foo-2.tar.gz, not foo.tar.gz-2.
Will Thompson <resiak@pidgin.im>
parents:
23849
diff
changeset
|
132 | /* Split at the first dot, to avoid uniquifying "foo.tar.gz" to "foo.tar-2.gz" */ |
|
d44f9c32397f
Uniquify auto-accepted file names to foo-2.tar.gz, not foo.tar.gz-2.
Will Thompson <resiak@pidgin.im>
parents:
23849
diff
changeset
|
133 | name_and_ext = g_strsplit(escape, ".", 2); |
|
d44f9c32397f
Uniquify auto-accepted file names to foo-2.tar.gz, not foo.tar.gz-2.
Will Thompson <resiak@pidgin.im>
parents:
23849
diff
changeset
|
134 | name = name_and_ext[0]; |
|
d44f9c32397f
Uniquify auto-accepted file names to foo-2.tar.gz, not foo.tar.gz-2.
Will Thompson <resiak@pidgin.im>
parents:
23849
diff
changeset
|
135 | g_return_if_fail(name != NULL); |
|
d44f9c32397f
Uniquify auto-accepted file names to foo-2.tar.gz, not foo.tar.gz-2.
Will Thompson <resiak@pidgin.im>
parents:
23849
diff
changeset
|
136 | if (name_and_ext[1] != NULL) { |
|
d44f9c32397f
Uniquify auto-accepted file names to foo-2.tar.gz, not foo.tar.gz-2.
Will Thompson <resiak@pidgin.im>
parents:
23849
diff
changeset
|
137 | /* g_strsplit does not include the separator in each chunk. */ |
|
d44f9c32397f
Uniquify auto-accepted file names to foo-2.tar.gz, not foo.tar.gz-2.
Will Thompson <resiak@pidgin.im>
parents:
23849
diff
changeset
|
138 | ext = g_strdup_printf(".%s", name_and_ext[1]); |
|
d44f9c32397f
Uniquify auto-accepted file names to foo-2.tar.gz, not foo.tar.gz-2.
Will Thompson <resiak@pidgin.im>
parents:
23849
diff
changeset
|
139 | } else { |
|
d44f9c32397f
Uniquify auto-accepted file names to foo-2.tar.gz, not foo.tar.gz-2.
Will Thompson <resiak@pidgin.im>
parents:
23849
diff
changeset
|
140 | ext = g_strdup(""); |
|
d44f9c32397f
Uniquify auto-accepted file names to foo-2.tar.gz, not foo.tar.gz-2.
Will Thompson <resiak@pidgin.im>
parents:
23849
diff
changeset
|
141 | } |
|
d44f9c32397f
Uniquify auto-accepted file names to foo-2.tar.gz, not foo.tar.gz-2.
Will Thompson <resiak@pidgin.im>
parents:
23849
diff
changeset
|
142 | |
|
21897
6de6b77176ac
Do not overwrite an existing file. Closes #3982.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21895
diff
changeset
|
143 | /* Make sure the file doesn't exist. Do we want some better checking than this? */ |
|
24266
d44f9c32397f
Uniquify auto-accepted file names to foo-2.tar.gz, not foo.tar.gz-2.
Will Thompson <resiak@pidgin.im>
parents:
23849
diff
changeset
|
144 | /* FIXME: There is a race here: if the newly uniquified file name gets created between |
|
d44f9c32397f
Uniquify auto-accepted file names to foo-2.tar.gz, not foo.tar.gz-2.
Will Thompson <resiak@pidgin.im>
parents:
23849
diff
changeset
|
145 | * this g_file_test and the transfer starting, the file created in the meantime |
|
d44f9c32397f
Uniquify auto-accepted file names to foo-2.tar.gz, not foo.tar.gz-2.
Will Thompson <resiak@pidgin.im>
parents:
23849
diff
changeset
|
146 | * will be clobbered. But it's not at all straightforward to fix. |
|
d44f9c32397f
Uniquify auto-accepted file names to foo-2.tar.gz, not foo.tar.gz-2.
Will Thompson <resiak@pidgin.im>
parents:
23849
diff
changeset
|
147 | */ |
|
21897
6de6b77176ac
Do not overwrite an existing file. Closes #3982.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21895
diff
changeset
|
148 | while (g_file_test(filename, G_FILE_TEST_EXISTS)) { |
|
24266
d44f9c32397f
Uniquify auto-accepted file names to foo-2.tar.gz, not foo.tar.gz-2.
Will Thompson <resiak@pidgin.im>
parents:
23849
diff
changeset
|
149 | char *file = g_strdup_printf("%s-%d%s", name, count++, ext); |
|
21897
6de6b77176ac
Do not overwrite an existing file. Closes #3982.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21895
diff
changeset
|
150 | g_free(filename); |
|
6de6b77176ac
Do not overwrite an existing file. Closes #3982.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21895
diff
changeset
|
151 | filename = g_build_filename(dirname, file, NULL); |
|
6de6b77176ac
Do not overwrite an existing file. Closes #3982.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21895
diff
changeset
|
152 | g_free(file); |
|
6de6b77176ac
Do not overwrite an existing file. Closes #3982.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21895
diff
changeset
|
153 | } |
| 15230 | 154 | |
| 15884 | 155 | purple_xfer_request_accepted(xfer, filename); |
| 15230 | 156 | |
|
24266
d44f9c32397f
Uniquify auto-accepted file names to foo-2.tar.gz, not foo.tar.gz-2.
Will Thompson <resiak@pidgin.im>
parents:
23849
diff
changeset
|
157 | g_strfreev(name_and_ext); |
|
d44f9c32397f
Uniquify auto-accepted file names to foo-2.tar.gz, not foo.tar.gz-2.
Will Thompson <resiak@pidgin.im>
parents:
23849
diff
changeset
|
158 | g_free(ext); |
| 15230 | 159 | g_free(dirname); |
| 160 | g_free(filename); | |
| 161 | } | |
|
21895
26a49c68b5b6
Normalize and escape the filename when auto-accepting a file. References #3982.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21630
diff
changeset
|
162 | |
| 15884 | 163 | purple_signal_connect(purple_xfers_get_handle(), "file-recv-complete", handle, |
| 164 | PURPLE_CALLBACK(auto_accept_complete_cb), xfer); | |
| 15230 | 165 | break; |
| 166 | case FT_REJECT: | |
| 15884 | 167 | xfer->status = PURPLE_XFER_STATUS_CANCEL_LOCAL; |
| 15230 | 168 | break; |
| 169 | } | |
| 170 | } | |
| 171 | ||
| 172 | static void | |
| 15884 | 173 | save_cb(PurpleBlistNode *node, int choice) |
| 15230 | 174 | { |
| 15884 | 175 | if (PURPLE_BLIST_NODE_IS_BUDDY(node)) |
|
24531
76e72697f7d6
Hide the blistnode, buddy, contact, group, and chat structs
Gary Kramlich <grim@reaperworld.com>
parents:
24266
diff
changeset
|
176 | node = purple_blist_node_get_parent(node); |
| 15884 | 177 | g_return_if_fail(PURPLE_BLIST_NODE_IS_CONTACT(node)); |
| 178 | purple_blist_node_set_int(node, "autoaccept", choice); | |
| 15230 | 179 | } |
| 180 | ||
| 181 | static void | |
| 15884 | 182 | set_auto_accept_settings(PurpleBlistNode *node, gpointer plugin) |
| 15230 | 183 | { |
| 184 | char *message; | |
| 185 | ||
| 15884 | 186 | if (PURPLE_BLIST_NODE_IS_BUDDY(node)) |
|
24531
76e72697f7d6
Hide the blistnode, buddy, contact, group, and chat structs
Gary Kramlich <grim@reaperworld.com>
parents:
24266
diff
changeset
|
187 | node = purple_blist_node_get_parent(node); |
| 15884 | 188 | g_return_if_fail(PURPLE_BLIST_NODE_IS_CONTACT(node)); |
| 15230 | 189 | |
| 190 | message = g_strdup_printf(_("When a file-transfer request arrives from %s"), | |
| 15884 | 191 | purple_contact_get_alias((PurpleContact *)node)); |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
192 | purple_request_choice(plugin, _("Set Autoaccept Setting"), message, |
| 15884 | 193 | NULL, purple_blist_node_get_int(node, "autoaccept"), |
| 15230 | 194 | _("_Save"), G_CALLBACK(save_cb), |
|
16490
68c22924d66b
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 <evands@pidgin.im>
parents:
16481
diff
changeset
|
195 | _("_Cancel"), NULL, |
|
68c22924d66b
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 <evands@pidgin.im>
parents:
16481
diff
changeset
|
196 | NULL, NULL, NULL, |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
197 | node, |
| 15230 | 198 | _("Ask"), FT_ASK, |
| 199 | _("Auto Accept"), FT_ACCEPT, | |
| 200 | _("Auto Reject"), FT_REJECT, | |
|
16490
68c22924d66b
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 <evands@pidgin.im>
parents:
16481
diff
changeset
|
201 | NULL, purple_contact_get_alias((PurpleContact *)node), NULL, |
|
19279
5e5883dbd532
Adding hints to libpurple/plugins/autoaccept.c
Gabriel Schulhof <nix@go-nix.ca>
parents:
19278
diff
changeset
|
202 | NULL); |
| 15230 | 203 | g_free(message); |
| 204 | } | |
| 205 | ||
| 206 | static void | |
| 15884 | 207 | context_menu(PurpleBlistNode *node, GList **menu, gpointer plugin) |
| 15230 | 208 | { |
| 15884 | 209 | PurpleMenuAction *action; |
| 15230 | 210 | |
|
18594
b4e1f5a7d2bf
Don't allow setting auto-accept preferences for blist nodes that won't be
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16745
diff
changeset
|
211 | if (!PURPLE_BLIST_NODE_IS_BUDDY(node) && !PURPLE_BLIST_NODE_IS_CONTACT(node) && |
|
b4e1f5a7d2bf
Don't allow setting auto-accept preferences for blist nodes that won't be
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16745
diff
changeset
|
212 | !(purple_blist_node_get_flags(node) & PURPLE_BLIST_NODE_FLAG_NO_SAVE)) |
| 15230 | 213 | return; |
| 214 | ||
| 15884 | 215 | action = purple_menu_action_new(_("Autoaccept File Transfers..."), |
| 216 | PURPLE_CALLBACK(set_auto_accept_settings), plugin, NULL); | |
| 15230 | 217 | (*menu) = g_list_prepend(*menu, action); |
| 218 | } | |
| 219 | ||
| 220 | static gboolean | |
| 15884 | 221 | plugin_load(PurplePlugin *plugin) |
| 15230 | 222 | { |
| 15884 | 223 | purple_signal_connect(purple_xfers_get_handle(), "file-recv-request", plugin, |
| 224 | PURPLE_CALLBACK(file_recv_request_cb), plugin); | |
| 225 | purple_signal_connect(purple_blist_get_handle(), "blist-node-extended-menu", plugin, | |
| 226 | PURPLE_CALLBACK(context_menu), plugin); | |
| 15230 | 227 | return TRUE; |
| 228 | } | |
| 229 | ||
| 230 | static gboolean | |
| 15884 | 231 | plugin_unload(PurplePlugin *plugin) |
| 15230 | 232 | { |
| 233 | return TRUE; | |
| 234 | } | |
| 235 | ||
| 15884 | 236 | static PurplePluginPrefFrame * |
| 237 | get_plugin_pref_frame(PurplePlugin *plugin) | |
| 15230 | 238 | { |
| 15884 | 239 | PurplePluginPrefFrame *frame; |
| 240 | PurplePluginPref *pref; | |
| 15230 | 241 | |
| 15884 | 242 | frame = purple_plugin_pref_frame_new(); |
| 15230 | 243 | |
| 244 | /* XXX: Is there a better way than this? There really should be. */ | |
| 15884 | 245 | pref = purple_plugin_pref_new_with_name_and_label(PREF_PATH, _("Path to save the files in\n" |
| 15230 | 246 | "(Please provide the full path)")); |
| 15884 | 247 | purple_plugin_pref_frame_add(frame, pref); |
| 15230 | 248 | |
| 15884 | 249 | pref = purple_plugin_pref_new_with_name_and_label(PREF_STRANGER, |
| 15230 | 250 | _("Automatically reject from users not in buddy list")); |
| 15884 | 251 | purple_plugin_pref_frame_add(frame, pref); |
| 15230 | 252 | |
| 15884 | 253 | pref = purple_plugin_pref_new_with_name_and_label(PREF_NOTIFY, |
| 15230 | 254 | _("Notify with a popup when an autoaccepted file transfer is complete\n" |
| 255 | "(only when there's no conversation with the sender)")); | |
| 15884 | 256 | purple_plugin_pref_frame_add(frame, pref); |
| 15230 | 257 | |
|
23849
020974bf1759
Allow not creating a different directory for each user. Closes #5997.
Luke Bratch <l_bratch@yahoo.co.uk>
parents:
21897
diff
changeset
|
258 | pref = purple_plugin_pref_new_with_name_and_label(PREF_NEWDIR, |
|
020974bf1759
Allow not creating a different directory for each user. Closes #5997.
Luke Bratch <l_bratch@yahoo.co.uk>
parents:
21897
diff
changeset
|
259 | _("Create a new directory for each user")); |
|
020974bf1759
Allow not creating a different directory for each user. Closes #5997.
Luke Bratch <l_bratch@yahoo.co.uk>
parents:
21897
diff
changeset
|
260 | purple_plugin_pref_frame_add(frame, pref); |
|
020974bf1759
Allow not creating a different directory for each user. Closes #5997.
Luke Bratch <l_bratch@yahoo.co.uk>
parents:
21897
diff
changeset
|
261 | |
| 15230 | 262 | return frame; |
| 263 | } | |
| 264 | ||
| 15884 | 265 | static PurplePluginUiInfo prefs_info = { |
| 15230 | 266 | get_plugin_pref_frame, |
| 267 | 0, | |
| 268 | NULL, | |
|
16745
df2c3d6b609a
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16490
diff
changeset
|
269 | |
|
df2c3d6b609a
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16490
diff
changeset
|
270 | /* padding */ |
|
df2c3d6b609a
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16490
diff
changeset
|
271 | NULL, |
|
df2c3d6b609a
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16490
diff
changeset
|
272 | NULL, |
|
df2c3d6b609a
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16490
diff
changeset
|
273 | NULL, |
|
df2c3d6b609a
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16490
diff
changeset
|
274 | NULL |
| 15230 | 275 | }; |
| 276 | ||
| 15884 | 277 | static PurplePluginInfo info = { |
| 278 | PURPLE_PLUGIN_MAGIC, /* Magic */ | |
| 279 | PURPLE_MAJOR_VERSION, /* Purple Major Version */ | |
| 280 | PURPLE_MINOR_VERSION, /* Purple Minor Version */ | |
| 281 | PURPLE_PLUGIN_STANDARD, /* plugin type */ | |
|
15418
bf287f742a5a
[gaim-migrate @ 18149]
Luke Schierer <lschiere@pidgin.im>
parents:
15230
diff
changeset
|
282 | NULL, /* ui requirement */ |
|
bf287f742a5a
[gaim-migrate @ 18149]
Luke Schierer <lschiere@pidgin.im>
parents:
15230
diff
changeset
|
283 | 0, /* flags */ |
|
bf287f742a5a
[gaim-migrate @ 18149]
Luke Schierer <lschiere@pidgin.im>
parents:
15230
diff
changeset
|
284 | NULL, /* dependencies */ |
| 15884 | 285 | PURPLE_PRIORITY_DEFAULT, /* priority */ |
| 15230 | 286 | |
|
15418
bf287f742a5a
[gaim-migrate @ 18149]
Luke Schierer <lschiere@pidgin.im>
parents:
15230
diff
changeset
|
287 | PLUGIN_ID, /* plugin id */ |
|
bf287f742a5a
[gaim-migrate @ 18149]
Luke Schierer <lschiere@pidgin.im>
parents:
15230
diff
changeset
|
288 | PLUGIN_NAME, /* name */ |
|
20288
5ca925a094e2
applied changes from 03b709ec2a153e7e82719df0ba4635108bb1d3c6
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19859
diff
changeset
|
289 | DISPLAY_VERSION, /* version */ |
|
15418
bf287f742a5a
[gaim-migrate @ 18149]
Luke Schierer <lschiere@pidgin.im>
parents:
15230
diff
changeset
|
290 | PLUGIN_SUMMARY, /* summary */ |
|
bf287f742a5a
[gaim-migrate @ 18149]
Luke Schierer <lschiere@pidgin.im>
parents:
15230
diff
changeset
|
291 | PLUGIN_DESCRIPTION, /* description */ |
| 15230 | 292 | PLUGIN_AUTHOR, /* author */ |
| 15884 | 293 | PURPLE_WEBSITE, /* website */ |
| 15230 | 294 | |
| 295 | plugin_load, /* load */ | |
| 296 | plugin_unload, /* unload */ | |
|
15418
bf287f742a5a
[gaim-migrate @ 18149]
Luke Schierer <lschiere@pidgin.im>
parents:
15230
diff
changeset
|
297 | NULL, /* destroy */ |
| 15230 | 298 | |
|
15418
bf287f742a5a
[gaim-migrate @ 18149]
Luke Schierer <lschiere@pidgin.im>
parents:
15230
diff
changeset
|
299 | NULL, /* ui_info */ |
|
bf287f742a5a
[gaim-migrate @ 18149]
Luke Schierer <lschiere@pidgin.im>
parents:
15230
diff
changeset
|
300 | NULL, /* extra_info */ |
| 15230 | 301 | &prefs_info, /* prefs_info */ |
|
16745
df2c3d6b609a
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16490
diff
changeset
|
302 | NULL, /* actions */ |
|
df2c3d6b609a
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16490
diff
changeset
|
303 | |
|
df2c3d6b609a
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16490
diff
changeset
|
304 | /* padding */ |
|
df2c3d6b609a
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16490
diff
changeset
|
305 | NULL, |
|
df2c3d6b609a
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16490
diff
changeset
|
306 | NULL, |
|
df2c3d6b609a
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16490
diff
changeset
|
307 | NULL, |
|
df2c3d6b609a
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16490
diff
changeset
|
308 | NULL |
| 15230 | 309 | }; |
| 310 | ||
| 311 | static void | |
| 15884 | 312 | init_plugin(PurplePlugin *plugin) { |
| 15230 | 313 | char *dirname; |
| 314 | ||
| 15884 | 315 | dirname = g_build_filename(purple_user_dir(), "autoaccept", NULL); |
| 316 | purple_prefs_add_none(PREF_PREFIX); | |
| 317 | purple_prefs_add_string(PREF_PATH, dirname); | |
| 318 | purple_prefs_add_bool(PREF_STRANGER, TRUE); | |
| 319 | purple_prefs_add_bool(PREF_NOTIFY, TRUE); | |
|
23849
020974bf1759
Allow not creating a different directory for each user. Closes #5997.
Luke Bratch <l_bratch@yahoo.co.uk>
parents:
21897
diff
changeset
|
320 | purple_prefs_add_bool(PREF_NEWDIR, TRUE); |
| 15230 | 321 | g_free(dirname); |
| 322 | } | |
| 323 | ||
| 15884 | 324 | PURPLE_INIT_PLUGIN(PLUGIN_STATIC_NAME, init_plugin, info) |