comparison libpurple/protocols/jabber/bosh.c @ 32819:2c6510167895 default tip

propagate from branch 'im.pidgin.pidgin.2.x.y' (head 3315c5dfbd0ad16511bdcf865e5b07c02d07df24) to branch 'im.pidgin.pidgin' (head cbd1eda6bcbf0565ae7766396bb8f6f419cb6a9a)
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Sat, 02 Jun 2012 02:30:49 +0000
parents a5b556ac1de5
children
comparison
equal deleted inserted replaced
32818:01ff09d4a463 32819:2c6510167895
434 434
435 type = xmlnode_get_attrib(node, "type"); 435 type = xmlnode_get_attrib(node, "type");
436 436
437 if (type != NULL && !strcmp(type, "terminate")) { 437 if (type != NULL && !strcmp(type, "terminate")) {
438 conn->state = BOSH_CONN_OFFLINE; 438 conn->state = BOSH_CONN_OFFLINE;
439 purple_connection_error_reason(conn->js->gc, 439 purple_connection_error(conn->js->gc,
440 PURPLE_CONNECTION_ERROR_OTHER_ERROR, 440 PURPLE_CONNECTION_ERROR_OTHER_ERROR,
441 _("The BOSH connection manager terminated your session.")); 441 _("The BOSH connection manager terminated your session."));
442 return TRUE; 442 return TRUE;
443 } 443 }
444 return FALSE; 444 return FALSE;
537 requests = xmlnode_get_attrib(node, "requests"); 537 requests = xmlnode_get_attrib(node, "requests");
538 538
539 if (sid) { 539 if (sid) {
540 conn->sid = g_strdup(sid); 540 conn->sid = g_strdup(sid);
541 } else { 541 } else {
542 purple_connection_error_reason(js->gc, 542 purple_connection_error(js->gc,
543 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, 543 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
544 _("No session ID given")); 544 _("No session ID given"));
545 return; 545 return;
546 } 546 }
547 547
554 major = atoi(version); 554 major = atoi(version);
555 if (dot) 555 if (dot)
556 minor = atoi(dot + 1); 556 minor = atoi(dot + 1);
557 557
558 if (major != 1 || minor < 6) { 558 if (major != 1 || minor < 6) {
559 purple_connection_error_reason(js->gc, 559 purple_connection_error(js->gc,
560 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, 560 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
561 _("Unsupported version of BOSH protocol")); 561 _("Unsupported version of BOSH protocol"));
562 return; 562 return;
563 } 563 }
564 } else { 564 } else {
731 * just wait until we have something to send before we reconnect 731 * just wait until we have something to send before we reconnect
732 */ 732 */
733 return; 733 return;
734 734
735 if (++conn->bosh->failed_connections == MAX_FAILED_CONNECTIONS) { 735 if (++conn->bosh->failed_connections == MAX_FAILED_CONNECTIONS) {
736 purple_connection_error_reason(conn->bosh->js->gc, 736 purple_connection_error(conn->bosh->js->gc,
737 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, 737 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
738 _("Unable to establish a connection with the server")); 738 _("Unable to establish a connection with the server"));
739 } else { 739 } else {
740 /* No! Please! Take me back. It was me, not you! I was weak! */ 740 /* No! Please! Take me back. It was me, not you! I was weak! */
741 http_connection_connect(conn); 741 http_connection_connect(conn);
937 937
938 if (source < 0) { 938 if (source < 0) {
939 gchar *tmp; 939 gchar *tmp;
940 tmp = g_strdup_printf(_("Unable to establish a connection with the server: %s"), 940 tmp = g_strdup_printf(_("Unable to establish a connection with the server: %s"),
941 error); 941 error);
942 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); 942 purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp);
943 g_free(tmp); 943 g_free(tmp);
944 return; 944 return;
945 } 945 }
946 946
947 conn->fd = source; 947 conn->fd = source;
963 conn->psc = purple_ssl_connect(account, bosh->host, bosh->port, 963 conn->psc = purple_ssl_connect(account, bosh->host, bosh->port,
964 ssl_connection_established_cb, 964 ssl_connection_established_cb,
965 ssl_connection_error_cb, 965 ssl_connection_error_cb,
966 conn); 966 conn);
967 if (!conn->psc) { 967 if (!conn->psc) {
968 purple_connection_error_reason(gc, 968 purple_connection_error(gc,
969 PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, 969 PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT,
970 _("Unable to establish SSL connection")); 970 _("Unable to establish SSL connection"));
971 } 971 }
972 } else { 972 } else {
973 purple_connection_error_reason(gc, 973 purple_connection_error(gc,
974 PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, 974 PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT,
975 _("SSL support unavailable")); 975 _("SSL support unavailable"));
976 } 976 }
977 } else if (purple_proxy_connect(conn, account, bosh->host, bosh->port, 977 } else if (purple_proxy_connect(conn, account, bosh->host, bosh->port,
978 connection_established_cb, conn) == NULL) { 978 connection_established_cb, conn) == NULL) {
979 purple_connection_error_reason(gc, 979 purple_connection_error(gc,
980 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, 980 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
981 _("Unable to connect")); 981 _("Unable to connect"));
982 } 982 }
983 } 983 }
984 984
1021 * buffer that stores what is "being sent" until the 1021 * buffer that stores what is "being sent" until the
1022 * PurpleHTTPConnection reports it is fully sent. 1022 * PurpleHTTPConnection reports it is fully sent.
1023 */ 1023 */
1024 gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"), 1024 gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"),
1025 g_strerror(errno)); 1025 g_strerror(errno));
1026 purple_connection_error_reason(conn->bosh->js->gc, 1026 purple_connection_error(conn->bosh->js->gc,
1027 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, 1027 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
1028 tmp); 1028 tmp);
1029 g_free(tmp); 1029 g_free(tmp);
1030 return; 1030 return;
1031 } 1031 }
1077 * buffer that stores what is "being sent" until the 1077 * buffer that stores what is "being sent" until the
1078 * PurpleHTTPConnection reports it is fully sent. 1078 * PurpleHTTPConnection reports it is fully sent.
1079 */ 1079 */
1080 gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"), 1080 gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"),
1081 g_strerror(errno)); 1081 g_strerror(errno));
1082 purple_connection_error_reason(conn->bosh->js->gc, 1082 purple_connection_error(conn->bosh->js->gc,
1083 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, 1083 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
1084 tmp); 1084 tmp);
1085 g_free(tmp); 1085 g_free(tmp);
1086 return; 1086 return;
1087 } else if (ret < len) { 1087 } else if (ret < len) {