| 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 */ |