changeset 20198:454b2b7b333e

applied changes from 5fda75104115d0a95c1e214b6b3ca18c4dc86a0c through 4a76180762b242f02e4f50a0f4d1fd58e596c9cd
author Richard Laager <rlaager@wiktel.com>
date Fri, 28 Sep 2007 15:11:53 +0000
parents 5d3b4da9b084
children 56a6d78c6613
files libpurple/account.c libpurple/protocols/jabber/auth.c
diffstat 2 files changed, 33 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/account.c	Fri Sep 28 15:05:09 2007 +0000
+++ b/libpurple/account.c	Fri Sep 28 15:11:53 2007 +0000
@@ -916,7 +916,7 @@
 purple_account_set_register_callback(PurpleAccount *account, PurpleAccountRegistrationCb cb, void *user_data)
 {
 	g_return_if_fail(account != NULL);
-	
+
 	account->registration_cb = cb;
 	account->registration_cb_user_data = user_data;
 }
@@ -936,10 +936,10 @@
 purple_account_unregister(PurpleAccount *account, PurpleAccountUnregistrationCb cb, void *user_data)
 {
 	g_return_if_fail(account != NULL);
-	
+
 	purple_debug_info("account", "Unregistering account %s\n",
 					  purple_account_get_username(account));
-	
+
 	purple_connection_new_unregister(account, purple_account_get_password(account), cb, user_data);
 }
 
@@ -959,13 +959,21 @@
 	}
 
 	if(remember)
-	  purple_account_set_remember_password(account, TRUE);
+		purple_account_set_remember_password(account, TRUE);
 
 	purple_account_set_password(account, entry);
 
 	purple_connection_new(account, FALSE, entry);
 }
 
+static void
+request_password_cancel_cb(PurpleAccount *account, PurpleRequestFields *fields)
+{
+	/* Disable the account as the user has canceled connecting */
+	purple_account_set_enabled(account, purple_core_get_ui(), FALSE);
+}
+
+
 void
 purple_account_request_password(PurpleAccount *account, GCallback ok_cb,
 				GCallback cancel_cb, void *user_data)
@@ -1039,7 +1047,7 @@
 	if ((password == NULL) &&
 		!(prpl_info->options & OPT_PROTO_NO_PASSWORD) &&
 		!(prpl_info->options & OPT_PROTO_PASSWORD_OPTIONAL))
-		purple_account_request_password(account, G_CALLBACK(request_password_ok_cb), NULL, account);
+		purple_account_request_password(account, G_CALLBACK(request_password_ok_cb), G_CALLBACK(request_password_cancel_cb), account);
 	else
 		purple_connection_new(account, FALSE, password);
 }
@@ -1110,18 +1118,18 @@
 	g_free(info);
 }
 
-void 
+void
 purple_account_request_close_with_account(PurpleAccount *account)
 {
 	GList *l, *l_next;
-	
+
 	g_return_if_fail(account != NULL);
-	
+
 	for (l = handles; l != NULL; l = l_next) {
 		PurpleAccountRequestInfo *info = l->data;
-		
+
 		l_next = l->next;
-		
+
 		if (info->account == account) {
 			handles = g_list_remove(handles, info);
 			purple_account_request_close_info(info);
@@ -1129,18 +1137,18 @@
 	}
 }
 
-void 
+void
 purple_account_request_close(void *ui_handle)
 {
 	GList *l, *l_next;
-	
+
 	g_return_if_fail(ui_handle != NULL);
-	
+
 	for (l = handles; l != NULL; l = l_next) {
 		PurpleAccountRequestInfo *info = l->data;
-		
+
 		l_next = l->next;
-		
+
 		if (info->ui_handle == ui_handle) {
 			handles = g_list_remove(handles, info);
 			purple_account_request_close_info(info);
@@ -1171,7 +1179,7 @@
 		handles = g_list_append(handles, info);
 		return info->ui_handle;
 	}
-	
+
 	return NULL;
 }
 
@@ -2442,7 +2450,7 @@
 						 purple_value_new(PURPLE_TYPE_SUBTYPE,
 							 			PURPLE_SUBTYPE_ACCOUNT),
 						 purple_value_new(PURPLE_TYPE_STRING));
-	
+
 	load_accounts();
 
 }
--- a/libpurple/protocols/jabber/auth.c	Fri Sep 28 15:05:09 2007 +0000
+++ b/libpurple/protocols/jabber/auth.c	Fri Sep 28 15:11:53 2007 +0000
@@ -23,6 +23,7 @@
 #include "account.h"
 #include "debug.h"
 #include "cipher.h"
+#include "core.h"
 #include "conversation.h"
 #include "request.h"
 #include "sslconn.h"
@@ -66,10 +67,10 @@
 
 		auth = xmlnode_new("auth");
 		xmlnode_set_namespace(auth, "urn:ietf:params:xml:ns:xmpp-sasl");
-		
+
 		xmlnode_set_attrib(auth, "xmlns:ga", "http://www.google.com/talk/protocol/auth");
 		xmlnode_set_attrib(auth, "ga:client-uses-full-bind-result", "true");
-		
+
 		response = g_string_new("");
 		response = g_string_append_len(response, "\0", 1);
 		response = g_string_append(response, js->user->node);
@@ -202,7 +203,7 @@
 
 	return TRUE;
 }
-	
+
 static void auth_pass_cb(PurpleConnection *conn, PurpleRequestFields *fields)
 {
 	JabberStream *js;
@@ -236,7 +237,7 @@
 
 	if (!auth_pass_generic(js, fields))
 		return;
-	
+
 	/* Restart our connection */
 	jabber_auth_start_old(js);
 }
@@ -253,7 +254,8 @@
 
 	js = conn->proto_data;
 
-	purple_connection_error(conn, _("Password is required to sign on."));
+	/* Disable the account as the user has canceled connecting */
+	purple_account_set_enabled(conn->account, purple_core_get_ui(), FALSE);
 }
 
 static void jabber_auth_start_cyrus(JabberStream *js)
@@ -621,7 +623,7 @@
 	 * to OPTIONAL for this protocol. So, we need to do our own
 	 * password prompting here
 	 */
-	
+
 	if (!purple_account_get_password(js->gc->account)) {
 		purple_account_request_password(js->gc->account, G_CALLBACK(auth_old_pass_cb), G_CALLBACK(auth_no_pass_cb), js->gc);
 		return;