| 356 else |
346 else |
| 357 { |
347 { |
| 358 /* ERROR */ |
348 /* ERROR */ |
| 359 gaim_debug_error("msn", "error reading\n"); |
349 gaim_debug_error("msn", "error reading\n"); |
| 360 |
350 |
| 361 if (directconn->inpa) |
|
| 362 gaim_input_remove(directconn->inpa); |
|
| 363 |
|
| 364 close(directconn->fd); |
|
| 365 |
|
| 366 msn_directconn_destroy(directconn); |
351 msn_directconn_destroy(directconn); |
| 367 } |
352 } |
| 368 } |
353 } |
| 369 |
354 |
| 370 static void |
355 static void |
| 371 connect_cb(gpointer data, gint source) |
356 connect_cb(gpointer data, gint source, const gchar *error_message) |
| 372 { |
357 { |
| 373 MsnDirectConn* directconn; |
358 MsnDirectConn* directconn; |
| 374 int fd; |
359 int fd; |
| 375 |
360 |
| 376 gaim_debug_misc("msn", "directconn: connect_cb: %d\n", source); |
361 gaim_debug_misc("msn", "directconn: connect_cb: %d\n", source); |
| 377 |
362 |
| 378 directconn = data; |
363 directconn = data; |
| |
364 directconn->connect_info = NULL; |
| 379 |
365 |
| 380 if (TRUE) |
366 if (TRUE) |
| 381 { |
367 { |
| 382 fd = source; |
368 fd = source; |
| 383 } |
369 } |
| 421 |
407 |
| 422 gboolean |
408 gboolean |
| 423 msn_directconn_connect(MsnDirectConn *directconn, const char *host, int port) |
409 msn_directconn_connect(MsnDirectConn *directconn, const char *host, int port) |
| 424 { |
410 { |
| 425 MsnSession *session; |
411 MsnSession *session; |
| 426 GaimProxyConnectInfo *connect_info; |
|
| 427 |
412 |
| 428 g_return_val_if_fail(directconn != NULL, FALSE); |
413 g_return_val_if_fail(directconn != NULL, FALSE); |
| 429 g_return_val_if_fail(host != NULL, TRUE); |
414 g_return_val_if_fail(host != NULL, TRUE); |
| 430 g_return_val_if_fail(port > 0, FALSE); |
415 g_return_val_if_fail(port > 0, FALSE); |
| 431 |
416 |
| 436 { |
421 { |
| 437 servconn->http_data->gateway_host = g_strdup(host); |
422 servconn->http_data->gateway_host = g_strdup(host); |
| 438 } |
423 } |
| 439 #endif |
424 #endif |
| 440 |
425 |
| 441 connect_info = gaim_proxy_connect(session->account, host, port, |
426 directconn->connect_info = gaim_proxy_connect(session->account, host, port, |
| 442 connect_cb, directconn); |
427 connect_cb, directconn); |
| 443 |
428 |
| 444 if (connect_info != NULL) |
429 if (directconn->connect_info != NULL) |
| 445 { |
430 { |
| 446 return TRUE; |
431 return TRUE; |
| 447 } |
432 } |
| 448 else |
433 else |
| 449 return FALSE; |
434 return FALSE; |
| 489 } |
474 } |
| 490 |
475 |
| 491 void |
476 void |
| 492 msn_directconn_destroy(MsnDirectConn *directconn) |
477 msn_directconn_destroy(MsnDirectConn *directconn) |
| 493 { |
478 { |
| |
479 if (directconn->connect_info != NULL) |
| |
480 gaim_proxy_connect_cancel(directconn->connect_info); |
| |
481 |
| |
482 if (directconn->inpa != 0) |
| |
483 gaim_input_remove(directconn->inpa); |
| |
484 |
| |
485 if (directconn->fd >= 0) |
| |
486 close(directconn->fd); |
| |
487 |
| 494 if (directconn->nonce != NULL) |
488 if (directconn->nonce != NULL) |
| 495 g_free(directconn->nonce); |
489 g_free(directconn->nonce); |
| 496 |
490 |
| 497 directconn->slplink->directconn = NULL; |
491 directconn->slplink->directconn = NULL; |
| 498 |
492 |