pidgin/gtkconn.c

branch
cpw.resiak.disconnectreason
changeset 21512
410530e068e7
parent 21309
3d4ea71cea76
child 21942
8ee08ef6b2a3
equal deleted inserted replaced
21511:e4dcf9f1261b 21512:410530e068e7
131 purple_account_connect(account); 131 purple_account_connect(account);
132 purple_debug_info("autorecon", "done calling purple_account_connect\n"); 132 purple_debug_info("autorecon", "done calling purple_account_connect\n");
133 } 133 }
134 134
135 return FALSE; 135 return FALSE;
136 }
137
138 static void
139 notify_account_disabled(PurpleAccount *account,
140 PurpleConnectionError reason,
141 const char *text)
142 {
143 const char *username = purple_account_get_username(account);
144 const char *alias = purple_account_get_alias(account);
145 const char *protocol = purple_account_get_protocol_name(account);
146 char *p, *s, *n;
147
148 if (alias)
149 n = g_strdup_printf("%s (%s) (%s)", username, alias, protocol);
150 else
151 n = g_strdup_printf("%s (%s)", username, protocol);
152
153 p = g_strdup_printf(_("%s disconnected"), n);
154
155 if(reason == PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT)
156 s = g_strdup_printf(
157 _("%s\n\n"
158 "%s will not attempt to reconnect the account until you "
159 "re-enable the account. See %s for information on how to "
160 "compile %s with SSL support."), text, PIDGIN_NAME,
161 "http://developer.pidgin.im/wiki/FAQssl", PIDGIN_NAME);
162 else
163 s = g_strdup_printf(
164 _("%s\n\n"
165 "%s will not attempt to reconnect the account until you "
166 "correct the error and re-enable the account."), text,
167 PIDGIN_NAME);
168
169 purple_notify_error(NULL, NULL, p, s);
170 g_free(p);
171 g_free(s);
172 g_free(n);
173 } 136 }
174 137
175 static void 138 static void
176 pidgin_connection_report_disconnect_reason (PurpleConnection *gc, 139 pidgin_connection_report_disconnect_reason (PurpleConnection *gc,
177 PurpleConnectionError reason, 140 PurpleConnectionError reason,
197 info->timeout = g_timeout_add(info->delay, do_signon, account); 160 info->timeout = g_timeout_add(info->delay, do_signon, account);
198 } else { 161 } else {
199 if (info != NULL) 162 if (info != NULL)
200 g_hash_table_remove(auto_reconns, account); 163 g_hash_table_remove(auto_reconns, account);
201 164
202 if (reason != PURPLE_CONNECTION_ERROR_NAME_IN_USE)
203 notify_account_disabled(account, reason, text);
204
205 /* 165 /*
206 * TODO: Do we really want to disable the account when it's 166 * TODO: Do we really want to disable the account when it's
207 * disconnected by wants_to_die? This happens when you sign 167 * disconnected by wants_to_die? This happens when you sign
208 * on from somewhere else, or when you enter an invalid password. 168 * on from somewhere else, or when you enter an invalid password.
209 */ 169 */

mercurial