Mercurial > pidgin
comparison src/protocols/jabber/si.c @ 14113:8ca0e500da4c
[gaim-migrate @ 16747]
Jabber is done. Also, I have a feeling JabberSIXfer->streamhosts is
leaking, if anyone wants to fix it. Wink wink. Nudge Nudge.
Karate chop.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Mon, 14 Aug 2006 07:18:58 +0000 |
parents | 7a205b430d19 |
children |
comparison
equal
deleted
inserted
replaced
14112:e149556f7569 | 14113:8ca0e500da4c |
---|---|
44 }; | 44 }; |
45 | 45 |
46 typedef struct _JabberSIXfer { | 46 typedef struct _JabberSIXfer { |
47 JabberStream *js; | 47 JabberStream *js; |
48 | 48 |
49 GaimProxyConnectInfo *connect_info; | |
50 | |
49 gboolean accepted; | 51 gboolean accepted; |
50 | 52 |
51 char *stream_id; | 53 char *stream_id; |
52 char *iq_id; | 54 char *iq_id; |
53 | 55 |
86 } | 88 } |
87 | 89 |
88 | 90 |
89 static void jabber_si_bytestreams_attempt_connect(GaimXfer *xfer); | 91 static void jabber_si_bytestreams_attempt_connect(GaimXfer *xfer); |
90 | 92 |
91 static void jabber_si_bytestreams_connect_cb(gpointer data, gint source) | 93 static void |
94 jabber_si_bytestreams_connect_cb(gpointer data, gint source, const gchar *error_message) | |
92 { | 95 { |
93 GaimXfer *xfer = data; | 96 GaimXfer *xfer = data; |
94 JabberSIXfer *jsx = xfer->data; | 97 JabberSIXfer *jsx = xfer->data; |
95 JabberIq *iq; | 98 JabberIq *iq; |
96 xmlnode *query, *su; | 99 xmlnode *query, *su; |
97 struct bytestreams_streamhost *streamhost = jsx->streamhosts->data; | 100 struct bytestreams_streamhost *streamhost = jsx->streamhosts->data; |
98 | 101 |
99 gaim_proxy_info_destroy(jsx->gpi); | 102 gaim_proxy_info_destroy(jsx->gpi); |
103 jsx->connect_info = NULL; | |
100 | 104 |
101 if(source < 0) { | 105 if(source < 0) { |
102 jsx->streamhosts = g_list_remove(jsx->streamhosts, streamhost); | 106 jsx->streamhosts = g_list_remove(jsx->streamhosts, streamhost); |
103 g_free(streamhost->jid); | 107 g_free(streamhost->jid); |
104 g_free(streamhost->host); | 108 g_free(streamhost->host); |
165 dstaddr = g_malloc(41); | 169 dstaddr = g_malloc(41); |
166 p = dstaddr; | 170 p = dstaddr; |
167 for(i=0; i<20; i++, p+=2) | 171 for(i=0; i<20; i++, p+=2) |
168 snprintf(p, 3, "%02x", hashval[i]); | 172 snprintf(p, 3, "%02x", hashval[i]); |
169 | 173 |
170 gaim_proxy_connect_socks5(jsx->gpi, dstaddr, 0, jabber_si_bytestreams_connect_cb, xfer); | 174 jsx->connect_info = gaim_proxy_connect_socks5(jsx->gpi, dstaddr, 0, |
175 jabber_si_bytestreams_connect_cb, xfer); | |
171 g_free(dstaddr); | 176 g_free(dstaddr); |
177 | |
178 if (jsx->connect_info == NULL) | |
179 { | |
180 jsx->streamhosts = g_list_remove(jsx->streamhosts, streamhost); | |
181 g_free(streamhost->jid); | |
182 g_free(streamhost->host); | |
183 g_free(streamhost); | |
184 jabber_si_bytestreams_attempt_connect(xfer); | |
185 } | |
172 } | 186 } |
173 | 187 |
174 void jabber_bytestreams_parse(JabberStream *js, xmlnode *packet) | 188 void jabber_bytestreams_parse(JabberStream *js, xmlnode *packet) |
175 { | 189 { |
176 GaimXfer *xfer; | 190 GaimXfer *xfer; |
679 { | 693 { |
680 JabberSIXfer *jsx = xfer->data; | 694 JabberSIXfer *jsx = xfer->data; |
681 JabberStream *js = jsx->js; | 695 JabberStream *js = jsx->js; |
682 | 696 |
683 js->file_transfers = g_list_remove(js->file_transfers, xfer); | 697 js->file_transfers = g_list_remove(js->file_transfers, xfer); |
698 | |
699 if (jsx->connect_info != NULL) | |
700 gaim_proxy_connect_cancel(jsx->connect_info); | |
684 | 701 |
685 g_free(jsx->stream_id); | 702 g_free(jsx->stream_id); |
686 g_free(jsx->iq_id); | 703 g_free(jsx->iq_id); |
687 /* XXX: free other stuff */ | 704 /* XXX: free other stuff */ |
688 g_free(jsx->rxqueue); | 705 g_free(jsx->rxqueue); |