Mercurial > pidgin
comparison libpurple/connection.c @ 23456:00eaff9396ec
propagate from branch 'im.pidgin.pidgin' (head e39a6e9be3df05b59a878001feb9276b9ceb66a9)
to branch 'im.pidgin.pidgin.khc.msnp15' (head c5b8a906c26f5cb0fd8c7256852e3c1e346d7863)
author | Ka-Hing Cheung <khc@hxbc.us> |
---|---|
date | Wed, 06 Feb 2008 03:35:04 +0000 |
parents | 2b426862ffbf |
children | aaaff38e144f 8282911d5e17 9ded0fb57e1c |
comparison
equal
deleted
inserted
replaced
23455:f182cf94145c | 23456:00eaff9396ec |
---|---|
50 send_keepalive(gpointer data) | 50 send_keepalive(gpointer data) |
51 { | 51 { |
52 PurpleConnection *gc = data; | 52 PurpleConnection *gc = data; |
53 PurplePluginProtocolInfo *prpl_info = NULL; | 53 PurplePluginProtocolInfo *prpl_info = NULL; |
54 | 54 |
55 if (gc != NULL && gc->prpl != NULL) | 55 if (gc == NULL) |
56 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); | 56 return TRUE; |
57 | |
58 /* Only send keep-alives if we haven't heard from the | |
59 * server in a while. | |
60 */ | |
61 if ((time(NULL) - gc->last_received) < KEEPALIVE_INTERVAL) | |
62 return TRUE; | |
63 | |
64 if (gc->prpl == NULL) | |
65 return TRUE; | |
66 | |
67 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); | |
57 | 68 |
58 if (prpl_info && prpl_info->keepalive) | 69 if (prpl_info && prpl_info->keepalive) |
59 prpl_info->keepalive(gc); | 70 prpl_info->keepalive(gc); |
60 | 71 |
61 return TRUE; | 72 return TRUE; |
411 g_return_val_if_fail(gc != NULL, NULL); | 422 g_return_val_if_fail(gc != NULL, NULL); |
412 | 423 |
413 return gc->account; | 424 return gc->account; |
414 } | 425 } |
415 | 426 |
427 PurplePlugin * | |
428 purple_connection_get_prpl(const PurpleConnection *gc) | |
429 { | |
430 g_return_val_if_fail(gc != NULL, NULL); | |
431 | |
432 return gc->prpl; | |
433 } | |
434 | |
416 const char * | 435 const char * |
417 purple_connection_get_password(const PurpleConnection *gc) | 436 purple_connection_get_password(const PurpleConnection *gc) |
418 { | 437 { |
419 g_return_val_if_fail(gc != NULL, NULL); | 438 g_return_val_if_fail(gc != NULL, NULL); |
420 | 439 |
540 { | 559 { |
541 PurpleConnectionError reason; | 560 PurpleConnectionError reason; |
542 | 561 |
543 switch (ssl_error) { | 562 switch (ssl_error) { |
544 case PURPLE_SSL_HANDSHAKE_FAILED: | 563 case PURPLE_SSL_HANDSHAKE_FAILED: |
564 reason = PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR; | |
565 break; | |
545 case PURPLE_SSL_CONNECT_FAILED: | 566 case PURPLE_SSL_CONNECT_FAILED: |
546 reason = PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR; | 567 reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; |
547 break; | 568 break; |
548 case PURPLE_SSL_CERTIFICATE_INVALID: | 569 case PURPLE_SSL_CERTIFICATE_INVALID: |
549 /* TODO: maybe PURPLE_SSL_* should be more specific? */ | 570 /* TODO: maybe PURPLE_SSL_* should be more specific? */ |
550 reason = PURPLE_CONNECTION_ERROR_CERT_OTHER_ERROR; | 571 reason = PURPLE_CONNECTION_ERROR_CERT_OTHER_ERROR; |
551 break; | 572 break; |
552 default: | 573 default: |
553 g_assert_not_reached (); | 574 g_assert_not_reached (); |
554 reason = PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR; | 575 reason = PURPLE_CONNECTION_ERROR_CERT_OTHER_ERROR; |
555 } | 576 } |
556 | 577 |
557 purple_connection_error_reason (gc, reason, | 578 purple_connection_error_reason (gc, reason, |
558 purple_ssl_strerror(ssl_error)); | 579 purple_ssl_strerror(ssl_error)); |
559 } | 580 } |
562 purple_connection_error_is_fatal (PurpleConnectionError reason) | 583 purple_connection_error_is_fatal (PurpleConnectionError reason) |
563 { | 584 { |
564 switch (reason) | 585 switch (reason) |
565 { | 586 { |
566 case PURPLE_CONNECTION_ERROR_NETWORK_ERROR: | 587 case PURPLE_CONNECTION_ERROR_NETWORK_ERROR: |
588 case PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR: | |
567 return FALSE; | 589 return FALSE; |
568 case PURPLE_CONNECTION_ERROR_INVALID_USERNAME: | 590 case PURPLE_CONNECTION_ERROR_INVALID_USERNAME: |
569 case PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED: | 591 case PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED: |
570 case PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE: | 592 case PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE: |
571 case PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT: | 593 case PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT: |
572 case PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR: | |
573 case PURPLE_CONNECTION_ERROR_NAME_IN_USE: | 594 case PURPLE_CONNECTION_ERROR_NAME_IN_USE: |
574 case PURPLE_CONNECTION_ERROR_INVALID_SETTINGS: | 595 case PURPLE_CONNECTION_ERROR_INVALID_SETTINGS: |
575 case PURPLE_CONNECTION_ERROR_OTHER_ERROR: | 596 case PURPLE_CONNECTION_ERROR_OTHER_ERROR: |
576 case PURPLE_CONNECTION_ERROR_CERT_NOT_PROVIDED: | 597 case PURPLE_CONNECTION_ERROR_CERT_NOT_PROVIDED: |
577 case PURPLE_CONNECTION_ERROR_CERT_UNTRUSTED: | 598 case PURPLE_CONNECTION_ERROR_CERT_UNTRUSTED: |