changeset 17881:a8b1159fd95b

Simplified registration callback per request of Sean.
author Andreas Monitzer <pidgin@monitzer.com>
date Fri, 22 Jun 2007 11:52:50 +0000
parents ca0b86f3dbd2
children f88b3a093cba
files libpurple/account.h libpurple/protocols/jabber/jabber.c libpurple/protocols/jabber/jabber.h
diffstat 3 files changed, 10 insertions(+), 34 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/account.h	Fri Jun 22 00:05:35 2007 +0000
+++ b/libpurple/account.h	Fri Jun 22 11:52:50 2007 +0000
@@ -36,7 +36,7 @@
 
 typedef gboolean (*PurpleFilterAccountFunc)(PurpleAccount *account);
 typedef void (*PurpleAccountRequestAuthorizationCb)(void *);
-typedef void (*PurpleAccountRegistrationCb)(PurpleAccount *account, gboolean succeeded, const char *username, const char *password, void *user_data);
+typedef void (*PurpleAccountRegistrationCb)(PurpleAccount *account, gboolean succeeded, void *user_data);
 
 #include "connection.h"
 #include "log.h"
--- a/libpurple/protocols/jabber/jabber.c	Fri Jun 22 00:05:35 2007 +0000
+++ b/libpurple/protocols/jabber/jabber.c	Fri Jun 22 11:52:50 2007 +0000
@@ -651,16 +651,8 @@
 		if(js->registration) {
 			buf = g_strdup_printf(_("Registration of %s@%s successful"),
 				js->user->node, js->user->domain);
-			if(account->registration_cb) {
-				char *jid = g_strdup_printf("%s@%s", js->user->node, js->user->domain);
-				(account->registration_cb)(account, TRUE, jid, js->password, account->registration_cb_user_data);
-				g_free(jid);
-				/* the password shouldn't be kept around longer than necessary */
-				if(js->password) {
-					g_free(js->password);
-					js->password = NULL;
-				}
-			}
+			if(account->registration_cb)
+				(account->registration_cb)(account, TRUE, account->registration_cb_user_data);
 		}
 		else
 			buf = g_strdup_printf(_("Registration to %s successful"),
@@ -677,16 +669,8 @@
 		purple_notify_error(NULL, _("Registration Failed"),
 				_("Registration Failed"), msg);
 		g_free(msg);
-		if(account->registration_cb) {
-			char *jid = g_strdup_printf("%s@%s", js->user->node, js->user->domain);
-			(account->registration_cb)(account, FALSE, NULL, NULL, account->registration_cb_user_data);
-			g_free(jid);
-			/* the password shouldn't be kept around longer than necessary */
-			if(js->password) {
-				g_free(js->password);
-				js->password = NULL;
-			}
-		}
+		if(account->registration_cb)
+			(account->registration_cb)(account, FALSE, account->registration_cb_user_data);
 	}
 	g_free(to);
 	if(js->registration)
@@ -755,11 +739,8 @@
 					g_free(cbdata->js->user->node);
 				cbdata->js->user->node = g_strdup(value);
 			}
-			if(cbdata->js->registration && !strcmp(id, "password")) {
-				if(cbdata->js->password)
-					g_free(cbdata->js->password);
-				cbdata->js->password = g_strdup(value);
-			}
+			if(cbdata->js->registration && !strcmp(id, "password"))
+				purple_account_set_password(cbdata->js->gc->account, value);
 		}
 	}
 
@@ -782,7 +763,7 @@
 	PurpleAccount *account = purple_connection_get_account(cbdata->js->gc);
 	if(cbdata->js->registration) {
 		if(account->registration_cb)
-			(account->registration_cb)(account, FALSE, NULL, NULL, account->registration_cb_user_data);
+			(account->registration_cb)(account, FALSE, account->registration_cb_user_data);
 		jabber_connection_schedule_close(cbdata->js);
 	}
 	g_free(cbdata->who);
@@ -831,7 +812,7 @@
 				_("Already Registered"), NULL);
 		if(js->registration) {
 			if(account->registration_cb)
-				(account->registration_cb)(account, FALSE, NULL, NULL, account->registration_cb_user_data);
+				(account->registration_cb)(account, FALSE, account->registration_cb_user_data);
 			jabber_connection_schedule_close(js);
 		}
 		return;
@@ -853,7 +834,7 @@
 				if(js->registration) {
 					js->gc->wants_to_die = TRUE;
 					if(account->registration_cb) /* succeeded, but we have no login info */
-						(account->registration_cb)(account, TRUE, NULL, NULL, account->registration_cb_user_data);
+						(account->registration_cb)(account, TRUE, account->registration_cb_user_data);
 					jabber_connection_schedule_close(js);
 				}
 				return;
@@ -1134,8 +1115,6 @@
 #endif
 	if(js->serverFQDN)
 		g_free(js->serverFQDN);
-	if(js->password)
-		g_free(js->password);
 	g_free(js->server_name);
 	g_free(js->gmail_last_time);
 	g_free(js->gmail_last_tid);
--- a/libpurple/protocols/jabber/jabber.h	Fri Jun 22 00:05:35 2007 +0000
+++ b/libpurple/protocols/jabber/jabber.h	Fri Jun 22 11:52:50 2007 +0000
@@ -154,9 +154,6 @@
 #endif
 	char *serverFQDN;
 	
-	/* don't expect this to be filled in */
-	char *password;
-	
 	/* does the local server support PEP? */
 	gboolean pep;