/cpw/tomkiewicz/masterpassword: 94102637e7c7: Coding style and e...
Tomasz Wasilczyk
tomkiewicz at cpw.pidgin.im
Sun Apr 28 09:56:04 EDT 2013
Changeset: 94102637e7c7f40e00cb11d8d57d6fe78452afda
Author: Tomasz Wasilczyk <tomkiewicz at cpw.pidgin.im>
Date: 2013-04-28 15:55 +0200
Branch: soc.2008.masterpassword
URL: https://hg.pidgin.im/cpw/tomkiewicz/masterpassword/rev/94102637e7c7
Description:
Coding style and entry description for GNOME Keyring
diffstat:
libpurple/account.c | 29 ++++++++++++---------------
libpurple/keyring.c | 2 +-
libpurple/plugins/keyrings/gnomekeyring.c | 7 ++++-
libpurple/plugins/keyrings/internalkeyring.c | 18 +++++++++++-----
libpurple/plugins/keyrings/kwallet.cpp | 6 +++-
5 files changed, 35 insertions(+), 27 deletions(-)
diffs (177 lines):
diff --git a/libpurple/account.c b/libpurple/account.c
--- a/libpurple/account.c
+++ b/libpurple/account.c
@@ -385,7 +385,7 @@ account_to_xmlnode(PurpleAccount *accoun
if (error != NULL) {
purple_debug_error("account",
- "Failed to export password for account %s : %s.\n",
+ "Failed to export password for account %s: %s.\n",
purple_account_get_username(account),
error->message);
} else if (exported) {
@@ -2238,16 +2238,15 @@ purple_account_get_username(const Purple
}
static void
-purple_account_get_password_async_finish(PurpleAccount *account,
+purple_account_get_password_got(PurpleAccount *account,
const gchar *password, GError *error, gpointer data)
{
PurpleCallbackBundle *cbb = data;
PurpleKeyringReadCallback cb;
purple_debug_info("account",
- "Read password for account %s (%s) from async keyring.\n",
- purple_account_get_username(account),
- purple_account_get_protocol_id(account));
+ "Read password for account %s from async keyring.\n",
+ purple_account_get_username(account));
purple_str_wipe(account->password);
account->password = g_strdup(password);
@@ -2270,9 +2269,8 @@ purple_account_get_password(PurpleAccoun
if (account->password != NULL) {
purple_debug_info("account",
- "Reading password for account %s (%s) from cache.\n",
- purple_account_get_username(account),
- purple_account_get_protocol_id(account));
+ "Reading password for account %s from cache.\n",
+ purple_account_get_username(account));
cb(account, account->password, NULL, data);
} else {
PurpleCallbackBundle *cbb = g_new0(PurpleCallbackBundle, 1);
@@ -2280,11 +2278,10 @@ purple_account_get_password(PurpleAccoun
cbb->data = data;
purple_debug_info("account",
- "Reading password for account %s (%s) from async keyring.\n",
- purple_account_get_username(account),
- purple_account_get_protocol_id(account));
+ "Reading password for account %s from async keyring.\n",
+ purple_account_get_username(account));
purple_keyring_get_password(account,
- purple_account_get_password_async_finish, cbb);
+ purple_account_get_password_got, cbb);
}
}
@@ -2960,7 +2957,7 @@ purple_accounts_remove(PurpleAccount *ac
}
static void
-purple_accounts_delete_finish(PurpleAccount *account, GError *error, gpointer data)
+purple_accounts_delete_set(PurpleAccount *account, GError *error, gpointer data)
{
purple_account_destroy(account);
}
@@ -3035,11 +3032,11 @@ purple_accounts_delete(PurpleAccount *ac
/* This will cause the deletion of an old buddy icon. */
purple_buddy_icons_set_account_icon(account, NULL, 0);
- /* this is async because we do not want the
- * account overwritten before we are done.
+ /* This is async because we do not want the
+ * account being overwritten before we are done.
*/
purple_keyring_set_password(account, NULL,
- purple_accounts_delete_finish, NULL);
+ purple_accounts_delete_set, NULL);
}
void
diff --git a/libpurple/keyring.c b/libpurple/keyring.c
--- a/libpurple/keyring.c
+++ b/libpurple/keyring.c
@@ -730,7 +730,7 @@ purple_keyring_export_password(PurpleAcc
*keyring_id = import->keyring_id;
*mode = import->mode;
*data = g_strdup(import->data);
- *destroy = purple_str_wipe;
+ *destroy = (GDestroyNotify)purple_str_wipe;
return TRUE;
}
}
diff --git a/libpurple/plugins/keyrings/gnomekeyring.c b/libpurple/plugins/keyrings/gnomekeyring.c
--- a/libpurple/plugins/keyrings/gnomekeyring.c
+++ b/libpurple/plugins/keyrings/gnomekeyring.c
@@ -302,7 +302,9 @@ gnomekeyring_process_queue(void)
NULL);
} else if (req->type == GNOMEKEYRING_REQUEST_SAVE &&
req->password != NULL) {
- gchar *display_name = g_strdup("test name [TODO]");
+ gchar *display_name = g_strdup_printf(
+ _("Pidgin IM password for account %s"),
+ purple_account_get_username(account));
current_request = gnome_keyring_store_password(
GNOME_KEYRING_NETWORK_PASSWORD, GNOME_KEYRING_DEFAULT,
display_name, req->password, gnomekeyring_save_cb, req,
@@ -390,7 +392,8 @@ gnomekeyring_load(PurplePlugin *plugin)
purple_keyring_set_id(keyring_handler, GNOMEKEYRING_ID);
purple_keyring_set_read_password(keyring_handler, gnomekeyring_read);
purple_keyring_set_save_password(keyring_handler, gnomekeyring_save);
- purple_keyring_set_cancel_requests(keyring_handler, gnomekeyring_cancel);
+ purple_keyring_set_cancel_requests(keyring_handler,
+ gnomekeyring_cancel);
purple_keyring_set_close_keyring(keyring_handler, gnomekeyring_close);
purple_keyring_register(keyring_handler);
diff --git a/libpurple/plugins/keyrings/internalkeyring.c b/libpurple/plugins/keyrings/internalkeyring.c
--- a/libpurple/plugins/keyrings/internalkeyring.c
+++ b/libpurple/plugins/keyrings/internalkeyring.c
@@ -109,7 +109,8 @@ internal_keyring_save(PurpleAccount *acc
if (!(password == NULL && old_password == NULL)) {
purple_debug_misc("keyring-internal",
"Password %s for account %s (%s).\n",
- (password == NULL ? "removed" : (old_password == NULL ? "saved" : "updated")),
+ (password == NULL ? "removed" : (old_password == NULL ?
+ "saved" : "updated")),
purple_account_get_username(account),
purple_account_get_protocol_id(account));
} else if (purple_debug_is_verbose()) {
@@ -191,11 +192,16 @@ internal_keyring_load(PurplePlugin *plug
purple_keyring_set_name(keyring_handler, INTERNALKEYRING_NAME);
purple_keyring_set_id(keyring_handler, INTERNALKEYRING_ID);
- purple_keyring_set_read_password(keyring_handler, internal_keyring_read);
- purple_keyring_set_save_password(keyring_handler, internal_keyring_save);
- purple_keyring_set_close_keyring(keyring_handler, internal_keyring_close);
- purple_keyring_set_import_password(keyring_handler, internal_keyring_import_password);
- purple_keyring_set_export_password(keyring_handler, internal_keyring_export_password);
+ purple_keyring_set_read_password(keyring_handler,
+ internal_keyring_read);
+ purple_keyring_set_save_password(keyring_handler,
+ internal_keyring_save);
+ purple_keyring_set_close_keyring(keyring_handler,
+ internal_keyring_close);
+ purple_keyring_set_import_password(keyring_handler,
+ internal_keyring_import_password);
+ purple_keyring_set_export_password(keyring_handler,
+ internal_keyring_export_password);
purple_keyring_register(keyring_handler);
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
@@ -460,7 +460,8 @@ kwallet_save(PurpleAccount *account, con
static void
kwallet_cancel(void)
{
- KWalletPlugin::engine *instance = KWalletPlugin::engine::instance(false);
+ KWalletPlugin::engine *instance =
+ KWalletPlugin::engine::instance(false);
if (instance)
instance->abortAll();
}
@@ -509,7 +510,8 @@ 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_cancel_requests(keyring_handler, kwallet_cancel);
- purple_keyring_set_close_keyring(keyring_handler, KWalletPlugin::engine::closeInstance);
+ purple_keyring_set_close_keyring(keyring_handler,
+ KWalletPlugin::engine::closeInstance);
purple_keyring_register(keyring_handler);
More information about the Commits
mailing list