changeset 20589:5723dbc6212d

Clear the password consistently when we get a "Signed-On elsewhere" or a "Invalid Password" disconnection. Disconnection reason codes will take care of this in the core, but until then, this is ok. Fixes #3204.
author Daniel Atallah <daniel.atallah@gmail.com>
date Fri, 21 Sep 2007 02:46:27 +0000
parents e23a1585d822
children a2cb2a2fe424
files libpurple/protocols/msn/session.c libpurple/protocols/novell/novell.c libpurple/protocols/oscar/flap_connection.c libpurple/protocols/qq/login_logout.c libpurple/protocols/simple/simple.c libpurple/protocols/yahoo/yahoo.c
diffstat 6 files changed, 23 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/session.c	Fri Sep 21 01:49:27 2007 +0000
+++ b/libpurple/protocols/msn/session.c	Fri Sep 21 02:46:27 2007 +0000
@@ -269,7 +269,7 @@
 
 	/* The core used to use msn_add_buddy to add all buddies before
 	 * being logged in. This no longer happens, so we manually iterate
-	 * over the whole buddy list to identify sync issues. 
+	 * over the whole buddy list to identify sync issues.
 	 */
 	for (gnode = purple_get_blist()->root; gnode; gnode = gnode->next) {
 		PurpleGroup *group = (PurpleGroup *)gnode;
@@ -342,6 +342,8 @@
 		case MSN_ERROR_SIGN_OTHER:
 			gc->wants_to_die = TRUE;
 			msg = g_strdup(_("You have signed on from another location."));
+			if (!purple_account_get_remember_password(session->account))
+				purple_account_set_password(session->account, NULL);
 			break;
 		case MSN_ERROR_SERV_UNAVAILABLE:
 			msg = g_strdup(_("The MSN servers are temporarily "
--- a/libpurple/protocols/novell/novell.c	Fri Sep 21 01:49:27 2007 +0000
+++ b/libpurple/protocols/novell/novell.c	Fri Sep 21 02:46:27 2007 +0000
@@ -130,6 +130,8 @@
 		if (ret_code == NMERR_AUTHENTICATION_FAILED ||
 			ret_code == NMERR_CREDENTIALS_MISSING ||
 			ret_code == NMERR_PASSWORD_INVALID) {
+			if (!purple_account_get_remember_password(gc->account))
+				purple_account_set_password(gc->account, NULL);
 			gc->wants_to_die = TRUE;
 		}
 		purple_connection_error(gc, err);
@@ -2004,11 +2006,14 @@
 _evt_user_disconnect(NMUser * user, NMEvent * event)
 {
 	PurpleConnection *gc;
-
-	gc = purple_account_get_connection((PurpleAccount *) user->client_data);
+	PurpleAccount *account = user->client_data;
+
+	gc = purple_account_get_connection(account);
 	if (gc)
 	{
 		gc->wants_to_die = TRUE; /* we don't want to reconnect in this case */
+		if (!purple_account_get_remember_password(account))
+			purple_account_set_password(account, NULL);
 		purple_connection_error(gc, _("You have been logged out because you"
 									" logged in at another workstation."));
 	}
@@ -2799,7 +2804,7 @@
 	const char *text = NULL;
 
 	if (buddy == NULL)
-		return; 
+		return;
 
 	gc = purple_account_get_connection(buddy->account);
 	if (gc == NULL || (user = gc->proto_data) == NULL)
--- a/libpurple/protocols/oscar/flap_connection.c	Fri Sep 21 01:49:27 2007 +0000
+++ b/libpurple/protocols/oscar/flap_connection.c	Fri Sep 21 02:46:27 2007 +0000
@@ -382,6 +382,8 @@
 		gchar *tmp;
 		if (conn->disconnect_code == 0x0001) {
 			tmp = g_strdup(_("You have signed on from another location."));
+			if (!purple_account_get_remember_password(account))
+				purple_account_set_password(account, NULL);
 			od->gc->wants_to_die = TRUE;
 		} else if (conn->disconnect_reason == OSCAR_DISCONNECT_REMOTE_CLOSED)
 			tmp = g_strdup(_("Server closed the connection."));
--- a/libpurple/protocols/qq/login_logout.c	Fri Sep 21 01:49:27 2007 +0000
+++ b/libpurple/protocols/qq/login_logout.c	Fri Sep 21 02:46:27 2007 +0000
@@ -480,6 +480,8 @@
 	switch (ret) {
 	case QQ_LOGIN_REPLY_PWD_ERROR:
 		gc->wants_to_die = TRUE;
+		if (!purple_account_get_remember_password(gc->account))
+			purple_account_set_password(gc->account, NULL);
 		purple_connection_error(gc, _("Incorrect password."));
 		break;
 	case QQ_LOGIN_REPLY_MISC_ERROR:
--- a/libpurple/protocols/simple/simple.c	Fri Sep 21 01:49:27 2007 +0000
+++ b/libpurple/protocols/simple/simple.c	Fri Sep 21 02:46:27 2007 +0000
@@ -695,7 +695,7 @@
 static void do_register_exp(struct simple_account_data *sip, int expire) {
 	char *uri, *to, *contact, *hdr;
 
-	/* Set our default expiration to 900, 
+	/* Set our default expiration to 900,
 	 * as done in the initialization of the simple_account_data
 	 * structure.
 	 */
@@ -1042,6 +1042,8 @@
 				if(sip->registrar.retries > SIMPLE_REGISTER_RETRY_MAX) {
 					purple_debug_info("simple", "Setting wants_to_die to true.\n");
 					sip->gc->wants_to_die = TRUE;
+					if (!purple_account_get_remember_password(sip->gc->account))
+						purple_account_set_password(sip->gc->account, NULL);
 					purple_connection_error(sip->gc, _("Incorrect password."));
 					return TRUE;
 				}
--- a/libpurple/protocols/yahoo/yahoo.c	Fri Sep 21 01:49:27 2007 +0000
+++ b/libpurple/protocols/yahoo/yahoo.c	Fri Sep 21 02:46:27 2007 +0000
@@ -202,6 +202,8 @@
 
 	if (pkt->service == YAHOO_SERVICE_LOGOFF && pkt->status == -1) {
 		gc->wants_to_die = TRUE;
+		if (!purple_account_get_remember_password(account))
+			purple_account_set_password(account, NULL);
 		purple_connection_error(gc, _("You have signed on from another location."));
 		return;
 	}
@@ -4087,12 +4089,12 @@
 {
 	return TRUE;
 }
-	
+
 gboolean yahoo_send_attention(PurpleConnection *gc, const char *username, guint type)
 {
 	PurpleConversation *c;
 
-	c = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, 
+	c = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM,
 			username, gc->account);
 
 	g_return_val_if_fail(c != NULL, FALSE);
@@ -4117,7 +4119,7 @@
 		attn->incoming_description = _("%s has buzzed you!");
 		attn->outgoing_description = _("Buzzing %s...");
 		list = g_list_append(list, attn);
-	} 
+	}
 
 	return list;
 }