changeset 31760:02b0fbc627c0

merge of '385542a8270ac30d2121b533494264a28cd04423' and '99c20d86165b24daadeb247977bbb6d4b80b94bf'
author Mark Doliner <mark@kingant.net>
date Mon, 07 Mar 2011 06:43:26 +0000
parents 5fa13ec086e0 (diff) 356adba49dae (current diff)
children 2e0cff411cc9
files libpurple/protocols/jabber/jabber.c
diffstat 1 files changed, 7 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/jabber.c	Sun Mar 06 23:49:32 2011 +0000
+++ b/libpurple/protocols/jabber/jabber.c	Mon Mar 07 06:43:26 2011 +0000
@@ -924,25 +924,24 @@
 	PurpleConnection *gc = purple_account_get_connection(account);
 	JabberStream *js;
 	PurplePresence *presence;
-	gchar *user;
+	const gchar *username;
 	gchar *slash;
 
 	js = gc->proto_data = g_new0(JabberStream, 1);
 	js->gc = gc;
 	js->fd = -1;
 
-	user = g_strdup(purple_account_get_username(account));
+	username = purple_account_get_username(account);
 	/* jabber_id_new doesn't accept "user@domain/" as valid */
-	slash = strchr(user, '/');
+	slash = strchr(username, '/');
 	if (slash && *(slash + 1) == '\0')
 		*slash = '\0';
-	js->user = jabber_id_new(user);
+	js->user = jabber_id_new(username);
 
 	if (!js->user) {
 		purple_connection_error_reason(gc,
 			PURPLE_CONNECTION_ERROR_INVALID_SETTINGS,
 			_("Invalid XMPP ID"));
-		g_free(user);
 		/* Destroying the connection will free the JabberStream */
 		return NULL;
 	}
@@ -951,7 +950,6 @@
 		purple_connection_error_reason(gc,
 			PURPLE_CONNECTION_ERROR_INVALID_SETTINGS,
 			_("Invalid XMPP ID. Username portion must be set."));
-		g_free(user);
 		/* Destroying the connection will free the JabberStream */
 		return NULL;
 	}
@@ -960,7 +958,6 @@
 		purple_connection_error_reason(gc,
 			PURPLE_CONNECTION_ERROR_INVALID_SETTINGS,
 			_("Invalid XMPP ID. Domain must be set."));
-		g_free(user);
 		/* Destroying the connection will free the JabberStream */
 		return NULL;
 	}
@@ -971,10 +968,9 @@
 	/* This is overridden during binding, but we need it here
 	 * in case the server only does legacy non-sasl auth!.
 	 */
-	purple_connection_set_display_name(gc, user);
-
-	js->user_jb = jabber_buddy_find(js, user, TRUE);
-	g_free(user);
+	purple_connection_set_display_name(gc, username);
+
+	js->user_jb = jabber_buddy_find(js, username, TRUE);
 	if (!js->user_jb) {
 		/* This basically *can't* fail, but for good measure... */
 		purple_connection_error_reason(gc,