soc.2008.masterpassword: 13b76367: Reformat many things.
qulogic at pidgin.im
qulogic at pidgin.im
Mon Oct 31 04:04:06 EDT 2011
----------------------------------------------------------------------
Revision: 13b76367579b1022e7c8913d8ec12cff19769374
Parent: 0a45dcb0f9e5db18f29633820ec26636a67f616c
Author: qulogic at pidgin.im
Date: 10/31/11 03:53:53
Branch: im.pidgin.soc.2008.masterpassword
URL: http://d.pidgin.im/viewmtn/revision/info/13b76367579b1022e7c8913d8ec12cff19769374
Changelog:
Reformat many things.
Changes against parent 0a45dcb0f9e5db18f29633820ec26636a67f616c
patched libpurple/keyring.c
patched libpurple/keyring.h
patched libpurple/plugins/keyrings/gnomekeyring.c
patched libpurple/plugins/keyrings/internalkeyring.c
patched libpurple/plugins/keyrings/kwallet.cpp
patched pidgin/gtkprefs.c
-------------- next part --------------
============================================================
--- pidgin/gtkprefs.c 96be40ba32cb595a952fa0d9d6e0fd20ab4d7f95
+++ pidgin/gtkprefs.c 351742dedbc00ae8cfd4ba28bce505339418a34c
@@ -2348,7 +2348,7 @@ static void
}
static void
-change_master_password_cb(GtkWidget * button, gpointer ptr)
+change_master_password_cb(GtkWidget *button, gpointer ptr)
{
purple_keyring_change_master(NULL, NULL);
}
@@ -2356,11 +2356,11 @@ keyring_page_pref_changed(const char *na
static void
keyring_page_pref_changed(const char *name, PurplePrefType type, gconstpointer val, gpointer data)
{
- GtkWidget * button = data;
- PurpleKeyring * keyring;
+ GtkWidget *button = data;
+ PurpleKeyring *keyring;
g_return_if_fail(type == PURPLE_PREF_STRING);
- g_return_if_fail(g_strcmp0(name,"/purple/keyring/active") == 0);
+ g_return_if_fail(g_strcmp0(name, "/purple/keyring/active") == 0);
/**
* This part is annoying.
@@ -2373,22 +2373,21 @@ keyring_page_pref_changed(const char *na
keyring = purple_keyring_get_keyring_by_id(val);
if (purple_keyring_get_change_master(keyring))
- gtk_widget_set_sensitive(button,TRUE);
+ gtk_widget_set_sensitive(button, TRUE);
else
- gtk_widget_set_sensitive(button,FALSE);
+ gtk_widget_set_sensitive(button, FALSE);
}
-
static GtkWidget *
keyring_page(void)
{
GtkWidget *ret;
GtkWidget *vbox;
- GtkWidget * button;
+ GtkWidget *button;
GList *names;
- void * prefs;
- const char * keyring_id;
- PurpleKeyring * keyring;
+ void *prefs;
+ const char *keyring_id;
+ PurpleKeyring *keyring;
keyring_id = purple_prefs_get_string("/purple/keyring/active");
keyring = purple_keyring_get_keyring_by_id(keyring_id);
@@ -2396,10 +2395,10 @@ keyring_page(void)
prefs = purple_prefs_get_handle();
ret = gtk_vbox_new(FALSE, PIDGIN_HIG_CAT_SPACE);
- gtk_container_set_border_width (GTK_CONTAINER (ret), PIDGIN_HIG_BORDER);
+ gtk_container_set_border_width(GTK_CONTAINER (ret), PIDGIN_HIG_BORDER);
/* Keyring selection */
- vbox = pidgin_make_frame (ret, _("Keyring"));
+ vbox = pidgin_make_frame(ret, _("Keyring"));
names = purple_keyring_get_options();
pidgin_prefs_dropdown_from_list(vbox, _("Keyring :"), PURPLE_PREF_STRING,
"/purple/keyring/active", names);
@@ -2412,12 +2411,13 @@ keyring_page(void)
purple_prefs_connect_callback (prefs, "/purple/keyring/active", keyring_page_pref_changed, button);
if (purple_keyring_get_change_master(keyring))
- gtk_widget_set_sensitive(button,TRUE);
+ gtk_widget_set_sensitive(button, TRUE);
else
- gtk_widget_set_sensitive(button,FALSE);
+ gtk_widget_set_sensitive(button, FALSE);
gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 1);
gtk_widget_show_all(ret);
+
return ret;
}
============================================================
--- libpurple/keyring.h b526bc4d9bf470aa88fa72980807f2c6c3a04b68
+++ libpurple/keyring.h 8ec5f2777a72add8614e4ec1eeaadf746092cec8
@@ -42,7 +42,7 @@
/** @name data structures and types */
/*******************************************************/
/*@{*/
-typedef struct _PurpleKeyring PurpleKeyring; /* public (for now) */
+typedef struct _PurpleKeyring PurpleKeyring;
/*@}*/
@@ -59,53 +59,57 @@ typedef struct _PurpleKeyring PurpleKeyr
/*@{*/
/**
- * Callback for once a password is read. If there was a problem, the password should
- * be NULL, and the error set.
+ * Callback for once a password is read. If there was a problem, the password
+ * should be NULL, and the error set.
*
- * @param account The account of which the password was asked.
- * @param password The password that was read. This should be freed when the callback returns.
- * @param error Error that could have occured. Must be freed by the calling function.
- * @param data Data passed to the callback.
+ * @param account The account of which the password was asked.
+ * @param password The password that was read. This should be freed when the
+ * callback returns.
+ * @param error Error that could have occured. Must be freed by the calling
+ * function.
+ * @param data Data passed to the callback.
*/
-typedef void (*PurpleKeyringReadCallback)(PurpleAccount * account,
- gchar * password,
- GError * error,
- gpointer data);
+typedef void (*PurpleKeyringReadCallback)(PurpleAccount *account,
+ gchar *password,
+ GError *error,
+ gpointer data);
/**
- * Callback for once a password has been stored. If there was a problem, the error will be set.
+ * Callback for once a password has been stored. If there was a problem, the
+ * error will be set.
*
- * @param error Error that could have occured. Must be freed by the calling function.
- * @param account The account of which the password was saved.
- * @param data Data passed to the callback.
+ * @param error Error that could have occured. Must be freed by the calling
+ * function.
+ * @param account The account for which the password was saved.
+ * @param data Data passed to the callback.
*/
-typedef void (*PurpleKeyringSaveCallback)(PurpleAccount * account,
- GError * error,
- gpointer data);
+typedef void (*PurpleKeyringSaveCallback)(PurpleAccount *account,
+ GError *error,
+ gpointer data);
/**
* Callback for once the master password for a keyring has been changed.
*
* @param result Will be TRUE if the password has been changed, false otherwise.
- * @param error Error that has occured. Must be freed if non NULL.
- * @param data Data passed to the callback.
+ * @param error Error that has occured. Must be freed if non NULL.
+ * @param data Data passed to the callback.
*/
typedef void (*PurpleKeyringChangeMasterCallback)(gboolean result,
- GError * error,
- gpointer data);
+ GError *error,
+ gpointer data);
/**
* Callback for when we change the keyring.
*
* @param keyring The keyring that is in use.
- * @param result TRUE if the keyring was changed, FALSE otherwise.
- * @param error An error that might have occured.
- * @param data A pointer to user supplied data.
+ * @param result TRUE if the keyring was changed, FALSE otherwise.
+ * @param error An error that might have occured.
+ * @param data A pointer to user supplied data.
*/
-typedef void (*PurpleKeyringSetInUseCallback)(const PurpleKeyring * keyring,
- gboolean result,
- GError * error,
- gpointer data);
+typedef void (*PurpleKeyringSetInUseCallback)(const PurpleKeyring *keyring,
+ gboolean result,
+ GError *error,
+ gpointer data);
/*@}*/
@@ -116,74 +120,89 @@ typedef void (*PurpleKeyringSetInUseCall
/**
* Read the password for an account
+ *
* @param account The account which's password we want.
- * @param cb A callback to be used once the password is found.
- * @param data Data to be passed to the callback.
+ * @param cb A callback to be used once the password is found.
+ * @param data Data to be passed to the callback.
*/
-typedef void (*PurpleKeyringRead)(PurpleAccount * account,
+typedef void (*PurpleKeyringRead)(PurpleAccount *account,
PurpleKeyringReadCallback cb,
gpointer data);
/**
* Store a password in the keyring.
- * @param account The account for which the password is to be stored.
+ *
+ * @param account The account for which the password is to be stored.
* @param password The password to be stored. This password will be freed once
- * the function returns, so one must take care to make a copy if they call other
- * async functions later. If the password is NULL, this means that the keyring
- * should forget about that password.
- * @param cb A callback to be called once the password is saved.
- * @param data A pointer to be passed to the callback
+ * the function returns, so one must take care to make a copy if
+ * they call other async functions later. If the password is
+ * NULL, this means that the keyring should forget about that
+ * password.
+ * @param cb A callback to be called once the password is saved.
+ * @param data A pointer to be passed to the callback
*/
-typedef void (*PurpleKeyringSave)(PurpleAccount * account,
- const gchar * password,
- PurpleKeyringSaveCallback cb,
- gpointer data);
+typedef void (*PurpleKeyringSave)(PurpleAccount *account,
+ const gchar *password,
+ PurpleKeyringSaveCallback cb,
+ gpointer data);
/**
* Close the keyring.
* This will be called so the keyring can do any cleanup it wants.
+ *
* @param error An error that may occur.
*/
-typedef void (*PurpleKeyringClose)(GError ** error);
+typedef void (*PurpleKeyringClose)(GError **error);
/**
* Change the master password for the keyring. If NULL, it means the Keyring
* has no master password capabilities.
+ *
* @param error An error that may occur.
- * @param cb A callback to call once the master password has been changed.
- * @param data A pointer to pass to the callback.
+ * @param cb A callback to call once the master password has been changed.
+ * @param data A pointer to pass to the callback.
*/
typedef void (*PurpleKeyringChangeMaster)(PurpleKeyringChangeMasterCallback cb,
- gpointer data);
+ gpointer data);
/**
* Import info on an XML node.
- * This is not async because it is not meant to prompt for a master password and decrypt passwords.
+ * This is not async because it is not meant to prompt for a master password and
+ * decrypt passwords.
+ *
* @param account The account.
- * @param mode A keyring specific option that was stored. Can be NULL, will be freed when function returns.
- * @param data Data that was stored, Can be NULL, will be freed when function returns (so copy it if you need it).
+ * @param mode A keyring specific option that was stored. Can be NULL, will
+ * be freed when function returns.
+ * @param data Data that was stored, Can be NULL, will be freed when function
+ * returns (so copy it if you need it).
+ *
* @return TRUE on success, FALSE on failure.
*/
-typedef gboolean (*PurpleKeyringImportPassword)(PurpleAccount * account,
- const char * mode,
- const char * data,
- GError ** error);
+typedef gboolean (*PurpleKeyringImportPassword)(PurpleAccount *account,
+ const char *mode,
+ const char *data,
+ GError **error);
/**
* Export information that will be stored in an XML node.
- * This is not async because it is not meant to prompt for a master password or encrypt passwords.
+ * This is not async because it is not meant to prompt for a master password or
+ * encrypt passwords.
+ *
* @param account The account for which we want the info.
- * @param mode An option field that can be used by the plugin. This is expected to be a static string.
- * @param data The data to be stored in the XML node. This string will be freed using destroy() once not needed anymore.
- * @param error Will be set if a problem occured.
+ * @param mode An option field that can be used by the plugin. This is
+ * expected to be a static string.
+ * @param data The data to be stored in the XML node. This string will be
+ * freed using destroy() once not needed anymore.
+ * @param error Will be set if a problem occured.
* @param destroy A function to be called, if non NULL, to free data.
+ *
* @return TRUE on success, FALSE on failure.
*/
-typedef gboolean (*PurpleKeyringExportPassword)(PurpleAccount * account,
- const char ** mode,
- char ** data,
- GError ** error,
- GDestroyNotify * destroy);
+typedef gboolean (*PurpleKeyringExportPassword)(PurpleAccount *account,
+ const char **mode,
+ char **data,
+ GError **error,
+ GDestroyNotify *destroy);
/*@}*/
@@ -199,16 +218,19 @@ extern "C" {
/**
* Find a keyring from it's keyring id.
+ *
* @param id The id for the keyring.
+ *
* @return The keyring, or NULL if not found.
*/
-PurpleKeyring * purple_keyring_get_keyring_by_id(const char * id);
+PurpleKeyring *purple_keyring_get_keyring_by_id(const char *id);
/**
* Get a list of id/name pairs (for preferences)
+ *
* @return The list.
*/
-GList * purple_keyring_get_options(void);
+GList *purple_keyring_get_options(void);
/**
* Prepare stuff at startup.
@@ -237,35 +259,37 @@ purple_keyring_get_inuse(void);
* the old keyring to the new one. If it fails, it will cancel all changes,
* close the new keyring, and notify the callback. If it succeeds, it will
* remove all passwords from the old safe and close that safe.
+ *
* @param newkeyring The new keyring to use.
- * @param error Error that may occur.
- * @param cb The callback to call once the change is done.
- * @param data A pointer that will be passed to the callback.
- * @param force FALSE if the change can be cancelled. If this is TRUE and an
- * error occurs, data might be lost.
+ * @param error Error that may occur.
+ * @param cb The callback to call once the change is done.
+ * @param data A pointer that will be passed to the callback.
+ * @param force FALSE if the change can be cancelled. If this is TRUE and
+ * an error occurs, data might be lost.
*/
void
-purple_keyring_set_inuse(const PurpleKeyring * newkeyring,
- gboolean force,
- PurpleKeyringSetInUseCallback cb,
- gpointer data);
+purple_keyring_set_inuse(const PurpleKeyring *newkeyring,
+ gboolean force,
+ PurpleKeyringSetInUseCallback cb,
+ gpointer data);
-
/**
* Register a keyring plugin.
- * @param keyrint The keyring to register.
+ *
+ * @param keyring The keyring to register.
*/
void
-purple_keyring_register(PurpleKeyring * keyring);
+purple_keyring_register(PurpleKeyring *keyring);
/**
* Unregister a keyring plugin. In case the keyring is in use,
* passwords will be moved to a fallback safe, and the keyring
* to unregister will be properly closed.
- * @param keyrint The keyring to unregister.
+ *
+ * @param keyring The keyring to unregister.
*/
void
-purple_keyring_unregister(PurpleKeyring * keyring);
+purple_keyring_unregister(PurpleKeyring *keyring);
/*@}*/
@@ -277,35 +301,43 @@ purple_keyring_unregister(PurpleKeyring
/**
* used by account.c while reading a password from xml.
- * @param account The account.
+ *
+ * @param account The account.
* @param keyringid The plugin ID that was stored in the xml file. Can be NULL.
- * @param mode A keyring specific option that was stored. Can be NULL.
- * @param data Data that was stored, can be NULL.
+ * @param mode A keyring specific option that was stored. Can be NULL.
+ * @param data Data that was stored, can be NULL.
+ *
* @return TRUE if the input was accepted, FALSE otherwise.
*/
-gboolean purple_keyring_import_password(PurpleAccount * account,
- const char * keyringid,
- const char * mode,
- const char * data,
- GError ** error);
+gboolean purple_keyring_import_password(PurpleAccount *account,
+ const char *keyringid,
+ const char *mode,
+ const char *data,
+ GError **error);
/**
* used by account.c while syncing accounts
- * @param account The account for which we want the info.
- * @param keyringid The plugin id to be stored in the XML node. This will be NULL or a string that can be considered static.
- * @param mode An option field that can be used by the plugin. This will be NULL or a string that can be considered static.
- * @param data The data to be stored in the XML node. This string must be freed using destroy() once not needed anymore if it is not NULL.
- * @param error Will be set if a problem occured.
- * @param destroy A function to be called, if non NULL, to free data.
+ *
+ * @param account The account for which we want the info.
+ * @param keyringid The plugin id to be stored in the XML node. This will be
+ * NULL or a string that can be considered static.
+ * @param mode An option field that can be used by the plugin. This will be
+ * NULL or a string that can be considered static.
+ * @param data The data to be stored in the XML node. This string must be
+ * freed using destroy() once not needed anymore if it is not
+ * NULL.
+ * @param error Will be set if a problem occured.
+ * @param destroy A function to be called, if non NULL, to free data.
+ *
* @return TRUE if the info was exported successfully, FALSE otherwise.
*/
gboolean
-purple_keyring_export_password(PurpleAccount * account,
- const char ** keyringid,
- const char ** mode,
- char ** data,
- GError ** error,
- GDestroyNotify * destroy);
+purple_keyring_export_password(PurpleAccount *account,
+ const char **keyringid,
+ const char **mode,
+ char **data,
+ GError **error,
+ GDestroyNotify *destroy);
/**
* Read a password from the active safe.
@@ -335,21 +367,22 @@ purple_keyring_set_password(PurpleAccoun
/**
* Close a safe.
+ *
* @param keyring The safe to close.
- * @param error Error that might occur.
+ * @param error Error that might occur.
*/
void
-purple_keyring_close(PurpleKeyring * keyring,
- GError ** error);
+purple_keyring_close(PurpleKeyring *keyring, GError **error);
/**
* Change the master password for a safe (if the safe supports it).
- * @param cb A callback to notify once we're done.
+ *
+ * @param cb A callback to notify once we're done.
* @param data A pointer to be passed to the callback.
*/
void
purple_keyring_change_master(PurpleKeyringChangeMasterCallback cb,
- gpointer data);
+ gpointer data);
/*@}*/
@@ -358,26 +391,26 @@ purple_keyring_change_master(PurpleKeyri
/***************************************/
/*@{*/
-PurpleKeyring * purple_keyring_new(void);
-void purple_keyring_free(PurpleKeyring * keyring);
+PurpleKeyring *purple_keyring_new(void);
+void purple_keyring_free(PurpleKeyring *keyring);
-const char * purple_keyring_get_name(const PurpleKeyring * info);
-const char * purple_keyring_get_id(const PurpleKeyring * info);
-PurpleKeyringRead purple_keyring_get_read_password(const PurpleKeyring * info);
-PurpleKeyringSave purple_keyring_get_save_password(const PurpleKeyring * info);
-PurpleKeyringClose purple_keyring_get_close_keyring(const PurpleKeyring * info);
-PurpleKeyringChangeMaster purple_keyring_get_change_master(const PurpleKeyring * info);
-PurpleKeyringImportPassword purple_keyring_get_import_password(const PurpleKeyring * info);
-PurpleKeyringExportPassword purple_keyring_get_export_password(const PurpleKeyring * info);
+const char *purple_keyring_get_name(const PurpleKeyring *info);
+const char *purple_keyring_get_id(const PurpleKeyring *info);
+PurpleKeyringRead purple_keyring_get_read_password(const PurpleKeyring *info);
+PurpleKeyringSave purple_keyring_get_save_password(const PurpleKeyring *info);
+PurpleKeyringClose purple_keyring_get_close_keyring(const PurpleKeyring *info);
+PurpleKeyringChangeMaster purple_keyring_get_change_master(const PurpleKeyring *info);
+PurpleKeyringImportPassword purple_keyring_get_import_password(const PurpleKeyring *info);
+PurpleKeyringExportPassword purple_keyring_get_export_password(const PurpleKeyring *info);
-void purple_keyring_set_name(PurpleKeyring * info, char * name);
-void purple_keyring_set_id(PurpleKeyring * info, char * id);
-void purple_keyring_set_read_password(PurpleKeyring * info, PurpleKeyringRead read);
-void purple_keyring_set_save_password(PurpleKeyring * info, PurpleKeyringSave save);
-void purple_keyring_set_close_keyring(PurpleKeyring * info, PurpleKeyringClose close);
-void purple_keyring_set_change_master(PurpleKeyring * info, PurpleKeyringChangeMaster change_master);
-void purple_keyring_set_import_password(PurpleKeyring * info, PurpleKeyringImportPassword import_password);
-void purple_keyring_set_export_password(PurpleKeyring * info, PurpleKeyringExportPassword export_password);
+void purple_keyring_set_name(PurpleKeyring *info, char *name);
+void purple_keyring_set_id(PurpleKeyring *info, char *id);
+void purple_keyring_set_read_password(PurpleKeyring *info, PurpleKeyringRead read);
+void purple_keyring_set_save_password(PurpleKeyring *info, PurpleKeyringSave save);
+void purple_keyring_set_close_keyring(PurpleKeyring *info, PurpleKeyringClose close);
+void purple_keyring_set_change_master(PurpleKeyring *info, PurpleKeyringChangeMaster change_master);
+void purple_keyring_set_import_password(PurpleKeyring *info, PurpleKeyringImportPassword import_password);
+void purple_keyring_set_export_password(PurpleKeyring *info, PurpleKeyringExportPassword export_password);
/*@}*/
@@ -414,3 +447,4 @@ enum PurpleKeyringError
#endif
/*}@*/
#endif /* _PURPLE_KEYRING_H_ */
+
============================================================
--- libpurple/keyring.c 5849f6194a2104870f91c2b0725fb296006d4c90
+++ libpurple/keyring.c 37923b6723ac53bb69531d523ea05f38d9158ded
@@ -45,8 +45,8 @@ struct _PurpleKeyring
struct _PurpleKeyring
{
- char * name; /* a user friendly name */
- char * id; /* same as plugin id */
+ char *name; /* a user friendly name */
+ char *id; /* same as plugin id */
PurpleKeyringRead read_password;
PurpleKeyringSave save_password;
PurpleKeyringClose close_keyring;
@@ -57,11 +57,11 @@ struct _PurpleKeyringChangeTracker
struct _PurpleKeyringChangeTracker
{
- GError * error; /* could probably be dropped */
+ GError *error; /* could probably be dropped */
PurpleKeyringSetInUseCallback cb;
gpointer data;
- const PurpleKeyring * new;
- const PurpleKeyring * old; /* we are done when : finished == TRUE && read_outstanding == 0 */
+ const PurpleKeyring *new;
+ const PurpleKeyring *old; /* we are done when: finished == TRUE && read_outstanding == 0 */
int read_outstanding;
gboolean finished;
gboolean abort;
@@ -90,7 +90,7 @@ const char *
/* Accessors */
const char *
-purple_keyring_get_name(const PurpleKeyring * keyring)
+purple_keyring_get_name(const PurpleKeyring *keyring)
{
g_return_val_if_fail(keyring != NULL, NULL);
@@ -98,7 +98,7 @@ const char *
}
const char *
-purple_keyring_get_id(const PurpleKeyring * keyring)
+purple_keyring_get_id(const PurpleKeyring *keyring)
{
g_return_val_if_fail(keyring != NULL, NULL);
@@ -106,7 +106,7 @@ PurpleKeyringRead
}
PurpleKeyringRead
-purple_keyring_get_read_password(const PurpleKeyring * keyring)
+purple_keyring_get_read_password(const PurpleKeyring *keyring)
{
g_return_val_if_fail(keyring != NULL, NULL);
@@ -114,7 +114,7 @@ PurpleKeyringSave
}
PurpleKeyringSave
-purple_keyring_get_save_password(const PurpleKeyring * keyring)
+purple_keyring_get_save_password(const PurpleKeyring *keyring)
{
g_return_val_if_fail(keyring != NULL, NULL);
@@ -122,7 +122,7 @@ PurpleKeyringClose
}
PurpleKeyringClose
-purple_keyring_get_close_keyring(const PurpleKeyring * keyring)
+purple_keyring_get_close_keyring(const PurpleKeyring *keyring)
{
g_return_val_if_fail(keyring != NULL, NULL);
@@ -130,7 +130,7 @@ PurpleKeyringChangeMaster
}
PurpleKeyringChangeMaster
-purple_keyring_get_change_master(const PurpleKeyring * keyring)
+purple_keyring_get_change_master(const PurpleKeyring *keyring)
{
g_return_val_if_fail(keyring != NULL, NULL);
@@ -138,7 +138,7 @@ PurpleKeyringImportPassword
}
PurpleKeyringImportPassword
-purple_keyring_get_import_password(const PurpleKeyring * keyring)
+purple_keyring_get_import_password(const PurpleKeyring *keyring)
{
g_return_val_if_fail(keyring != NULL, NULL);
@@ -146,7 +146,7 @@ PurpleKeyringExportPassword
}
PurpleKeyringExportPassword
-purple_keyring_get_export_password(const PurpleKeyring * keyring)
+purple_keyring_get_export_password(const PurpleKeyring *keyring)
{
g_return_val_if_fail(keyring != NULL, NULL);
@@ -154,7 +154,7 @@ void
}
void
-purple_keyring_set_name(PurpleKeyring * keyring, char * name)
+purple_keyring_set_name(PurpleKeyring *keyring, char *name)
{
g_return_if_fail(keyring != NULL);
@@ -163,7 +163,7 @@ void
}
void
-purple_keyring_set_id(PurpleKeyring * keyring, char * id)
+purple_keyring_set_id(PurpleKeyring *keyring, char *id)
{
g_return_if_fail(keyring != NULL);
@@ -172,7 +172,7 @@ void
}
void
-purple_keyring_set_read_password(PurpleKeyring * keyring, PurpleKeyringRead read)
+purple_keyring_set_read_password(PurpleKeyring *keyring, PurpleKeyringRead read)
{
g_return_if_fail(keyring != NULL);
@@ -180,7 +180,7 @@ void
}
void
-purple_keyring_set_save_password(PurpleKeyring * keyring, PurpleKeyringSave save)
+purple_keyring_set_save_password(PurpleKeyring *keyring, PurpleKeyringSave save)
{
g_return_if_fail(keyring != NULL);
@@ -188,7 +188,7 @@ void
}
void
-purple_keyring_set_close_keyring(PurpleKeyring * keyring, PurpleKeyringClose close)
+purple_keyring_set_close_keyring(PurpleKeyring *keyring, PurpleKeyringClose close)
{
g_return_if_fail(keyring != NULL);
@@ -196,7 +196,7 @@ void
}
void
-purple_keyring_set_change_master(PurpleKeyring * keyring, PurpleKeyringChangeMaster change)
+purple_keyring_set_change_master(PurpleKeyring *keyring, PurpleKeyringChangeMaster change)
{
g_return_if_fail(keyring != NULL);
@@ -204,7 +204,7 @@ void
}
void
-purple_keyring_set_import_password(PurpleKeyring * keyring, PurpleKeyringImportPassword import)
+purple_keyring_set_import_password(PurpleKeyring *keyring, PurpleKeyringImportPassword import)
{
g_return_if_fail(keyring != NULL);
@@ -212,7 +212,7 @@ void
}
void
-purple_keyring_set_export_password(PurpleKeyring * keyring, PurpleKeyringExportPassword export)
+purple_keyring_set_export_password(PurpleKeyring *keyring, PurpleKeyringExportPassword export)
{
g_return_if_fail(keyring != NULL);
@@ -227,9 +227,9 @@ purple_keyring_set_export_password(Purpl
/***************************************/
/*@{*/
-static GList * purple_keyring_keyrings; /* list of available keyrings */
-static const PurpleKeyring * purple_keyring_inuse; /* keyring being used */
-static char * purple_keyring_to_use;
+static GList *purple_keyring_keyrings; /* list of available keyrings */
+static const PurpleKeyring *purple_keyring_inuse; /* keyring being used */
+static char *purple_keyring_to_use;
static guint purple_keyring_pref_cb_id;
static void
@@ -238,7 +238,7 @@ purple_keyring_pref_cb(const char *pref,
gconstpointer id,
gpointer data)
{
- PurpleKeyring * new;
+ PurpleKeyring *new;
g_return_if_fail(g_strcmp0(pref, "/purple/keyring/active") == 0);
g_return_if_fail(type == PURPLE_PREF_STRING);
@@ -251,10 +251,10 @@ void
}
void
-purple_keyring_init()
+purple_keyring_init(void)
{
- PurpleCore * core;
- const char * touse;
+ PurpleCore *core;
+ const char *touse;
/* Make sure we don't have junk */
purple_keyring_keyrings = NULL;
@@ -266,13 +266,13 @@ purple_keyring_init()
purple_signal_register(core, "keyring-register",
purple_marshal_VOID__POINTER_POINTER,
NULL, 2,
- purple_value_new(PURPLE_TYPE_STRING), /* keyring ID */
+ purple_value_new(PURPLE_TYPE_STRING), /* keyring ID */
purple_value_new(PURPLE_TYPE_BOXED, "PurpleKeyring *")); /* a pointer to the keyring */
purple_signal_register(core, "keyring-unregister",
purple_marshal_VOID__POINTER_POINTER,
NULL, 2,
- purple_value_new(PURPLE_TYPE_STRING), /* keyring ID */
+ purple_value_new(PURPLE_TYPE_STRING), /* keyring ID */
purple_value_new(PURPLE_TYPE_BOXED, "PurpleKeyring *")); /* a pointer to the keyring */
/* see what keyring we want to use */
@@ -282,9 +282,7 @@ purple_keyring_init()
purple_prefs_add_none("/purple/keyring");
purple_prefs_add_string("/purple/keyring/active", FALLBACK_KEYRING);
purple_keyring_to_use = g_strdup(FALLBACK_KEYRING);
-
} else {
-
purple_keyring_to_use = g_strdup(touse);
}
@@ -296,18 +294,18 @@ void
}
void
-purple_keyring_uninit()
+purple_keyring_uninit(void)
{
g_free(purple_keyring_to_use);
purple_debug_info("keyring", "purple_keyring_uninit() done.\n");
}
static PurpleKeyring *
-purple_keyring_find_keyring_by_id(char * id)
+purple_keyring_find_keyring_by_id(char *id)
{
- GList * l;
- PurpleKeyring * keyring;
- const char * curr_id;
+ GList *l;
+ PurpleKeyring *keyring;
+ const char *curr_id;
for (l = purple_keyring_keyrings; l != NULL; l = l->next) {
keyring = l->data;
@@ -321,13 +319,13 @@ const GList *
}
const GList *
-purple_keyring_get_keyrings()
+purple_keyring_get_keyrings(void)
{
return purple_keyring_keyrings;
}
const PurpleKeyring *
-purple_keyring_get_inuse()
+purple_keyring_get_inuse(void)
{
return purple_keyring_inuse;
}
@@ -335,9 +333,9 @@ static void
/* fire and forget */
static void
-purple_keyring_drop_passwords(const PurpleKeyring * keyring)
+purple_keyring_drop_passwords(const PurpleKeyring *keyring)
{
- GList * cur;
+ GList *cur;
PurpleKeyringSave save;
save = purple_keyring_get_save_password(keyring);
@@ -350,17 +348,14 @@ purple_keyring_drop_passwords(const Purp
save(cur->data, NULL, NULL, NULL);
}
-
-
static void
-purple_keyring_set_inuse_check_error_cb(PurpleAccount * account,
- GError * error,
+purple_keyring_set_inuse_check_error_cb(PurpleAccount *account,
+ GError *error,
gpointer data)
{
-
- const char * name;
+ const char *name;
PurpleKeyringClose close;
- struct _PurpleKeyringChangeTracker * tracker;
+ struct _PurpleKeyringChangeTracker *tracker;
tracker = (PurpleKeyringChangeTracker *)data;
@@ -368,46 +363,42 @@ purple_keyring_set_inuse_check_error_cb(
tracker->read_outstanding--;
- name = purple_account_get_username(account);;
+ name = purple_account_get_username(account);
-
if ((error != NULL) && (error->domain == ERR_PIDGINKEYRING)) {
-
tracker->error = error;
switch(error->code) {
-
- case ERR_NOCAP :
+ case ERR_NOCAP:
purple_debug_info("keyring",
"Keyring could not save password for account %s : %s\n",
name, error->message);
break;
- case ERR_NOPASSWD :
+ case ERR_NOPASSWD:
purple_debug_info("keyring",
"No password found while changing keyring for account %s : %s\n",
name, error->message);
break;
- case ERR_NOCHANNEL :
+ case ERR_NOCHANNEL:
purple_debug_info("keyring",
"Failed to communicate with backend while changing keyring for account %s : %s Aborting changes.\n",
name, error->message);
tracker->abort = TRUE;
break;
- default :
+ default:
purple_debug_info("keyring",
"Unknown error while changing keyring for account %s : %s\n",
name, error->message);
break;
}
}
+
/* if this was the last one */
if (tracker->finished == TRUE && tracker->read_outstanding == 0) {
-
if (tracker->abort == TRUE && tracker->force == FALSE) {
-
if (tracker->cb != NULL)
tracker->cb(tracker->old, FALSE, tracker->error, tracker->data);
@@ -429,7 +420,6 @@ purple_keyring_set_inuse_check_error_cb(
purple_keyring_pref_cb_id = purple_prefs_connect_callback(NULL,
"/purple/keyring/active", purple_keyring_pref_cb, NULL);
-
} else {
close = purple_keyring_get_close_keyring(tracker->old);
if (close != NULL)
@@ -446,6 +436,7 @@ purple_keyring_set_inuse_check_error_cb(
g_free(tracker);
}
+
/**
* This is kind of hackish. It will schedule an account save,
* and then return because account == NULL.
@@ -458,14 +449,14 @@ static void
static void
-purple_keyring_set_inuse_got_pw_cb(PurpleAccount * account,
- gchar * password,
- GError * error,
- gpointer data)
+purple_keyring_set_inuse_got_pw_cb(PurpleAccount *account,
+ gchar *password,
+ GError *error,
+ gpointer data)
{
- const PurpleKeyring * new;
+ const PurpleKeyring *new;
PurpleKeyringSave save;
- PurpleKeyringChangeTracker * tracker;
+ PurpleKeyringChangeTracker *tracker;
tracker = (PurpleKeyringChangeTracker *)data;
new = tracker->new;
@@ -473,23 +464,18 @@ purple_keyring_set_inuse_got_pw_cb(Purpl
g_return_if_fail(tracker->abort == FALSE);
if (error != NULL) {
-
if (error->code == ERR_NOPASSWD ||
error->code == ERR_NOACCOUNT ||
tracker->force == TRUE) {
-
/* don't save password, and directly trigger callback */
purple_keyring_set_inuse_check_error_cb(account, error, data);
} else {
-
/* fatal error, abort all */
tracker->abort = TRUE;
}
} else {
-
-
save = purple_keyring_get_save_password(new);
if (save != NULL) {
@@ -501,7 +487,7 @@ purple_keyring_set_inuse_got_pw_cb(Purpl
purple_keyring_set_inuse_check_error_cb, tracker);
} else {
- error = g_error_new(ERR_PIDGINKEYRING , ERR_NOCAP,
+ error = g_error_new(ERR_PIDGINKEYRING, ERR_NOCAP,
"cannot store passwords in new keyring");
purple_keyring_set_inuse_check_error_cb(account, error, data);
g_error_free(error);
@@ -509,20 +495,17 @@ purple_keyring_set_inuse_got_pw_cb(Purpl
}
}
-
-
-
void
-purple_keyring_set_inuse(const PurpleKeyring * newkeyring,
- gboolean force,
- PurpleKeyringSetInUseCallback cb,
- gpointer data)
+purple_keyring_set_inuse(const PurpleKeyring *newkeyring,
+ gboolean force,
+ PurpleKeyringSetInUseCallback cb,
+ gpointer data)
{
- GList * cur;
- const PurpleKeyring * oldkeyring;
+ GList *cur;
+ const PurpleKeyring *oldkeyring;
PurpleKeyringRead read = NULL;
PurpleKeyringClose close;
- PurpleKeyringChangeTracker * tracker;
+ PurpleKeyringChangeTracker *tracker;
if (newkeyring != NULL)
purple_debug_info("keyring", "Attempting to set new keyring : %s.\n",
@@ -537,7 +520,7 @@ purple_keyring_set_inuse(const PurpleKey
if (read == NULL) {
/*
- error = g_error_new(ERR_PIDGINKEYRING , ERR_NOCAP,
+ error = g_error_new(ERR_PIDGINKEYRING, ERR_NOCAP,
"Existing keyring cannot read passwords");
*/
purple_debug_info("keyring", "Existing keyring cannot read passwords");
@@ -553,7 +536,7 @@ purple_keyring_set_inuse(const PurpleKey
close = purple_keyring_get_close_keyring(oldkeyring);
if (close != NULL)
- close(NULL); /* we can't do much about errors at this point*/
+ close(NULL); /* we can't do much about errors at this point */
} else {
tracker = g_malloc(sizeof(PurpleKeyringChangeTracker));
@@ -594,14 +577,12 @@ purple_keyring_set_inuse(const PurpleKey
}
}
-
-
GList *
-purple_keyring_get_options()
+purple_keyring_get_options(void)
{
- const GList * keyrings;
- PurpleKeyring * keyring;
- GList * list = NULL;
+ const GList *keyrings;
+ PurpleKeyring *keyring;
+ GList *list = NULL;
for (keyrings = purple_keyring_get_keyrings();
keyrings != NULL;
@@ -618,10 +599,10 @@ PurpleKeyring *
}
PurpleKeyring *
-purple_keyring_get_keyring_by_id(const char * id)
+purple_keyring_get_keyring_by_id(const char *id)
{
- const GList * keyrings;
- PurpleKeyring * keyring;
+ const GList *keyrings;
+ PurpleKeyring *keyring;
for (keyrings = purple_keyring_get_keyrings();
keyrings != NULL;
@@ -632,16 +613,15 @@ purple_keyring_get_keyring_by_id(const c
return keyring;
}
+
return NULL;
}
-
-
void
-purple_keyring_register(PurpleKeyring * keyring)
+purple_keyring_register(PurpleKeyring *keyring)
{
- const char * keyring_id;
- PurpleCore * core;
+ const char *keyring_id;
+ PurpleCore *core;
g_return_if_fail(keyring != NULL);
@@ -650,7 +630,6 @@ purple_keyring_register(PurpleKeyring *
/* keyring with no ID. Add error handling ? */
g_return_if_fail(keyring_id != NULL);
-
purple_debug_info("keyring", "Registering keyring : %s\n",
keyring->id);
@@ -673,19 +652,17 @@ purple_keyring_register(PurpleKeyring *
keyring);
}
-
void
-purple_keyring_unregister(PurpleKeyring * keyring)
+purple_keyring_unregister(PurpleKeyring *keyring)
{
- PurpleCore * core;
- const PurpleKeyring * inuse;
- PurpleKeyring * fallback;
- const char * keyring_id;
+ PurpleCore *core;
+ const PurpleKeyring *inuse;
+ PurpleKeyring *fallback;
+ const char *keyring_id;
g_return_if_fail(keyring != NULL);
- purple_debug_info("keyring",
- "Unregistering keyring %s",
+ purple_debug_info("keyring", "Unregistering keyring %s",
purple_keyring_get_id(keyring));
core = purple_get_core();
@@ -711,7 +688,6 @@ purple_keyring_unregister(PurpleKeyring
purple_debug_info("keyring", "Keyring %s unregistered", keyring->id);
}
-
/*@}*/
@@ -720,17 +696,16 @@ purple_keyring_unregister(PurpleKeyring
/***************************************/
/*@{*/
-
gboolean
-purple_keyring_import_password(PurpleAccount * account,
- const char * keyringid,
- const char * mode,
- const char * data,
- GError ** error)
+purple_keyring_import_password(PurpleAccount *account,
+ const char *keyringid,
+ const char *mode,
+ const char *data,
+ GError **error)
{
- const PurpleKeyring * inuse;
+ const PurpleKeyring *inuse;
PurpleKeyringImportPassword import;
- const char * realid;
+ const char *realid;
purple_debug_info("keyring", "Importing password for account %s (%s) to keyring %s.\n",
purple_account_get_username(account),
@@ -777,14 +752,14 @@ gboolean
}
gboolean
-purple_keyring_export_password(PurpleAccount * account,
- const char ** keyringid,
- const char ** mode,
- char ** data,
- GError ** error,
- GDestroyNotify * destroy)
+purple_keyring_export_password(PurpleAccount *account,
+ const char **keyringid,
+ const char **mode,
+ char **data,
+ GError **error,
+ GDestroyNotify *destroy)
{
- const PurpleKeyring * inuse;
+ const PurpleKeyring *inuse;
PurpleKeyringExportPassword export;
inuse = purple_keyring_get_inuse();
@@ -831,8 +806,8 @@ purple_keyring_get_password(PurpleAccoun
PurpleKeyringReadCallback cb,
gpointer data)
{
- GError * error = NULL;
- const PurpleKeyring * inuse;
+ GError *error = NULL;
+ const PurpleKeyring *inuse;
PurpleKeyringRead read;
if (account == NULL) {
@@ -876,11 +851,11 @@ static void
}
static void
-purple_keyring_set_password_async_cb(PurpleAccount * account,
- GError * error,
- gpointer data)
+purple_keyring_set_password_async_cb(PurpleAccount *account,
+ GError *error,
+ gpointer data)
{
- PurpleKeyringCbInfo * cbinfo;
+ PurpleKeyringCbInfo *cbinfo;
PurpleKeyringSaveCallback cb;
g_return_if_fail(data != NULL);
@@ -901,15 +876,15 @@ void
}
void
-purple_keyring_set_password(PurpleAccount * account,
+purple_keyring_set_password(PurpleAccount *account,
const gchar *password,
PurpleKeyringSaveCallback cb,
gpointer data)
{
- GError * error = NULL;
- const PurpleKeyring * inuse;
+ GError *error = NULL;
+ const PurpleKeyring *inuse;
PurpleKeyringSave save;
- PurpleKeyringCbInfo * cbinfo;
+ PurpleKeyringCbInfo *cbinfo;
g_return_if_fail(account != NULL);
@@ -940,8 +915,7 @@ void
}
void
-purple_keyring_close(PurpleKeyring * keyring,
- GError ** error)
+purple_keyring_close(PurpleKeyring *keyring, GError **error)
{
PurpleKeyringClose close;
@@ -966,11 +940,11 @@ purple_keyring_change_master(PurpleKeyri
void
purple_keyring_change_master(PurpleKeyringChangeMasterCallback cb,
- gpointer data)
+ gpointer data)
{
- GError * error = NULL;
+ GError *error = NULL;
PurpleKeyringChangeMaster change;
- const PurpleKeyring * inuse;
+ const PurpleKeyring *inuse;
inuse = purple_keyring_get_inuse();
@@ -982,7 +956,6 @@ purple_keyring_change_master(PurpleKeyri
g_error_free(error);
} else {
-
change = purple_keyring_get_change_master(inuse);
if (change == NULL) {
============================================================
--- libpurple/plugins/keyrings/gnomekeyring.c c8277a505fecab01c0a2f0bce80a7e7c1dc96a2e
+++ libpurple/plugins/keyrings/gnomekeyring.c 74fec7544719b7ec1a42b715643662819b578de5
@@ -56,15 +56,15 @@
#include "plugin.h"
#include "internal.h"
-#define GNOMEKEYRING_NAME N_("Gnome-Keyring")
-#define GNOMEKEYRING_VERSION "0.3b"
-#define GNOMEKEYRING_DESCRIPTION N_("This plugin will store passwords in Gnome-Keyring.")
-#define GNOMEKEYRING_AUTHOR "Scrouaf (scrouaf[at]soc.pidgin.im)"
-#define GNOMEKEYRING_ID "core-scrouaf-gnomekeyring"
+#define GNOMEKEYRING_NAME N_("Gnome-Keyring")
+#define GNOMEKEYRING_VERSION "0.3b"
+#define GNOMEKEYRING_DESCRIPTION N_("This plugin will store passwords in Gnome-Keyring.")
+#define GNOMEKEYRING_AUTHOR "Scrouaf (scrouaf[at]soc.pidgin.im)"
+#define GNOMEKEYRING_ID "core-scrouaf-gnomekeyring"
#define ERR_GNOMEKEYRINGPLUGIN gkp_error_domain()
-static PurpleKeyring * keyring_handler = NULL;
+static PurpleKeyring *keyring_handler = NULL;
typedef struct _InfoStorage InfoStorage;
@@ -72,8 +72,8 @@ struct _InfoStorage
{
gpointer cb;
gpointer user_data;
- PurpleAccount * account;
- char * name;
+ PurpleAccount *account;
+ char *name;
};
static GQuark gkp_error_domain(void)
@@ -85,22 +85,21 @@ static GQuark gkp_error_domain(void)
/***********************************************/
/* Keyring interface */
/***********************************************/
-static void gkp_read_continue(GnomeKeyringResult result,
- const char *password,
- gpointer data)
+static void
+gkp_read_continue(GnomeKeyringResult result,
+ const char *password,
+ gpointer data)
/* XXX : make sure list is freed on return */
{
- InfoStorage * storage = data;
- PurpleAccount * account =storage->account;
+ InfoStorage *storage = data;
+ PurpleAccount *account = storage->account;
PurpleKeyringReadCallback cb = storage->cb;
- GError * error;
- char * copy;
+ GError *error;
+ char *copy;
if (result != GNOME_KEYRING_RESULT_OK) {
-
- switch(result)
- {
- case GNOME_KEYRING_RESULT_NO_MATCH :
+ switch(result) {
+ case GNOME_KEYRING_RESULT_NO_MATCH:
error = g_error_new(ERR_GNOMEKEYRINGPLUGIN,
ERR_NOPASSWD, "no password found for account : %s",
purple_account_get_username(account));
@@ -109,8 +108,8 @@ static void gkp_read_continue(GnomeKeyri
g_error_free(error);
return;
- case GNOME_KEYRING_RESULT_NO_KEYRING_DAEMON :
- case GNOME_KEYRING_RESULT_IO_ERROR :
+ case GNOME_KEYRING_RESULT_NO_KEYRING_DAEMON:
+ case GNOME_KEYRING_RESULT_IO_ERROR:
error = g_error_new(ERR_GNOMEKEYRINGPLUGIN,
ERR_NOCHANNEL, "Failed to communicate with gnome keyring (account : %s).",
purple_account_get_username(account));
@@ -119,7 +118,7 @@ static void gkp_read_continue(GnomeKeyri
g_error_free(error);
return;
- default :
+ default:
error = g_error_new(ERR_GNOMEKEYRINGPLUGIN,
ERR_NOCHANNEL, "Unknown error (account : %s).",
purple_account_get_username(account));
@@ -130,8 +129,7 @@ static void gkp_read_continue(GnomeKeyri
}
} else {
-
- if(cb != NULL) {
+ if (cb != NULL) {
copy = g_strdup(password);
cb(account, copy, NULL, storage->user_data);
g_free(copy);
@@ -140,33 +138,30 @@ static void
}
static void
-gkp_read(PurpleAccount * account,
- PurpleKeyringReadCallback cb,
- gpointer data)
+gkp_read(PurpleAccount *account, PurpleKeyringReadCallback cb, gpointer data)
{
- InfoStorage * storage = g_malloc(sizeof(InfoStorage));
+ 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);
+ gkp_read_continue,
+ storage,
+ g_free,
+ "user", purple_account_get_username(account),
+ "protocol", purple_account_get_protocol_id(account),
+ NULL);
}
static void
-gkp_save_continue(GnomeKeyringResult result,
- gpointer data)
+gkp_save_continue(GnomeKeyringResult result, gpointer data)
{
- InfoStorage * storage;
+ InfoStorage *storage;
PurpleKeyringSaveCallback cb;
- GError * error;
- PurpleAccount * account;
+ GError *error;
+ PurpleAccount *account;
storage = data;
g_return_if_fail(storage != NULL);
@@ -177,9 +172,8 @@ gkp_save_continue(GnomeKeyringResult res
g_free(storage->name);
if (result != GNOME_KEYRING_RESULT_OK) {
- switch(result)
- {
- case GNOME_KEYRING_RESULT_NO_MATCH :
+ switch(result) {
+ case GNOME_KEYRING_RESULT_NO_MATCH:
purple_debug_info("Gnome keyring plugin",
"Could not update password for %s (%s) : not found.\n",
purple_account_get_username(account),
@@ -192,8 +186,8 @@ gkp_save_continue(GnomeKeyringResult res
g_error_free(error);
return;
- case GNOME_KEYRING_RESULT_NO_KEYRING_DAEMON :
- case GNOME_KEYRING_RESULT_IO_ERROR :
+ case GNOME_KEYRING_RESULT_NO_KEYRING_DAEMON:
+ case GNOME_KEYRING_RESULT_IO_ERROR:
purple_debug_info("Gnome keyring plugin",
"Failed to communicate with gnome keyring (account : %s (%s)).\n",
purple_account_get_username(account),
@@ -206,7 +200,7 @@ gkp_save_continue(GnomeKeyringResult res
g_error_free(error);
return;
- default :
+ default:
purple_debug_info("Gnome keyring plugin",
"Unknown error (account : %s (%s)).\n",
purple_account_get_username(account),
@@ -221,22 +215,21 @@ gkp_save_continue(GnomeKeyringResult res
}
} else {
-
purple_debug_info("gnome-keyring-plugin", "password for %s updated.\n",
purple_account_get_username(account));
- if(cb != NULL)
+ if (cb != NULL)
cb(account, NULL, storage->user_data);
}
}
static void
-gkp_save(PurpleAccount * account,
- const gchar * password,
- PurpleKeyringSaveCallback cb,
- gpointer data)
+gkp_save(PurpleAccount *account,
+ const gchar *password,
+ PurpleKeyringSaveCallback cb,
+ gpointer data)
{
- InfoStorage * storage = g_new0(InfoStorage,1);
+ InfoStorage *storage = g_new0(InfoStorage,1);
storage->account = account;
storage->cb = cb;
@@ -244,67 +237,61 @@ gkp_save(PurpleAccount * account,
storage->name = g_strdup_printf("pidgin-%s",
purple_account_get_username(account));
- if(password != NULL && *password != '\0') {
-
+ 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,
+ 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);
+ 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);
-
+ 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)
+gkp_close(GError **error)
{
}
static gboolean
-gkp_import_password(PurpleAccount * account,
- const char * mode,
- const char * data,
- GError ** error)
+gkp_import_password(PurpleAccount *account,
+ const char *mode,
+ const char *data,
+ GError **error)
{
- purple_debug_info("Gnome Keyring plugin",
- "Importing password.\n");
+ purple_debug_info("Gnome Keyring plugin", "Importing password.\n");
return TRUE;
}
static gboolean
-gkp_export_password(PurpleAccount * account,
- const char ** mode,
- char ** data,
- GError ** error,
- GDestroyNotify * destroy)
+gkp_export_password(PurpleAccount *account,
+ const char **mode,
+ char **data,
+ GError **error,
+ GDestroyNotify *destroy)
{
- purple_debug_info("Gnome Keyring plugin",
- "Exporting password.\n");
+ purple_debug_info("Gnome Keyring plugin", "Exporting password.\n");
*data = NULL;
*mode = NULL;
*destroy = NULL;
@@ -320,19 +307,18 @@ gkp_change_master(PurpleKeyringChangeMas
"This keyring does not support master passwords.\n");
purple_notify_info(NULL, _("Gnome-Keyring plugin"),
- _("Failed to change master password."),
- _("This plugin does not really support master passwords, it just pretends to."));
- if(cb)
+ _("Failed to change master password."),
+ _("This plugin does not really support master passwords, it just pretends to."));
+ if (cb)
cb(FALSE, NULL, data);
}
static gboolean
-gkp_init()
+gkp_init(void)
{
purple_debug_info("gnome-keyring-plugin", "init.\n");
if (gnome_keyring_is_available()) {
-
keyring_handler = purple_keyring_new();
purple_keyring_set_name(keyring_handler, GNOMEKEYRING_NAME);
@@ -349,7 +335,6 @@ gkp_init()
return TRUE;
} else {
-
purple_debug_info("gnome-keyring-plugin",
"failed to communicate with daemon, not loading.");
return FALSE;
@@ -357,7 +342,7 @@ static void
}
static void
-gkp_uninit()
+gkp_uninit(void)
{
purple_debug_info("gnome-keyring-plugin", "uninit.\n");
gkp_close(NULL);
@@ -366,8 +351,6 @@ gkp_uninit()
keyring_handler = NULL;
}
-
-
/***********************************************/
/* Plugin interface */
/***********************************************/
@@ -393,29 +376,29 @@ PurplePluginInfo plugininfo =
PurplePluginInfo plugininfo =
{
- PURPLE_PLUGIN_MAGIC, /* magic */
- PURPLE_MAJOR_VERSION, /* major_version */
- PURPLE_MINOR_VERSION, /* minor_version */
- PURPLE_PLUGIN_STANDARD, /* type */
- NULL, /* ui_requirement */
+ PURPLE_PLUGIN_MAGIC, /* magic */
+ PURPLE_MAJOR_VERSION, /* major_version */
+ PURPLE_MINOR_VERSION, /* minor_version */
+ PURPLE_PLUGIN_STANDARD, /* type */
+ NULL, /* ui_requirement */
PURPLE_PLUGIN_FLAG_INVISIBLE|PURPLE_PLUGIN_FLAG_AUTOLOAD, /* flags */
- NULL, /* dependencies */
- PURPLE_PRIORITY_DEFAULT, /* priority */
- GNOMEKEYRING_ID, /* id */
- GNOMEKEYRING_NAME, /* name */
- GNOMEKEYRING_VERSION, /* version */
- "Internal Keyring Plugin", /* summary */
- GNOMEKEYRING_DESCRIPTION, /* description */
- GNOMEKEYRING_AUTHOR, /* author */
- "N/A", /* homepage */
- gkp_load, /* load */
+ NULL, /* dependencies */
+ PURPLE_PRIORITY_DEFAULT, /* priority */
+ GNOMEKEYRING_ID, /* id */
+ GNOMEKEYRING_NAME, /* name */
+ GNOMEKEYRING_VERSION, /* version */
+ "Internal Keyring Plugin", /* summary */
+ GNOMEKEYRING_DESCRIPTION, /* description */
+ GNOMEKEYRING_AUTHOR, /* author */
+ "N/A", /* homepage */
+ gkp_load, /* load */
gkp_unload, /* unload */
- gkp_destroy, /* destroy */
- NULL, /* ui_info */
- NULL, /* extra_info */
- NULL, /* prefs_info */
- NULL, /* actions */
- NULL, /* padding... */
+ gkp_destroy, /* destroy */
+ NULL, /* ui_info */
+ NULL, /* extra_info */
+ NULL, /* prefs_info */
+ NULL, /* actions */
+ NULL, /* padding... */
NULL,
NULL,
NULL,
============================================================
--- libpurple/plugins/keyrings/internalkeyring.c a811b736122090c0ca212aa73ab2412612b80710
+++ libpurple/plugins/keyrings/internalkeyring.c 26c9aa38f3164760426cfdcfbff731bbb98b670f
@@ -52,13 +52,12 @@
#include "plugin.h"
#include "internal.h"
-#define INTERNALKEYRING_NAME N_("Internal keyring")
-#define INTERNALKEYRING_VERSION "0.8b"
-#define INTERNALKEYRING_DESCRIPTION N_("This plugin provides the default password storage behaviour for libpurple. Password will be stored unencrypted.")
-#define INTERNALKEYRING_AUTHOR "Scrouaf (scrouaf[at]soc.pidgin.im)"
-#define INTERNALKEYRING_ID FALLBACK_KEYRING
+#define INTERNALKEYRING_NAME N_("Internal keyring")
+#define INTERNALKEYRING_VERSION "0.8b"
+#define INTERNALKEYRING_DESCRIPTION N_("This plugin provides the default password storage behaviour for libpurple. Password will be stored unencrypted.")
+#define INTERNALKEYRING_AUTHOR "Scrouaf (scrouaf[at]soc.pidgin.im)"
+#define INTERNALKEYRING_ID FALLBACK_KEYRING
-
#define GET_PASSWORD(account) \
g_hash_table_lookup (internal_keyring_passwords, account)
#define SET_PASSWORD(account, password) \
@@ -67,16 +66,15 @@
if (internal_keyring_is_active == FALSE)\
internal_keyring_open();
-
-static GHashTable * internal_keyring_passwords = NULL;
-static PurpleKeyring * keyring_handler = NULL;
+static GHashTable *internal_keyring_passwords = NULL;
+static PurpleKeyring *keyring_handler = NULL;
static gboolean internal_keyring_is_active = FALSE;
/***********************************************/
/* Keyring interface */
/***********************************************/
static void
-internal_keyring_open()
+internal_keyring_open(void)
{
internal_keyring_passwords = g_hash_table_new_full(g_direct_hash,
g_direct_equal, NULL, g_free);
@@ -84,12 +82,12 @@ static void
}
static void
-internal_keyring_read(PurpleAccount * account,
- PurpleKeyringReadCallback cb,
- gpointer data)
+internal_keyring_read(PurpleAccount *account,
+ PurpleKeyringReadCallback cb,
+ gpointer data)
{
- char * password;
- GError * error;
+ char *password;
+ GError *error;
ACTIVATE();
@@ -101,24 +99,24 @@ internal_keyring_read(PurpleAccount * ac
password = GET_PASSWORD(account);
if (password != NULL) {
- if(cb != NULL)
+ if (cb != NULL)
cb(account, password, NULL, data);
} else {
error = g_error_new(ERR_PIDGINKEYRING,
ERR_NOPASSWD, "password not found");
- if(cb != NULL)
+ if (cb != NULL)
cb(account, NULL, error, data);
g_error_free(error);
}
}
static void
-internal_keyring_save(PurpleAccount * account,
- const gchar * password,
- PurpleKeyringSaveCallback cb,
- gpointer data)
+internal_keyring_save(PurpleAccount *account,
+ const gchar *password,
+ PurpleKeyringSaveCallback cb,
+ gpointer data)
{
- gchar * copy;
+ gchar *copy;
ACTIVATE();
@@ -144,7 +142,7 @@ static void
static void
-internal_keyring_close(GError ** error)
+internal_keyring_close(GError **error)
{
internal_keyring_is_active = FALSE;
@@ -153,17 +151,16 @@ static gboolean
}
static gboolean
-internal_keyring_import_password(PurpleAccount * account,
- const char * mode,
- const char * data,
- GError ** error)
+internal_keyring_import_password(PurpleAccount *account,
+ const char *mode,
+ const char *data,
+ GError **error)
{
- gchar * copy;
+ gchar *copy;
ACTIVATE();
- purple_debug_info("Internal keyring",
- "Importing password");
+ purple_debug_info("Internal keyring", "Importing password");
if (account != NULL &&
data != NULL &&
@@ -174,7 +171,6 @@ internal_keyring_import_password(PurpleA
return TRUE;
} else {
-
*error = g_error_new(ERR_PIDGINKEYRING, ERR_NOPASSWD, "no password for account");
return FALSE;
@@ -184,13 +180,13 @@ static gboolean
}
static gboolean
-internal_keyring_export_password(PurpleAccount * account,
- const char ** mode,
- char ** data,
- GError ** error,
- GDestroyNotify * destroy)
+internal_keyring_export_password(PurpleAccount *account,
+ const char **mode,
+ char **data,
+ GError **error,
+ GDestroyNotify *destroy)
{
- gchar * password;
+ gchar *password;
ACTIVATE();
@@ -209,11 +205,8 @@ internal_keyring_export_password(PurpleA
}
}
-
-
-
static void
-internal_keyring_init()
+internal_keyring_init(void)
{
keyring_handler = purple_keyring_new();
@@ -230,15 +223,13 @@ static void
}
static void
-internal_keyring_uninit()
+internal_keyring_uninit(void)
{
internal_keyring_close(NULL);
purple_keyring_unregister(keyring_handler);
}
-
-
/***********************************************/
/* Plugin interface */
/***********************************************/
@@ -269,24 +260,24 @@ PurplePluginInfo plugininfo =
PurplePluginInfo plugininfo =
{
- PURPLE_PLUGIN_MAGIC, /* magic */
- PURPLE_MAJOR_VERSION, /* major_version */
- PURPLE_MINOR_VERSION, /* minor_version */
- PURPLE_PLUGIN_STANDARD, /* type */
+ PURPLE_PLUGIN_MAGIC, /* magic */
+ PURPLE_MAJOR_VERSION, /* major_version */
+ PURPLE_MINOR_VERSION, /* minor_version */
+ PURPLE_PLUGIN_STANDARD, /* type */
NULL, /* ui_requirement */
PURPLE_PLUGIN_FLAG_INVISIBLE|PURPLE_PLUGIN_FLAG_AUTOLOAD, /* flags */
NULL, /* dependencies */
- PURPLE_PRIORITY_DEFAULT, /* priority */
- INTERNALKEYRING_ID, /* id */
- INTERNALKEYRING_NAME, /* name */
- INTERNALKEYRING_VERSION, /* version */
- "Internal Keyring Plugin", /* summary */
- INTERNALKEYRING_DESCRIPTION, /* description */
- INTERNALKEYRING_AUTHOR, /* author */
+ PURPLE_PRIORITY_DEFAULT, /* priority */
+ INTERNALKEYRING_ID, /* id */
+ INTERNALKEYRING_NAME, /* name */
+ INTERNALKEYRING_VERSION, /* version */
+ "Internal Keyring Plugin", /* summary */
+ INTERNALKEYRING_DESCRIPTION, /* description */
+ INTERNALKEYRING_AUTHOR, /* author */
"N/A", /* homepage */
- internal_keyring_load, /* load */
- internal_keyring_unload, /* unload */
- internal_keyring_destroy, /* destroy */
+ internal_keyring_load, /* load */
+ internal_keyring_unload, /* unload */
+ internal_keyring_destroy, /* destroy */
NULL, /* ui_info */
NULL, /* extra_info */
NULL, /* prefs_info */
============================================================
--- libpurple/plugins/keyrings/kwallet.cpp a3c77670836ad172e1cd327916e5eb24d0755100
+++ libpurple/plugins/keyrings/kwallet.cpp 87cb5b1f272cb0139d376ce004a980d762d2c58f
@@ -54,7 +54,7 @@
#include "internal.h"
-PurpleKeyring * keyring_handler;
+PurpleKeyring *keyring_handler;
PurplePluginInfo plugininfo =
{
@@ -105,16 +105,16 @@ class KWalletPlugin::engine
engine();
~engine();
void queue(request req);
- static engine * Instance();
+ static engine *Instance();
signal :
void walletopened(bool opened);
private :
bool connected;
- KWallet::wallet * wallet;
+ KWallet::wallet *wallet;
std::list<request> requests;
- static engine * pinstance;
+ static engine *pinstance;
KApplication *app;
void ExecuteRequests();
@@ -191,20 +191,20 @@ class KWalletPlugin::request
{
public :
virtual void abort();
- virtual void execute(KWallet::wallet * wallet);
+ virtual void execute(KWallet::wallet *wallet);
private :
gpointer data;
- PurpleAccount * account
+ PurpleAccount *account
QString password;
}
class KWalletPlugin::save_request : public request
{
public :
- request(PurpleAccount * account, char * password, void * cb, void * data);
+ request(PurpleAccount *account, char *password, void *cb, void *data);
void abort();
- void execute(KWallet::wallet * wallet);
+ void execute(KWallet::wallet *wallet);
private :
PurpleKeyringReadCallback callback;
@@ -213,9 +213,9 @@ class KWalletPlugin::read_request : publ
class KWalletPlugin::read_request : public request
{
public :
- request(PurpleAccount * account, void * cb, void * data);
+ request(PurpleAccount *account, void *cb, void *data);
void abort();
- void execute(KWallet::wallet * wallet);
+ void execute(KWallet::wallet *wallet);
private :
PurpleKeyringSaveCallback callback;
@@ -223,7 +223,7 @@ class KWalletPlugin::read_request : publ
-KWalletPlugin::save_request::save_request(PurpleAccount * acc, char * pw, void * cb, void * userdata)
+KWalletPlugin::save_request::save_request(PurpleAccount *acc, char *pw, void *cb, void *userdata)
{
account = acc;
data = userdata;
@@ -231,7 +231,7 @@ KWalletPlugin::save_request::save_reques
password = pw;
}
-KWalletPlugin::read_request::read_request(PurpleAccount * acc, void * cb, void * userdata)
+KWalletPlugin::read_request::read_request(PurpleAccount *acc, void *cb, void *userdata)
{
account = acc;
data = userdata;
@@ -242,7 +242,7 @@ KWalletPlugin::save_request::abort()
void
KWalletPlugin::save_request::abort()
{
- GError * error;
+ GError *error;
if (cb != NULL) {
error = g_error_new(ERR_KWALLETPLUGIN,
ERR_UNKNOWN,
@@ -255,7 +255,7 @@ KWalletPlugin::read_request::abort()
void
KWalletPlugin::read_request::abort()
{
- GError * error;
+ GError *error;
if (callback != NULL) {
error = g_error_new(ERR_KWALLETPLUGIN,
ERR_UNKNOWN,
@@ -266,7 +266,7 @@ void
}
void
-KWalletPlugin::read_request::execute(KWallet::wallet * wallet)
+KWalletPlugin::read_request::execute(KWallet::wallet *wallet)
{
int result;
GString key;
@@ -282,7 +282,7 @@ void
}
void
-KWalletPlugin::save_request::execute(KWallet::wallet * wallet)
+KWalletPlugin::save_request::execute(KWallet::wallet *wallet)
{
int result;
GString key;
@@ -307,7 +307,7 @@ void
void
-kwallet_read(PurpleAccount * account,
+kwallet_read(PurpleAccount *account,
PurpleKeyringReadCallback cb,
gpointer data)
{
@@ -317,8 +317,8 @@ void
void
-kwallet_save(PurpleAccount * account,
- const char * password,
+kwallet_save(PurpleAccount *account,
+ const char *password,
PurpleKeyringSaveCallback cb,
gpointer data)
{
@@ -328,26 +328,26 @@ void
void
-kwallet_close(GError ** error)
+kwallet_close(GError **error)
{
delete KWalletPlugin::engine::instance();
}
void
-kwallet_import(PurpleAccount * account,
- const char * mode,
- const char * data,
- GError ** error)
+kwallet_import(PurpleAccount *account,
+ const char *mode,
+ const char *data,
+ GError **error)
{
return TRUE;
}
void
-kwallet_export(PurpleAccount * account,
- const char ** mode,
- char ** data,
- GError ** error,
- GDestroyNotify * destroy)
+kwallet_export(PurpleAccount *account,
+ const char **mode,
+ char **data,
+ GError **error,
+ GDestroyNotify *destroy)
{
*mode = NULL;
*data = NULL;
More information about the Commits
mailing list