comparison src/gtkconn.c @ 11721:2d98b2759fa1

[gaim-migrate @ 14012] Whitespace and change the max autorecon delay from 34.13 minutes to 10 minutes committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sat, 22 Oct 2005 21:06:28 +0000
parents 3a05b53a589e
children 8a7553e149de
comparison
equal deleted inserted replaced
11720:4d8023465af4 11721:2d98b2759fa1
37 #include "gtkblist.h" 37 #include "gtkblist.h"
38 #include "gtkdialogs.h" 38 #include "gtkdialogs.h"
39 #include "gtkutils.h" 39 #include "gtkutils.h"
40 40
41 #define INITIAL_RECON_DELAY 8000 41 #define INITIAL_RECON_DELAY 8000
42 #define MAX_RECON_DELAY 2048000 42 #define MAX_RECON_DELAY 600000
43 43
44 typedef struct { 44 typedef struct {
45 int delay; 45 int delay;
46 guint timeout; 46 guint timeout;
47 } GaimAutoRecon; 47 } GaimAutoRecon;
140 GaimAccount *account = NULL; 140 GaimAccount *account = NULL;
141 GaimAutoRecon *info; 141 GaimAutoRecon *info;
142 GSList* listAccount; 142 GSList* listAccount;
143 143
144 if (hash == NULL) { 144 if (hash == NULL) {
145 hash = g_hash_table_new_full(g_int_hash, g_int_equal, NULL, 145 hash = g_hash_table_new_full(g_int_hash, g_int_equal, NULL,
146 free_auto_recon); 146 free_auto_recon);
147 } 147 }
148 account = gaim_connection_get_account(gc); 148 account = gaim_connection_get_account(gc);
149 info = g_hash_table_lookup(hash, account); 149 info = g_hash_table_lookup(hash, account);
150 if (accountReconnecting) 150 if (accountReconnecting)
151 listAccount = g_slist_find(accountReconnecting, account); 151 listAccount = g_slist_find(accountReconnecting, account);
152 else 152 else
153 listAccount = NULL; 153 listAccount = NULL;
154 154
155 if (!gc->wants_to_die) { 155 if (!gc->wants_to_die) {
156 gtk_gaim_status_box_set_error(GTK_GAIM_STATUS_BOX(list->statusbox), text); 156 gtk_gaim_status_box_set_error(GTK_GAIM_STATUS_BOX(list->statusbox), text);
157 157
158 if (info == NULL) { 158 if (info == NULL) {
159 info = g_new0(GaimAutoRecon, 1); 159 info = g_new0(GaimAutoRecon, 1);
160 g_hash_table_insert(hash, account, info); 160 g_hash_table_insert(hash, account, info);
161 info->delay = INITIAL_RECON_DELAY; 161 info->delay = INITIAL_RECON_DELAY;
162 } else { 162 } else {
168 168
169 if (!listAccount) 169 if (!listAccount)
170 accountReconnecting = g_slist_prepend(accountReconnecting, account); 170 accountReconnecting = g_slist_prepend(accountReconnecting, account);
171 } else { 171 } else {
172 char *p, *s, *n=NULL ; 172 char *p, *s, *n=NULL ;
173 if (info != NULL) 173 if (info != NULL)
174 g_hash_table_remove(hash, account); 174 g_hash_table_remove(hash, account);
175 175
176 if (listAccount) 176 if (listAccount)
177 accountReconnecting = g_slist_delete_link(accountReconnecting, listAccount); 177 accountReconnecting = g_slist_delete_link(accountReconnecting, listAccount);
178 178
179 if (gaim_account_get_alias(account)) { 179 if (gaim_account_get_alias(account)) {
180 n = g_strdup_printf("%s (%s) (%s)", 180 n = g_strdup_printf("%s (%s) (%s)",
181 gaim_account_get_username(account), 181 gaim_account_get_username(account),
182 gaim_account_get_alias(account), 182 gaim_account_get_alias(account),
183 gaim_account_get_protocol_name(account)); 183 gaim_account_get_protocol_name(account));
184 } else { 184 } else {
185 n = g_strdup_printf("%s (%s)", 185 n = g_strdup_printf("%s (%s)",
186 gaim_account_get_username(account), 186 gaim_account_get_username(account),
187 gaim_account_get_protocol_name(account)); 187 gaim_account_get_protocol_name(account));
188 } 188 }
189 189
190 p = g_strdup_printf(_("%s disconnected"), n); 190 p = g_strdup_printf(_("%s disconnected"), n);
191 s = g_strdup_printf(_("%s was disconnected due to an error. %s The account has been disabled. " 191 s = g_strdup_printf(_("%s was disconnected due to an error. %s The account has been disabled. "
192 "Correct the error and reenable the account to connect."), n, text); 192 "Correct the error and reenable the account to connect."), n, text);
193 gaim_notify_error(NULL, NULL, p, s); 193 gaim_notify_error(NULL, NULL, p, s);
194 g_free(p); 194 g_free(p);