Mercurial > pidgin.yaz
comparison libpurple/protocols/jabber/bosh.c @ 27463:f541583e31bd
More uniformity among disconnect error messages
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Mon, 06 Jul 2009 09:07:42 +0000 |
parents | 708f92703a13 |
children | 70dcaa0b6fea |
comparison
equal
deleted
inserted
replaced
27462:1bbed9fd046b | 27463:f541583e31bd |
---|---|
352 | 352 |
353 type = xmlnode_get_attrib(node, "type"); | 353 type = xmlnode_get_attrib(node, "type"); |
354 | 354 |
355 if (type != NULL && !strcmp(type, "terminate")) { | 355 if (type != NULL && !strcmp(type, "terminate")) { |
356 conn->ready = FALSE; | 356 conn->ready = FALSE; |
357 purple_connection_error_reason (conn->js->gc, | 357 purple_connection_error_reason(conn->js->gc, |
358 PURPLE_CONNECTION_ERROR_OTHER_ERROR, | 358 PURPLE_CONNECTION_ERROR_OTHER_ERROR, |
359 _("The BOSH connection manager terminated your session.")); | 359 _("The BOSH connection manager terminated your session.")); |
360 return TRUE; | 360 return TRUE; |
361 } | 361 } |
362 return FALSE; | 362 return FALSE; |
781 PurpleHTTPConnection *conn = data; | 781 PurpleHTTPConnection *conn = data; |
782 PurpleConnection *gc = conn->bosh->js->gc; | 782 PurpleConnection *gc = conn->bosh->js->gc; |
783 | 783 |
784 if (source < 0) { | 784 if (source < 0) { |
785 gchar *tmp; | 785 gchar *tmp; |
786 tmp = g_strdup_printf(_("Could not establish a connection with the server:\n%s"), | 786 tmp = g_strdup_printf(_("Unable to establish a connection with the server: %s"), |
787 error); | 787 error); |
788 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); | 788 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); |
789 g_free(tmp); | 789 g_free(tmp); |
790 return; | 790 return; |
791 } | 791 } |
820 } | 820 } |
821 } else if (purple_proxy_connect(conn, account, bosh->host, bosh->port, | 821 } else if (purple_proxy_connect(conn, account, bosh->host, bosh->port, |
822 connection_established_cb, conn) == NULL) { | 822 connection_established_cb, conn) == NULL) { |
823 purple_connection_error_reason(gc, | 823 purple_connection_error_reason(gc, |
824 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, | 824 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
825 _("Unable to create socket")); | 825 _("Unable to connect")); |
826 } | 826 } |
827 } | 827 } |
828 | 828 |
829 static int | 829 static int |
830 http_connection_do_send(PurpleHTTPConnection *conn, const char *data, int len) | 830 http_connection_do_send(PurpleHTTPConnection *conn, const char *data, int len) |
860 /* | 860 /* |
861 * TODO: Handle this better. Probably requires a PurpleBOSHConnection | 861 * TODO: Handle this better. Probably requires a PurpleBOSHConnection |
862 * buffer that stores what is "being sent" until the | 862 * buffer that stores what is "being sent" until the |
863 * PurpleHTTPConnection reports it is fully sent. | 863 * PurpleHTTPConnection reports it is fully sent. |
864 */ | 864 */ |
865 gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"), | |
866 g_strerror(errno)); | |
865 purple_connection_error_reason(conn->bosh->js->gc, | 867 purple_connection_error_reason(conn->bosh->js->gc, |
866 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, | 868 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
867 _("Write error")); | 869 tmp); |
870 g_free(tmp); | |
868 return; | 871 return; |
869 } | 872 } |
870 | 873 |
871 purple_circ_buffer_mark_read(conn->write_buffer, ret); | 874 purple_circ_buffer_mark_read(conn->write_buffer, ret); |
872 } | 875 } |
903 /* | 906 /* |
904 * TODO: Handle this better. Probably requires a PurpleBOSHConnection | 907 * TODO: Handle this better. Probably requires a PurpleBOSHConnection |
905 * buffer that stores what is "being sent" until the | 908 * buffer that stores what is "being sent" until the |
906 * PurpleHTTPConnection reports it is fully sent. | 909 * PurpleHTTPConnection reports it is fully sent. |
907 */ | 910 */ |
911 gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"), | |
912 g_strerror(errno)); | |
908 purple_connection_error_reason(conn->bosh->js->gc, | 913 purple_connection_error_reason(conn->bosh->js->gc, |
909 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, | 914 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
910 _("Write error")); | 915 tmp); |
916 g_free(tmp); | |
911 return; | 917 return; |
912 } else if (ret < len) { | 918 } else if (ret < len) { |
913 if (ret < 0) | 919 if (ret < 0) |
914 ret = 0; | 920 ret = 0; |
915 if (conn->writeh == 0) | 921 if (conn->writeh == 0) |