/cpw/tomkiewicz/masterpassword: 31427d618b09: keyring.c refactor...
Tomasz Wasilczyk
tomkiewicz at cpw.pidgin.im
Sat Apr 27 21:09:23 EDT 2013
Changeset: 31427d618b09b6a5b06a1aadaadf837dfe05c0c1
Author: Tomasz Wasilczyk <tomkiewicz at cpw.pidgin.im>
Date: 2013-04-28 03:09 +0200
Branch: soc.2008.masterpassword
URL: https://hg.pidgin.im/cpw/tomkiewicz/masterpassword/rev/31427d618b09
Description:
keyring.c refactoring: fix naming for purple_keyring_set_inuse
diffstat:
libpurple/keyring.c | 102 +++++++++++++++++++++++++++------------------------
1 files changed, 53 insertions(+), 49 deletions(-)
diffs (165 lines):
diff --git a/libpurple/keyring.c b/libpurple/keyring.c
--- a/libpurple/keyring.c
+++ b/libpurple/keyring.c
@@ -112,6 +112,10 @@ purple_keyring_failed_import_free(Purple
static void
purple_keyring_close(PurpleKeyring *keyring);
+static void
+purple_keyring_drop_passwords(PurpleKeyring *keyring,
+ PurpleKeyringDropCallback cb, gpointer data);
+
/* A list of available keyrings */
static GList *purple_keyring_keyrings = NULL;
@@ -189,49 +193,6 @@ purple_keyring_get_inuse(void)
}
static void
-purple_keyring_drop_passwords_cb(PurpleAccount *account, GError *error,
- gpointer _tracker)
-{
- PurpleKeyringDropTracker *tracker = _tracker;
-
- tracker->drop_outstanding--;
-
- if (!tracker->finished || tracker->drop_outstanding > 0)
- return;
-
- if (tracker->cb)
- tracker->cb(tracker->cb_data);
- g_free(tracker);
-}
-
-static void
-purple_keyring_drop_passwords(PurpleKeyring *keyring,
- PurpleKeyringDropCallback cb, gpointer data)
-{
- GList *cur;
- PurpleKeyringSave save_cb;
- PurpleKeyringDropTracker *tracker;
-
- g_return_if_fail(keyring != NULL);
-
- save_cb = purple_keyring_get_save_password(keyring);
- g_return_if_fail(save_cb != NULL);
-
- tracker = g_new0(PurpleKeyringDropTracker, 1);
- tracker->cb = cb;
- tracker->cb_data = data;
-
- for (cur = purple_accounts_get_all(); cur != NULL; cur = cur->next) {
- tracker->drop_outstanding++;
- if (cur->next == NULL)
- tracker->finished = TRUE;
-
- save_cb(cur->data, NULL, purple_keyring_drop_passwords_cb,
- tracker);
- }
-}
-
-static void
purple_keyring_set_inuse_drop_cb(gpointer _tracker)
{
PurpleKeyringChangeTracker *tracker = _tracker;
@@ -274,7 +235,7 @@ purple_keyring_set_inuse_drop_cb(gpointe
}
static void
-purple_keyring_set_inuse_check_error_cb(PurpleAccount *account,
+purple_keyring_set_inuse_save_cb(PurpleAccount *account,
GError *error,
gpointer data)
{
@@ -351,7 +312,7 @@ purple_keyring_set_inuse_check_error_cb(
}
static void
-purple_keyring_set_inuse_got_pw_cb(PurpleAccount *account,
+purple_keyring_set_inuse_read_cb(PurpleAccount *account,
const gchar *password,
GError *error,
gpointer data)
@@ -365,7 +326,7 @@ purple_keyring_set_inuse_got_pw_cb(Purpl
g_return_if_fail(tracker != NULL);
if (tracker->abort) {
- purple_keyring_set_inuse_check_error_cb(account, NULL, data);
+ purple_keyring_set_inuse_save_cb(account, NULL, data);
return;
}
@@ -377,12 +338,12 @@ purple_keyring_set_inuse_got_pw_cb(Purpl
/* fatal error, abort all */
tracker->abort = TRUE;
}
- purple_keyring_set_inuse_check_error_cb(account, error, data);
+ purple_keyring_set_inuse_save_cb(account, error, data);
} else {
save_cb = purple_keyring_get_save_password(new);
g_return_if_fail(save_cb != NULL);
- save_cb(account, password, purple_keyring_set_inuse_check_error_cb,
+ save_cb(account, password, purple_keyring_set_inuse_save_cb,
tracker);
}
}
@@ -461,7 +422,7 @@ purple_keyring_set_inuse(PurpleKeyring *
if (cur->next == NULL)
tracker->finished = TRUE;
- read_cb(cur->data, purple_keyring_set_inuse_got_pw_cb, tracker);
+ read_cb(cur->data, purple_keyring_set_inuse_read_cb, tracker);
}
} else { /* no keyring was set before. */
if (purple_debug_is_verbose()) {
@@ -599,6 +560,49 @@ purple_keyring_close(PurpleKeyring *keyr
close_cb();
}
+static void
+purple_keyring_drop_passwords_cb(PurpleAccount *account, GError *error,
+ gpointer _tracker)
+{
+ PurpleKeyringDropTracker *tracker = _tracker;
+
+ tracker->drop_outstanding--;
+
+ if (!tracker->finished || tracker->drop_outstanding > 0)
+ return;
+
+ if (tracker->cb)
+ tracker->cb(tracker->cb_data);
+ g_free(tracker);
+}
+
+static void
+purple_keyring_drop_passwords(PurpleKeyring *keyring,
+ PurpleKeyringDropCallback cb, gpointer data)
+{
+ GList *cur;
+ PurpleKeyringSave save_cb;
+ PurpleKeyringDropTracker *tracker;
+
+ g_return_if_fail(keyring != NULL);
+
+ save_cb = purple_keyring_get_save_password(keyring);
+ g_return_if_fail(save_cb != NULL);
+
+ tracker = g_new0(PurpleKeyringDropTracker, 1);
+ tracker->cb = cb;
+ tracker->cb_data = data;
+
+ for (cur = purple_accounts_get_all(); cur != NULL; cur = cur->next) {
+ tracker->drop_outstanding++;
+ if (cur->next == NULL)
+ tracker->finished = TRUE;
+
+ save_cb(cur->data, NULL, purple_keyring_drop_passwords_cb,
+ tracker);
+ }
+}
+
gboolean
purple_keyring_import_password(PurpleAccount *account,
const gchar *keyring_id,
More information about the Commits
mailing list