src/protocols/qq/qq_proxy.c

changeset 14151
34427f138b1f
parent 14107
d034d8218d02
child 14170
f611621bc8a0
equal deleted inserted replaced
14150:b9617d019b31 14151:34427f138b1f
117 */ 117 */
118 } 118 }
119 119
120 /* the callback function after socket is built 120 /* the callback function after socket is built
121 * we setup the qq protocol related configuration here */ 121 * we setup the qq protocol related configuration here */
122 static void _qq_got_login(gpointer data, gint source, GaimInputCondition cond) 122 static void _qq_got_login(gpointer data, gint source)
123 { 123 {
124 qq_data *qd; 124 qq_data *qd;
125 GaimConnection *gc; 125 GaimConnection *gc;
126 gchar *buf; 126 gchar *buf;
127 const gchar *passwd; 127 const gchar *passwd;
307 /* QQ connection via UDP/TCP. 307 /* QQ connection via UDP/TCP.
308 * I use GAIM proxy function to provide TCP proxy support, 308 * I use GAIM proxy function to provide TCP proxy support,
309 * and qq_udp_proxy.c to add UDP proxy support (thanks henry) 309 * and qq_udp_proxy.c to add UDP proxy support (thanks henry)
310 * return the socket handle, -1 means fail */ 310 * return the socket handle, -1 means fail */
311 static gint _proxy_connect_full (GaimAccount *account, const gchar *host, guint16 port, 311 static gint _proxy_connect_full (GaimAccount *account, const gchar *host, guint16 port,
312 GaimInputFunction func, gpointer data, gboolean use_tcp) 312 GaimProxyConnectFunction func, gpointer data, gboolean use_tcp)
313 { 313 {
314 GaimConnection *gc; 314 GaimConnection *gc;
315 qq_data *qd; 315 qq_data *qd;
316 316
317 gc = gaim_account_get_connection(account); 317 gc = gaim_account_get_connection(account);
318 qd = (qq_data *) gc->proto_data; 318 qd = (qq_data *) gc->proto_data;
319 qd->server_ip = g_strdup(host); 319 qd->server_ip = g_strdup(host);
320 qd->server_port = port; 320 qd->server_port = port;
321 321
322 return use_tcp ? gaim_proxy_connect(account, host, port, func, data) : /* TCP mode */ 322 if (use_tcp)
323 _qq_udp_proxy_connect(account, host, port, func, data); /* UDP mode */ 323 /* TCP mode */
324 return (gaim_proxy_connect(account, host, port, func, NULL, data) == NULL);
325 else
326 /* UDP mode */
327 return _qq_udp_proxy_connect(account, host, port, func, data);
324 } 328 }
325 329
326 /* establish a generic QQ connection 330 /* establish a generic QQ connection
327 * TCP/UDP, and direct/redirected 331 * TCP/UDP, and direct/redirected
328 * return the socket handler, or -1 if there is any error */ 332 * return the socket handler, or -1 if there is any error */

mercurial