1
0
Fork 0
mirror of https://gitlab.gnome.org/GNOME/calls.git synced 2024-11-16 16:06:11 +00:00

sip: provider: Add argument to _add_origin() whether to store credentials

This allows us to avoid unnecessary saving to disk during initial account
loading.
This commit is contained in:
Evangelos Ribeiro Tzaras 2021-07-08 17:27:09 +02:00 committed by Evangelos Ribeiro Tzaras
parent e9f155678e
commit 3f12b3fcd5
4 changed files with 23 additions and 11 deletions

View file

@ -259,7 +259,8 @@ on_login_clicked (CallsSipAccountWidget *self)
gtk_entry_get_text (GTK_ENTRY (self->password)), gtk_entry_get_text (GTK_ENTRY (self->password)),
gtk_entry_get_text (GTK_ENTRY (self->display_name)), gtk_entry_get_text (GTK_ENTRY (self->display_name)),
"UDP", "UDP",
0); 0,
TRUE);
self->origin = origin; self->origin = origin;
update_header (self); update_header (self);

View file

@ -147,7 +147,8 @@ new_origin_from_keyfile (CallsSipProvider *self,
port, port,
auto_connect, auto_connect,
direct_mode, direct_mode,
local_port); local_port,
FALSE);
} }
@ -505,6 +506,7 @@ calls_sip_provider_init (CallsSipProvider *self)
* @password: The password to use * @password: The password to use
* @display_name: The display name * @display_name: The display name
* @transport_protocol: The transport protocol to use, can be one of "UDP", "TCP" or "TLS" * @transport_protocol: The transport protocol to use, can be one of "UDP", "TCP" or "TLS"
* @store_credentials: Whether to store credentials for this origin to disk
* *
* Adds a new origin (SIP account) * Adds a new origin (SIP account)
* *
@ -517,7 +519,8 @@ calls_sip_provider_add_origin (CallsSipProvider *self,
const char *password, const char *password,
const char *display_name, const char *display_name,
const char *transport_protocol, const char *transport_protocol,
gint port) gint port,
gboolean store_credentials)
{ {
return calls_sip_provider_add_origin_full (self, return calls_sip_provider_add_origin_full (self,
host, host,
@ -528,7 +531,8 @@ calls_sip_provider_add_origin (CallsSipProvider *self,
port, port,
TRUE, TRUE,
FALSE, FALSE,
0); 0,
store_credentials);
} }
/** /**
@ -542,6 +546,7 @@ calls_sip_provider_add_origin (CallsSipProvider *self,
* @auto_connect: Whether to automatically try going online * @auto_connect: Whether to automatically try going online
* @direct_mode: Whether to use direct connection mode. Useful when you don't want to * @direct_mode: Whether to use direct connection mode. Useful when you don't want to
* connect to a SIP server. Mostly useful for testing and debugging. * connect to a SIP server. Mostly useful for testing and debugging.
* @store_credentials: Whether to store credentials for this origin to disk
* *
* Adds a new origin (SIP account). If @direct_mode is %TRUE then @host, @user and * Adds a new origin (SIP account). If @direct_mode is %TRUE then @host, @user and
* @password do not have to be set. * @password do not have to be set.
@ -558,7 +563,8 @@ calls_sip_provider_add_origin_full (CallsSipProvider *self,
gint port, gint port,
gboolean auto_connect, gboolean auto_connect,
gboolean direct_mode, gboolean direct_mode,
gint local_port) gint local_port,
gboolean store_credentials)
{ {
g_autoptr (CallsSipOrigin) origin = NULL; g_autoptr (CallsSipOrigin) origin = NULL;
g_autofree char *protocol = NULL; g_autofree char *protocol = NULL;
@ -593,7 +599,7 @@ calls_sip_provider_add_origin_full (CallsSipProvider *self,
g_list_store_append (self->origins, origin); g_list_store_append (self->origins, origin);
if (!self->use_memory_backend) if (store_credentials && !self->use_memory_backend)
save_to_disk (self); save_to_disk (self);
return origin; return origin;

View file

@ -43,7 +43,8 @@ CallsSipOrigin *calls_sip_provider_add_origin (CallsSipProvider *s
const char *password, const char *password,
const char *display_name, const char *display_name,
const char *transport_protocol, const char *transport_protocol,
gint port); gint port,
gboolean store_credentials);
CallsSipOrigin *calls_sip_provider_add_origin_full (CallsSipProvider *self, CallsSipOrigin *calls_sip_provider_add_origin_full (CallsSipProvider *self,
const char *host, const char *host,
const char *user, const char *user,
@ -53,7 +54,8 @@ CallsSipOrigin *calls_sip_provider_add_origin_full (CallsSipProvider *s
gint port, gint port,
gboolean auto_connect, gboolean auto_connect,
gboolean direct_mode, gboolean direct_mode,
gint local_port); gint local_port,
gboolean store_credentials);
gboolean calls_sip_provider_remove_origin (CallsSipProvider *self, gboolean calls_sip_provider_remove_origin (CallsSipProvider *self,
CallsSipOrigin *origin); CallsSipOrigin *origin);
void calls_sip_provider_load_accounts (CallsSipProvider *self, void calls_sip_provider_load_accounts (CallsSipProvider *self,

View file

@ -370,7 +370,8 @@ setup_sip_origins (SipFixture *fixture,
0, 0,
FALSE, FALSE,
TRUE, TRUE,
5060); 5060,
FALSE);
fixture->origin_bob = fixture->origin_bob =
calls_sip_provider_add_origin_full (fixture->provider, calls_sip_provider_add_origin_full (fixture->provider,
@ -382,7 +383,8 @@ setup_sip_origins (SipFixture *fixture,
0, 0,
FALSE, FALSE,
TRUE, TRUE,
5061); 5061,
FALSE);
fixture->origin_offline = fixture->origin_offline =
calls_sip_provider_add_origin_full (fixture->provider, calls_sip_provider_add_origin_full (fixture->provider,
@ -394,7 +396,8 @@ setup_sip_origins (SipFixture *fixture,
0, 0,
FALSE, FALSE,
FALSE, FALSE,
0); 0,
FALSE);
} }