Sun, 15 Apr 2007 18:52:28 +0000
Sort smiley themes case-insensitively because I think that's what
normal humans expect. I don't know, what do you guys think?
Polling developers about this is not a good sample set.
| 15230 | 1 | /* |
| 2 | * Autoreply - Autoreply feature for all the protocols | |
| 3 | * Copyright (C) 2005 | |
| 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 | |
| 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | |
| 18 | * 02111-1307, USA. | |
| 19 | */ | |
| 20 | #include "internal.h" | |
| 21 | ||
| 22 | #define PLUGIN_ID "core-plugin_pack-autoreply" | |
|
15418
bf287f742a5a
[gaim-migrate @ 18149]
Luke Schierer <lschiere@pidgin.im>
parents:
15230
diff
changeset
|
23 | #define PLUGIN_NAME N_("Autoreply") |
| 15230 | 24 | #define PLUGIN_STATIC_NAME "Autoreply" |
|
15418
bf287f742a5a
[gaim-migrate @ 18149]
Luke Schierer <lschiere@pidgin.im>
parents:
15230
diff
changeset
|
25 | #define PLUGIN_SUMMARY N_("Autoreply for all the protocols") |
|
bf287f742a5a
[gaim-migrate @ 18149]
Luke Schierer <lschiere@pidgin.im>
parents:
15230
diff
changeset
|
26 | #define PLUGIN_DESCRIPTION N_("This plugin lets you set autoreply message for any protocol. "\ |
| 15230 | 27 | "You can set the global autoreply message from the Plugin-options dialog. " \ |
| 28 | "To set some specific autoreply message for a particular buddy, right click " \ | |
| 29 | "on the buddy in the buddy-list window. To set autoreply messages for some " \ | |
|
15418
bf287f742a5a
[gaim-migrate @ 18149]
Luke Schierer <lschiere@pidgin.im>
parents:
15230
diff
changeset
|
30 | "account, go to the `Advanced' tab of the Account-edit dialog.") |
| 15230 | 31 | #define PLUGIN_AUTHOR "Sadrul Habib Chowdhury <sadrul@users.sourceforge.net>" |
| 32 | ||
| 33 | /* System headers */ | |
| 34 | #include <glib.h> | |
| 35 | ||
| 15884 | 36 | /* Purple headers */ |
| 15230 | 37 | #include <account.h> |
| 38 | #include <accountopt.h> | |
| 39 | #include <blist.h> | |
| 40 | #include <conversation.h> | |
| 41 | #include <plugin.h> | |
| 42 | #include <pluginpref.h> | |
| 43 | #include <request.h> | |
| 44 | #include <savedstatuses.h> | |
| 45 | #include <status.h> | |
| 46 | #include <util.h> | |
| 47 | #include <version.h> | |
| 48 | ||
| 49 | #define PREFS_PREFIX "/core/" PLUGIN_ID | |
| 50 | #define PREFS_IDLE PREFS_PREFIX "/idle" | |
| 51 | #define PREFS_AWAY PREFS_PREFIX "/away" | |
| 52 | #define PREFS_GLOBAL PREFS_PREFIX "/global" | |
| 53 | #define PREFS_MINTIME PREFS_PREFIX "/mintime" | |
| 54 | #define PREFS_MAXSEND PREFS_PREFIX "/maxsend" | |
| 55 | #define PREFS_USESTATUS PREFS_PREFIX "/usestatus" | |
| 56 | ||
| 15884 | 57 | typedef struct _PurpleAutoReply PurpleAutoReply; |
| 15230 | 58 | |
| 15884 | 59 | struct _PurpleAutoReply |
| 15230 | 60 | { |
| 15884 | 61 | PurpleBuddy *buddy; |
| 15230 | 62 | char *reply; |
| 63 | }; | |
| 64 | ||
| 65 | typedef enum | |
| 66 | { | |
| 67 | STATUS_NEVER, | |
| 68 | STATUS_ALWAYS, | |
| 69 | STATUS_FALLBACK | |
| 70 | } UseStatusMessage; | |
| 71 | ||
| 72 | static GHashTable *options = NULL; | |
| 73 | ||
| 74 | /** | |
| 75 | * Returns the auto-reply message for buddy | |
| 76 | */ | |
| 77 | static const char * | |
| 15884 | 78 | get_autoreply_message(PurpleBuddy *buddy, PurpleAccount *account) |
| 15230 | 79 | { |
| 80 | const char *reply = NULL; | |
| 81 | UseStatusMessage use_status; | |
| 82 | ||
| 15884 | 83 | use_status = purple_prefs_get_int(PREFS_USESTATUS); |
| 15230 | 84 | if (use_status == STATUS_ALWAYS) |
| 85 | { | |
| 15884 | 86 | PurpleStatus *status = purple_account_get_active_status(account); |
| 87 | PurpleStatusType *type = purple_status_get_type(status); | |
| 88 | if (purple_status_type_get_attr(type, "message") != NULL) | |
| 89 | reply = purple_status_get_attr_string(status, "message"); | |
| 15230 | 90 | else |
| 15884 | 91 | reply = purple_savedstatus_get_message(purple_savedstatus_get_current()); |
| 15230 | 92 | } |
| 93 | ||
| 94 | if (!reply && buddy) | |
| 95 | { | |
| 96 | /* Is there any special auto-reply for this buddy? */ | |
| 15884 | 97 | reply = purple_blist_node_get_string((PurpleBlistNode*)buddy, "autoreply"); |
| 15230 | 98 | |
| 15884 | 99 | if (!reply && PURPLE_BLIST_NODE_IS_BUDDY((PurpleBlistNode*)buddy)) |
| 15230 | 100 | { |
| 101 | /* Anything for the contact, then? */ | |
| 15884 | 102 | reply = purple_blist_node_get_string(((PurpleBlistNode*)buddy)->parent, "autoreply"); |
| 15230 | 103 | } |
| 104 | } | |
| 105 | ||
| 106 | if (!reply) | |
| 107 | { | |
| 108 | /* Is there any specific auto-reply for this account? */ | |
| 15884 | 109 | reply = purple_account_get_string(account, "autoreply", NULL); |
| 15230 | 110 | } |
| 111 | ||
| 112 | if (!reply) | |
| 113 | { | |
| 114 | /* Get the global auto-reply message */ | |
| 15884 | 115 | reply = purple_prefs_get_string(PREFS_GLOBAL); |
| 15230 | 116 | } |
| 117 | ||
| 118 | if (*reply == ' ') | |
| 119 | reply = NULL; | |
| 120 | ||
| 121 | if (!reply && use_status == STATUS_FALLBACK) | |
| 15884 | 122 | reply = purple_status_get_attr_string(purple_account_get_active_status(account), "message"); |
| 15230 | 123 | |
| 124 | return reply; | |
| 125 | } | |
| 126 | ||
| 127 | static void | |
| 15884 | 128 | written_msg(PurpleAccount *account, const char *who, const char *message, |
| 129 | PurpleConversation *conv, PurpleMessageFlags flags, gpointer null) | |
| 15230 | 130 | { |
| 15884 | 131 | PurpleBuddy *buddy; |
| 132 | PurplePresence *presence; | |
| 15230 | 133 | const char *reply = NULL; |
| 134 | gboolean trigger = FALSE; | |
| 135 | ||
| 15884 | 136 | if (!(flags & PURPLE_MESSAGE_RECV)) |
| 15230 | 137 | return; |
| 138 | ||
| 139 | if (!message || !*message) | |
| 140 | return; | |
| 141 | ||
| 142 | /* Do not send an autoreply for an autoreply */ | |
| 15884 | 143 | if (flags & PURPLE_MESSAGE_AUTO_RESP) |
| 15230 | 144 | return; |
| 145 | ||
| 15884 | 146 | g_return_if_fail(purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM); |
| 15230 | 147 | |
| 15884 | 148 | presence = purple_account_get_presence(account); |
| 15230 | 149 | |
| 15884 | 150 | if (purple_prefs_get_bool(PREFS_AWAY) && !purple_presence_is_available(presence)) |
| 15230 | 151 | trigger = TRUE; |
| 15884 | 152 | if (purple_prefs_get_bool(PREFS_IDLE) && purple_presence_is_idle(presence)) |
| 15230 | 153 | trigger = TRUE; |
| 154 | ||
| 155 | if (!trigger) | |
| 156 | return; | |
| 157 | ||
| 15884 | 158 | buddy = purple_find_buddy(account, who); |
| 15230 | 159 | reply = get_autoreply_message(buddy, account); |
| 160 | ||
| 161 | if (reply) | |
| 162 | { | |
| 15884 | 163 | PurpleConnection *gc; |
| 164 | PurpleMessageFlags flag = PURPLE_MESSAGE_SEND; | |
| 15230 | 165 | time_t last_sent, now; |
| 166 | int count_sent, maxsend; | |
| 167 | ||
| 15884 | 168 | last_sent = GPOINTER_TO_INT(purple_conversation_get_data(conv, "autoreply_lastsent")); |
| 15230 | 169 | now = time(NULL); |
| 170 | ||
| 171 | /* Have we spent enough time after our last autoreply? */ | |
| 15884 | 172 | if (now - last_sent >= (purple_prefs_get_int(PREFS_MINTIME)*60)) |
| 15230 | 173 | { |
| 15884 | 174 | count_sent = GPOINTER_TO_INT(purple_conversation_get_data(conv, "autoreply_count")); |
| 175 | maxsend = purple_prefs_get_int(PREFS_MAXSEND); | |
| 15230 | 176 | |
| 177 | /* Have we sent the autoreply enough times? */ | |
| 178 | if (count_sent < maxsend || maxsend == -1) | |
| 179 | { | |
| 15884 | 180 | purple_conversation_set_data(conv, "autoreply_count", GINT_TO_POINTER(++count_sent)); |
| 181 | purple_conversation_set_data(conv, "autoreply_lastsent", GINT_TO_POINTER(now)); | |
| 182 | gc = purple_account_get_connection(account); | |
| 183 | if (gc->flags & PURPLE_CONNECTION_AUTO_RESP) | |
| 184 | flag |= PURPLE_MESSAGE_AUTO_RESP; | |
| 15230 | 185 | serv_send_im(gc, who, reply, flag); |
| 15884 | 186 | purple_conv_im_write(PURPLE_CONV_IM(conv), NULL, reply, flag, time(NULL)); |
| 15230 | 187 | } |
| 188 | } | |
| 189 | } | |
| 190 | } | |
| 191 | ||
| 192 | static void | |
| 15884 | 193 | set_auto_reply_cb(PurpleBlistNode *node, char *message) |
| 15230 | 194 | { |
| 195 | if (!message || !*message) | |
| 196 | message = " "; | |
| 15884 | 197 | purple_blist_node_set_string(node, "autoreply", message); |
| 15230 | 198 | } |
| 199 | ||
| 200 | static void | |
| 15884 | 201 | set_auto_reply(PurpleBlistNode *node, gpointer plugin) |
| 15230 | 202 | { |
| 203 | char *message; | |
| 15884 | 204 | PurpleBuddy *buddy; |
| 205 | PurpleAccount *account; | |
| 206 | PurpleConnection *gc; | |
| 15230 | 207 | |
| 15884 | 208 | if (PURPLE_BLIST_NODE_IS_BUDDY(node)) |
| 209 | buddy = (PurpleBuddy *)node; | |
| 15230 | 210 | else |
| 15884 | 211 | buddy = purple_contact_get_priority_buddy((PurpleContact*)node); |
| 15230 | 212 | |
| 15884 | 213 | account = purple_buddy_get_account(buddy); |
| 214 | gc = purple_account_get_connection(account); | |
| 15230 | 215 | |
| 216 | /* XXX: There should be a way to reset to the default/account-default autoreply */ | |
| 217 | ||
| 218 | message = g_strdup_printf(_("Set autoreply message for %s"), | |
| 15884 | 219 | purple_buddy_get_contact_alias(buddy)); |
| 220 | purple_request_input(plugin, _("Set Autoreply Message"), message, | |
| 15230 | 221 | _("The following message will be sent to the buddy when " |
| 222 | "the buddy sends you a message and autoreply is enabled."), | |
| 223 | get_autoreply_message(buddy, account), TRUE, FALSE, | |
| 15884 | 224 | (gc->flags & PURPLE_CONNECTION_HTML) ? "html" : NULL, |
| 15230 | 225 | _("_Save"), G_CALLBACK(set_auto_reply_cb), |
| 226 | _("_Cancel"), NULL, node); | |
| 227 | g_free(message); | |
| 228 | } | |
| 229 | ||
| 230 | static void | |
| 15884 | 231 | context_menu(PurpleBlistNode *node, GList **menu, gpointer plugin) |
| 15230 | 232 | { |
| 15884 | 233 | PurpleMenuAction *action; |
| 15230 | 234 | |
| 15884 | 235 | if (!PURPLE_BLIST_NODE_IS_BUDDY(node) && !PURPLE_BLIST_NODE_IS_CONTACT(node)) |
| 15230 | 236 | return; |
| 237 | ||
| 15884 | 238 | action = purple_menu_action_new(_("Set _Autoreply Message"), |
| 239 | PURPLE_CALLBACK(set_auto_reply), plugin, NULL); | |
| 15230 | 240 | (*menu) = g_list_prepend(*menu, action); |
| 241 | } | |
| 242 | ||
| 243 | static void | |
| 15884 | 244 | add_option_for_protocol(PurplePlugin *plg) |
| 15230 | 245 | { |
| 15884 | 246 | PurplePluginProtocolInfo *info = PURPLE_PLUGIN_PROTOCOL_INFO(plg); |
| 247 | PurpleAccountOption *option; | |
| 15230 | 248 | |
| 15884 | 249 | option = purple_account_option_string_new(_("Autoreply message"), "autoreply", NULL); |
| 15230 | 250 | info->protocol_options = g_list_append(info->protocol_options, option); |
| 251 | ||
| 252 | if (!g_hash_table_lookup(options, plg)) | |
| 253 | g_hash_table_insert(options, plg, option); | |
| 254 | } | |
| 255 | ||
| 256 | static void | |
| 15884 | 257 | remove_option_for_protocol(PurplePlugin *plg) |
| 15230 | 258 | { |
| 15884 | 259 | PurplePluginProtocolInfo *info = PURPLE_PLUGIN_PROTOCOL_INFO(plg); |
| 260 | PurpleAccountOption *option = g_hash_table_lookup(options, plg); | |
| 15230 | 261 | |
| 262 | if (g_list_find(info->protocol_options, option)) | |
| 263 | { | |
| 264 | info->protocol_options = g_list_remove(info->protocol_options, option); | |
| 15884 | 265 | purple_account_option_destroy(option); |
| 15230 | 266 | g_hash_table_remove(options, plg); |
| 267 | } | |
| 268 | } | |
| 269 | ||
| 270 | static void | |
| 15884 | 271 | plugin_load_cb(PurplePlugin *plugin, gboolean load) |
| 15230 | 272 | { |
| 15884 | 273 | if (plugin->info && plugin->info->type == PURPLE_PLUGIN_PROTOCOL) |
| 15230 | 274 | { |
| 275 | if (load) | |
| 276 | add_option_for_protocol(plugin); | |
| 277 | else | |
| 278 | remove_option_for_protocol(plugin); | |
| 279 | } | |
| 280 | } | |
| 281 | ||
| 282 | static gboolean | |
| 15884 | 283 | plugin_load(PurplePlugin *plugin) |
| 15230 | 284 | { |
| 285 | GList *list; | |
| 286 | ||
| 15884 | 287 | purple_signal_connect(purple_conversations_get_handle(), "wrote-im-msg", plugin, |
| 288 | PURPLE_CALLBACK(written_msg), NULL); | |
| 289 | purple_signal_connect(purple_blist_get_handle(), "blist-node-extended-menu", plugin, | |
| 290 | PURPLE_CALLBACK(context_menu), plugin); | |
| 291 | purple_signal_connect(purple_plugins_get_handle(), "plugin-load", plugin, | |
| 292 | PURPLE_CALLBACK(plugin_load_cb), GINT_TO_POINTER(TRUE)); | |
| 293 | purple_signal_connect(purple_plugins_get_handle(), "plugin-unload", plugin, | |
| 294 | PURPLE_CALLBACK(plugin_load_cb), GINT_TO_POINTER(FALSE)); | |
| 15230 | 295 | |
| 296 | /* Perhaps it's necessary to do this after making sure the prpl-s have been loaded? */ | |
| 297 | options = g_hash_table_new(g_direct_hash, g_direct_equal); | |
| 15884 | 298 | list = purple_plugins_get_protocols(); |
| 15230 | 299 | while (list) |
| 300 | { | |
| 301 | add_option_for_protocol(list->data); | |
| 302 | list = list->next; | |
| 303 | } | |
| 304 | ||
| 305 | return TRUE; | |
| 306 | } | |
| 307 | ||
| 308 | static gboolean | |
| 15884 | 309 | plugin_unload(PurplePlugin *plugin) |
| 15230 | 310 | { |
| 311 | GList *list; | |
| 312 | ||
| 313 | if (options == NULL) | |
| 314 | return TRUE; | |
| 315 | ||
| 15884 | 316 | list = purple_plugins_get_protocols(); |
| 15230 | 317 | while (list) |
| 318 | { | |
| 319 | remove_option_for_protocol(list->data); | |
| 320 | list = list->next; | |
| 321 | } | |
| 322 | g_hash_table_destroy(options); | |
| 323 | options = NULL; | |
| 324 | ||
| 325 | return TRUE; | |
| 326 | } | |
| 327 | ||
| 15884 | 328 | static PurplePluginPrefFrame * |
| 329 | get_plugin_pref_frame(PurplePlugin *plugin) | |
| 15230 | 330 | { |
| 15884 | 331 | PurplePluginPrefFrame *frame; |
| 332 | PurplePluginPref *pref; | |
| 15230 | 333 | |
| 15884 | 334 | frame = purple_plugin_pref_frame_new(); |
| 15230 | 335 | |
| 15884 | 336 | pref = purple_plugin_pref_new_with_label(_("Send autoreply messages when")); |
| 337 | purple_plugin_pref_frame_add(frame, pref); | |
| 15230 | 338 | |
| 15884 | 339 | pref = purple_plugin_pref_new_with_name_and_label(PREFS_AWAY, |
| 15230 | 340 | _("When my account is _away")); |
| 15884 | 341 | purple_plugin_pref_frame_add(frame, pref); |
| 15230 | 342 | |
| 15884 | 343 | pref = purple_plugin_pref_new_with_name_and_label(PREFS_IDLE, |
| 15230 | 344 | _("When my account is _idle")); |
| 15884 | 345 | purple_plugin_pref_frame_add(frame, pref); |
| 15230 | 346 | |
| 15884 | 347 | pref = purple_plugin_pref_new_with_name_and_label(PREFS_GLOBAL, |
| 15230 | 348 | _("_Default reply")); |
| 15884 | 349 | purple_plugin_pref_set_type(pref, PURPLE_PLUGIN_PREF_STRING_FORMAT); |
| 350 | purple_plugin_pref_set_format_type(pref, | |
| 351 | PURPLE_STRING_FORMAT_TYPE_MULTILINE | PURPLE_STRING_FORMAT_TYPE_HTML); | |
| 352 | purple_plugin_pref_frame_add(frame, pref); | |
| 15230 | 353 | |
| 15884 | 354 | pref = purple_plugin_pref_new_with_label(_("Status message")); |
| 355 | purple_plugin_pref_frame_add(frame, pref); | |
| 15230 | 356 | |
| 15884 | 357 | pref = purple_plugin_pref_new_with_name_and_label(PREFS_USESTATUS, |
| 15230 | 358 | _("Autoreply with status message")); |
| 15884 | 359 | purple_plugin_pref_set_type(pref, PURPLE_PLUGIN_PREF_CHOICE); |
| 360 | purple_plugin_pref_add_choice(pref, _("Never"), | |
| 15230 | 361 | GINT_TO_POINTER(STATUS_NEVER)); |
| 15884 | 362 | purple_plugin_pref_add_choice(pref, _("Always when there is a status message"), |
| 15230 | 363 | GINT_TO_POINTER(STATUS_ALWAYS)); |
| 15884 | 364 | purple_plugin_pref_add_choice(pref, _("Only when there's no autoreply message"), |
| 15230 | 365 | GINT_TO_POINTER(STATUS_FALLBACK)); |
| 366 | ||
| 15884 | 367 | purple_plugin_pref_frame_add(frame, pref); |
| 15230 | 368 | |
| 15884 | 369 | pref = purple_plugin_pref_new_with_label(_("Delay between autoreplies")); |
| 370 | purple_plugin_pref_frame_add(frame, pref); | |
| 15230 | 371 | |
| 15884 | 372 | pref = purple_plugin_pref_new_with_name_and_label(PREFS_MINTIME, |
| 15230 | 373 | _("_Minimum delay (mins)")); |
| 15884 | 374 | purple_plugin_pref_set_bounds(pref, 0, 9999); |
| 375 | purple_plugin_pref_frame_add(frame, pref); | |
| 15230 | 376 | |
| 15884 | 377 | pref = purple_plugin_pref_new_with_label(_("Times to send autoreplies")); |
| 378 | purple_plugin_pref_frame_add(frame, pref); | |
| 15230 | 379 | |
| 15884 | 380 | pref = purple_plugin_pref_new_with_name_and_label(PREFS_MAXSEND, |
| 15230 | 381 | _("Ma_ximum count")); |
| 15884 | 382 | purple_plugin_pref_set_bounds(pref, 0, 9999); |
| 383 | purple_plugin_pref_frame_add(frame, pref); | |
| 15230 | 384 | |
| 385 | return frame; | |
| 386 | } | |
| 387 | ||
| 15884 | 388 | static PurplePluginUiInfo prefs_info = { |
| 15230 | 389 | get_plugin_pref_frame, |
| 390 | 0, | |
| 391 | NULL | |
| 392 | }; | |
| 393 | ||
| 15884 | 394 | static PurplePluginInfo info = { |
| 395 | PURPLE_PLUGIN_MAGIC, /* Magic */ | |
| 396 | PURPLE_MAJOR_VERSION, /* Purple Major Version */ | |
| 397 | PURPLE_MINOR_VERSION, /* Purple Minor Version */ | |
| 398 | PURPLE_PLUGIN_STANDARD, /* plugin type */ | |
|
15418
bf287f742a5a
[gaim-migrate @ 18149]
Luke Schierer <lschiere@pidgin.im>
parents:
15230
diff
changeset
|
399 | NULL, /* ui requirement */ |
|
bf287f742a5a
[gaim-migrate @ 18149]
Luke Schierer <lschiere@pidgin.im>
parents:
15230
diff
changeset
|
400 | 0, /* flags */ |
|
bf287f742a5a
[gaim-migrate @ 18149]
Luke Schierer <lschiere@pidgin.im>
parents:
15230
diff
changeset
|
401 | NULL, /* dependencies */ |
| 15884 | 402 | PURPLE_PRIORITY_DEFAULT, /* priority */ |
| 15230 | 403 | |
|
15418
bf287f742a5a
[gaim-migrate @ 18149]
Luke Schierer <lschiere@pidgin.im>
parents:
15230
diff
changeset
|
404 | PLUGIN_ID, /* plugin id */ |
|
bf287f742a5a
[gaim-migrate @ 18149]
Luke Schierer <lschiere@pidgin.im>
parents:
15230
diff
changeset
|
405 | PLUGIN_NAME, /* name */ |
|
bf287f742a5a
[gaim-migrate @ 18149]
Luke Schierer <lschiere@pidgin.im>
parents:
15230
diff
changeset
|
406 | VERSION, /* version */ |
|
bf287f742a5a
[gaim-migrate @ 18149]
Luke Schierer <lschiere@pidgin.im>
parents:
15230
diff
changeset
|
407 | PLUGIN_SUMMARY, /* summary */ |
|
bf287f742a5a
[gaim-migrate @ 18149]
Luke Schierer <lschiere@pidgin.im>
parents:
15230
diff
changeset
|
408 | PLUGIN_DESCRIPTION, /* description */ |
| 15230 | 409 | PLUGIN_AUTHOR, /* author */ |
| 15884 | 410 | PURPLE_WEBSITE, /* website */ |
| 15230 | 411 | |
| 412 | plugin_load, /* load */ | |
| 413 | plugin_unload, /* unload */ | |
|
15418
bf287f742a5a
[gaim-migrate @ 18149]
Luke Schierer <lschiere@pidgin.im>
parents:
15230
diff
changeset
|
414 | NULL, /* destroy */ |
| 15230 | 415 | |
|
15418
bf287f742a5a
[gaim-migrate @ 18149]
Luke Schierer <lschiere@pidgin.im>
parents:
15230
diff
changeset
|
416 | NULL, /* ui_info */ |
|
bf287f742a5a
[gaim-migrate @ 18149]
Luke Schierer <lschiere@pidgin.im>
parents:
15230
diff
changeset
|
417 | NULL, /* extra_info */ |
| 15230 | 418 | &prefs_info, /* prefs_info */ |
|
15418
bf287f742a5a
[gaim-migrate @ 18149]
Luke Schierer <lschiere@pidgin.im>
parents:
15230
diff
changeset
|
419 | NULL /* actions */ |
| 15230 | 420 | }; |
| 421 | ||
| 422 | static void | |
| 15884 | 423 | init_plugin(PurplePlugin *plugin) |
| 15230 | 424 | { |
| 15884 | 425 | purple_prefs_add_none(PREFS_PREFIX); |
| 426 | purple_prefs_add_bool(PREFS_IDLE, TRUE); | |
| 427 | purple_prefs_add_bool(PREFS_AWAY, TRUE); | |
| 428 | purple_prefs_add_string(PREFS_GLOBAL, _("I am currently not available. Please leave your message, " | |
| 15230 | 429 | "and I will get back to you as soon as possible.")); |
| 15884 | 430 | purple_prefs_add_int(PREFS_MINTIME, 10); |
| 431 | purple_prefs_add_int(PREFS_MAXSEND, 10); | |
| 432 | purple_prefs_add_int(PREFS_USESTATUS, STATUS_NEVER); | |
| 15230 | 433 | } |
| 434 | ||
| 15884 | 435 | PURPLE_INIT_PLUGIN(PLUGIN_STATIC_NAME, init_plugin, info) |