soc.2008.masterpassword: 378b58b6: Fixed two bugs that caused everything to...

scrouaf at soc.pidgin.im scrouaf at soc.pidgin.im
Fri Aug 15 22:25:55 EDT 2008


-----------------------------------------------------------------
Revision: 378b58b6aa7f2f7424cf1e2321866e7c93336884
Ancestor: edf6be62a046a003a75458e4ce0807af9c2e9598
Author: scrouaf at soc.pidgin.im
Date: 2008-08-15T16:58:06
Branch: im.pidgin.soc.2008.masterpassword
URL: http://d.pidgin.im/viewmtn/revision/info/378b58b6aa7f2f7424cf1e2321866e7c93336884

Modified files:
        libpurple/account.c libpurple/connection.c
        libpurple/plugins/keyrings/gnomekeyring.c
        libpurple/plugins/keyrings/internalkeyring.c

ChangeLog: 

Fixed two bugs that caused everything to go wrong when accounts were connected
or disconnected.

-------------- next part --------------
============================================================
--- libpurple/account.c	a5e3bf543a269a3102833771b3d34a37596f6f03
+++ libpurple/account.c	8f8aa52620113831e04edaf8d7da193c78044ec8
@@ -1168,7 +1168,7 @@ request_password_ok_cb(PurpleAccount *ac
 		purple_account_set_remember_password(account, TRUE);
 
 	/* XXX this might be a problem if a read occurs before the write is finished */
-	purple_account_set_password_async(account, g_strdup(entry), g_free, NULL, NULL);
+	purple_account_set_password(account, entry);
 
 	purple_connection_new(account, FALSE, entry);
 }
@@ -1615,7 +1615,7 @@ purple_account_set_password(PurpleAccoun
 		account->password = g_strdup(password);
 
 	else
-		purple_keyring_set_password_async(account, g_strdup(password), g_free, NULL, NULL);
+		purple_keyring_set_password_sync(account, password);
 
 	schedule_accounts_save();
 }
============================================================
--- libpurple/connection.c	86690bfbdfe4d6bbb9bf7bf9fa7abec03ab67a9a
+++ libpurple/connection.c	a6f921d711d5e480297fb161211ce985e31ac737
@@ -443,7 +443,12 @@ purple_connection_get_password(const Pur
 {
 	g_return_val_if_fail(gc != NULL, NULL);
 
-	return gc->password ? gc->password : purple_account_get_password(gc->account);
+	if (gc->password) {
+		return gc->password;
+	} else {
+		purple_debug_info("connection",
+			"Password was unknown, getting password from account");
+		return purple_account_get_password(gc->account);
 }
 
 void
@@ -452,7 +457,7 @@ purple_connection_get_password_async(Pur
 				     gpointer data)
 {
 	char * password;
-	g_return_val_if_fail(gc != NULL, NULL);
+	g_return_if_fail(gc != NULL);
 
 	if (gc->password != NULL) {
 		/* casted to prevent warning */
@@ -517,11 +522,9 @@ purple_connection_disconnect_got_pw_cb(P
 				       GError * error,
 				       gpointer data)
 {
-	/* FIXME : handle error */
-	char * pw = g_strdup(password);
-
+	/* FIXME : needs to be async */
 	purple_account_disconnect(account);
-	purple_account_set_password_async(account, g_strdup(pw), g_free, NULL, NULL);
+	purple_account_set_password(account, password);
 }
 
 void
============================================================
--- libpurple/plugins/keyrings/gnomekeyring.c	c5b8750e267af5ffaad947b07c4329c59ed7d7db
+++ libpurple/plugins/keyrings/gnomekeyring.c	692b04cbd20c9e00ddc89a8625d666b0a12f0b60
@@ -239,6 +239,8 @@ gkp_save_continue(GnomeKeyringResult res
 	GError * error;
 	PurpleAccount * account = storage->account;
 
+	g_return_if_fail(storage != NULL);
+
 	if (result != GNOME_KEYRING_RESULT_OK) {
 		switch(result)
 		{
@@ -290,6 +292,7 @@ gkp_save_continue(GnomeKeyringResult res
 
 		if(cb != NULL)
 			cb(account, NULL, storage->user_data);
+
 		return;
 	
 	}
============================================================
--- libpurple/plugins/keyrings/internalkeyring.c	59f457c7cdfcae457e24b449ff93a07eb520e95f
+++ libpurple/plugins/keyrings/internalkeyring.c	a60976c9fc96aa38dc229ecfcfa0b97de82cadd3
@@ -146,7 +146,7 @@ internal_keyring_save(PurpleAccount * ac
 
 	}
 
-	if(destroy != NULL)
+	if(destroy && password)
 		destroy(password);
 
 	if (cb != NULL)


More information about the Commits mailing list