comparison libgaim/protocols/jabber/jabber.c @ 14837:118fd0dc5b6e

[gaim-migrate @ 17606] Add a "handle" parameter to gaim_proxy_connect(). It seemed like people thought this was a good idea. You can still cancel each gaim_proxy_connect() individually, if needed. I passed in NULL for the handle in most places. It might be better to pass in the gc in more places, but these changes do no harm, and they should help some Yahoo! things, and I wanted to get the API change in. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sat, 28 Oct 2006 20:04:03 +0000
parents 459dafda90af
children 8a564904e9b5
comparison
equal deleted inserted replaced
14836:bfcdd361357e 14837:118fd0dc5b6e
443 jabber_login_callback(gpointer data, gint source, const gchar *error) 443 jabber_login_callback(gpointer data, gint source, const gchar *error)
444 { 444 {
445 GaimConnection *gc = data; 445 GaimConnection *gc = data;
446 JabberStream *js = gc->proto_data; 446 JabberStream *js = gc->proto_data;
447 447
448 js->connect_data = NULL;
449
450 if (source < 0) { 448 if (source < 0) {
451 gaim_connection_error(gc, _("Couldn't connect to host")); 449 gaim_connection_error(gc, _("Couldn't connect to host"));
452 return; 450 return;
453 } 451 }
454 452
488 jabber_login_callback_ssl, jabber_ssl_connect_failure, js->gc); 486 jabber_login_callback_ssl, jabber_ssl_connect_failure, js->gc);
489 } 487 }
490 488
491 static void jabber_login_connect(JabberStream *js, const char *server, int port) 489 static void jabber_login_connect(JabberStream *js, const char *server, int port)
492 { 490 {
493 js->connect_data = gaim_proxy_connect(js->gc->account, server, 491 if (gaim_proxy_connect(js->gc, js->gc->account, server,
494 port, jabber_login_callback, js->gc); 492 port, jabber_login_callback, js->gc) == NULL)
495
496 if (js->connect_data == NULL)
497 gaim_connection_error(js->gc, _("Unable to create socket")); 493 gaim_connection_error(js->gc, _("Unable to create socket"));
498 } 494 }
499 495
500 static void srv_resolved_cb(GaimSrvResponse *resp, int results, gpointer data) 496 static void srv_resolved_cb(GaimSrvResponse *resp, int results, gpointer data)
501 { 497 {
920 gaim_connection_error(gc, _("SSL support unavailable")); 916 gaim_connection_error(gc, _("SSL support unavailable"));
921 } 917 }
922 } 918 }
923 919
924 if(!js->gsc) { 920 if(!js->gsc) {
925 js->connect_data = gaim_proxy_connect(account, server, 921 if (gaim_proxy_connect(gc, account, server,
926 gaim_account_get_int(account, "port", 5222), 922 gaim_account_get_int(account, "port", 5222),
927 jabber_login_callback, gc); 923 jabber_login_callback, gc) == NULL)
928
929 if (js->connect_data == NULL)
930 gaim_connection_error(gc, _("Unable to create socket")); 924 gaim_connection_error(gc, _("Unable to create socket"));
931 } 925 }
932 } 926 }
933 927
934 static void jabber_close(GaimConnection *gc) 928 static void jabber_close(GaimConnection *gc)
942 if (!gc->disconnect_timeout) 936 if (!gc->disconnect_timeout)
943 jabber_send_raw(js, "</stream:stream>", -1); 937 jabber_send_raw(js, "</stream:stream>", -1);
944 938
945 if (js->srv_query_data) 939 if (js->srv_query_data)
946 gaim_srv_cancel(js->srv_query_data); 940 gaim_srv_cancel(js->srv_query_data);
947
948 if (js->connect_data)
949 gaim_proxy_connect_cancel(js->connect_data);
950 941
951 if(js->gsc) { 942 if(js->gsc) {
952 #ifdef HAVE_OPENSSL 943 #ifdef HAVE_OPENSSL
953 if (!gc->disconnect_timeout) 944 if (!gc->disconnect_timeout)
954 #endif 945 #endif