[calls/wip/ui-manage-accounts: 12/26] sip: Remove auto loading functionality
- From: Evangelos Ribeiro Tzaras <devrtz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [calls/wip/ui-manage-accounts: 12/26] sip: Remove auto loading functionality
- Date: Fri, 16 Jul 2021 12:16:34 +0000 (UTC)
commit 4232a47de947887732e3f704fc1d5911d4c71c52
Author: Evangelos Ribeiro Tzaras <evangelos tzaras puri sm>
Date: Fri Jun 11 09:39:15 2021 +0200
sip: Remove auto loading functionality
This functionality moves to CallsCredentials, see the following commits.
plugins/sip/calls-sip-provider.c | 71 +---------------------------------------
tests/meson.build | 1 -
2 files changed, 1 insertion(+), 71 deletions(-)
---
diff --git a/plugins/sip/calls-sip-provider.c b/plugins/sip/calls-sip-provider.c
index 6b6af7f7..b8522ece 100644
--- a/plugins/sip/calls-sip-provider.c
+++ b/plugins/sip/calls-sip-provider.c
@@ -24,8 +24,6 @@
#define G_LOG_DOMAIN "CallsSipProvider"
-#define SIP_ACCOUNT_FILE "sip-account.cfg"
-
#include "calls-account-provider.h"
#include "calls-credentials.h"
#include "calls-message-source.h"
@@ -73,8 +71,6 @@ struct _CallsSipProvider
/* SIP */
CallsSipContext *ctx;
SipEngineState sip_state;
-
- gchar *filename;
};
static void calls_sip_provider_message_source_interface_init (CallsMessageSourceInterface *iface);
@@ -89,49 +85,6 @@ G_DEFINE_DYNAMIC_TYPE_EXTENDED
calls_sip_provider_account_provider_interface_init));
-static void
-calls_sip_provider_load_accounts (CallsSipProvider *self)
-{
- g_autoptr (GError) error = NULL;
- g_autoptr (GKeyFile) key_file = g_key_file_new ();
- gchar **groups = NULL;
-
- g_assert (CALLS_IS_SIP_PROVIDER (self));
-
- if (!g_key_file_load_from_file (key_file, self->filename, G_KEY_FILE_NONE, &error)) {
- g_warning ("Error loading key file: %s", error->message);
- return;
- }
-
- groups = g_key_file_get_groups (key_file, NULL);
-
- for (gsize i = 0; groups[i] != NULL; i++) {
- g_autoptr (CallsCredentials) credentials =
- calls_credentials_new (CALLS_CREDENTIALS_TYPE_SIP, groups[i]);
-
- gint local_port = 0;
- gboolean direct_connection =
- g_key_file_get_boolean (key_file, groups[i], "Direct", NULL);
-
- if (direct_connection) {
- g_object_set (credentials, "name", groups[i], NULL);
-
- local_port = g_key_file_get_integer (key_file, groups[i], "LocalPort", NULL);
- /* direct connection mode, needs a local port set */
- if (local_port == 0)
- local_port = 5060;
- } else {
- calls_credentials_update_from_keyfile (credentials, key_file, groups[i]);
- }
- g_debug ("Adding origin for SIP account %s", groups[i]);
-
- calls_sip_provider_add_origin (self, g_steal_pointer (&credentials), local_port, direct_connection);
- }
-
- g_strfreev (groups);
-}
-
-
static const char *
calls_sip_provider_get_name (CallsProvider *provider)
{
@@ -283,18 +236,8 @@ calls_sip_provider_constructed (GObject *object)
{
CallsSipProvider *self = CALLS_SIP_PROVIDER (object);
g_autoptr (GError) error = NULL;
- gboolean auto_load_accounts = TRUE;
- const gchar *env_do_not_auto_load;
-
- env_do_not_auto_load = g_getenv ("CALLS_SIP_DO_NOT_AUTOLOAD");
- if (env_do_not_auto_load && env_do_not_auto_load[0] != '\0')
- auto_load_accounts = FALSE;
- if (calls_sip_provider_init_sofia (self, &error)) {
- if (auto_load_accounts)
- calls_sip_provider_load_accounts (self);
- }
- else
+ if (!calls_sip_provider_init_sofia (self, &error))
g_warning ("Could not initialize sofia stack: %s", error->message);
G_OBJECT_CLASS (calls_sip_provider_parent_class)->constructed (object);
@@ -312,8 +255,6 @@ calls_sip_provider_dispose (GObject *object)
g_hash_table_remove_all (self->credentials);
g_clear_pointer (&self->credentials, g_hash_table_unref);
- g_clear_pointer (&self->filename, g_free);
-
calls_sip_provider_deinit_sip (self);
G_OBJECT_CLASS (calls_sip_provider_parent_class)->dispose (object);
@@ -417,20 +358,10 @@ calls_sip_provider_account_provider_interface_init (CallsAccountProviderInterfac
static void
calls_sip_provider_init (CallsSipProvider *self)
{
- const char *filename_env = g_getenv ("CALLS_SIP_ACCOUNT_FILE");
-
self->credentials =
g_hash_table_new_full (NULL, NULL, g_object_unref, g_object_unref);
self->origins = g_list_store_new (CALLS_TYPE_ORIGIN);
-
- 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);
}
/**
diff --git a/tests/meson.build b/tests/meson.build
index c0df8ac2..f54f4c78 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -8,7 +8,6 @@ test_env = [
'PYTHONDONTWRITEBYTECODE=yes',
'MALLOC_CHECK_=2',
'NO_AT_BRIDGE=1',
- 'CALLS_SIP_DO_NOT_AUTOLOAD=1',
'CALLS_AUDIOSRC=audiotestsrc',
'CALLS_AUDIOSINK=fakesink',
]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]