diff libpurple/protocols/sametime/sametime.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 01f1929d0936
children f1437342cc0e
line wrap: on
line diff
--- a/libpurple/protocols/sametime/sametime.c	Mon Jul 06 07:26:12 2009 +0000
+++ b/libpurple/protocols/sametime/sametime.c	Mon Jul 06 09:07:42 2009 +0000
@@ -411,11 +411,14 @@
     pd->outpa = purple_input_add(pd->socket, PURPLE_INPUT_WRITE, write_cb, pd);
 
   } else if(len > 0) {
+	gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"),
+			g_strerror(errno));
     DEBUG_ERROR("write returned %" G_GSSIZE_FORMAT ", %" G_GSIZE_FORMAT
 			" bytes left unwritten\n", ret, len);
     purple_connection_error_reason(pd->gc,
                                    PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
-                                   _("Connection closed (writing)"));
+                                   tmp);
+	g_free(tmp);
 
 #if 0
     close(pd->socket);
@@ -1755,11 +1758,10 @@
   }
 
   if(! ret) {
-    const char *msg = _("Connection reset");
     DEBUG_INFO("connection reset\n");
     purple_connection_error_reason(pd->gc,
                                    PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
-                                   msg);
+                                   _("Server closed the connection"));
 
   } else if(ret < 0) {
     const gchar *err_str = g_strerror(err);
@@ -1767,7 +1769,7 @@
 
     DEBUG_INFO("error in read callback: %s\n", err_str);
 
-    msg = g_strdup_printf(_("Error reading from socket: %s"), err_str);
+    msg = g_strdup_printf(_("Lost connection with server: %s"), err_str);
     purple_connection_error_reason(pd->gc,
                                    PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
                                    msg);
@@ -1792,10 +1794,12 @@
 
     } else {
       /* this is a regular connect, error out */
-      const char *msg = _("Unable to connect to host");
+      gchar *tmp = g_strdup_printf(_("Unable to connect: %s"),
+          error_message);
       purple_connection_error_reason(pd->gc,
                                      PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
-                                     msg);
+                                     tmp);
+      g_free(tmp);
     }
 
     return;
@@ -3800,7 +3804,7 @@
 
   if (purple_proxy_connect(gc, account, host, port, connect_cb, pd) == NULL) {
     purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
-                                   _("Unable to connect to host"));
+                                   _("Unable to connect"));
   }
 }