Mercurial > pidgin.yaz
comparison plugins/autorecon.c @ 6485:70d5122bc3ff
[gaim-migrate @ 6999]
Removed the old event system and replaced it with a much better signal
system. There will most likely be some bugs in this, but it seems to be
working for now. Plugins can now generate their own signals, and other
plugins can find those plugins and connect to them. This could give
plugins a form of IPC. It's also useful for other things. It's rather
flexible, except for the damn marshalling, but there's no way around that
that I or the glib people can see.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Mon, 18 Aug 2003 01:03:43 +0000 |
parents | 8f94cce8faa5 |
children | cc1d09631513 |
comparison
equal
deleted
inserted
replaced
6484:5ced8e111473 | 6485:70d5122bc3ff |
---|---|
1 #include "internal.h" | 1 #include "internal.h" |
2 | 2 |
3 #include "connection.h" | 3 #include "connection.h" |
4 #include "debug.h" | 4 #include "debug.h" |
5 #include "prpl.h" | 5 #include "prpl.h" |
6 #include "signals.h" | |
6 | 7 |
7 #define AUTORECON_PLUGIN_ID "core-autorecon" | 8 #define AUTORECON_PLUGIN_ID "core-autorecon" |
8 | 9 |
9 #define INITIAL 8000 | 10 #define INITIAL 8000 |
10 #define MAXTIME 2048000 | 11 #define MAXTIME 2048000 |
70 } | 71 } |
71 | 72 |
72 static gboolean | 73 static gboolean |
73 plugin_load(GaimPlugin *plugin) | 74 plugin_load(GaimPlugin *plugin) |
74 { | 75 { |
75 hash = g_hash_table_new_full(g_int_hash, g_int_equal, NULL, free_auto_recon); | 76 hash = g_hash_table_new_full(g_int_hash, g_int_equal, NULL, |
77 free_auto_recon); | |
76 | 78 |
77 gaim_signal_connect(plugin, event_signoff, reconnect, NULL); | 79 gaim_signal_connect(gaim_connections_get_handle(), "signed-off", |
80 plugin, GAIM_CALLBACK(reconnect), NULL); | |
78 | 81 |
79 return TRUE; | 82 return TRUE; |
80 } | 83 } |
81 | 84 |
82 static gboolean | 85 static gboolean |
83 plugin_unload(GaimPlugin *plugin) | 86 plugin_unload(GaimPlugin *plugin) |
84 { | 87 { |
85 gaim_signal_disconnect(plugin, event_signoff, reconnect); | |
86 | |
87 g_hash_table_destroy(hash); | 88 g_hash_table_destroy(hash); |
88 hash = NULL; | 89 hash = NULL; |
89 | 90 |
90 return TRUE; | 91 return TRUE; |
91 } | 92 } |
101 | 102 |
102 AUTORECON_PLUGIN_ID, /**< id */ | 103 AUTORECON_PLUGIN_ID, /**< id */ |
103 N_("Auto-Reconnect"), /**< name */ | 104 N_("Auto-Reconnect"), /**< name */ |
104 VERSION, /**< version */ | 105 VERSION, /**< version */ |
105 /** summary */ | 106 /** summary */ |
106 N_("When you are kicked offline, this reconnects you."), | 107 N_("When you are kicked offline, this reconnects you."), |
107 /** description */ | 108 /** description */ |
108 N_("When you are kicked offline, this reconnects you."), | 109 N_("When you are kicked offline, this reconnects you."), |
109 "Eric Warmenhoven <eric@warmenhoven.org>", /**< author */ | 110 "Eric Warmenhoven <eric@warmenhoven.org>", /**< author */ |
110 GAIM_WEBSITE, /**< homepage */ | 111 GAIM_WEBSITE, /**< homepage */ |
111 | 112 |
112 plugin_load, /**< load */ | 113 plugin_load, /**< load */ |
113 plugin_unload, /**< unload */ | 114 plugin_unload, /**< unload */ |
114 NULL, /**< destroy */ | 115 NULL, /**< destroy */ |
115 | 116 |