Mercurial > pidgin
comparison plugins/autorecon.c @ 9549:d80ed3ba45a4
[gaim-migrate @ 10378]
(10:52:04) nosnilmot: LSchiere:
http://nosnilmot.com/patches/gaim-0.81cvs-autorecon-whitespace-and-commentfix.patch
(10:52:17) LSchiere: lol, okay. i was just starting on that
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Fri, 16 Jul 2004 14:52:52 +0000 |
parents | ebbe4390f75b |
children | 14c1ffd053e5 |
comparison
equal
deleted
inserted
replaced
9548:563137069d3d | 9549:d80ed3ba45a4 |
---|---|
17 guint timeout; | 17 guint timeout; |
18 } GaimAutoRecon; | 18 } GaimAutoRecon; |
19 | 19 |
20 /* | 20 /* |
21 I use a struct here, but the visible/invisible isn't yet supported | 21 I use a struct here, but the visible/invisible isn't yet supported |
22 in this plugin, so this is more for future implementation of those | 22 in this plugin, so this is more for future implementation of those |
23 features | 23 features |
24 */ | 24 */ |
25 typedef struct { | 25 typedef struct { |
26 const char *state; | 26 const char *state; |
27 const char *message; | 27 const char *message; |
28 } GaimAwayState; | 28 } GaimAwayState; |
119 if (gc->wants_to_die) | 119 if (gc->wants_to_die) |
120 g_hash_table_remove(awayStates, account); | 120 g_hash_table_remove(awayStates, account); |
121 } | 121 } |
122 | 122 |
123 static void save_state(GaimAccount *account, const char *state, const char *message) { | 123 static void save_state(GaimAccount *account, const char *state, const char *message) { |
124 //Saves whether the account is back/away/visible/invisible | 124 /* Saves whether the account is back/away/visible/invisible */ |
125 | 125 |
126 GaimAwayState *info; | 126 GaimAwayState *info; |
127 | 127 |
128 if (!strcmp(state,GAIM_AWAY_CUSTOM)) { | 128 if (!strcmp(state,GAIM_AWAY_CUSTOM)) { |
129 info = g_new0(GaimAwayState, 1); | 129 info = g_new0(GaimAwayState, 1); |
130 info->state = state; | 130 info->state = state; |
131 info->message = message; | 131 info->message = message; |
132 | 132 |
133 g_hash_table_insert(awayStates, account, info); | 133 g_hash_table_insert(awayStates, account, info); |
134 } else if(!strcmp(state,"Back")) | 134 } else if(!strcmp(state,"Back")) |
135 g_hash_table_remove(awayStates, account); | 135 g_hash_table_remove(awayStates, account); |
136 } | 136 } |
137 | 137 |
138 static void restore_state(GaimConnection *gc, void *m) { | 138 static void restore_state(GaimConnection *gc, void *m) { |
139 //Restore the state to what it was before the disconnect | 139 /* Restore the state to what it was before the disconnect */ |
140 GaimAwayState *info; | 140 GaimAwayState *info; |
141 GaimAccount *account; | 141 GaimAccount *account; |
142 | 142 |
143 g_return_if_fail(gc != NULL && gaim_prefs_get_bool(OPT_RESTORE_STATE)); | 143 g_return_if_fail(gc != NULL && gaim_prefs_get_bool(OPT_RESTORE_STATE)); |
144 account = gaim_connection_get_account(gc); | 144 account = gaim_connection_get_account(gc); |
145 | 145 |
146 info = g_hash_table_lookup(awayStates, account); | 146 info = g_hash_table_lookup(awayStates, account); |
147 if (info) | 147 if (info) |
148 serv_set_away(gc, info->state, info->message); | 148 serv_set_away(gc, info->state, info->message); |
149 } | 149 } |
150 | 150 |
151 static void | 151 static void |
152 free_auto_recon(gpointer data) | 152 free_auto_recon(gpointer data) |
153 { | 153 { |
209 gaim_signal_disconnect(gaim_connections_get_handle(), "signed-on", | 209 gaim_signal_disconnect(gaim_connections_get_handle(), "signed-on", |
210 plugin, GAIM_CALLBACK(restore_state)); | 210 plugin, GAIM_CALLBACK(restore_state)); |
211 | 211 |
212 gaim_signal_disconnect(gaim_accounts_get_handle(), "account-away", | 212 gaim_signal_disconnect(gaim_accounts_get_handle(), "account-away", |
213 plugin, GAIM_CALLBACK(save_state)); | 213 plugin, GAIM_CALLBACK(save_state)); |
214 | 214 |
215 g_hash_table_destroy(hash); | 215 g_hash_table_destroy(hash); |
216 hash = NULL; | 216 hash = NULL; |
217 | 217 |
218 g_hash_table_destroy(awayStates); | 218 g_hash_table_destroy(awayStates); |
219 awayStates = NULL; | 219 awayStates = NULL; |
229 static GaimPluginPrefFrame *get_plugin_pref_frame(GaimPlugin *plugin) { | 229 static GaimPluginPrefFrame *get_plugin_pref_frame(GaimPlugin *plugin) { |
230 GaimPluginPrefFrame *frame = gaim_plugin_pref_frame_new(); | 230 GaimPluginPrefFrame *frame = gaim_plugin_pref_frame_new(); |
231 GaimPluginPref *pref; | 231 GaimPluginPref *pref; |
232 | 232 |
233 pref = gaim_plugin_pref_new_with_label(_("Error Message Suppression")); | 233 pref = gaim_plugin_pref_new_with_label(_("Error Message Suppression")); |
234 gaim_plugin_pref_frame_add(frame, pref); | 234 gaim_plugin_pref_frame_add(frame, pref); |
235 | 235 |
236 pref = gaim_plugin_pref_new_with_name_and_label(OPT_HIDE_CONNECTED, | 236 pref = gaim_plugin_pref_new_with_name_and_label(OPT_HIDE_CONNECTED, |
237 _("Hide Disconnect Errors")); | 237 _("Hide Disconnect Errors")); |
238 gaim_plugin_pref_frame_add(frame, pref); | 238 gaim_plugin_pref_frame_add(frame, pref); |
239 | 239 |