/cpw/tomkiewicz/masterpassword: fda68dc6481c: Don't require impl...

Tomasz Wasilczyk tomkiewicz at cpw.pidgin.im
Sat Mar 23 17:09:19 EDT 2013


Changeset: fda68dc6481ca61ad3f7824393822d075d11d0dd
Author:	 Tomasz Wasilczyk <tomkiewicz at cpw.pidgin.im>
Date:	 2013-03-23 22:09 +0100
Branch:	 soc.2008.masterpassword
URL: https://hg.pidgin.im/cpw/tomkiewicz/masterpassword/rev/fda68dc6481c

Description:

Don't require implementing import/export of password

diffstat:

 libpurple/account.c                        |  10 ++++------
 libpurple/keyring.c                        |  25 ++++++++++++++-----------
 libpurple/plugins/keyrings/kwallet.cpp     |  20 --------------------
 libpurple/plugins/keyrings/secretservice.c |  27 ---------------------------
 4 files changed, 18 insertions(+), 64 deletions(-)

diffs (157 lines):

diff --git a/libpurple/account.c b/libpurple/account.c
--- a/libpurple/account.c
+++ b/libpurple/account.c
@@ -380,17 +380,15 @@ account_to_xmlnode(PurpleAccount *accoun
 
 	if (purple_account_get_remember_password(account))
 	{
-		purple_keyring_export_password(account, &keyring_id, 
-			&mode, &data, &error, &destroy);
+		gboolean exported = purple_keyring_export_password(account,
+			&keyring_id, &mode, &data, &error, &destroy);
 
 		if (error != NULL) {
-
 			purple_debug_error("account",
 				"Failed to export password for account %s : %s.\n",
 				purple_account_get_username(account),
 				error->message);
-
-		} else {
+		} else if (exported) {
 			child = xmlnode_new_child(node, "password");
 			if (keyring_id != NULL)
 				xmlnode_set_attrib(child, "keyring_id", keyring_id);
@@ -978,7 +976,7 @@ parse_account(xmlnode *node)
 		if (result == TRUE) {
 			purple_account_set_remember_password(ret, TRUE);
 		} else {
-			purple_debug_info("account", "Failed to import password.\n");
+			purple_debug_error("account", "Failed to import password.\n");
 		} 
 		g_free(data); 
 	}
diff --git a/libpurple/keyring.c b/libpurple/keyring.c
--- a/libpurple/keyring.c
+++ b/libpurple/keyring.c
@@ -822,13 +822,12 @@ purple_keyring_import_password(PurpleAcc
 
 	import = purple_keyring_get_import_password(inuse);
 	if (import == NULL) {
-		if (error != NULL) {
-			*error = g_error_new(PURPLE_KEYRING_ERROR,
-				PURPLE_KEYRING_ERROR_NOCAP,
-				"Keyring cannot import password info.");
+		if (purple_debug_is_verbose()) {
+			purple_debug_misc("Keyring", "Configured keyring "
+				"cannot import password info. This might be "
+				"normal.\n");
 		}
-		purple_debug_info("Keyring", "Configured keyring cannot import password info. This might be normal.\n");
-		return FALSE;
+		return TRUE;
 	}
 
 	return import(account, mode, data, error);
@@ -876,11 +875,15 @@ purple_keyring_export_password(PurpleAcc
 	export = purple_keyring_get_export_password(inuse);
 
 	if (export == NULL) {
-		*error = g_error_new(PURPLE_KEYRING_ERROR, PURPLE_KEYRING_ERROR_NOCAP,
-			"Keyring cannot export password info.");
-		purple_debug_info("keyring",
-			"Keyring cannot export password info. This might be normal.\n");
-		return FALSE;
+		if (purple_debug_is_verbose()) {
+			purple_debug_misc("Keyring", "Configured keyring "
+				"cannot export password info. This might be "
+				"normal.\n");
+		}
+		*mode = NULL;
+		*data = NULL;
+		*destroy = NULL;
+		return TRUE;
 	}
 
 	return export(account, mode, data, error, destroy);
diff --git a/libpurple/plugins/keyrings/kwallet.cpp b/libpurple/plugins/keyrings/kwallet.cpp
--- a/libpurple/plugins/keyrings/kwallet.cpp
+++ b/libpurple/plugins/keyrings/kwallet.cpp
@@ -450,24 +450,6 @@ kwallet_close(GError **error)
 }
 
 static gboolean
-kwallet_import(PurpleAccount *account, const char *mode, const char *data,
-	GError **error)
-{
-	return TRUE;
-}
-
-static gboolean
-kwallet_export(PurpleAccount *account, const char **mode, char **data,
-	GError **error, GDestroyNotify *destroy)
-{
-	*mode = NULL;
-	*data = NULL;
-	*destroy = NULL;
-
-	return TRUE;
-}
-
-static gboolean
 kwallet_load(PurplePlugin *plugin)
 {
 	if (!qCoreApp) {
@@ -489,8 +471,6 @@ kwallet_load(PurplePlugin *plugin)
 	purple_keyring_set_read_password(keyring_handler, kwallet_read);
 	purple_keyring_set_save_password(keyring_handler, kwallet_save);
 	purple_keyring_set_close_keyring(keyring_handler, kwallet_close);
-	purple_keyring_set_import_password(keyring_handler, kwallet_import);
-	purple_keyring_set_export_password(keyring_handler, kwallet_export);
 
 	purple_keyring_register(keyring_handler);
 
diff --git a/libpurple/plugins/keyrings/secretservice.c b/libpurple/plugins/keyrings/secretservice.c
--- a/libpurple/plugins/keyrings/secretservice.c
+++ b/libpurple/plugins/keyrings/secretservice.c
@@ -236,31 +236,6 @@ ss_close(GError **error)
 }
 
 static gboolean
-ss_import_password(PurpleAccount *account,
-                    const char *mode,
-                    const char *data,
-                    GError **error)
-{
-	purple_debug_info("keyring-libsecret", "Importing password.\n");
-	return TRUE;
-}
-
-static gboolean
-ss_export_password(PurpleAccount *account,
-                    const char **mode,
-                    char **data,
-                    GError **error,
-                    GDestroyNotify *destroy)
-{
-	purple_debug_info("keyring-libsecret", "Exporting password.\n");
-	*data = NULL;
-	*mode = NULL;
-	*destroy = NULL;
-
-	return TRUE;
-}
-
-static gboolean
 ss_init(void)
 {
 	purple_debug_info("keyring-libsecret", "Init.\n");
@@ -272,8 +247,6 @@ ss_init(void)
 	purple_keyring_set_read_password(keyring_handler, ss_read);
 	purple_keyring_set_save_password(keyring_handler, ss_save);
 	purple_keyring_set_close_keyring(keyring_handler, ss_close);
-	purple_keyring_set_import_password(keyring_handler, ss_import_password);
-	purple_keyring_set_export_password(keyring_handler, ss_export_password);
 
 	purple_keyring_register(keyring_handler);
 



More information about the Commits mailing list