soc.2008.masterpassword: 3d56b84e: Rearrange code so we can drop the protot...
qulogic at pidgin.im
qulogic at pidgin.im
Mon Oct 31 04:10:27 EDT 2011
----------------------------------------------------------------------
Revision: 3d56b84e396a8dca307c964e42849d5d1ca8a713
Parent: 8a1a035b69a7baaffeb5cf8c890fc9f200e28cd3
Author: qulogic at pidgin.im
Date: 10/31/11 03:06:21
Branch: im.pidgin.soc.2008.masterpassword
URL: http://d.pidgin.im/viewmtn/revision/info/3d56b84e396a8dca307c964e42849d5d1ca8a713
Changelog:
Rearrange code so we can drop the prototypes. Most of it was already
in order, so they were not needed then, too.
Changes against parent 8a1a035b69a7baaffeb5cf8c890fc9f200e28cd3
patched libpurple/keyring.c
patched libpurple/plugins/keyrings/gnomekeyring.c
patched libpurple/plugins/keyrings/internalkeyring.c
patched libpurple/plugins/keyrings/kwallet.cpp
-------------- next part --------------
============================================================
--- libpurple/keyring.c 5b181239f810c7582e85f9ef3d5c33369b8df866
+++ libpurple/keyring.c 620d252c907011b3a9f8a8c1660285157036fe8d
@@ -38,14 +38,6 @@ typedef struct _PurpleKeyringChangeTrack
typedef struct _PurpleKeyringCbInfo PurpleKeyringCbInfo;
typedef struct _PurpleKeyringChangeTracker PurpleKeyringChangeTracker;
-static void purple_keyring_pref_cb(const char *, PurplePrefType, gconstpointer, gpointer);
-static PurpleKeyring * purple_keyring_find_keyring_by_id(char * id);
-static void purple_keyring_drop_passwords(const PurpleKeyring * keyring);
-static void purple_keyring_set_inuse_check_error_cb(PurpleAccount *,GError *,gpointer);
-static void purple_keyring_set_inuse_got_pw_cb(PurpleAccount *, gchar *, GError *, gpointer);
-static void purple_keyring_set_password_async_cb(PurpleAccount * account, GError * error, gpointer data);
-
-
/******************************************/
/** @name PurpleKeyring */
/******************************************/
@@ -240,6 +232,24 @@ static guint purple_keyring_pref_cb_id;
static char * purple_keyring_to_use;
static guint purple_keyring_pref_cb_id;
+static void
+purple_keyring_pref_cb(const char *pref,
+ PurplePrefType type,
+ gconstpointer id,
+ gpointer data)
+{
+ PurpleKeyring * new;
+
+ g_return_if_fail(g_strcmp0(pref, "/purple/keyring/active") == 0);
+ g_return_if_fail(type == PURPLE_PREF_STRING);
+ g_return_if_fail(id != NULL);
+
+ new = purple_keyring_get_keyring_by_id(id);
+ g_return_if_fail(new != NULL);
+
+ purple_keyring_set_inuse(new, FALSE, NULL, data);
+}
+
void
purple_keyring_init()
{
@@ -586,24 +596,6 @@ purple_keyring_set_inuse(const PurpleKey
-static void
-purple_keyring_pref_cb(const char *pref,
- PurplePrefType type,
- gconstpointer id,
- gpointer data)
-{
- PurpleKeyring * new;
-
- g_return_if_fail(g_strcmp0(pref, "/purple/keyring/active") == 0);
- g_return_if_fail(type == PURPLE_PREF_STRING);
- g_return_if_fail(id != NULL);
-
- new = purple_keyring_get_keyring_by_id(id);
- g_return_if_fail(new != NULL);
-
- purple_keyring_set_inuse(new, FALSE, NULL, data);
-}
-
GList *
purple_keyring_get_options()
{
@@ -883,6 +875,31 @@ purple_keyring_get_password(PurpleAccoun
}
}
+static void
+purple_keyring_set_password_async_cb(PurpleAccount * account,
+ GError * error,
+ gpointer data)
+{
+ PurpleKeyringCbInfo * cbinfo;
+ PurpleKeyringSaveCallback cb;
+
+ g_return_if_fail(data != NULL);
+ g_return_if_fail(account != NULL);
+
+ cbinfo = data;
+ cb = cbinfo->cb;
+
+ if (error != NULL) {
+ purple_notify_error(NULL, _("Keyrings"),
+ _("Failed to save password in keyring."),
+ error->message);
+ }
+
+ if (cb != NULL)
+ cb(account, error, cbinfo->data);
+ g_free(data);
+}
+
void
purple_keyring_set_password(PurpleAccount * account,
const gchar *password,
@@ -922,31 +939,6 @@ purple_keyring_set_password(PurpleAccoun
}
}
-static void
-purple_keyring_set_password_async_cb(PurpleAccount * account,
- GError * error,
- gpointer data)
-{
- PurpleKeyringCbInfo * cbinfo;
- PurpleKeyringSaveCallback cb;
-
- g_return_if_fail(data != NULL);
- g_return_if_fail(account != NULL);
-
- cbinfo = data;
- cb = cbinfo->cb;
-
- if (error != NULL) {
- purple_notify_error(NULL, _("Keyrings"),
- _("Failed to save password in keyring."),
- error->message);
- }
-
- if (cb != NULL)
- cb(account, error, cbinfo->data);
- g_free(data);
-}
-
void
purple_keyring_close(PurpleKeyring * keyring,
GError ** error)
============================================================
--- libpurple/plugins/keyrings/gnomekeyring.c 52c6fc2154ad8b152eaca5be4d5fc70c5faf940a
+++ libpurple/plugins/keyrings/gnomekeyring.c d1f3b1cb5c12e8e0b36d3ef6b4d8c610ab537d35
@@ -76,24 +76,7 @@ struct _InfoStorage
char * name;
};
-/* a few prototypes : */
-static GQuark gkp_error_domain(void);
-static void gkp_read(PurpleAccount *, PurpleKeyringReadCallback, gpointer);
-static void gkp_read_continue(GnomeKeyringResult, const char *, gpointer);
-static void gkp_save(PurpleAccount *, const gchar *, PurpleKeyringSaveCallback, gpointer);
-static void gkp_save_continue(GnomeKeyringResult, gpointer);
-static void gkp_close(GError **);
-static gboolean gkp_import_password(PurpleAccount *, const char *, const char *, GError **);
-static gboolean gkp_export_password(PurpleAccount *, const char **, char **, GError **, GDestroyNotify *);
-static gboolean gkp_init(void);
-static void gkp_uninit(void);
-static gboolean gkp_load(PurplePlugin *);
-static gboolean gkp_unload(PurplePlugin *);
-static void gkp_destroy(PurplePlugin *);
-
-static void gkp_change_master(PurpleKeyringChangeMasterCallback cb, gpointer data);
-
-GQuark gkp_error_domain(void)
+static GQuark gkp_error_domain(void)
{
return g_quark_from_static_string("Gnome-Keyring plugin");
}
@@ -102,26 +85,6 @@ GQuark gkp_error_domain(void)
/***********************************************/
/* Keyring interface */
/***********************************************/
-static void
-gkp_read(PurpleAccount * account,
- PurpleKeyringReadCallback cb,
- gpointer data)
-{
- InfoStorage * storage = g_malloc(sizeof(InfoStorage));
-
- storage->cb = cb;
- storage->user_data = data;
- storage->account = account;
-
- gnome_keyring_find_password(GNOME_KEYRING_NETWORK_PASSWORD,
- gkp_read_continue,
- storage,
- g_free,
- "user", purple_account_get_username(account),
- "protocol", purple_account_get_protocol_id(account),
- NULL);
-}
-
static void gkp_read_continue(GnomeKeyringResult result,
const char *password,
gpointer data)
@@ -176,55 +139,24 @@ static void gkp_read_continue(GnomeKeyri
}
}
-
-static void
-gkp_save(PurpleAccount * account,
- const gchar * password,
- PurpleKeyringSaveCallback cb,
+static void
+gkp_read(PurpleAccount * account,
+ PurpleKeyringReadCallback cb,
gpointer data)
{
- InfoStorage * storage = g_new0(InfoStorage,1);
+ InfoStorage * storage = g_malloc(sizeof(InfoStorage));
- storage->account = account;
storage->cb = cb;
storage->user_data = data;
- storage->name = g_strdup_printf("pidgin-%s",
- purple_account_get_username(account));
+ storage->account = account;
- if(password != NULL && *password != '\0') {
-
- purple_debug_info("Gnome keyring plugin",
- "Updating password for account %s (%s).\n",
- purple_account_get_username(account),
- purple_account_get_protocol_id(account));
-
- gnome_keyring_store_password(GNOME_KEYRING_NETWORK_PASSWORD,
- NULL, /*default keyring */
- storage->name,
- password,
- gkp_save_continue,
- storage,
- g_free, /* function to free storage */
- "user", purple_account_get_username(account),
- "protocol", purple_account_get_protocol_id(account),
- NULL);
-
- } else { /* password == NULL, delete password. */
-
- purple_debug_info("Gnome keyring plugin",
- "Forgetting password for account %s (%s).\n",
- purple_account_get_username(account),
- purple_account_get_protocol_id(account));
-
- gnome_keyring_delete_password(GNOME_KEYRING_NETWORK_PASSWORD,
- gkp_save_continue,
- storage,
- g_free,
- "user", purple_account_get_username(account),
- "protocol", purple_account_get_protocol_id(account),
- NULL);
-
- }
+ gnome_keyring_find_password(GNOME_KEYRING_NETWORK_PASSWORD,
+ gkp_read_continue,
+ storage,
+ g_free,
+ "user", purple_account_get_username(account),
+ "protocol", purple_account_get_protocol_id(account),
+ NULL);
}
static void
@@ -299,6 +231,56 @@ static void
}
static void
+gkp_save(PurpleAccount * account,
+ const gchar * password,
+ PurpleKeyringSaveCallback cb,
+ gpointer data)
+{
+ InfoStorage * storage = g_new0(InfoStorage,1);
+
+ storage->account = account;
+ storage->cb = cb;
+ storage->user_data = data;
+ storage->name = g_strdup_printf("pidgin-%s",
+ purple_account_get_username(account));
+
+ if(password != NULL && *password != '\0') {
+
+ purple_debug_info("Gnome keyring plugin",
+ "Updating password for account %s (%s).\n",
+ purple_account_get_username(account),
+ purple_account_get_protocol_id(account));
+
+ gnome_keyring_store_password(GNOME_KEYRING_NETWORK_PASSWORD,
+ NULL, /*default keyring */
+ storage->name,
+ password,
+ gkp_save_continue,
+ storage,
+ g_free, /* function to free storage */
+ "user", purple_account_get_username(account),
+ "protocol", purple_account_get_protocol_id(account),
+ NULL);
+
+ } else { /* password == NULL, delete password. */
+
+ purple_debug_info("Gnome keyring plugin",
+ "Forgetting password for account %s (%s).\n",
+ purple_account_get_username(account),
+ purple_account_get_protocol_id(account));
+
+ gnome_keyring_delete_password(GNOME_KEYRING_NETWORK_PASSWORD,
+ gkp_save_continue,
+ storage,
+ g_free,
+ "user", purple_account_get_username(account),
+ "protocol", purple_account_get_protocol_id(account),
+ NULL);
+
+ }
+}
+
+static void
gkp_close(GError ** error)
{
}
============================================================
--- libpurple/plugins/keyrings/internalkeyring.c 8860ca762d714193898d292bde6da4b9b844ffa5
+++ libpurple/plugins/keyrings/internalkeyring.c d0c69882458b963ba77e03319f6e2605e860b6c2
@@ -72,22 +72,17 @@ static gboolean internal_keyring_is_acti
static PurpleKeyring * keyring_handler = NULL;
static gboolean internal_keyring_is_active = FALSE;
-/* a few prototypes : */
-static void internal_keyring_read(PurpleAccount *, PurpleKeyringReadCallback, gpointer);
-static void internal_keyring_save(PurpleAccount *, const gchar *, PurpleKeyringSaveCallback, gpointer);
-static void internal_keyring_close(GError **);
-static void internal_keyring_open(void);
-static gboolean internal_keyring_import_password(PurpleAccount *, const char *, const char *, GError **);
-static gboolean internal_keyring_export_password(PurpleAccount *, const char **, char **, GError **, GDestroyNotify *);
-static void internal_keyring_init(void);
-static void internal_keyring_uninit(void);
-static gboolean internal_keyring_load(PurplePlugin *);
-static gboolean internal_keyring_unload(PurplePlugin *);
-static void internal_keyring_destroy(PurplePlugin *);
-
/***********************************************/
/* Keyring interface */
/***********************************************/
+static void
+internal_keyring_open()
+{
+ internal_keyring_passwords = g_hash_table_new_full(g_direct_hash,
+ g_direct_equal, NULL, g_free);
+ internal_keyring_is_active = TRUE;
+}
+
static void
internal_keyring_read(PurpleAccount * account,
PurpleKeyringReadCallback cb,
@@ -157,14 +152,6 @@ internal_keyring_close(GError ** error)
internal_keyring_passwords = NULL;
}
-static void
-internal_keyring_open()
-{
- internal_keyring_passwords = g_hash_table_new_full(g_direct_hash,
- g_direct_equal, NULL, g_free);
- internal_keyring_is_active = TRUE;
-}
-
static gboolean
internal_keyring_import_password(PurpleAccount * account,
const char * mode,
============================================================
--- libpurple/plugins/keyrings/kwallet.cpp 8ff631b3dfd752191a6f840c9b9046e3b8a9861a
+++ libpurple/plugins/keyrings/kwallet.cpp 267e031dccce8db1a0dd1c22b9ab75ee888884d6
@@ -54,19 +54,6 @@
#include "internal.h"
-static GQuark kwallet_plugin_error_domain(void);
-
-static void kwallet_read(PurpleAccount * account, PurpleKeyringReadCallback cb, gpointer data);
-static void kwallet_save(PurpleAccount * account, gchar * password, GDestroyNotify destroypassword, PurpleKeyringSaveCallback cb, gpointer data);
-static void kwallet_close(GError ** error);
-static void kwallet_import(PurpleAccount * account, const char * mode, const char * data, GError ** error);
-static void kwallet_export(PurpleAccount * account, const char ** mode, char ** data, GError ** error, GDestroyNotify * destroy);
-
-static gboolean kwallet_load(PurplePlugin *plugin);
-static gboolean kwallet_unload(PurplePlugin *plugin);
-static void kwallet_destroy(PurplePlugin *plugin);
-static void init_plugin(PurplePlugin *plugin)
-
PurpleKeyring * keyring_handler;
PurplePluginInfo plugininfo =
More information about the Commits
mailing list