diff src/protocols/msn/notification.c @ 10568:fed2a7c2471d

[gaim-migrate @ 11954] Some MSN bits: - Fix HTTP Method works when using an HTTP proxy that require authentication (Bastien Durel) - Better error reporting when the MSN servers are temporarily unavailable - Prevent zombie failed switchboard connections swallowing up messages - Fix win32 crashes receiving messages from aMSN with no formatting info - Fix a crash when the connection to the nexus server fails - maybe some other stuff, I forgot how much had piled up committer: Tailor Script <tailor@pidgin.im>
author Stu Tomlinson <stu@nosnilmot.com>
date Thu, 03 Feb 2005 19:47:52 +0000
parents bec9130b24d2
children 0f7452b1f777
line wrap: on
line diff
--- a/src/protocols/msn/notification.c	Thu Feb 03 15:37:13 2005 +0000
+++ b/src/protocols/msn/notification.c	Thu Feb 03 19:47:52 2005 +0000
@@ -269,6 +269,30 @@
 }
 
 static void
+usr_error(MsnCmdProc *cmdproc, MsnTransaction *trans, int error)
+{
+	MsnErrorType msnerr = 0;
+
+	switch (error)
+	{
+		case 500:
+		case 601:
+		case 910:
+		case 921:
+			msnerr = MSN_ERROR_SERV_UNAVAILABLE;
+			break;
+		case 911:
+			msnerr = MSN_ERROR_AUTH;
+			break;
+		default:
+			return;
+			break;
+	}
+
+	msn_session_set_error(cmdproc->session, msnerr, NULL);
+}
+
+static void
 ver_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
 {
 	MsnSession *session;
@@ -322,6 +346,9 @@
 {
 	g_return_if_fail(notification != NULL);
 
+	if (!notification->in_use)
+		return;
+
 	msn_cmdproc_send_quick(notification->cmdproc, "OUT", NULL, NULL);
 
 	msn_notification_disconnect(notification);
@@ -976,7 +1003,8 @@
 	swboard->im_user = g_strdup(cmd->params[4]);
 	/* msn_switchboard_add_user(swboard, cmd->params[4]); */
 
-	msn_switchboard_connect(swboard, host, port);
+	if (!msn_switchboard_connect(swboard, host, port))
+		msn_switchboard_destroy(swboard);
 
 	g_free(host);
 }
@@ -1320,15 +1348,7 @@
 	msn_table_add_error(cbs_table, "REG", reg_error);
 	msn_table_add_error(cbs_table, "RMG", rmg_error);
 	/* msn_table_add_error(cbs_table, "REA", rea_error); */
-
-	/* I received a '500' error from the notification server just now.
-	 * I think this means 'Service temporarily unavailable' or similar,
-	 * in response to a USR command. We should report this instead of
-	 * 'Error reading from notification server'.
-	 * I'm not going to implement this right now, because we're string
-	 * frozen (and I'd probably break something anyway), so I'll put this
-	 * here as a reminder, or something. Stu. */
-	/* msn_table_add_error(cbs_table, "USR", usr_error); */
+	msn_table_add_error(cbs_table, "USR", usr_error);
 
 	msn_table_add_msg_type(cbs_table,
 						   "text/x-msmsgsprofile",