diff libpurple/protocols/jabber/jabber.c @ 16996:37a2d6eadd34

fix #699 People usually enter IP addresses into Connect Server, and that's not gonna be a FQDN, which we need for SASL to work correctly. If this causes problems for people (i.e. they were depending on the old behavior of assuming that the connect server was the fqdn), then we'll have to implement something smarter to detect IP addresses vs hostnames, and make TheRightDecision(TM)
author Nathan Walp <nwalp@pidgin.im>
date Fri, 11 May 2007 00:15:12 +0000
parents 919515748253
children efb5d0fe4895 4b4eb353cf9f 988102692e39
line wrap: on
line diff
--- a/libpurple/protocols/jabber/jabber.c	Fri May 11 00:11:14 2007 +0000
+++ b/libpurple/protocols/jabber/jabber.c	Fri May 11 00:15:12 2007 +0000
@@ -508,13 +508,13 @@
 			jabber_login_callback_ssl, jabber_ssl_connect_failure, js->gc);
 }
 
-static void jabber_login_connect(JabberStream *js, const char *server, int port)
+static void jabber_login_connect(JabberStream *js, const char *fqdn, const char *host, int port)
 {
 #ifdef HAVE_CYRUS_SASL
-	js->serverFQDN = g_strdup(server);
+	js->serverFQDN = g_strdup(fqdn);
 #endif
 
-	if (purple_proxy_connect(js->gc, js->gc->account, server,
+	if (purple_proxy_connect(js->gc, js->gc->account, host,
 			port, jabber_login_callback, js->gc) == NULL)
 		purple_connection_error(js->gc, _("Unable to create socket"));
 }
@@ -527,10 +527,10 @@
 	js->srv_query_data = NULL;
 
 	if(results) {
-		jabber_login_connect(js, resp->hostname, resp->port);
+		jabber_login_connect(js, resp->hostname, resp->hostname, resp->port);
 		g_free(resp);
 	} else {
-		jabber_login_connect(js, js->user->domain,
+		jabber_login_connect(js, js->user->domain, js->user->domain,
 			purple_account_get_int(js->gc->account, "port", 5222));
 	}
 }
@@ -604,7 +604,7 @@
 	 * invoke the magic of SRV lookups, to figure out host and port */
 	if(!js->gsc) {
 		if(connect_server[0]) {
-			jabber_login_connect(js, connect_server, purple_account_get_int(account, "port", 5222));
+			jabber_login_connect(js, js->user->domain, connect_server, purple_account_get_int(account, "port", 5222));
 		} else {
 			js->srv_query_data = purple_srv_resolve("xmpp-client",
 					"tcp", js->user->domain, srv_resolved_cb, js);
@@ -949,7 +949,7 @@
 
 	if(!js->gsc) {
 		if (connect_server[0]) {
-			jabber_login_connect(js, server,
+			jabber_login_connect(js, js->user->domain, server,
 			                     purple_account_get_int(account,
 			                                          "port", 5222));
 		} else {