Mercurial > pidgin
comparison src/protocols/irc/irc.c @ 14111:c44af67e2065
[gaim-migrate @ 16745]
IRC is now canceling gaim_proxy_connect() attempts instead of using
GAIM_CONNECTION_IS_VALID(). This will probably be the most clear
example of the changes needed, for you folks sitting at home.
committer: Tailor Script <tailor@pidgin.im>
| author | Mark Doliner <mark@kingant.net> |
|---|---|
| date | Mon, 14 Aug 2006 06:38:12 +0000 |
| parents | 7a205b430d19 |
| children | c8ebbc0110f4 |
comparison
equal
deleted
inserted
replaced
| 14110:5cefeb370262 | 14111:c44af67e2065 |
|---|---|
| 44 static GList *irc_status_types(GaimAccount *account); | 44 static GList *irc_status_types(GaimAccount *account); |
| 45 static GList *irc_actions(GaimPlugin *plugin, gpointer context); | 45 static GList *irc_actions(GaimPlugin *plugin, gpointer context); |
| 46 /* static GList *irc_chat_info(GaimConnection *gc); */ | 46 /* static GList *irc_chat_info(GaimConnection *gc); */ |
| 47 static void irc_login(GaimAccount *account); | 47 static void irc_login(GaimAccount *account); |
| 48 static void irc_login_cb_ssl(gpointer data, GaimSslConnection *gsc, GaimInputCondition cond); | 48 static void irc_login_cb_ssl(gpointer data, GaimSslConnection *gsc, GaimInputCondition cond); |
| 49 static void irc_login_cb(gpointer data, gint source); | 49 static void irc_login_cb(gpointer data, gint source, const gchar *error_message); |
| 50 static void irc_ssl_connect_failure(GaimSslConnection *gsc, GaimSslErrorType error, gpointer data); | 50 static void irc_ssl_connect_failure(GaimSslConnection *gsc, GaimSslErrorType error, gpointer data); |
| 51 static void irc_close(GaimConnection *gc); | 51 static void irc_close(GaimConnection *gc); |
| 52 static int irc_im_send(GaimConnection *gc, const char *who, const char *what, GaimMessageFlags flags); | 52 static int irc_im_send(GaimConnection *gc, const char *who, const char *what, GaimMessageFlags flags); |
| 53 static int irc_chat_send(GaimConnection *gc, int id, const char *what, GaimMessageFlags flags); | 53 static int irc_chat_send(GaimConnection *gc, int id, const char *what, GaimMessageFlags flags); |
| 54 static void irc_chat_join (GaimConnection *gc, GHashTable *data); | 54 static void irc_chat_join (GaimConnection *gc, GHashTable *data); |
| 281 { | 281 { |
| 282 GaimConnection *gc; | 282 GaimConnection *gc; |
| 283 struct irc_conn *irc; | 283 struct irc_conn *irc; |
| 284 char **userparts; | 284 char **userparts; |
| 285 const char *username = gaim_account_get_username(account); | 285 const char *username = gaim_account_get_username(account); |
| 286 GaimProxyConnectInfo *connect_info; | |
| 287 | 286 |
| 288 gc = gaim_account_get_connection(account); | 287 gc = gaim_account_get_connection(account); |
| 289 gc->flags |= GAIM_CONNECTION_NO_NEWLINES; | 288 gc->flags |= GAIM_CONNECTION_NO_NEWLINES; |
| 290 | 289 |
| 291 if (strpbrk(username, " \t\v\r\n") != NULL) { | 290 if (strpbrk(username, " \t\v\r\n") != NULL) { |
| 323 } | 322 } |
| 324 } | 323 } |
| 325 | 324 |
| 326 if (!irc->gsc) { | 325 if (!irc->gsc) { |
| 327 | 326 |
| 328 connect_info = gaim_proxy_connect(account, irc->server, | 327 irc->connect_info = gaim_proxy_connect(account, irc->server, |
| 329 gaim_account_get_int(account, "port", IRC_DEFAULT_PORT), | 328 gaim_account_get_int(account, "port", IRC_DEFAULT_PORT), |
| 330 irc_login_cb, gc); | 329 irc_login_cb, gc); |
| 331 | 330 |
| 332 if (!connect_info || !gaim_account_get_connection(account)) { | 331 if (!irc->connect_info || !gaim_account_get_connection(account)) { |
| 333 gaim_connection_error(gc, _("Couldn't create socket")); | 332 gaim_connection_error(gc, _("Couldn't create socket")); |
| 334 return; | 333 return; |
| 335 } | 334 } |
| 336 } | 335 } |
| 337 } | 336 } |
| 392 if (do_login(gc)) { | 391 if (do_login(gc)) { |
| 393 gaim_ssl_input_add(gsc, irc_input_cb_ssl, gc); | 392 gaim_ssl_input_add(gsc, irc_input_cb_ssl, gc); |
| 394 } | 393 } |
| 395 } | 394 } |
| 396 | 395 |
| 397 static void irc_login_cb(gpointer data, gint source) | 396 static void irc_login_cb(gpointer data, gint source, const gchar *error_message) |
| 398 { | 397 { |
| 399 GaimConnection *gc = data; | 398 GaimConnection *gc = data; |
| 400 struct irc_conn *irc = gc->proto_data; | 399 struct irc_conn *irc = gc->proto_data; |
| 401 GList *connections = gaim_connections_get_all(); | 400 |
| 401 irc->connect_info = NULL; | |
| 402 | 402 |
| 403 if (source < 0) { | 403 if (source < 0) { |
| 404 gaim_connection_error(gc, _("Couldn't connect to host")); | 404 gaim_connection_error(gc, _("Couldn't connect to host")); |
| 405 return; | |
| 406 } | |
| 407 | |
| 408 if (!g_list_find(connections, gc)) { | |
| 409 close(source); | |
| 410 return; | 405 return; |
| 411 } | 406 } |
| 412 | 407 |
| 413 irc->fd = source; | 408 irc->fd = source; |
| 414 | 409 |
| 441 struct irc_conn *irc = gc->proto_data; | 436 struct irc_conn *irc = gc->proto_data; |
| 442 | 437 |
| 443 if (irc == NULL) | 438 if (irc == NULL) |
| 444 return; | 439 return; |
| 445 | 440 |
| 446 irc_cmd_quit(irc, "quit", NULL, NULL); | 441 if (irc->gsc || (irc->fd >= 0)) |
| 442 irc_cmd_quit(irc, "quit", NULL, NULL); | |
| 443 | |
| 444 if (irc->connect_info) | |
| 445 gaim_proxy_connect_cancel(irc->connect_info); | |
| 447 | 446 |
| 448 if (gc->inpa) | 447 if (gc->inpa) |
| 449 gaim_input_remove(gc->inpa); | 448 gaim_input_remove(gc->inpa); |
| 450 | 449 |
| 451 g_free(irc->inbuf); | 450 g_free(irc->inbuf); |
