comparison src/protocols/sametime/sametime.c @ 14116:12be86c7e2ce

[gaim-migrate @ 16750] Sametime should be good committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Mon, 14 Aug 2006 07:37:11 +0000
parents 7a205b430d19
children
comparison
equal deleted inserted replaced
14115:8ea1929c4c69 14116:12be86c7e2ce
224 guint save_event; 224 guint save_event;
225 225
226 /** socket fd */ 226 /** socket fd */
227 int socket; 227 int socket;
228 gint outpa; /* like inpa, but the other way */ 228 gint outpa; /* like inpa, but the other way */
229 GaimProxyConnectInfo *connect_info;
229 230
230 /** circular buffer for outgoing data */ 231 /** circular buffer for outgoing data */
231 GaimCircBuffer *sock_buf; 232 GaimCircBuffer *sock_buf;
232 233
233 GaimConnection *gc; 234 GaimConnection *gc;
308 }; 309 };
309 310
310 311
311 /* connection functions */ 312 /* connection functions */
312 313
313 static void connect_cb(gpointer data, gint source); 314 static void connect_cb(gpointer data, gint source, const gchar *error_message);
314 315
315 316
316 /* ----- session ------ */ 317 /* ----- session ------ */
317 318
318 319
1667 } 1668 }
1668 1669
1669 1670
1670 /** Callback passed to gaim_proxy_connect when an account is logged 1671 /** Callback passed to gaim_proxy_connect when an account is logged
1671 in, and if the session logging in receives a redirect message */ 1672 in, and if the session logging in receives a redirect message */
1672 static void connect_cb(gpointer data, gint source) { 1673 static void connect_cb(gpointer data, gint source, const gchar *error_message) {
1673 1674
1674 struct mwGaimPluginData *pd = data; 1675 struct mwGaimPluginData *pd = data;
1675 GaimConnection *gc = pd->gc; 1676 GaimConnection *gc = pd->gc;
1676 1677
1677 if(! g_list_find(gaim_connections_get_all(), pd->gc)) { 1678 pd->connect_info = NULL;
1678 close(source);
1679 g_return_if_reached();
1680 }
1681 1679
1682 if(source < 0) { 1680 if(source < 0) {
1683 /* connection failed */ 1681 /* connection failed */
1684 1682
1685 if(pd->socket) { 1683 if(pd->socket) {
3681 mwSession_setProperty(pd->session, mwSession_CLIENT_TYPE_ID, 3679 mwSession_setProperty(pd->session, mwSession_CLIENT_TYPE_ID,
3682 GUINT_TO_POINTER(client), NULL); 3680 GUINT_TO_POINTER(client), NULL);
3683 3681
3684 gaim_connection_update_progress(gc, _("Connecting"), 1, MW_CONNECT_STEPS); 3682 gaim_connection_update_progress(gc, _("Connecting"), 1, MW_CONNECT_STEPS);
3685 3683
3686 if(gaim_proxy_connect(account, host, port, connect_cb, pd) == NULL) { 3684 pd->connect_info = gaim_proxy_connect(account, host, port, connect_cb, pd);
3685 if(pd->connect_info == NULL) {
3687 gaim_connection_error(gc, _("Unable to connect to host")); 3686 gaim_connection_error(gc, _("Unable to connect to host"));
3688 } 3687 }
3689 } 3688 }
3690 3689
3691 3690
3712 3711
3713 /* stop watching the socket */ 3712 /* stop watching the socket */
3714 if(gc->inpa) { 3713 if(gc->inpa) {
3715 gaim_input_remove(gc->inpa); 3714 gaim_input_remove(gc->inpa);
3716 gc->inpa = 0; 3715 gc->inpa = 0;
3716 }
3717
3718 if(pd->connect_info != NULL) {
3719 gaim_proxy_connect_cancel(pd->connect_info);
3720 pd->connect_info = NULL;
3717 } 3721 }
3718 3722
3719 /* clean up the rest */ 3723 /* clean up the rest */
3720 mwGaimPluginData_free(pd); 3724 mwGaimPluginData_free(pd);
3721 } 3725 }