changeset 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 44a6eeaabd80
children 0f4a5ff5dc84 1d92b85ef5d9 98633d62ec87
files libpurple/protocols/jabber/jabber.c
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
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)