Wed, 30 Jul 2008 03:58:21 +0000
Cleanup unnecessary casts and etc.
| 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") |
| 15230 | 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> | |
| 31 | #if GLIB_CHECK_VERSION(2,6,0) | |
| 32 | # include <glib/gstdio.h> | |
| 33 | #else | |
| 34 | # include <sys/types.h> | |
| 35 | # include <sys/stat.h> | |
| 36 | # define g_mkdir mkdir | |
| 37 | #endif | |
| 38 | ||
| 15884 | 39 | /* Purple headers */ |
| 15230 | 40 | #include <plugin.h> |
| 41 | #include <version.h> | |
| 42 | ||
| 43 | #include <blist.h> | |
| 44 | #include <conversation.h> | |
| 45 | #include <ft.h> | |
| 46 | #include <request.h> | |
| 47 | #include <notify.h> | |
| 48 | #include <util.h> | |
| 49 | ||
| 16481 | 50 | #define PREF_PREFIX "/plugins/core/" PLUGIN_ID |
| 15230 | 51 | #define PREF_PATH PREF_PREFIX "/path" |
| 52 | #define PREF_STRANGER PREF_PREFIX "/reject_stranger" | |
| 53 | #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
|
54 | #define PREF_NEWDIR PREF_PREFIX "/newdir" |
| 15230 | 55 | |
| 56 | typedef enum | |
| 57 | { | |
| 58 | FT_ASK, | |
| 59 | FT_ACCEPT, | |
| 60 | FT_REJECT | |
| 61 | } AutoAcceptSetting; | |
| 62 | ||
| 63 | static gboolean | |
| 64 | ensure_path_exists(const char *dir) | |
| 65 | { | |
| 66 | if (!g_file_test(dir, G_FILE_TEST_IS_DIR)) | |
| 67 | { | |
| 15884 | 68 | if (purple_build_dir(dir, S_IRUSR | S_IWUSR | S_IXUSR)) |
| 15230 | 69 | return FALSE; |
| 70 | } | |
| 71 | ||
| 72 | return TRUE; | |
| 73 | } | |
| 74 | ||
| 75 | static void | |
| 15884 | 76 | auto_accept_complete_cb(PurpleXfer *xfer, PurpleXfer *my) |
| 15230 | 77 | { |
| 15884 | 78 | if (xfer == my && purple_prefs_get_bool(PREF_NOTIFY) && |
| 79 | !purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, xfer->who, xfer->account)) | |
| 15230 | 80 | { |
| 81 | char *message = g_strdup_printf(_("Autoaccepted file transfer of \"%s\" from \"%s\" completed."), | |
| 82 | xfer->filename, xfer->who); | |
| 15884 | 83 | purple_notify_info(NULL, _("Autoaccept complete"), message, NULL); |
| 15230 | 84 | g_free(message); |
| 85 | } | |
| 86 | } | |
| 87 | ||
| 88 | static void | |
| 15884 | 89 | file_recv_request_cb(PurpleXfer *xfer, gpointer handle) |
| 15230 | 90 | { |
| 15884 | 91 | PurpleAccount *account; |
| 92 | PurpleBlistNode *node; | |
| 15230 | 93 | const char *pref; |
| 94 | char *filename; | |
| 95 | char *dirname; | |
| 96 | ||
| 97 | account = xfer->account; | |
| 15884 | 98 | node = (PurpleBlistNode *)purple_find_buddy(account, xfer->who); |
| 15230 | 99 | |
| 100 | if (!node) | |
| 101 | { | |
| 15884 | 102 | if (purple_prefs_get_bool(PREF_STRANGER)) |
| 103 | xfer->status = PURPLE_XFER_STATUS_CANCEL_LOCAL; | |
| 15230 | 104 | return; |
| 105 | } | |
| 106 | ||
| 107 | node = node->parent; | |
| 15884 | 108 | g_return_if_fail(PURPLE_BLIST_NODE_IS_CONTACT(node)); |
| 15230 | 109 | |
| 15884 | 110 | pref = purple_prefs_get_string(PREF_PATH); |
| 111 | switch (purple_blist_node_get_int(node, "autoaccept")) | |
| 15230 | 112 | { |
| 113 | case FT_ASK: | |
| 114 | break; | |
| 115 | case FT_ACCEPT: | |
| 116 | if (ensure_path_exists(pref)) | |
| 117 | { | |
|
21897
6de6b77176ac
Do not overwrite an existing file. Closes #3982.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21895
diff
changeset
|
118 | int count = 1; |
|
6de6b77176ac
Do not overwrite an existing file. Closes #3982.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21895
diff
changeset
|
119 | const char *escape; |
|
23849
020974bf1759
Allow not creating a different directory for each user. Closes #5997.
Luke Bratch <l_bratch@yahoo.co.uk>
parents:
21897
diff
changeset
|
120 | |
|
020974bf1759
Allow not creating a different directory for each user. Closes #5997.
Luke Bratch <l_bratch@yahoo.co.uk>
parents:
21897
diff
changeset
|
121 | 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
|
122 | 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
|
123 | else |
|
020974bf1759
Allow not creating a different directory for each user. Closes #5997.
Luke Bratch <l_bratch@yahoo.co.uk>
parents:
21897
diff
changeset
|
124 | dirname = g_build_filename(pref, NULL); |
| 15230 | 125 | |
| 126 | if (!ensure_path_exists(dirname)) | |
| 127 | { | |
| 128 | g_free(dirname); | |
| 129 | break; | |
| 130 | } | |
|
21895
26a49c68b5b6
Normalize and escape the filename when auto-accepting a file. References #3982.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21630
diff
changeset
|
131 | |
|
21897
6de6b77176ac
Do not overwrite an existing file. Closes #3982.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21895
diff
changeset
|
132 | 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
|
133 | 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
|
134 | |
|
6de6b77176ac
Do not overwrite an existing file. Closes #3982.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21895
diff
changeset
|
135 | /* Make sure the file doesn't exist. Do we want some better checking than this? */ |
|
6de6b77176ac
Do not overwrite an existing file. Closes #3982.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21895
diff
changeset
|
136 | while (g_file_test(filename, G_FILE_TEST_EXISTS)) { |
|
6de6b77176ac
Do not overwrite an existing file. Closes #3982.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21895
diff
changeset
|
137 | char *file = g_strdup_printf("%s-%d", escape, count++); |
|
6de6b77176ac
Do not overwrite an existing file. Closes #3982.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21895
diff
changeset
|
138 | g_free(filename); |
|
6de6b77176ac
Do not overwrite an existing file. Closes #3982.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21895
diff
changeset
|
139 | 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
|
140 | g_free(file); |
|
6de6b77176ac
Do not overwrite an existing file. Closes #3982.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21895
diff
changeset
|
141 | } |
| 15230 | 142 | |
| 15884 | 143 | purple_xfer_request_accepted(xfer, filename); |
| 15230 | 144 | |
| 145 | g_free(dirname); | |
| 146 | g_free(filename); | |
| 147 | } | |
|
21895
26a49c68b5b6
Normalize and escape the filename when auto-accepting a file. References #3982.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21630
diff
changeset
|
148 | |
| 15884 | 149 | purple_signal_connect(purple_xfers_get_handle(), "file-recv-complete", handle, |
| 150 | PURPLE_CALLBACK(auto_accept_complete_cb), xfer); | |
| 15230 | 151 | break; |
| 152 | case FT_REJECT: | |
| 15884 | 153 | xfer->status = PURPLE_XFER_STATUS_CANCEL_LOCAL; |
| 15230 | 154 | break; |
| 155 | } | |
| 156 | } | |
| 157 | ||
| 158 | static void | |
| 15884 | 159 | save_cb(PurpleBlistNode *node, int choice) |
| 15230 | 160 | { |
| 15884 | 161 | if (PURPLE_BLIST_NODE_IS_BUDDY(node)) |
| 15230 | 162 | node = node->parent; |
| 15884 | 163 | g_return_if_fail(PURPLE_BLIST_NODE_IS_CONTACT(node)); |
| 164 | purple_blist_node_set_int(node, "autoaccept", choice); | |
| 15230 | 165 | } |
| 166 | ||
| 167 | static void | |
| 15884 | 168 | set_auto_accept_settings(PurpleBlistNode *node, gpointer plugin) |
| 15230 | 169 | { |
| 170 | char *message; | |
| 171 | ||
| 15884 | 172 | if (PURPLE_BLIST_NODE_IS_BUDDY(node)) |
| 15230 | 173 | node = node->parent; |
| 15884 | 174 | g_return_if_fail(PURPLE_BLIST_NODE_IS_CONTACT(node)); |
| 15230 | 175 | |
| 176 | message = g_strdup_printf(_("When a file-transfer request arrives from %s"), | |
| 15884 | 177 | purple_contact_get_alias((PurpleContact *)node)); |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
178 | purple_request_choice(plugin, _("Set Autoaccept Setting"), message, |
| 15884 | 179 | NULL, purple_blist_node_get_int(node, "autoaccept"), |
| 15230 | 180 | _("_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
|
181 | _("_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
|
182 | NULL, NULL, NULL, |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
183 | node, |
| 15230 | 184 | _("Ask"), FT_ASK, |
| 185 | _("Auto Accept"), FT_ACCEPT, | |
| 186 | _("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
|
187 | 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
|
188 | NULL); |
| 15230 | 189 | g_free(message); |
| 190 | } | |
| 191 | ||
| 192 | static void | |
| 15884 | 193 | context_menu(PurpleBlistNode *node, GList **menu, gpointer plugin) |
| 15230 | 194 | { |
| 15884 | 195 | PurpleMenuAction *action; |
| 15230 | 196 | |
|
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
|
197 | 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
|
198 | !(purple_blist_node_get_flags(node) & PURPLE_BLIST_NODE_FLAG_NO_SAVE)) |
| 15230 | 199 | return; |
| 200 | ||
| 15884 | 201 | action = purple_menu_action_new(_("Autoaccept File Transfers..."), |
| 202 | PURPLE_CALLBACK(set_auto_accept_settings), plugin, NULL); | |
| 15230 | 203 | (*menu) = g_list_prepend(*menu, action); |
| 204 | } | |
| 205 | ||
| 206 | static gboolean | |
| 15884 | 207 | plugin_load(PurplePlugin *plugin) |
| 15230 | 208 | { |
| 15884 | 209 | purple_signal_connect(purple_xfers_get_handle(), "file-recv-request", plugin, |
| 210 | PURPLE_CALLBACK(file_recv_request_cb), plugin); | |
| 211 | purple_signal_connect(purple_blist_get_handle(), "blist-node-extended-menu", plugin, | |
| 212 | PURPLE_CALLBACK(context_menu), plugin); | |
| 15230 | 213 | return TRUE; |
| 214 | } | |
| 215 | ||
| 216 | static gboolean | |
| 15884 | 217 | plugin_unload(PurplePlugin *plugin) |
| 15230 | 218 | { |
| 219 | return TRUE; | |
| 220 | } | |
| 221 | ||
| 15884 | 222 | static PurplePluginPrefFrame * |
| 223 | get_plugin_pref_frame(PurplePlugin *plugin) | |
| 15230 | 224 | { |
| 15884 | 225 | PurplePluginPrefFrame *frame; |
| 226 | PurplePluginPref *pref; | |
| 15230 | 227 | |
| 15884 | 228 | frame = purple_plugin_pref_frame_new(); |
| 15230 | 229 | |
| 230 | /* XXX: Is there a better way than this? There really should be. */ | |
| 15884 | 231 | pref = purple_plugin_pref_new_with_name_and_label(PREF_PATH, _("Path to save the files in\n" |
| 15230 | 232 | "(Please provide the full path)")); |
| 15884 | 233 | purple_plugin_pref_frame_add(frame, pref); |
| 15230 | 234 | |
| 15884 | 235 | pref = purple_plugin_pref_new_with_name_and_label(PREF_STRANGER, |
| 15230 | 236 | _("Automatically reject from users not in buddy list")); |
| 15884 | 237 | purple_plugin_pref_frame_add(frame, pref); |
| 15230 | 238 | |
| 15884 | 239 | pref = purple_plugin_pref_new_with_name_and_label(PREF_NOTIFY, |
| 15230 | 240 | _("Notify with a popup when an autoaccepted file transfer is complete\n" |
| 241 | "(only when there's no conversation with the sender)")); | |
| 15884 | 242 | purple_plugin_pref_frame_add(frame, pref); |
| 15230 | 243 | |
|
23849
020974bf1759
Allow not creating a different directory for each user. Closes #5997.
Luke Bratch <l_bratch@yahoo.co.uk>
parents:
21897
diff
changeset
|
244 | 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
|
245 | _("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
|
246 | 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
|
247 | |
| 15230 | 248 | return frame; |
| 249 | } | |
| 250 | ||
| 15884 | 251 | static PurplePluginUiInfo prefs_info = { |
| 15230 | 252 | get_plugin_pref_frame, |
| 253 | 0, | |
| 254 | 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
|
255 | |
|
df2c3d6b609a
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16490
diff
changeset
|
256 | /* padding */ |
|
df2c3d6b609a
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16490
diff
changeset
|
257 | NULL, |
|
df2c3d6b609a
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16490
diff
changeset
|
258 | NULL, |
|
df2c3d6b609a
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16490
diff
changeset
|
259 | NULL, |
|
df2c3d6b609a
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16490
diff
changeset
|
260 | NULL |
| 15230 | 261 | }; |
| 262 | ||
| 15884 | 263 | static PurplePluginInfo info = { |
| 264 | PURPLE_PLUGIN_MAGIC, /* Magic */ | |
| 265 | PURPLE_MAJOR_VERSION, /* Purple Major Version */ | |
| 266 | PURPLE_MINOR_VERSION, /* Purple Minor Version */ | |
| 267 | PURPLE_PLUGIN_STANDARD, /* plugin type */ | |
|
15418
bf287f742a5a
[gaim-migrate @ 18149]
Luke Schierer <lschiere@pidgin.im>
parents:
15230
diff
changeset
|
268 | NULL, /* ui requirement */ |
|
bf287f742a5a
[gaim-migrate @ 18149]
Luke Schierer <lschiere@pidgin.im>
parents:
15230
diff
changeset
|
269 | 0, /* flags */ |
|
bf287f742a5a
[gaim-migrate @ 18149]
Luke Schierer <lschiere@pidgin.im>
parents:
15230
diff
changeset
|
270 | NULL, /* dependencies */ |
| 15884 | 271 | PURPLE_PRIORITY_DEFAULT, /* priority */ |
| 15230 | 272 | |
|
15418
bf287f742a5a
[gaim-migrate @ 18149]
Luke Schierer <lschiere@pidgin.im>
parents:
15230
diff
changeset
|
273 | PLUGIN_ID, /* plugin id */ |
|
bf287f742a5a
[gaim-migrate @ 18149]
Luke Schierer <lschiere@pidgin.im>
parents:
15230
diff
changeset
|
274 | PLUGIN_NAME, /* name */ |
|
20288
5ca925a094e2
applied changes from 03b709ec2a153e7e82719df0ba4635108bb1d3c6
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19859
diff
changeset
|
275 | DISPLAY_VERSION, /* version */ |
|
15418
bf287f742a5a
[gaim-migrate @ 18149]
Luke Schierer <lschiere@pidgin.im>
parents:
15230
diff
changeset
|
276 | PLUGIN_SUMMARY, /* summary */ |
|
bf287f742a5a
[gaim-migrate @ 18149]
Luke Schierer <lschiere@pidgin.im>
parents:
15230
diff
changeset
|
277 | PLUGIN_DESCRIPTION, /* description */ |
| 15230 | 278 | PLUGIN_AUTHOR, /* author */ |
| 15884 | 279 | PURPLE_WEBSITE, /* website */ |
| 15230 | 280 | |
| 281 | plugin_load, /* load */ | |
| 282 | plugin_unload, /* unload */ | |
|
15418
bf287f742a5a
[gaim-migrate @ 18149]
Luke Schierer <lschiere@pidgin.im>
parents:
15230
diff
changeset
|
283 | NULL, /* destroy */ |
| 15230 | 284 | |
|
15418
bf287f742a5a
[gaim-migrate @ 18149]
Luke Schierer <lschiere@pidgin.im>
parents:
15230
diff
changeset
|
285 | NULL, /* ui_info */ |
|
bf287f742a5a
[gaim-migrate @ 18149]
Luke Schierer <lschiere@pidgin.im>
parents:
15230
diff
changeset
|
286 | NULL, /* extra_info */ |
| 15230 | 287 | &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
|
288 | 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
|
289 | |
|
df2c3d6b609a
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16490
diff
changeset
|
290 | /* padding */ |
|
df2c3d6b609a
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16490
diff
changeset
|
291 | NULL, |
|
df2c3d6b609a
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16490
diff
changeset
|
292 | NULL, |
|
df2c3d6b609a
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16490
diff
changeset
|
293 | NULL, |
|
df2c3d6b609a
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16490
diff
changeset
|
294 | NULL |
| 15230 | 295 | }; |
| 296 | ||
| 297 | static void | |
| 15884 | 298 | init_plugin(PurplePlugin *plugin) { |
| 15230 | 299 | char *dirname; |
| 300 | ||
| 15884 | 301 | dirname = g_build_filename(purple_user_dir(), "autoaccept", NULL); |
| 302 | purple_prefs_add_none(PREF_PREFIX); | |
| 303 | purple_prefs_add_string(PREF_PATH, dirname); | |
| 304 | purple_prefs_add_bool(PREF_STRANGER, TRUE); | |
| 305 | 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
|
306 | purple_prefs_add_bool(PREF_NEWDIR, TRUE); |
| 15230 | 307 | g_free(dirname); |
| 308 | } | |
| 309 | ||
| 15884 | 310 | PURPLE_INIT_PLUGIN(PLUGIN_STATIC_NAME, init_plugin, info) |