From 6e6873432b2fe67f88dc70ac53a2a917e4781305 Mon Sep 17 00:00:00 2001 From: Evangelos Ribeiro Tzaras Date: Fri, 9 Apr 2021 18:13:10 +0200 Subject: [PATCH] sip: provider: Allow overriding SIP account config via environment This will make it easier for testing down the line. --- plugins/sip/calls-sip-provider.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/plugins/sip/calls-sip-provider.c b/plugins/sip/calls-sip-provider.c index fb4ada4..52476ae 100644 --- a/plugins/sip/calls-sip-provider.c +++ b/plugins/sip/calls-sip-provider.c @@ -381,11 +381,16 @@ calls_sip_provider_message_source_interface_init (CallsMessageSourceInterface *i static void calls_sip_provider_init (CallsSipProvider *self) { + const char *filename_env = g_getenv ("CALLS_SIP_ACCOUNT_FILE"); + self->origins = g_list_store_new (CALLS_TYPE_SIP_ORIGIN); - self->filename = g_build_filename (g_get_user_config_dir (), - APP_DATA_NAME, - SIP_ACCOUNT_FILE, - NULL); + if (filename_env && filename_env[0] != '\0') + self->filename = g_strdup (filename_env); + else + self->filename = g_build_filename (g_get_user_config_dir (), + APP_DATA_NAME, + SIP_ACCOUNT_FILE, + NULL); }