diff options
author | Jonny Lamb <jonnylamb@gnome.org> | 2011-01-28 21:52:26 +0800 |
---|---|---|
committer | Jonny Lamb <jonnylamb@gnome.org> | 2011-01-28 21:52:26 +0800 |
commit | a8e29279f323a5a1f4fc66a450a633b3415bea4d (patch) | |
tree | b54612258a7bccfdc836bad2767b553994cd24d2 | |
parent | fe7c6ed34c96c0b57b0294ccebdab20dd0b702ba (diff) | |
download | gsoc2013-empathy-a8e29279f323a5a1f4fc66a450a633b3415bea4d.tar gsoc2013-empathy-a8e29279f323a5a1f4fc66a450a633b3415bea4d.tar.gz gsoc2013-empathy-a8e29279f323a5a1f4fc66a450a633b3415bea4d.tar.bz2 gsoc2013-empathy-a8e29279f323a5a1f4fc66a450a633b3415bea4d.tar.lz gsoc2013-empathy-a8e29279f323a5a1f4fc66a450a633b3415bea4d.tar.xz gsoc2013-empathy-a8e29279f323a5a1f4fc66a450a633b3415bea4d.tar.zst gsoc2013-empathy-a8e29279f323a5a1f4fc66a450a633b3415bea4d.zip |
keyring: rename current functions to be more specifically about account passwords
Signed-off-by: Jonny Lamb <jonnylamb@gnome.org>
-rw-r--r-- | libempathy/empathy-account-settings.c | 16 | ||||
-rw-r--r-- | libempathy/empathy-auth-factory.c | 4 | ||||
-rw-r--r-- | libempathy/empathy-keyring.c | 34 | ||||
-rw-r--r-- | libempathy/empathy-keyring.h | 12 | ||||
-rw-r--r-- | libempathy/empathy-server-sasl-handler.c | 8 |
5 files changed, 40 insertions, 34 deletions
diff --git a/libempathy/empathy-account-settings.c b/libempathy/empathy-account-settings.c index 8c673dfcf..1d2379fe5 100644 --- a/libempathy/empathy-account-settings.c +++ b/libempathy/empathy-account-settings.c @@ -434,7 +434,7 @@ empathy_account_settings_get_password_cb (GObject *source, const gchar *password; GError *error = NULL; - password = empathy_keyring_get_password_finish (TP_ACCOUNT (source), + password = empathy_keyring_get_account_password_finish (TP_ACCOUNT (source), result, &error); if (error != NULL) @@ -467,7 +467,7 @@ empathy_account_settings_migrate_password_cb (GObject *source, GHashTable *empty; const gchar *unset[] = { "password", NULL }; - if (!empathy_keyring_set_password_finish (account, result, &error)) + if (!empathy_keyring_set_account_password_finish (account, result, &error)) { DEBUG ("Failed to set password: %s", error->message); g_clear_error (&error); @@ -513,7 +513,7 @@ empathy_account_settings_try_migrating_password (EmpathyAccountSettings *self) if (EMP_STR_EMPTY (password)) return; - empathy_keyring_set_password_async (priv->account, password, + empathy_keyring_set_account_password_async (priv->account, password, empathy_account_settings_migrate_password_cb, self); /* We don't want to request the password again, we @@ -624,7 +624,7 @@ empathy_account_settings_check_readyness (EmpathyAccountSettings *self) /* Make this call but don't block on its readiness. We'll signal * if it's updated later with ::password-retrieved. */ - empathy_keyring_get_password_async (priv->account, + empathy_keyring_get_account_password_async (priv->account, empathy_account_settings_get_password_cb, self); } @@ -1401,7 +1401,7 @@ empathy_account_settings_set_password_cb (GObject *source, gpointer user_data) { empathy_account_settings_processed_password (source, result, user_data, - empathy_keyring_set_password_finish); + empathy_keyring_set_account_password_finish); } static void @@ -1410,7 +1410,7 @@ empathy_account_settings_delete_password_cb (GObject *source, gpointer user_data) { empathy_account_settings_processed_password (source, result, user_data, - empathy_keyring_delete_password_finish); + empathy_keyring_delete_account_password_finish); } static void @@ -1437,12 +1437,12 @@ empathy_account_settings_account_updated (GObject *source, { if (priv->password != NULL) { - empathy_keyring_set_password_async (priv->account, priv->password, + empathy_keyring_set_account_password_async (priv->account, priv->password, empathy_account_settings_set_password_cb, settings); } else { - empathy_keyring_delete_password_async (priv->account, + empathy_keyring_delete_account_password_async (priv->account, empathy_account_settings_delete_password_cb, settings); } diff --git a/libempathy/empathy-auth-factory.c b/libempathy/empathy-auth-factory.c index 443962a7c..8cbb90a14 100644 --- a/libempathy/empathy-auth-factory.c +++ b/libempathy/empathy-auth-factory.c @@ -345,7 +345,7 @@ get_password_cb (GObject *source, { ObserveChannelsData *data = user_data; - if (empathy_keyring_get_password_finish (TP_ACCOUNT (source), result, NULL) == NULL) + if (empathy_keyring_get_account_password_finish (TP_ACCOUNT (source), result, NULL) == NULL) { /* We don't actually mind if this fails, just let the approver * go ahead and take the channel. */ @@ -404,7 +404,7 @@ observe_channels (TpBaseClient *client, data->account = g_object_ref (account); data->channel = g_object_ref (channel); - empathy_keyring_get_password_async (account, get_password_cb, data); + empathy_keyring_get_account_password_async (account, get_password_cb, data); tp_observe_channels_context_delay (context); } diff --git a/libempathy/empathy-keyring.c b/libempathy/empathy-keyring.c index 4923a9463..10226ac09 100644 --- a/libempathy/empathy-keyring.c +++ b/libempathy/empathy-keyring.c @@ -27,12 +27,14 @@ #define DEBUG_FLAG EMPATHY_DEBUG_OTHER #include "empathy-debug.h" -static GnomeKeyringPasswordSchema keyring_schema = +static GnomeKeyringPasswordSchema account_keyring_schema = { GNOME_KEYRING_ITEM_GENERIC_SECRET, { { "account-id", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING }, { "param-name", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING }, { NULL } } }; +/* get */ + static void find_items_cb (GnomeKeyringResult result, GList *list, @@ -63,7 +65,7 @@ find_items_cb (GnomeKeyringResult result, } void -empathy_keyring_get_password_async (TpAccount *account, +empathy_keyring_get_account_password_async (TpAccount *account, GAsyncReadyCallback callback, gpointer user_data) { @@ -75,7 +77,7 @@ empathy_keyring_get_password_async (TpAccount *account, g_return_if_fail (callback != NULL); simple = g_simple_async_result_new (G_OBJECT (account), callback, - user_data, empathy_keyring_get_password_async); + user_data, empathy_keyring_get_account_password_async); account_id = tp_proxy_get_object_path (account) + strlen (TP_ACCOUNT_OBJECT_PATH_BASE); @@ -94,7 +96,7 @@ empathy_keyring_get_password_async (TpAccount *account, } const gchar * -empathy_keyring_get_password_finish (TpAccount *account, +empathy_keyring_get_account_password_finish (TpAccount *account, GAsyncResult *result, GError **error) { @@ -109,11 +111,13 @@ empathy_keyring_get_password_finish (TpAccount *account, return NULL; g_return_val_if_fail (g_simple_async_result_is_valid (result, - G_OBJECT (account), empathy_keyring_get_password_async), NULL); + G_OBJECT (account), empathy_keyring_get_room_password_async), NULL); return g_simple_async_result_get_op_res_gpointer (simple); } +/* set */ + static void store_password_cb (GnomeKeyringResult result, gpointer user_data) @@ -134,7 +138,7 @@ store_password_cb (GnomeKeyringResult result, } void -empathy_keyring_set_password_async (TpAccount *account, +empathy_keyring_set_account_password_async (TpAccount *account, const gchar *password, GAsyncReadyCallback callback, gpointer user_data) @@ -147,7 +151,7 @@ empathy_keyring_set_password_async (TpAccount *account, g_return_if_fail (password != NULL); simple = g_simple_async_result_new (G_OBJECT (account), callback, - user_data, empathy_keyring_set_password_async); + user_data, empathy_keyring_set_account_password_async); account_id = tp_proxy_get_object_path (account) + strlen (TP_ACCOUNT_OBJECT_PATH_BASE); @@ -157,7 +161,7 @@ empathy_keyring_set_password_async (TpAccount *account, name = g_strdup_printf ("IM account password for %s (%s)", tp_account_get_display_name (account), account_id); - gnome_keyring_store_password (&keyring_schema, NULL, name, password, + gnome_keyring_store_password (&account_keyring_schema, NULL, name, password, store_password_cb, simple, NULL, "account-id", account_id, "param-name", "password", @@ -167,7 +171,7 @@ empathy_keyring_set_password_async (TpAccount *account, } gboolean -empathy_keyring_set_password_finish (TpAccount *account, +empathy_keyring_set_account_password_finish (TpAccount *account, GAsyncResult *result, GError **error) { @@ -182,11 +186,13 @@ empathy_keyring_set_password_finish (TpAccount *account, return FALSE; g_return_val_if_fail (g_simple_async_result_is_valid (result, - G_OBJECT (account), empathy_keyring_set_password_async), FALSE); + G_OBJECT (account), empathy_keyring_set_account_password_async), FALSE); return TRUE; } +/* delete */ + static void item_delete_cb (GnomeKeyringResult result, gpointer user_data) @@ -234,7 +240,7 @@ find_item_to_delete_cb (GnomeKeyringResult result, } void -empathy_keyring_delete_password_async (TpAccount *account, +empathy_keyring_delete_account_password_async (TpAccount *account, GAsyncReadyCallback callback, gpointer user_data) { @@ -245,7 +251,7 @@ empathy_keyring_delete_password_async (TpAccount *account, g_return_if_fail (TP_IS_ACCOUNT (account)); simple = g_simple_async_result_new (G_OBJECT (account), callback, - user_data, empathy_keyring_delete_password_async); + user_data, empathy_keyring_delete_account_password_async); account_id = tp_proxy_get_object_path (account) + strlen (TP_ACCOUNT_OBJECT_PATH_BASE); @@ -262,7 +268,7 @@ empathy_keyring_delete_password_async (TpAccount *account, } gboolean -empathy_keyring_delete_password_finish (TpAccount *account, +empathy_keyring_delete_account_password_finish (TpAccount *account, GAsyncResult *result, GError **error) { @@ -277,7 +283,7 @@ empathy_keyring_delete_password_finish (TpAccount *account, return FALSE; g_return_val_if_fail (g_simple_async_result_is_valid (result, - G_OBJECT (account), empathy_keyring_delete_password_async), FALSE); + G_OBJECT (account), empathy_keyring_delete_account_password_async), FALSE); return TRUE; } diff --git a/libempathy/empathy-keyring.h b/libempathy/empathy-keyring.h index 000f987f7..e4211671a 100644 --- a/libempathy/empathy-keyring.h +++ b/libempathy/empathy-keyring.h @@ -25,23 +25,23 @@ G_BEGIN_DECLS -void empathy_keyring_get_password_async (TpAccount *account, +void empathy_keyring_get_account_password_async (TpAccount *account, GAsyncReadyCallback callback, gpointer user_data); -const gchar * empathy_keyring_get_password_finish (TpAccount *account, +const gchar * empathy_keyring_get_account_password_finish (TpAccount *account, GAsyncResult *result, GError **error); -void empathy_keyring_set_password_async (TpAccount *account, +void empathy_keyring_set_account_password_async (TpAccount *account, const gchar *password, GAsyncReadyCallback callback, gpointer user_data); -gboolean empathy_keyring_set_password_finish (TpAccount *account, +gboolean empathy_keyring_set_account_password_finish (TpAccount *account, GAsyncResult *result, GError **error); -void empathy_keyring_delete_password_async (TpAccount *account, +void empathy_keyring_delete_account_password_async (TpAccount *account, GAsyncReadyCallback callback, gpointer user_data); -gboolean empathy_keyring_delete_password_finish (TpAccount *account, +gboolean empathy_keyring_delete_account_password_finish (TpAccount *account, GAsyncResult *result, GError **error); G_END_DECLS diff --git a/libempathy/empathy-server-sasl-handler.c b/libempathy/empathy-server-sasl-handler.c index 3cfc86fa8..4b5683881 100644 --- a/libempathy/empathy-server-sasl-handler.c +++ b/libempathy/empathy-server-sasl-handler.c @@ -124,7 +124,7 @@ empathy_server_sasl_handler_get_password_async_cb (GObject *source, priv = EMPATHY_SERVER_SASL_HANDLER (user_data)->priv; - password = empathy_keyring_get_password_finish (TP_ACCOUNT (source), + password = empathy_keyring_get_account_password_finish (TP_ACCOUNT (source), result, &error); if (password != NULL) @@ -155,7 +155,7 @@ empathy_server_sasl_handler_init_async (GAsyncInitable *initable, priv->async_init_res = g_simple_async_result_new (G_OBJECT (self), callback, user_data, empathy_server_sasl_handler_new_async); - empathy_keyring_get_password_async (priv->account, + empathy_keyring_get_account_password_async (priv->account, empathy_server_sasl_handler_get_password_async_cb, self); } @@ -374,7 +374,7 @@ empathy_server_sasl_handler_set_password_cb (GObject *source, { GError *error = NULL; - if (!empathy_keyring_set_password_finish (TP_ACCOUNT (source), result, + if (!empathy_keyring_set_account_password_finish (TP_ACCOUNT (source), result, &error)) { DEBUG ("Failed to set password: %s", error->message); @@ -416,7 +416,7 @@ empathy_server_sasl_handler_provide_password ( if (remember) { - empathy_keyring_set_password_async (priv->account, password, + empathy_keyring_set_account_password_async (priv->account, password, empathy_server_sasl_handler_set_password_cb, NULL); } } |