[epiphany/wip/sync] sync-secret: Discard unnecessary parameters of _store_tokens()



commit 1680f32db0d348dc9506f91bc62c16c9d439a121
Author: Gabriel Ivascu <ivascu gabriel59 gmail com>
Date:   Tue Mar 7 19:55:35 2017 +0200

    sync-secret: Discard unnecessary parameters of _store_tokens()

 src/sync/ephy-sync-secret.c  |   36 +++++++++++-------------------------
 src/sync/ephy-sync-secret.h  |    9 +--------
 src/sync/ephy-sync-service.c |    4 +---
 3 files changed, 13 insertions(+), 36 deletions(-)
---
diff --git a/src/sync/ephy-sync-secret.c b/src/sync/ephy-sync-secret.c
index 9db7971..2db6fde 100644
--- a/src/sync/ephy-sync-secret.c
+++ b/src/sync/ephy-sync-secret.c
@@ -211,41 +211,27 @@ store_tokens_cb (SecretService *service,
 }
 
 void
-ephy_sync_secret_store_tokens (EphySyncService *service,
-                               const char      *email,
-                               const char      *uid,
-                               const char      *sessionToken,
-                               const char      *keyFetchToken,
-                               const char      *unwrapBKey,
-                               const char      *kA,
-                               const char      *kB)
+ephy_sync_secret_store_tokens (EphySyncService *service)
 {
   SecretValue *value;
   GHashTable *attributes;
   char *tokens;
   char *label;
 
-  g_return_if_fail (email);
-  g_return_if_fail (uid);
-  g_return_if_fail (sessionToken);
-  g_return_if_fail (keyFetchToken);
-  g_return_if_fail (unwrapBKey);
-  g_return_if_fail (kA);
-  g_return_if_fail (kB);
-
-  tokens = ephy_sync_utils_build_json_string ("uid", uid,
-                                              "sessionToken", sessionToken,
-                                              "keyFetchToken", keyFetchToken,
-                                              "unwrapBKey", unwrapBKey,
-                                              "kA", kA,
-                                              "kB", kB,
+  tokens = ephy_sync_utils_build_json_string ("uid", ephy_sync_service_get_token (service, TOKEN_UID),
+                                              "sessionToken", ephy_sync_service_get_token (service, 
TOKEN_SESSIONTOKEN),
+                                              "keyFetchToken", ephy_sync_service_get_token (service, 
TOKEN_KEYFETCHTOKEN),
+                                              "unwrapBKey", ephy_sync_service_get_token (service, 
TOKEN_UNWRAPBKEY),
+                                              "kA", ephy_sync_service_get_token (service, TOKEN_KA),
+                                              "kB", ephy_sync_service_get_token (service, TOKEN_KB),
                                               NULL);
   value = secret_value_new (tokens, -1, "text/plain");
-  attributes = secret_attributes_build (EPHY_SYNC_TOKEN_SCHEMA,
-                                        EMAIL_KEY, email,
+  attributes = secret_attributes_build (EPHY_SYNC_TOKEN_SCHEMA, EMAIL_KEY,
+                                        ephy_sync_service_get_user_email (service),
                                         NULL);
   /* Translators: The %s represents the email of the user. */
-  label = g_strdup_printf (_("The sync tokens of %s"), email);
+  label = g_strdup_printf (_("The sync tokens of %s"),
+                           ephy_sync_service_get_user_email (service));
 
   secret_service_store (NULL, EPHY_SYNC_TOKEN_SCHEMA, attributes,
                         NULL, label, value, NULL,
diff --git a/src/sync/ephy-sync-secret.h b/src/sync/ephy-sync-secret.h
index f540c8e..7b52057 100644
--- a/src/sync/ephy-sync-secret.h
+++ b/src/sync/ephy-sync-secret.h
@@ -37,13 +37,6 @@ const SecretSchema *ephy_sync_secret_get_token_schema (void) G_GNUC_CONST;
 
 void ephy_sync_secret_forget_tokens (void);
 void ephy_sync_secret_load_tokens   (EphySyncService *service);
-void ephy_sync_secret_store_tokens  (EphySyncService *service,
-                                     const char      *email,
-                                     const char      *uid,
-                                     const char      *sessionToken,
-                                     const char      *keyFetchToken,
-                                     const char      *unwrapBKey,
-                                     const char      *kA,
-                                     const char      *kB);
+void ephy_sync_secret_store_tokens  (EphySyncService *service);
 
 G_END_DECLS
diff --git a/src/sync/ephy-sync-service.c b/src/sync/ephy-sync-service.c
index 46323bf..93ec5ae 100644
--- a/src/sync/ephy-sync-service.c
+++ b/src/sync/ephy-sync-service.c
@@ -937,9 +937,7 @@ check_storage_version_cb (SoupSession *session,
   storage_version = json_object_get_int_member (json, "storageVersion");
 
   if (storage_version == STORAGE_VERSION) {
-    ephy_sync_secret_store_tokens (service, service->user_email, service->uid,
-                                   service->sessionToken, service->keyFetchToken,
-                                   service->unwrapBKey, service->kA, service->kB);
+    ephy_sync_secret_store_tokens (service);
   } else {
     /* Translators: the %d is the storage version, the \n is a newline character. */
     char *message = g_strdup_printf (_("Your Firefox Account uses a storage version "


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]