diff libpurple/protocols/jabber/jabber.c @ 21058:647b841ea945

This patch prevents changing the saved account password for XMPP accounts if the server returns an error. Fixes #2265.
author John Bailey <rekkanoryo@rekkanoryo.org>
date Fri, 02 Nov 2007 06:59:04 +0000
parents 89c7be36fd61
children 6de09629f091
line wrap: on
line diff
--- a/libpurple/protocols/jabber/jabber.c	Fri Nov 02 01:41:41 2007 +0000
+++ b/libpurple/protocols/jabber/jabber.c	Fri Nov 02 06:59:04 2007 +0000
@@ -1664,6 +1664,8 @@
 	if(type && !strcmp(type, "result")) {
 		purple_notify_info(js->gc, _("Password Changed"), _("Password Changed"),
 				_("Your password has been changed."));
+
+		purple_account_set_password(js->gc->account, (char *)data);
 	} else {
 		char *msg = jabber_parse_error(js, packet);
 
@@ -1671,6 +1673,8 @@
 				_("Error changing password"), msg);
 		g_free(msg);
 	}
+
+	g_free(data);
 }
 
 static void jabber_password_change_cb(JabberStream *js,
@@ -1699,11 +1703,9 @@
 	y = xmlnode_new_child(query, "password");
 	xmlnode_insert_data(y, p1, -1);
 
-	jabber_iq_set_callback(iq, jabber_password_change_result_cb, NULL);
+	jabber_iq_set_callback(iq, jabber_password_change_result_cb, g_strdup(p1));
 
 	jabber_iq_send(iq);
-
-	purple_account_set_password(js->gc->account, p1);
 }
 
 static void jabber_password_change(PurplePluginAction *action)