/cpw/tomkiewicz/masterpassword: fa72f1e5cd77: Some polishing on ...
Tomasz Wasilczyk
tomkiewicz at cpw.pidgin.im
Thu Mar 28 04:49:27 EDT 2013
Changeset: fa72f1e5cd77a3dd3f93661949d1b4a0fb931763
Author: Tomasz Wasilczyk <tomkiewicz at cpw.pidgin.im>
Date: 2013-03-28 09:49 +0100
Branch: soc.2008.masterpassword
URL: https://hg.pidgin.im/cpw/tomkiewicz/masterpassword/rev/fa72f1e5cd77
Description:
Some polishing on files modified on this branch (mostly formatting)
diffstat:
finch/gntprefs.c | 12 +----
libpurple/account.c | 64 +++++++++++++--------------------
libpurple/account.h | 9 +---
libpurple/connection.c | 6 +--
libpurple/keyring.c | 9 +++-
libpurple/plugins/keyrings/kwallet.cpp | 2 +-
libpurple/protocols/gg/account.c | 6 ++-
libpurple/protocols/gg/gg.c | 3 +-
libpurple/protocols/mxit/actions.c | 2 +-
libpurple/util.c | 9 ++++
libpurple/util.h | 9 ++++
pidgin/gtkaccount.c | 27 ++++++-------
12 files changed, 78 insertions(+), 80 deletions(-)
diffs (truncated from 470 to 300 lines):
diff --git a/finch/gntprefs.c b/finch/gntprefs.c
--- a/finch/gntprefs.c
+++ b/finch/gntprefs.c
@@ -1,7 +1,7 @@
/**
* @file gntprefs.c GNT Preferences API
* @ingroup finch
- * @todo : add support for master password changing.
+ * @todo: add support for master password changing.
*/
/* finch
@@ -74,13 +74,6 @@ typedef struct
} Prefs;
static GList *
-get_keyring_options(void)
-{
- return purple_keyring_get_options();
-}
-
-
-static GList *
get_log_options(void)
{
return purple_log_logger_get_options();
@@ -205,7 +198,8 @@ static Prefs logging[] =
static Prefs keyring[] =
{
- {PURPLE_PREF_STRING, "/purple/keyring/active", N_("Active keyring"), get_keyring_options}
+ {PURPLE_PREF_STRING, "/purple/keyring/active", N_("Active keyring"), purple_keyring_get_options},
+ {PURPLE_PREF_NONE, NULL, NULL, NULL}
};
static Prefs idle[] =
diff --git a/libpurple/account.c b/libpurple/account.c
--- a/libpurple/account.c
+++ b/libpurple/account.c
@@ -362,13 +362,8 @@ account_to_xmlnode(PurpleAccount *accoun
{
xmlnode *node, *child;
const char *tmp;
- const char *keyring_id = NULL;
- const char *mode = NULL;
- char *data = NULL;
PurplePresence *presence;
PurpleProxyInfo *proxy_info;
- GError *error = NULL;
- GDestroyNotify destroy = NULL;
node = xmlnode_new("account");
@@ -380,6 +375,11 @@ account_to_xmlnode(PurpleAccount *accoun
if (purple_account_get_remember_password(account))
{
+ const char *keyring_id = NULL;
+ const char *mode = NULL;
+ char *data = NULL;
+ GError *error = NULL;
+ GDestroyNotify destroy = NULL;
gboolean exported = purple_keyring_export_password(account,
&keyring_id, &mode, &data, &error, &destroy);
@@ -869,10 +869,7 @@ parse_account(xmlnode *node)
xmlnode *child;
char *protocol_id = NULL;
char *name = NULL;
- const char *keyring_id = NULL;
- const char *mode = NULL;
- char *data = NULL;
- gboolean result = FALSE;
+ char *data;
child = xmlnode_get_child(node, "protocol");
if (child != NULL)
@@ -967,10 +964,11 @@ parse_account(xmlnode *node)
child = xmlnode_get_child(node, "password");
if (child != NULL)
{
- keyring_id = xmlnode_get_attrib(child, "keyring_id");
- mode = xmlnode_get_attrib(child, "mode");
+ const char *keyring_id = xmlnode_get_attrib(child, "keyring_id");
+ const char *mode = xmlnode_get_attrib(child, "mode");
+ gboolean result;
+
data = xmlnode_get_data(child);
-
result = purple_keyring_import_password(ret, keyring_id, mode, data, NULL);
if (result == TRUE) {
@@ -1150,9 +1148,7 @@ purple_account_set_register_callback(Pur
static void
purple_account_register_got_password_cb(PurpleAccount *account,
- const char *password,
- GError *error,
- gpointer data)
+ const gchar *password, GError *error, gpointer data)
{
g_return_if_fail(account != NULL);
@@ -1167,14 +1163,13 @@ purple_account_register(PurpleAccount *a
purple_debug_info("account", "Registering account %s\n",
purple_account_get_username(account));
- purple_keyring_get_password(account, purple_account_register_got_password_cb, NULL);
+ purple_keyring_get_password(account,
+ purple_account_register_got_password_cb, NULL);
}
static void
purple_account_unregister_got_password_cb(PurpleAccount *account,
- const char *password,
- GError *error,
- gpointer data)
+ const gchar *password, GError *error, gpointer data)
{
PurpleCallbackBundle *cbb = data;
PurpleAccountUnregistrationCb cb;
@@ -1208,7 +1203,8 @@ purple_account_unregister(PurpleAccount
cbb->cb = PURPLE_CALLBACK(cb);
cbb->data = user_data;
- purple_keyring_get_password(account, purple_account_unregister_got_password_cb, cbb);
+ purple_keyring_get_password(account,
+ purple_account_unregister_got_password_cb, cbb);
}
static void
@@ -1286,16 +1282,16 @@ purple_account_request_password(PurpleAc
static void
purple_account_connect_got_password_cb(PurpleAccount *account,
- const gchar *password,
- GError *error,
- gpointer data)
+ const gchar *password, GError *error, gpointer data)
{
PurplePluginProtocolInfo *prpl_info = data;
if ((password == NULL || *password == '\0') &&
!(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), G_CALLBACK(request_password_cancel_cb), 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);
}
@@ -1709,10 +1705,8 @@ purple_account_set_username(PurpleAccoun
}
void
-purple_account_set_password(PurpleAccount *account,
- const gchar *password,
- PurpleKeyringSaveCallback cb,
- gpointer data)
+purple_account_set_password(PurpleAccount *account, const gchar *password,
+ PurpleKeyringSaveCallback cb, gpointer data)
{
g_return_if_fail(account != NULL);
@@ -1721,8 +1715,7 @@ purple_account_set_password(PurpleAccoun
schedule_accounts_save();
- if (purple_account_get_remember_password(account) == FALSE) {
-
+ if (!purple_account_get_remember_password(account)) {
account->password = g_strdup(password);
purple_debug_info("account",
"Password for %s set, not sent to keyring.\n",
@@ -1730,7 +1723,6 @@ purple_account_set_password(PurpleAccoun
if (cb != NULL)
cb(account, NULL, data);
-
} else {
purple_keyring_set_password(account, password, cb, data);
}
@@ -2242,9 +2234,7 @@ purple_account_get_username(const Purple
static void
purple_account_get_password_async_finish(PurpleAccount *account,
- const char *password,
- GError *error,
- gpointer data)
+ const gchar *password, GError *error, gpointer data)
{
PurpleCallbackBundle *cbb = data;
PurpleKeyringReadCallback cb;
@@ -2254,7 +2244,7 @@ purple_account_get_password_async_finish
purple_account_get_username(account),
purple_account_get_protocol_id(account));
- g_free(account->password);
+ purple_str_wipe(account->password);
account->password = g_strdup(password);
cb = (PurpleKeyringReadCallback)cbb->cb;
@@ -2266,8 +2256,7 @@ purple_account_get_password_async_finish
void
purple_account_get_password(PurpleAccount *account,
- PurpleKeyringReadCallback cb,
- gpointer data)
+ PurpleKeyringReadCallback cb, gpointer data)
{
if (account == NULL) {
cb(NULL, NULL, NULL, data);
@@ -2280,7 +2269,6 @@ purple_account_get_password(PurpleAccoun
purple_account_get_username(account),
purple_account_get_protocol_id(account));
cb(account, account->password, NULL, data);
-
} else {
PurpleCallbackBundle *cbb = g_new0(PurpleCallbackBundle, 1);
cbb->cb = PURPLE_CALLBACK(cb);
diff --git a/libpurple/account.h b/libpurple/account.h
--- a/libpurple/account.h
+++ b/libpurple/account.h
@@ -375,10 +375,8 @@ void purple_account_set_username(PurpleA
* @param cb A callback for once the password is saved.
* @param data A pointer to be passed to the callback.
*/
-void purple_account_set_password(PurpleAccount *account,
- const gchar *password,
- PurpleKeyringSaveCallback cb,
- gpointer data);
+void purple_account_set_password(PurpleAccount *account, const gchar *password,
+ PurpleKeyringSaveCallback cb, gpointer data);
/**
* Sets the account's alias.
@@ -698,8 +696,7 @@ const char *purple_account_get_username(
* @param data A pointer passed to the callback.
*/
void purple_account_get_password(PurpleAccount *account,
- PurpleKeyringReadCallback cb,
- gpointer data);
+ PurpleKeyringReadCallback cb, gpointer data);
/**
* Returns the account's alias.
diff --git a/libpurple/connection.c b/libpurple/connection.c
--- a/libpurple/connection.c
+++ b/libpurple/connection.c
@@ -284,7 +284,7 @@ void
purple_account_set_connection(account, NULL);
- g_free(gc->password);
+ purple_str_wipe(gc->password);
g_free(gc->display_name);
if (gc->disconnect_timeout > 0)
@@ -453,10 +453,6 @@ purple_connection_get_prpl(const PurpleC
return gc->prpl;
}
-
-/**
- * FIXME : all the calling tree needs to be async.
- */
const char *
purple_connection_get_password(const PurpleConnection *gc)
{
diff --git a/libpurple/keyring.c b/libpurple/keyring.c
--- a/libpurple/keyring.c
+++ b/libpurple/keyring.c
@@ -696,9 +696,12 @@ purple_keyring_set_inuse(const PurpleKey
}
if (oldkeyring == newkeyring) {
- purple_debug_misc("keyring",
- "Old and new keyring are the same: %s.\n",
- (newkeyring != NULL) ? newkeyring->id : "(null)");
+ if (purple_debug_is_verbose()) {
+ purple_debug_misc("keyring",
+ "Old and new keyring are the same: %s.\n",
+ (newkeyring != NULL) ?
+ newkeyring->id : "(null)");
+ }
if (cb != NULL)
cb(newkeyring, NULL, data);
return;
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
@@ -302,7 +302,7 @@ KWalletPlugin::engine::executeRequests()
req->abort();
delete req;
}
- } else {
+ } else if (purple_debug_is_verbose()) {
purple_debug_misc("keyring-kwallet", "not yet connected\n");
}
More information about the Commits
mailing list