diff src/protocols/msn/servconn.c @ 9092:9e5a709c30a8

[gaim-migrate @ 9869] More patches by shx. These prevent disconnects with message lengths that are past the allowed MSN message length, fixes pager messages, and provides a better error dialog stuff for MSN errors. I hope I got that all right. :) committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Thu, 27 May 2004 08:19:29 +0000
parents 9883e3398e37
children 6dd02df922b4
line wrap: on
line diff
--- a/src/protocols/msn/servconn.c	Thu May 27 08:04:11 2004 +0000
+++ b/src/protocols/msn/servconn.c	Thu May 27 08:19:29 2004 +0000
@@ -26,6 +26,43 @@
 static void read_cb(gpointer data, gint source, GaimInputCondition cond);
 
 static void
+show_error(MsnServConn *servconn)
+{
+	GaimConnection *gc;
+	char *tmp;
+	char *cmd;
+
+	const char *names[] = { "Notification", "Switchboard" };
+	const char *name;
+	
+	gc = gaim_account_get_connection(servconn->session->account);
+	name = names[servconn->type];
+
+	switch (servconn->cmdproc->error)
+	{
+		case MSN_ERROR_CONNECT:
+			tmp = g_strdup_printf(_("Unable to connect to %s server"),
+								  name);
+			break;
+		case MSN_ERROR_WRITE:
+			tmp = g_strdup_printf(_("Error writing to %s server"), name);
+			break;
+		case MSN_ERROR_READ:
+			cmd = servconn->cmdproc->last_trans;
+			tmp = g_strdup_printf(_("Error reading from %s server"), name);
+			gaim_debug_info("msn", "Last command was: %s\n", cmd);
+			break;
+		default:
+			tmp = g_strdup_printf(_("Unknown error from %s server"), name);
+			break;
+	}
+
+	gaim_connection_error(gc, tmp);
+	
+	g_free(tmp);
+}
+
+static void
 connect_cb(gpointer data, gint source, GaimInputCondition cond)
 {
 	MsnServConn *servconn = data;
@@ -43,8 +80,8 @@
 	}
 	else
 	{
-		GaimConnection *gc = servconn->session->account->gc;
-		gaim_connection_error(gc, _("Unable to connect."));
+		servconn->cmdproc->error = MSN_ERROR_CONNECT;
+		show_error(servconn);
 	}
 }
 
@@ -192,46 +229,6 @@
 }
 
 static void
-show_error(MsnServConn *servconn)
-{
-	GaimConnection *gc;
-	char *tmp;
-	char *cmd;
-
-	const char *names[] = { "Notification", "Switchboard" };
-	const char *name;
-
-	gc = gaim_account_get_connection(servconn->session->account);
-	name = names[servconn->type];
-
-	switch (servconn->cmdproc->error)
-	{
-		case MSN_ERROR_CONNECT:
-			tmp = g_strdup_printf(_("Unable to connect to %s server"),
-								  name);
-			break;
-		case MSN_ERROR_WRITE:
-			tmp = g_strdup_printf(_("Error writing to %s server"), name);
-			break;
-		case MSN_ERROR_READ:
-			cmd = servconn->cmdproc->last_trans;
-			tmp = g_strdup_printf(_("Error reading from %s server. Last"
-									"command was:\n %s"), name, cmd);
-			break;
-		default:
-			tmp = g_strdup_printf(_("Unknown error from %s server"), name);
-			break;
-	}
-
-	if (servconn->type != MSN_SERVER_SB)
-		gaim_connection_error(gc, tmp);
-	else
-		gaim_notify_error(gc, NULL, tmp, NULL);
-
-	g_free(tmp);
-}
-
-static void
 failed_io(MsnServConn *servconn)
 {
 	show_error(servconn);