diff libpurple/protocols/qq/qq_network.c @ 27381:f541583e31bd

More uniformity among disconnect error messages
author Mark Doliner <mark@kingant.net>
date Mon, 06 Jul 2009 09:07:42 +0000
parents 7da3cf2530b7
children 73a30365c293 33921125348d
line wrap: on
line diff
--- a/libpurple/protocols/qq/qq_network.c	Mon Jul 06 07:26:12 2009 +0000
+++ b/libpurple/protocols/qq/qq_network.c	Mon Jul 06 09:07:42 2009 +0000
@@ -208,7 +208,7 @@
 		if ( set_new_server(qd) != TRUE) {
 			purple_connection_error_reason(gc,
 					PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
-					_("Unable to connect."));
+					_("Unable to connect"));
 			return FALSE;
 		}
 		qd->connect_retry = QQ_CONNECT_MAX;
@@ -233,7 +233,7 @@
 	if ( !connect_to_server(gc, tmp_server, port) ) {
 			purple_connection_error_reason(gc,
 				PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
-				_("Unable to connect."));
+				_("Unable to connect"));
 	}
 
 	g_free(tmp_server);
@@ -389,7 +389,7 @@
 			/* No worries */
 			return;
 
-		error_msg = g_strdup_printf(_("Lost connection with server:\n%s"), g_strerror(errno));
+		error_msg = g_strdup_printf(_("Lost connection with server: %s"), g_strerror(errno));
 		purple_connection_error_reason(gc,
 				PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
 				error_msg);
@@ -397,7 +397,7 @@
 		return;
 	} else if (buf_len == 0) {
 		purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
-				_("Server closed the connection."));
+				_("Server closed the connection"));
 		return;
 	}
 
@@ -585,9 +585,11 @@
 		return;
 	else if (ret < 0) {
 		/* TODO: what to do here - do we really have to disconnect? */
+		gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"),
+				g_strerror(errno));
 		purple_connection_error_reason(gc,
-				PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
-		        _("Write Error"));
+				PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp);
+		g_free(tmp);
 		return;
 	}
 
@@ -629,11 +631,13 @@
 		ret = 0;
 	} else if (ret <= 0) {
 		/* TODO: what to do here - do we really have to disconnect? */
+		gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"),
+				g_strerror(errno));
 		purple_debug_error("TCP_SEND_OUT",
 			"Send to socket %d failed: %d, %s\n", qd->fd, errno, g_strerror(errno));
 		purple_connection_error_reason(gc,
-				PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
-				g_strerror(errno));
+				PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp);
+		g_free(tmp);
 		return ret;
 	}
 
@@ -663,7 +667,7 @@
 	if (is_lost_conn) {
 		purple_connection_error_reason(gc,
 			PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
-			_("Connection lost"));
+			_("Lost connection with server"));
 		return TRUE;
 	}
 
@@ -864,7 +868,7 @@
 	if (!hosts || !hosts->data) {
 		purple_connection_error_reason(gc,
 				PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
-				_("Couldn't resolve host"));
+				_("Unable to resolve hostname"));
 		return;
 	}
 
@@ -941,7 +945,7 @@
 	account = purple_connection_get_account(gc);
 	qd = (qq_data *) gc->proto_data;
 
-	if (server == NULL || strlen(server) == 0 || port == 0) {
+	if (server == NULL || server[0] == '\0' || port == 0) {
 		purple_connection_error_reason(gc,
 				PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
 				_("Invalid server or port"));