[calls] sip: provider: Save accounts to disk



commit 5c1b76908b92e42f3bcc41db28e0c63a93d10bfe
Author: Evangelos Ribeiro Tzaras <evangelos tzaras puri sm>
Date:   Tue Jul 6 13:17:53 2021 +0200

    sip: provider: Save accounts to disk

 plugins/sip/calls-sip-provider.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
---
diff --git a/plugins/sip/calls-sip-provider.c b/plugins/sip/calls-sip-provider.c
index d30290d8..c437907a 100644
--- a/plugins/sip/calls-sip-provider.c
+++ b/plugins/sip/calls-sip-provider.c
@@ -194,6 +194,20 @@ origin_to_keyfile (CallsSipOrigin *origin,
 }
 
 
+static void
+save_to_disk (CallsSipProvider *self)
+{
+  g_autoptr (GKeyFile) key_file = g_key_file_new ();
+  g_autoptr (GError) error = NULL;
+
+  g_assert (CALLS_IS_SIP_PROVIDER (self));
+
+  calls_sip_provider_save_accounts (self, key_file);
+
+  if (!g_key_file_save_to_file (key_file, self->filename, &error))
+    g_warning ("Error saving keyfile to file %s: %s", self->filename, error->message);
+}
+
 static const char *
 calls_sip_provider_get_name (CallsProvider *provider)
 {
@@ -579,6 +593,9 @@ calls_sip_provider_add_origin_full (CallsSipProvider *self,
 
   g_list_store_append (self->origins, origin);
 
+  if (!self->use_memory_backend)
+    save_to_disk (self);
+
   return origin;
 }
 


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