Mercurial > pidgin.yaz
comparison libpurple/protocols/sametime/sametime.c @ 32772:6135b24cdc8a
Samtime: Move the "inpa" input watcher into protocol_data.
author | andrew.victor@mxit.com |
---|---|
date | Tue, 18 Oct 2011 21:17:08 +0000 |
parents | 2ec94166be43 |
children | 3e7a7e14af62 |
comparison
equal
deleted
inserted
replaced
32771:a78523019e7a | 32772:6135b24cdc8a |
---|---|
215 /** event id for the buddy list save callback */ | 215 /** event id for the buddy list save callback */ |
216 guint save_event; | 216 guint save_event; |
217 | 217 |
218 /** socket fd */ | 218 /** socket fd */ |
219 int socket; | 219 int socket; |
220 guint inpa; /* input watcher */ | |
220 gint outpa; /* like inpa, but the other way */ | 221 gint outpa; /* like inpa, but the other way */ |
221 | 222 |
222 /** circular buffer for outgoing data */ | 223 /** circular buffer for outgoing data */ |
223 PurpleCircBuffer *sock_buf; | 224 PurpleCircBuffer *sock_buf; |
224 | 225 |
447 if(pd->socket) { | 448 if(pd->socket) { |
448 close(pd->socket); | 449 close(pd->socket); |
449 pd->socket = 0; | 450 pd->socket = 0; |
450 } | 451 } |
451 | 452 |
452 if(gc->inpa) { | 453 if(pd->inpa) { |
453 purple_input_remove(gc->inpa); | 454 purple_input_remove(pd->inpa); |
454 gc->inpa = 0; | 455 pd->inpa = 0; |
455 } | 456 } |
456 } | 457 } |
457 | 458 |
458 | 459 |
459 static void mw_session_clear(struct mwSession *session) { | 460 static void mw_session_clear(struct mwSession *session) { |
1758 if(pd->socket) { | 1759 if(pd->socket) { |
1759 close(pd->socket); | 1760 close(pd->socket); |
1760 pd->socket = 0; | 1761 pd->socket = 0; |
1761 } | 1762 } |
1762 | 1763 |
1763 if(pd->gc->inpa) { | 1764 if(pd->inpa) { |
1764 purple_input_remove(pd->gc->inpa); | 1765 purple_input_remove(pd->inpa); |
1765 pd->gc->inpa = 0; | 1766 pd->inpa = 0; |
1766 } | 1767 } |
1767 | 1768 |
1768 if(! ret) { | 1769 if(! ret) { |
1769 DEBUG_INFO("connection reset\n"); | 1770 DEBUG_INFO("connection reset\n"); |
1770 purple_connection_error(pd->gc, | 1771 purple_connection_error(pd->gc, |
1789 /** Callback passed to purple_proxy_connect when an account is logged | 1790 /** Callback passed to purple_proxy_connect when an account is logged |
1790 in, and if the session logging in receives a redirect message */ | 1791 in, and if the session logging in receives a redirect message */ |
1791 static void connect_cb(gpointer data, gint source, const gchar *error_message) { | 1792 static void connect_cb(gpointer data, gint source, const gchar *error_message) { |
1792 | 1793 |
1793 struct mwPurplePluginData *pd = data; | 1794 struct mwPurplePluginData *pd = data; |
1794 PurpleConnection *gc = pd->gc; | |
1795 | 1795 |
1796 if(source < 0) { | 1796 if(source < 0) { |
1797 /* connection failed */ | 1797 /* connection failed */ |
1798 | 1798 |
1799 if(pd->socket) { | 1799 if(pd->socket) { |
1817 /* stop any existing login attempt */ | 1817 /* stop any existing login attempt */ |
1818 mwSession_stop(pd->session, ERR_SUCCESS); | 1818 mwSession_stop(pd->session, ERR_SUCCESS); |
1819 } | 1819 } |
1820 | 1820 |
1821 pd->socket = source; | 1821 pd->socket = source; |
1822 gc->inpa = purple_input_add(source, PURPLE_INPUT_READ, | 1822 pd->inpa = purple_input_add(source, PURPLE_INPUT_READ, |
1823 read_cb, pd); | 1823 read_cb, pd); |
1824 | 1824 |
1825 mwSession_start(pd->session); | 1825 mwSession_start(pd->session); |
1826 } | 1826 } |
1827 | 1827 |
3792 | 3792 |
3793 /* no longer necessary */ | 3793 /* no longer necessary */ |
3794 purple_connection_set_protocol_data(gc, NULL); | 3794 purple_connection_set_protocol_data(gc, NULL); |
3795 | 3795 |
3796 /* stop watching the socket */ | 3796 /* stop watching the socket */ |
3797 if(gc->inpa) { | 3797 if(pd->inpa) { |
3798 purple_input_remove(gc->inpa); | 3798 purple_input_remove(pd->inpa); |
3799 gc->inpa = 0; | 3799 pd->inpa = 0; |
3800 } | 3800 } |
3801 | 3801 |
3802 /* clean up the rest */ | 3802 /* clean up the rest */ |
3803 mwPurplePluginData_free(pd); | 3803 mwPurplePluginData_free(pd); |
3804 } | 3804 } |