Sun, 17 Oct 2004 23:55:49 +0000
[gaim-migrate @ 11141]
Two things:
a. Added Enter as a gtk_binding to GtkIMHtml. This fixes everything.
Input methods now work. The "Enter sends" and "Ctrl-Enter sends" preferences
were removed and defaulted to yes and no respectively, BUT, in a very super-cool
turn of events, you can now add your own bindings to .gtkrc to make WHATEVER
YOU WANT send. Awesome. Someone should use g_signal_accumulator_true_handled
or something to make profiles and away messages able to insert newlines.
b. Removed "Use multi-colored screennames in chats," defaulted to yes, and
wrote a nifty algorithm to automatically adjust the colors to accomodate the
background (see http://gaim.sf.net/sean/porn-chat.png). People should play
around and tweak it a bit. The algorithm takes into consideration the
luminosity of the current background and the base hue to use for the screenname
in generating the new colors. Note that it does this while maintaining the hues.
Someone should optimize this so it skips over the floating point arithmatic when
the background color is white.
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5607
diff
changeset
|
1 | #include "internal.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5607
diff
changeset
|
2 | |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5607
diff
changeset
|
3 | #include "connection.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5607
diff
changeset
|
4 | #include "debug.h" |
| 8774 | 5 | #include "pluginpref.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5607
diff
changeset
|
6 | #include "prpl.h" |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
7 | #include "signals.h" |
| 9943 | 8 | #include "version.h" |
|
4202
8b92de3b1c07
[gaim-migrate @ 4438]
Christian Hammond <chipx86@chipx86.com>
parents:
4113
diff
changeset
|
9 | |
| 8774 | 10 | |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4590
diff
changeset
|
11 | #define AUTORECON_PLUGIN_ID "core-autorecon" |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4590
diff
changeset
|
12 | |
|
2216
ae70f10e0d27
[gaim-migrate @ 2226]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1818
diff
changeset
|
13 | #define INITIAL 8000 |
| 4590 | 14 | #define MAXTIME 2048000 |
|
2216
ae70f10e0d27
[gaim-migrate @ 2226]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1818
diff
changeset
|
15 | |
|
6113
5bc7394e69ea
[gaim-migrate @ 6575]
Mark Doliner <markdoliner@pidgin.im>
parents:
6063
diff
changeset
|
16 | typedef struct { |
|
5bc7394e69ea
[gaim-migrate @ 6575]
Mark Doliner <markdoliner@pidgin.im>
parents:
6063
diff
changeset
|
17 | int delay; |
|
5bc7394e69ea
[gaim-migrate @ 6575]
Mark Doliner <markdoliner@pidgin.im>
parents:
6063
diff
changeset
|
18 | guint timeout; |
|
5bc7394e69ea
[gaim-migrate @ 6575]
Mark Doliner <markdoliner@pidgin.im>
parents:
6063
diff
changeset
|
19 | } GaimAutoRecon; |
|
2216
ae70f10e0d27
[gaim-migrate @ 2226]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1818
diff
changeset
|
20 | |
|
6113
5bc7394e69ea
[gaim-migrate @ 6575]
Mark Doliner <markdoliner@pidgin.im>
parents:
6063
diff
changeset
|
21 | static GHashTable *hash = NULL; |
| 8774 | 22 | |
| 10020 | 23 | static GSList *accountReconnecting = NULL; |
| 24 | ||
| 8774 | 25 | #define AUTORECON_OPT "/plugins/core/autorecon" |
| 10020 | 26 | #define OPT_HIDE_CONNECTED AUTORECON_OPT "/hide_connected_error" |
| 27 | #define OPT_HIDE_CONNECTING AUTORECON_OPT "/hide_connecting_error" | |
| 28 | #define OPT_RESTORE_STATE AUTORECON_OPT "/restore_state" | |
| 29 | #define OPT_HIDE_RECONNECTING_DIALOG AUTORECON_OPT "/hide_reconnecting_dialog" | |
| 8774 | 30 | |
| 31 | /* storage of original (old_ops) and modified (new_ops) ui ops to allow us to | |
| 32 | intercept calls to report_disconnect */ | |
| 33 | static GaimConnectionUiOps *old_ops = NULL; | |
| 34 | static GaimConnectionUiOps *new_ops = NULL; | |
| 35 | ||
| 10020 | 36 | static void connect_progress(GaimConnection *gc, const char *text, |
| 37 | size_t step, size_t step_count) { | |
| 38 | if(old_ops == NULL || old_ops->connect_progress == NULL) { | |
| 39 | /* there's nothing to call through to, so don't bother | |
| 40 | checking prefs */ | |
| 41 | return; | |
| 42 | } else if(gaim_prefs_get_bool(OPT_HIDE_RECONNECTING_DIALOG) && accountReconnecting && | |
| 43 | g_slist_find(accountReconnecting, gc->account)) { | |
| 44 | /* this is a reconnecting, and we're hiding those */ | |
| 45 | gaim_debug(GAIM_DEBUG_INFO, "autorecon", | |
| 46 | "hide connecting dialog while reconnecting\n"); | |
| 47 | return; | |
| 48 | } | |
| 49 | ||
| 50 | old_ops->connect_progress(gc, text, step, step_count); | |
| 51 | } | |
| 52 | ||
| 53 | static void connected(GaimConnection *gc) { | |
| 54 | if(old_ops == NULL || old_ops->connected == NULL) { | |
| 55 | /* there's nothing to call through to, so don't bother | |
| 56 | checking prefs */ | |
| 57 | return; | |
| 58 | } else if(gaim_prefs_get_bool(OPT_HIDE_RECONNECTING_DIALOG) && accountReconnecting && | |
| 59 | g_slist_find(accountReconnecting, gc->account)) { | |
| 60 | /* this is a reconnecting, and we're hiding those */ | |
| 61 | gaim_debug(GAIM_DEBUG_INFO, "autorecon", | |
| 62 | "hide connecting dialog while reconnecting\n"); | |
| 63 | return; | |
| 64 | } | |
| 65 | ||
| 66 | old_ops->connected(gc); | |
| 67 | } | |
| 68 | ||
| 69 | static void disconnected(GaimConnection *gc) { | |
| 70 | if(old_ops == NULL || old_ops->disconnected == NULL) { | |
| 71 | /* there's nothing to call through to, so don't bother | |
| 72 | checking prefs */ | |
| 73 | return; | |
| 74 | } else if(gaim_prefs_get_bool(OPT_HIDE_RECONNECTING_DIALOG) && accountReconnecting && | |
| 75 | g_slist_find(accountReconnecting, gc->account)) { | |
| 76 | /* this is a reconnecting, and we're hiding those */ | |
| 77 | gaim_debug(GAIM_DEBUG_INFO, "autorecon", | |
| 78 | "hide connecting dialog while reconnecting\n"); | |
| 79 | return; | |
| 80 | } | |
| 81 | ||
| 82 | old_ops->disconnected(gc); | |
| 83 | } | |
| 84 | ||
| 85 | static void notice(GaimConnection *gc, const char *text) { | |
| 86 | if(old_ops == NULL || old_ops->notice == NULL) { | |
| 87 | /* there's nothing to call through to, so don't bother | |
| 88 | checking prefs */ | |
| 89 | return; | |
| 90 | } else if(gaim_prefs_get_bool(OPT_HIDE_RECONNECTING_DIALOG) && accountReconnecting && | |
| 91 | g_slist_find(accountReconnecting, gc->account)) { | |
| 92 | /* this is a reconnecting, and we're hiding those */ | |
| 93 | gaim_debug(GAIM_DEBUG_INFO, "autorecon", | |
| 94 | "hide connecting dialog while reconnecting\n"); | |
| 95 | } | |
| 96 | ||
| 97 | old_ops->notice(gc, text); | |
| 98 | } | |
| 8774 | 99 | |
| 100 | static void report_disconnect(GaimConnection *gc, const char *text) { | |
| 101 | ||
| 102 | if(old_ops == NULL || old_ops->report_disconnect == NULL) { | |
| 103 | /* there's nothing to call through to, so don't bother | |
| 104 | checking prefs */ | |
| 105 | return; | |
| 106 | ||
| 107 | } else if(gc->state == GAIM_CONNECTED | |
| 108 | && gaim_prefs_get_bool(OPT_HIDE_CONNECTED)) { | |
| 109 | /* this is a connected error, and we're hiding those */ | |
| 110 | gaim_debug(GAIM_DEBUG_INFO, "autorecon", | |
| 111 | "hid disconnect error message\n"); | |
| 112 | return; | |
| 113 | ||
| 114 | } else if(gc->state == GAIM_CONNECTING | |
| 115 | && gaim_prefs_get_bool(OPT_HIDE_CONNECTING)) { | |
| 116 | /* this is a connecting error, and we're hiding those */ | |
| 117 | gaim_debug(GAIM_DEBUG_INFO, "autorecon", | |
| 118 | "hid error message while connecting\n"); | |
| 119 | return; | |
| 120 | } | |
| 121 | ||
| 122 | /* if we haven't returned by now, then let's pass to the real | |
| 123 | function */ | |
| 124 | old_ops->report_disconnect(gc, text); | |
| 125 | } | |
| 126 | ||
| 127 | ||
|
2216
ae70f10e0d27
[gaim-migrate @ 2226]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1818
diff
changeset
|
128 | static gboolean do_signon(gpointer data) { |
|
5587
22cb9fe4798a
[gaim-migrate @ 5991]
Christian Hammond <chipx86@chipx86.com>
parents:
5227
diff
changeset
|
129 | GaimAccount *account = data; |
|
6113
5bc7394e69ea
[gaim-migrate @ 6575]
Mark Doliner <markdoliner@pidgin.im>
parents:
6063
diff
changeset
|
130 | GaimAutoRecon *info; |
|
5bc7394e69ea
[gaim-migrate @ 6575]
Mark Doliner <markdoliner@pidgin.im>
parents:
6063
diff
changeset
|
131 | |
|
5227
6b44f7901f94
[gaim-migrate @ 5597]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
132 | gaim_debug(GAIM_DEBUG_INFO, "autorecon", "do_signon called\n"); |
|
6113
5bc7394e69ea
[gaim-migrate @ 6575]
Mark Doliner <markdoliner@pidgin.im>
parents:
6063
diff
changeset
|
133 | g_return_val_if_fail(account != NULL, FALSE); |
|
5bc7394e69ea
[gaim-migrate @ 6575]
Mark Doliner <markdoliner@pidgin.im>
parents:
6063
diff
changeset
|
134 | info = g_hash_table_lookup(hash, account); |
|
4494
c170d1ed7fde
[gaim-migrate @ 4769]
Herman Bloggs <herman@bluedigits.com>
parents:
4491
diff
changeset
|
135 | |
| 5607 | 136 | if (g_list_index(gaim_accounts_get_all(), account) < 0) |
|
1817
67ad2e2348a2
[gaim-migrate @ 1827]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1404
diff
changeset
|
137 | return FALSE; |
|
6113
5bc7394e69ea
[gaim-migrate @ 6575]
Mark Doliner <markdoliner@pidgin.im>
parents:
6063
diff
changeset
|
138 | |
| 7372 | 139 | if(info) |
| 140 | info->timeout = 0; | |
| 141 | ||
|
5587
22cb9fe4798a
[gaim-migrate @ 5991]
Christian Hammond <chipx86@chipx86.com>
parents:
5227
diff
changeset
|
142 | gaim_debug(GAIM_DEBUG_INFO, "autorecon", "calling gaim_account_connect\n"); |
|
22cb9fe4798a
[gaim-migrate @ 5991]
Christian Hammond <chipx86@chipx86.com>
parents:
5227
diff
changeset
|
143 | gaim_account_connect(account); |
|
22cb9fe4798a
[gaim-migrate @ 5991]
Christian Hammond <chipx86@chipx86.com>
parents:
5227
diff
changeset
|
144 | gaim_debug(GAIM_DEBUG_INFO, "autorecon", "done calling gaim_account_connect\n"); |
|
6113
5bc7394e69ea
[gaim-migrate @ 6575]
Mark Doliner <markdoliner@pidgin.im>
parents:
6063
diff
changeset
|
145 | |
|
1817
67ad2e2348a2
[gaim-migrate @ 1827]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1404
diff
changeset
|
146 | return FALSE; |
|
1378
49578635eddb
[gaim-migrate @ 1388]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1165
diff
changeset
|
147 | } |
|
49578635eddb
[gaim-migrate @ 1388]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1165
diff
changeset
|
148 | |
| 8774 | 149 | |
|
5587
22cb9fe4798a
[gaim-migrate @ 5991]
Christian Hammond <chipx86@chipx86.com>
parents:
5227
diff
changeset
|
150 | static void reconnect(GaimConnection *gc, void *m) { |
|
6113
5bc7394e69ea
[gaim-migrate @ 6575]
Mark Doliner <markdoliner@pidgin.im>
parents:
6063
diff
changeset
|
151 | GaimAccount *account; |
|
5bc7394e69ea
[gaim-migrate @ 6575]
Mark Doliner <markdoliner@pidgin.im>
parents:
6063
diff
changeset
|
152 | GaimAutoRecon *info; |
| 10020 | 153 | GSList* listAccount; |
|
6113
5bc7394e69ea
[gaim-migrate @ 6575]
Mark Doliner <markdoliner@pidgin.im>
parents:
6063
diff
changeset
|
154 | |
|
5bc7394e69ea
[gaim-migrate @ 6575]
Mark Doliner <markdoliner@pidgin.im>
parents:
6063
diff
changeset
|
155 | g_return_if_fail(gc != NULL); |
|
5bc7394e69ea
[gaim-migrate @ 6575]
Mark Doliner <markdoliner@pidgin.im>
parents:
6063
diff
changeset
|
156 | account = gaim_connection_get_account(gc); |
|
5bc7394e69ea
[gaim-migrate @ 6575]
Mark Doliner <markdoliner@pidgin.im>
parents:
6063
diff
changeset
|
157 | info = g_hash_table_lookup(hash, account); |
| 10020 | 158 | if (accountReconnecting) |
| 159 | listAccount = g_slist_find(accountReconnecting, account); | |
| 160 | else | |
| 161 | listAccount = NULL; | |
|
6113
5bc7394e69ea
[gaim-migrate @ 6575]
Mark Doliner <markdoliner@pidgin.im>
parents:
6063
diff
changeset
|
162 | |
|
2216
ae70f10e0d27
[gaim-migrate @ 2226]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1818
diff
changeset
|
163 | if (!gc->wants_to_die) { |
|
6113
5bc7394e69ea
[gaim-migrate @ 6575]
Mark Doliner <markdoliner@pidgin.im>
parents:
6063
diff
changeset
|
164 | if (info == NULL) { |
|
5bc7394e69ea
[gaim-migrate @ 6575]
Mark Doliner <markdoliner@pidgin.im>
parents:
6063
diff
changeset
|
165 | info = g_new0(GaimAutoRecon, 1); |
|
5bc7394e69ea
[gaim-migrate @ 6575]
Mark Doliner <markdoliner@pidgin.im>
parents:
6063
diff
changeset
|
166 | g_hash_table_insert(hash, account, info); |
|
5bc7394e69ea
[gaim-migrate @ 6575]
Mark Doliner <markdoliner@pidgin.im>
parents:
6063
diff
changeset
|
167 | info->delay = INITIAL; |
|
8249
b6223529f267
[gaim-migrate @ 8972]
Mark Doliner <markdoliner@pidgin.im>
parents:
8246
diff
changeset
|
168 | } else { |
|
6113
5bc7394e69ea
[gaim-migrate @ 6575]
Mark Doliner <markdoliner@pidgin.im>
parents:
6063
diff
changeset
|
169 | info->delay = MIN(2 * info->delay, MAXTIME); |
|
8250
e855dcce1fa0
[gaim-migrate @ 8973]
Mark Doliner <markdoliner@pidgin.im>
parents:
8249
diff
changeset
|
170 | if (info->timeout != 0) |
|
e855dcce1fa0
[gaim-migrate @ 8973]
Mark Doliner <markdoliner@pidgin.im>
parents:
8249
diff
changeset
|
171 | g_source_remove(info->timeout); |
|
8249
b6223529f267
[gaim-migrate @ 8972]
Mark Doliner <markdoliner@pidgin.im>
parents:
8246
diff
changeset
|
172 | } |
|
6113
5bc7394e69ea
[gaim-migrate @ 6575]
Mark Doliner <markdoliner@pidgin.im>
parents:
6063
diff
changeset
|
173 | info->timeout = g_timeout_add(info->delay, do_signon, account); |
| 10020 | 174 | |
| 175 | if (!listAccount) | |
| 176 | accountReconnecting = g_slist_prepend(accountReconnecting, account); | |
|
6113
5bc7394e69ea
[gaim-migrate @ 6575]
Mark Doliner <markdoliner@pidgin.im>
parents:
6063
diff
changeset
|
177 | } else if (info != NULL) { |
|
5bc7394e69ea
[gaim-migrate @ 6575]
Mark Doliner <markdoliner@pidgin.im>
parents:
6063
diff
changeset
|
178 | g_hash_table_remove(hash, account); |
| 10020 | 179 | |
| 180 | if (listAccount) | |
| 181 | accountReconnecting = g_slist_delete_link(accountReconnecting, listAccount); | |
|
2216
ae70f10e0d27
[gaim-migrate @ 2226]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1818
diff
changeset
|
182 | } |
| 9546 | 183 | } |
| 8774 | 184 | |
|
6113
5bc7394e69ea
[gaim-migrate @ 6575]
Mark Doliner <markdoliner@pidgin.im>
parents:
6063
diff
changeset
|
185 | static void |
| 10020 | 186 | reconnected(GaimConnection *gc, void *m) { |
| 187 | GaimAccount *account; | |
| 188 | ||
| 189 | g_return_if_fail(gc != NULL && accountReconnecting != NULL); | |
| 190 | account = gaim_connection_get_account(gc); | |
| 191 | ||
| 192 | accountReconnecting = g_slist_remove(accountReconnecting, account); | |
| 193 | } | |
| 194 | ||
| 195 | static void | |
|
6113
5bc7394e69ea
[gaim-migrate @ 6575]
Mark Doliner <markdoliner@pidgin.im>
parents:
6063
diff
changeset
|
196 | free_auto_recon(gpointer data) |
|
5bc7394e69ea
[gaim-migrate @ 6575]
Mark Doliner <markdoliner@pidgin.im>
parents:
6063
diff
changeset
|
197 | { |
|
5bc7394e69ea
[gaim-migrate @ 6575]
Mark Doliner <markdoliner@pidgin.im>
parents:
6063
diff
changeset
|
198 | GaimAutoRecon *info = data; |
|
5bc7394e69ea
[gaim-migrate @ 6575]
Mark Doliner <markdoliner@pidgin.im>
parents:
6063
diff
changeset
|
199 | |
|
5bc7394e69ea
[gaim-migrate @ 6575]
Mark Doliner <markdoliner@pidgin.im>
parents:
6063
diff
changeset
|
200 | if (info->timeout != 0) |
|
5bc7394e69ea
[gaim-migrate @ 6575]
Mark Doliner <markdoliner@pidgin.im>
parents:
6063
diff
changeset
|
201 | g_source_remove(info->timeout); |
|
5bc7394e69ea
[gaim-migrate @ 6575]
Mark Doliner <markdoliner@pidgin.im>
parents:
6063
diff
changeset
|
202 | |
|
5bc7394e69ea
[gaim-migrate @ 6575]
Mark Doliner <markdoliner@pidgin.im>
parents:
6063
diff
changeset
|
203 | g_free(info); |
|
5bc7394e69ea
[gaim-migrate @ 6575]
Mark Doliner <markdoliner@pidgin.im>
parents:
6063
diff
changeset
|
204 | } |
|
5bc7394e69ea
[gaim-migrate @ 6575]
Mark Doliner <markdoliner@pidgin.im>
parents:
6063
diff
changeset
|
205 | |
| 8774 | 206 | |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4590
diff
changeset
|
207 | static gboolean |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4590
diff
changeset
|
208 | plugin_load(GaimPlugin *plugin) |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4590
diff
changeset
|
209 | { |
| 8774 | 210 | |
| 211 | /* this was the suggested way to override a single function of the | |
| 212 | real ui ops. However, there's a mild concern of having more than one | |
| 213 | bit of code making a new ui op call-through copy. If plugins A and B | |
| 214 | both override the ui ops (in that order), B thinks that the | |
| 215 | overridden ui ops A created was the original. If A unloads first, | |
| 216 | and swaps out and frees its overridden version, then B is calling | |
| 217 | through to a free'd ui op. There needs to be a way to "stack up" | |
| 218 | overridden ui ops or something... I have a good idea of how to write | |
| 219 | such a creature if someone wants it done. - siege 2004-04-20 */ | |
| 220 | ||
| 221 | /* get old ops, make a copy with a minor change */ | |
| 222 | old_ops = gaim_connections_get_ui_ops(); | |
| 223 | new_ops = (GaimConnectionUiOps *) g_memdup(old_ops, | |
| 224 | sizeof(GaimConnectionUiOps)); | |
| 10020 | 225 | new_ops->connect_progress = connect_progress; |
| 226 | new_ops->connected = connected; | |
| 227 | new_ops->disconnected = disconnected; | |
| 228 | new_ops->notice = notice; | |
| 8774 | 229 | new_ops->report_disconnect = report_disconnect; |
| 230 | gaim_connections_set_ui_ops(new_ops); | |
| 231 | ||
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
232 | hash = g_hash_table_new_full(g_int_hash, g_int_equal, NULL, |
| 8774 | 233 | free_auto_recon); |
| 10020 | 234 | |
| 235 | accountReconnecting = NULL; | |
| 3630 | 236 | |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
237 | gaim_signal_connect(gaim_connections_get_handle(), "signed-off", |
| 8774 | 238 | plugin, GAIM_CALLBACK(reconnect), NULL); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4590
diff
changeset
|
239 | |
| 10020 | 240 | gaim_signal_connect(gaim_connections_get_handle(), "signed-on", |
| 241 | plugin, GAIM_CALLBACK(reconnected), NULL); | |
| 242 | ||
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4590
diff
changeset
|
243 | return TRUE; |
| 3802 | 244 | } |
| 245 | ||
| 8774 | 246 | |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4590
diff
changeset
|
247 | static gboolean |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4590
diff
changeset
|
248 | plugin_unload(GaimPlugin *plugin) |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4590
diff
changeset
|
249 | { |
| 8243 | 250 | gaim_signal_disconnect(gaim_connections_get_handle(), "signed-off", |
| 251 | plugin, GAIM_CALLBACK(reconnect)); | |
| 9546 | 252 | |
| 10020 | 253 | gaim_signal_disconnect(gaim_connections_get_handle(), "signed-on", |
| 254 | plugin, GAIM_CALLBACK(reconnected)); | |
| 255 | ||
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4590
diff
changeset
|
256 | g_hash_table_destroy(hash); |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4590
diff
changeset
|
257 | hash = NULL; |
| 10020 | 258 | |
| 259 | if (accountReconnecting) { | |
| 260 | g_slist_free(accountReconnecting); | |
| 261 | accountReconnecting = NULL; | |
| 262 | } | |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4590
diff
changeset
|
263 | |
| 8774 | 264 | gaim_connections_set_ui_ops(old_ops); |
| 265 | g_free(new_ops); | |
| 266 | old_ops = new_ops = NULL; | |
| 267 | ||
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4590
diff
changeset
|
268 | return TRUE; |
| 3630 | 269 | } |
| 270 | ||
| 8774 | 271 | |
| 272 | static GaimPluginPrefFrame *get_plugin_pref_frame(GaimPlugin *plugin) { | |
| 273 | GaimPluginPrefFrame *frame = gaim_plugin_pref_frame_new(); | |
| 274 | GaimPluginPref *pref; | |
| 275 | ||
| 276 | pref = gaim_plugin_pref_new_with_label(_("Error Message Suppression")); | |
|
9549
19c5469f9a3e
[gaim-migrate @ 10378]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9546
diff
changeset
|
277 | gaim_plugin_pref_frame_add(frame, pref); |
| 8774 | 278 | |
| 279 | pref = gaim_plugin_pref_new_with_name_and_label(OPT_HIDE_CONNECTED, | |
| 280 | _("Hide Disconnect Errors")); | |
| 281 | gaim_plugin_pref_frame_add(frame, pref); | |
| 282 | ||
| 283 | pref = gaim_plugin_pref_new_with_name_and_label(OPT_HIDE_CONNECTING, | |
| 284 | _("Hide Login Errors")); | |
| 285 | gaim_plugin_pref_frame_add(frame, pref); | |
| 286 | ||
| 10020 | 287 | pref = gaim_plugin_pref_new_with_name_and_label(OPT_HIDE_RECONNECTING_DIALOG, |
| 288 | _("Hide Reconnecting Dialog")); | |
| 289 | gaim_plugin_pref_frame_add(frame, pref); | |
| 290 | ||
| 8774 | 291 | return frame; |
| 292 | } | |
| 293 | ||
| 294 | ||
| 295 | static GaimPluginUiInfo pref_info = { | |
| 296 | get_plugin_pref_frame | |
| 297 | }; | |
| 298 | ||
| 299 | ||
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4590
diff
changeset
|
300 | static GaimPluginInfo info = |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4590
diff
changeset
|
301 | { |
| 9943 | 302 | GAIM_PLUGIN_MAGIC, |
| 303 | GAIM_MAJOR_VERSION, | |
| 304 | GAIM_MINOR_VERSION, | |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4590
diff
changeset
|
305 | GAIM_PLUGIN_STANDARD, /**< type */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4590
diff
changeset
|
306 | NULL, /**< ui_requirement */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4590
diff
changeset
|
307 | 0, /**< flags */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4590
diff
changeset
|
308 | NULL, /**< dependencies */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4590
diff
changeset
|
309 | GAIM_PRIORITY_DEFAULT, /**< priority */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4590
diff
changeset
|
310 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4590
diff
changeset
|
311 | AUTORECON_PLUGIN_ID, /**< id */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4590
diff
changeset
|
312 | N_("Auto-Reconnect"), /**< name */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4590
diff
changeset
|
313 | VERSION, /**< version */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4590
diff
changeset
|
314 | /** summary */ |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
315 | N_("When you are kicked offline, this reconnects you."), |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4590
diff
changeset
|
316 | /** description */ |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
317 | N_("When you are kicked offline, this reconnects you."), |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4590
diff
changeset
|
318 | "Eric Warmenhoven <eric@warmenhoven.org>", /**< author */ |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
319 | GAIM_WEBSITE, /**< homepage */ |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4590
diff
changeset
|
320 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4590
diff
changeset
|
321 | plugin_load, /**< load */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4590
diff
changeset
|
322 | plugin_unload, /**< unload */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4590
diff
changeset
|
323 | NULL, /**< destroy */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4590
diff
changeset
|
324 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4590
diff
changeset
|
325 | NULL, /**< ui_info */ |
| 8774 | 326 | NULL, /**< extra_info */ |
| 8993 | 327 | &pref_info, /**< prefs_info */ |
| 328 | NULL | |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4590
diff
changeset
|
329 | }; |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4590
diff
changeset
|
330 | |
| 8774 | 331 | |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4590
diff
changeset
|
332 | static void |
|
5920
963bfdefee02
[gaim-migrate @ 6360]
Christian Hammond <chipx86@chipx86.com>
parents:
5873
diff
changeset
|
333 | init_plugin(GaimPlugin *plugin) |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
4590
diff
changeset
|
334 | { |
| 8774 | 335 | gaim_prefs_add_none(AUTORECON_OPT); |
| 336 | gaim_prefs_add_bool(OPT_HIDE_CONNECTED, FALSE); | |
| 337 | gaim_prefs_add_bool(OPT_HIDE_CONNECTING, FALSE); | |
| 10020 | 338 | gaim_prefs_add_bool(OPT_HIDE_RECONNECTING_DIALOG, FALSE); |
|
9971
8291bafb0025
[gaim-migrate @ 10882]
Daniel Atallah <datallah@pidgin.im>
parents:
9961
diff
changeset
|
339 | gaim_prefs_remove(OPT_RESTORE_STATE); |
| 3630 | 340 | } |
| 341 | ||
| 6063 | 342 | GAIM_INIT_PLUGIN(autorecon, init_plugin, info) |
| 8774 | 343 |