15 #define MAXTIME 1024000
17 static GHashTable
*hash
= NULL
;
21 static gboolean
do_signon(gpointer data
) {
22 struct aim_user
*u
= data
;
23 if (g_slist_index(aim_users
, u
) < 0)
30 static void reconnect(struct gaim_connection
*gc
, void *m
) {
31 if (!gc
->wants_to_die
) {
33 del
= (int)g_hash_table_lookup(hash
, gc
->user
);
37 del
= MAX(2 * del
, MAXTIME
);
38 tim
= g_timeout_add(del
, do_signon
, gc
->user
);
39 g_hash_table_insert(hash
, gc
->user
, (gpointer
)del
);
41 g_hash_table_remove(hash
, gc
->user
);
49 struct gaim_plugin_description desc
;
50 G_MODULE_EXPORT
struct gaim_plugin_description
*gaim_plugin_desc() {
51 desc
.api_version
= PLUGIN_API_VERSION
;
52 desc
.name
= g_strdup("Autoreconnect");
53 desc
.version
= g_strdup(VERSION
);
54 desc
.description
= g_strdup(_("When you are kicked offline, this reconnects you."));
55 desc
.authors
= g_strdup("Eric Warmenhoven <eric@warmenhoven.org>");
56 desc
.url
= g_strdup(WEBSITE
);
60 G_MODULE_EXPORT
char *name() {
61 return _("Auto Reconnect");
64 G_MODULE_EXPORT
char *description() {
65 return _("When you are kicked offline, this reconnects you.");
68 G_MODULE_EXPORT
char *gaim_plugin_init(GModule
*handle
) {
69 hash
= g_hash_table_new(g_int_hash
, g_int_equal
);
71 gaim_signal_connect(handle
, event_signoff
, reconnect
, NULL
);
76 G_MODULE_EXPORT
void gaim_plugin_remove() {
79 g_hash_table_destroy(hash
);