From 5c1b76908b92e42f3bcc41db28e0c63a93d10bfe Mon Sep 17 00:00:00 2001 From: Evangelos Ribeiro Tzaras Date: Tue, 6 Jul 2021 13:17:53 +0200 Subject: [PATCH] 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 d30290d..c437907 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; }