changeset 5385:150cf1615098

[gaim-migrate @ 5761] This should let gaim jump to the new notification server when the server tells us to. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Thu, 15 May 2003 20:28:10 +0000
parents 0b544518a365
children fff5a7bfdb62
files src/protocols/msn/notification.c
diffstat 1 files changed, 30 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/msn/notification.c	Thu May 15 20:26:34 2003 +0000
+++ b/src/protocols/msn/notification.c	Thu May 15 20:28:10 2003 +0000
@@ -1031,7 +1031,7 @@
 	char *c;
 	int port;
 
-	if (strcmp(params[1], "SB")) {
+	if (strcmp(params[1], "SB") && strcmp(params[1], "NS")) {
 		hide_login_progress(gc, _("Got invalid XFR"));
 		signoff(gc);
 		
@@ -1047,25 +1047,40 @@
 	else
 		port = 1863;
 
-	swboard = msn_session_find_unused_switch(session);
+	if (!strcmp(params[1], "SB")) {
+		swboard = msn_session_find_unused_switch(session);
 
-	if (swboard == NULL) {
-		gaim_debug(GAIM_DEBUG_ERROR, "msn",
-				   "Received an XFR SB request when there's no unused "
-				   "switchboards!\n");
-		return FALSE;
-	}
+		if (swboard == NULL) {
+			gaim_debug(GAIM_DEBUG_ERROR, "msn",
+					   "Received an XFR SB request when there's no unused "
+					   "switchboards!\n");
+			return FALSE;
+		}
+
+		msn_switchboard_set_auth_key(swboard, params[4]);
+
+		if (!msn_switchboard_connect(swboard, host, port)) {
+			gaim_debug(GAIM_DEBUG_ERROR, "msn",
+					   "Unable to connect to switchboard on %s, port %d\n",
+					   host, port);
 
-	msn_switchboard_set_auth_key(swboard, params[4]);
+			g_free(host);
+
+			return FALSE;
+		}
+	}
+	else if (!strcmp(params[1], "NS")) {
+		msn_servconn_destroy(session->notification_conn);
 
-	if (!msn_switchboard_connect(swboard, host, port)) {
-		gaim_debug(GAIM_DEBUG_ERROR, "msn",
-				   "Unable to connect to switchboard on %s, port %d\n",
-				   host, port);
+		session->notification_conn = msn_notification_new(session, host, port);
 
-		g_free(host);
+		if (!msn_servconn_connect(session->notification_conn)) {
+			hide_login_progress(gc, _("Unable to transfer to "
+									  "notification server"));
+			signoff(gc);
 
-		return FALSE;
+			return FALSE;
+		}
 	}
 
 	g_free(host);