Mercurial > pidgin.yaz
view plugins/autorecon.c @ 4898:bd37db7531e4
[gaim-migrate @ 5230]
I Nathan D. Walped the gaimrc file so that it writes a .gaimrc.save file
and then renames it to .gaimrc, in the hopes of avoiding the loss of this
data in a time that could be crucial to forward progress. Or something.
I tested it with and without specifying -f
I added a "Status: Not Available" (or whatever) string to ICQ tooltips.
This should help at least until we get some new icons. AHEM. And then
I dunno, I was planning on taking it out after that, but it could be
useful.
Also updated some comments and var names in oscar.c to keep things accurate,
because I'm one of those people that actually does that.
Go ask your Goddess if you've served her well
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Thu, 27 Mar 2003 21:41:21 +0000 |
parents | 3b8e6c2b4a50 |
children | fefad67de2c7 |
line wrap: on
line source
#include "config.h" #ifndef GAIM_PLUGINS #define GAIM_PLUGINS #endif #include "gaim.h" #include "prpl.h" #ifdef _WIN32 #include "win32dep.h" #endif G_MODULE_IMPORT GSList *gaim_accounts; #define INITIAL 8000 #define MAXTIME 2048000 static GHashTable *hash = NULL; static guint tim = 0; static gboolean do_signon(gpointer data) { struct gaim_account *account = data; debug_printf("do_signon called\n"); if (g_slist_index(gaim_accounts, account) < 0) return FALSE; debug_printf("calling serv_login\n"); serv_login(account); debug_printf("done calling serv_login\n"); tim = 0; return FALSE; } static void reconnect(struct gaim_connection *gc, void *m) { if (!gc->wants_to_die) { int del; del = (int)g_hash_table_lookup(hash, gc->account); if (!del) del = INITIAL; else del = MIN(2 * del, MAXTIME); tim = g_timeout_add(del, do_signon, gc->account); g_hash_table_insert(hash, gc->account, (gpointer)del); } else { g_hash_table_remove(hash, gc->account); } } /* * EXPORTED FUNCTIONS */ struct gaim_plugin_description desc; G_MODULE_EXPORT struct gaim_plugin_description *gaim_plugin_desc() { desc.api_version = PLUGIN_API_VERSION; desc.name = g_strdup(_("Autoreconnect")); desc.version = g_strdup(VERSION); desc.description = g_strdup(_("When you are kicked offline, this reconnects you.")); desc.authors = g_strdup("Eric Warmenhoven <eric@warmenhoven.org>"); desc.url = g_strdup(WEBSITE); return &desc; } G_MODULE_EXPORT char *name() { return _("Auto Reconnect"); } G_MODULE_EXPORT char *description() { return _("When you are kicked offline, this reconnects you."); } G_MODULE_EXPORT char *gaim_plugin_init(GModule *handle) { hash = g_hash_table_new(g_int_hash, g_int_equal); gaim_signal_connect(handle, event_signoff, reconnect, NULL); return NULL; } G_MODULE_EXPORT void gaim_plugin_remove() { if (tim) g_source_remove(tim); g_hash_table_destroy(hash); hash = NULL; tim = 0; }