mirror of
https://gitlab.gnome.org/GNOME/calls.git
synced 2024-11-04 23:51:17 +00:00
sip: Store media encryption account preference to disk
This commit is contained in:
parent
aeae044534
commit
50e7c87a4d
6 changed files with 108 additions and 63 deletions
|
@ -126,6 +126,23 @@ get_selected_protocol (CallsSipAccountWidget *self)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static SipMediaEncryption
|
||||||
|
get_selected_media_encryption (CallsSipAccountWidget *self)
|
||||||
|
{
|
||||||
|
g_autoptr (HdyValueObject) obj = NULL;
|
||||||
|
SipMediaEncryption media_encryption = SIP_MEDIA_ENCRYPTION_NONE;
|
||||||
|
gint i;
|
||||||
|
|
||||||
|
if ((i = hdy_combo_row_get_selected_index (self->media_encryption)) != -1) {
|
||||||
|
obj = g_list_model_get_item (G_LIST_MODEL (self->media_encryption_store), i);
|
||||||
|
media_encryption = (SipMediaEncryption) GPOINTER_TO_INT (g_object_get_data (G_OBJECT (obj), "value"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return media_encryption;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
update_media_encryption (CallsSipAccountWidget *self)
|
update_media_encryption (CallsSipAccountWidget *self)
|
||||||
{
|
{
|
||||||
|
@ -477,6 +494,7 @@ on_login_clicked (CallsSipAccountWidget *self)
|
||||||
gtk_entry_get_text (GTK_ENTRY (self->display_name)),
|
gtk_entry_get_text (GTK_ENTRY (self->display_name)),
|
||||||
get_selected_protocol (self),
|
get_selected_protocol (self),
|
||||||
get_port (self),
|
get_port (self),
|
||||||
|
get_selected_media_encryption (self),
|
||||||
TRUE);
|
TRUE);
|
||||||
|
|
||||||
self->origin = origin;
|
self->origin = origin;
|
||||||
|
@ -510,6 +528,7 @@ on_apply_clicked (CallsSipAccountWidget *self)
|
||||||
gtk_entry_get_text (self->display_name),
|
gtk_entry_get_text (self->display_name),
|
||||||
get_selected_protocol (self),
|
get_selected_protocol (self),
|
||||||
get_port (self),
|
get_port (self),
|
||||||
|
get_selected_media_encryption (self),
|
||||||
gtk_switch_get_state (self->tel_switch),
|
gtk_switch_get_state (self->tel_switch),
|
||||||
gtk_switch_get_state (self->auto_connect_switch));
|
gtk_switch_get_state (self->auto_connect_switch));
|
||||||
|
|
||||||
|
|
|
@ -1678,6 +1678,7 @@ calls_sip_origin_set_credentials (CallsSipOrigin *self,
|
||||||
const char *display_name,
|
const char *display_name,
|
||||||
const char *transport_protocol,
|
const char *transport_protocol,
|
||||||
gint port,
|
gint port,
|
||||||
|
SipMediaEncryption media_encryption,
|
||||||
gboolean can_tel,
|
gboolean can_tel,
|
||||||
gboolean auto_connect)
|
gboolean auto_connect)
|
||||||
{
|
{
|
||||||
|
@ -1715,8 +1716,8 @@ calls_sip_origin_set_credentials (CallsSipOrigin *self,
|
||||||
self->transport_protocol = g_strdup ("UDP");
|
self->transport_protocol = g_strdup ("UDP");
|
||||||
|
|
||||||
self->port = port;
|
self->port = port;
|
||||||
|
|
||||||
self->can_tel = can_tel;
|
self->can_tel = can_tel;
|
||||||
|
self->media_encryption = media_encryption;
|
||||||
|
|
||||||
update_name (self);
|
update_name (self);
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,8 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "calls-sip-util.h"
|
||||||
|
|
||||||
#include <glib-object.h>
|
#include <glib-object.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
@ -39,6 +41,7 @@ void calls_sip_origin_set_credentials (CallsSipOrigin *self,
|
||||||
const char *display_name,
|
const char *display_name,
|
||||||
const char *transport_protocol,
|
const char *transport_protocol,
|
||||||
gint port,
|
gint port,
|
||||||
|
SipMediaEncryption media_encryption,
|
||||||
gboolean use_for_tel,
|
gboolean use_for_tel,
|
||||||
gboolean auto_connect);
|
gboolean auto_connect);
|
||||||
|
|
||||||
|
|
|
@ -128,6 +128,7 @@ on_origin_pw_looked_up (GObject *source,
|
||||||
gboolean auto_connect = TRUE;
|
gboolean auto_connect = TRUE;
|
||||||
gboolean direct_mode = FALSE;
|
gboolean direct_mode = FALSE;
|
||||||
gboolean can_tel = FALSE;
|
gboolean can_tel = FALSE;
|
||||||
|
SipMediaEncryption media_encryption = SIP_MEDIA_ENCRYPTION_NONE;
|
||||||
|
|
||||||
g_assert (user_data);
|
g_assert (user_data);
|
||||||
|
|
||||||
|
@ -159,6 +160,10 @@ on_origin_pw_looked_up (GObject *source,
|
||||||
can_tel =
|
can_tel =
|
||||||
g_key_file_get_boolean (data->key_file, data->name, "CanTel", NULL);
|
g_key_file_get_boolean (data->key_file, data->name, "CanTel", NULL);
|
||||||
|
|
||||||
|
if (g_key_file_has_key (data->key_file, data->name, "MediaEncryption", NULL))
|
||||||
|
media_encryption =
|
||||||
|
(SipMediaEncryption) g_key_file_get_integer (data->key_file, data->name, "MediaEncryption", NULL);
|
||||||
|
|
||||||
/* PW */
|
/* PW */
|
||||||
password = secret_password_lookup_finish (result, &error);
|
password = secret_password_lookup_finish (result, &error);
|
||||||
if (!direct_mode && error) {
|
if (!direct_mode && error) {
|
||||||
|
@ -185,6 +190,7 @@ on_origin_pw_looked_up (GObject *source,
|
||||||
display_name,
|
display_name,
|
||||||
protocol,
|
protocol,
|
||||||
port,
|
port,
|
||||||
|
media_encryption,
|
||||||
auto_connect,
|
auto_connect,
|
||||||
direct_mode,
|
direct_mode,
|
||||||
local_port,
|
local_port,
|
||||||
|
@ -292,6 +298,7 @@ origin_to_keyfile (CallsSipOrigin *origin,
|
||||||
gboolean auto_connect;
|
gboolean auto_connect;
|
||||||
gboolean direct_mode;
|
gboolean direct_mode;
|
||||||
gboolean can_tel;
|
gboolean can_tel;
|
||||||
|
SipMediaEncryption media_encryption;
|
||||||
|
|
||||||
g_assert (CALLS_IS_SIP_ORIGIN (origin));
|
g_assert (CALLS_IS_SIP_ORIGIN (origin));
|
||||||
g_assert (key_file);
|
g_assert (key_file);
|
||||||
|
@ -308,6 +315,7 @@ origin_to_keyfile (CallsSipOrigin *origin,
|
||||||
"direct-mode", &direct_mode,
|
"direct-mode", &direct_mode,
|
||||||
"local-port", &local_port,
|
"local-port", &local_port,
|
||||||
"can-tel", &can_tel,
|
"can-tel", &can_tel,
|
||||||
|
"media-encryption", &media_encryption,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
g_key_file_set_string (key_file, name, "Id", id);
|
g_key_file_set_string (key_file, name, "Id", id);
|
||||||
|
@ -320,6 +328,7 @@ origin_to_keyfile (CallsSipOrigin *origin,
|
||||||
g_key_file_set_boolean (key_file, name, "DirectMode", direct_mode);
|
g_key_file_set_boolean (key_file, name, "DirectMode", direct_mode);
|
||||||
g_key_file_set_integer (key_file, name, "LocalPort", local_port);
|
g_key_file_set_integer (key_file, name, "LocalPort", local_port);
|
||||||
g_key_file_set_boolean (key_file, name, "CanTel", can_tel);
|
g_key_file_set_boolean (key_file, name, "CanTel", can_tel);
|
||||||
|
g_key_file_set_integer (key_file, name, "MediaEncryption", media_encryption);
|
||||||
|
|
||||||
label_secret = g_strdup_printf ("Calls Password for %s", id);
|
label_secret = g_strdup_printf ("Calls Password for %s", id);
|
||||||
|
|
||||||
|
@ -648,6 +657,8 @@ 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"
|
||||||
|
* @port: The port of the host
|
||||||
|
* @media_encryption: A #SipMediaEncryption specifying if media should be encrypted
|
||||||
* @store_credentials: Whether to store credentials for this origin to disk
|
* @store_credentials: Whether to store credentials for this origin to disk
|
||||||
*
|
*
|
||||||
* Adds a new origin (SIP account)
|
* Adds a new origin (SIP account)
|
||||||
|
@ -663,6 +674,7 @@ calls_sip_provider_add_origin (CallsSipProvider *self,
|
||||||
const char *display_name,
|
const char *display_name,
|
||||||
const char *transport_protocol,
|
const char *transport_protocol,
|
||||||
gint port,
|
gint port,
|
||||||
|
SipMediaEncryption media_encryption,
|
||||||
gboolean store_credentials)
|
gboolean store_credentials)
|
||||||
{
|
{
|
||||||
return calls_sip_provider_add_origin_full (self,
|
return calls_sip_provider_add_origin_full (self,
|
||||||
|
@ -673,6 +685,7 @@ calls_sip_provider_add_origin (CallsSipProvider *self,
|
||||||
display_name,
|
display_name,
|
||||||
transport_protocol,
|
transport_protocol,
|
||||||
port,
|
port,
|
||||||
|
media_encryption,
|
||||||
TRUE,
|
TRUE,
|
||||||
FALSE,
|
FALSE,
|
||||||
0,
|
0,
|
||||||
|
@ -689,6 +702,8 @@ calls_sip_provider_add_origin (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"
|
||||||
|
* @port: The port of the host
|
||||||
|
* @media_encryption: A #SipMediaEncryption specifying if media should be encrypted
|
||||||
* @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.
|
||||||
|
@ -709,6 +724,7 @@ calls_sip_provider_add_origin_full (CallsSipProvider *self,
|
||||||
const char *display_name,
|
const char *display_name,
|
||||||
const char *transport_protocol,
|
const char *transport_protocol,
|
||||||
gint port,
|
gint port,
|
||||||
|
SipMediaEncryption media_encryption,
|
||||||
gboolean auto_connect,
|
gboolean auto_connect,
|
||||||
gboolean direct_mode,
|
gboolean direct_mode,
|
||||||
gint local_port,
|
gint local_port,
|
||||||
|
@ -743,6 +759,7 @@ calls_sip_provider_add_origin_full (CallsSipProvider *self,
|
||||||
"display-name", display_name,
|
"display-name", display_name,
|
||||||
"transport-protocol", protocol ?: "UDP",
|
"transport-protocol", protocol ?: "UDP",
|
||||||
"port", port,
|
"port", port,
|
||||||
|
"media-encryption", media_encryption,
|
||||||
"auto-connect", auto_connect,
|
"auto-connect", auto_connect,
|
||||||
"direct-mode", direct_mode,
|
"direct-mode", direct_mode,
|
||||||
"local-port", local_port,
|
"local-port", local_port,
|
||||||
|
|
|
@ -45,6 +45,7 @@ CallsSipOrigin *calls_sip_provider_add_origin (CallsSipProvider *self,
|
||||||
const char *display_name,
|
const char *display_name,
|
||||||
const char *transport_protocol,
|
const char *transport_protocol,
|
||||||
gint port,
|
gint port,
|
||||||
|
SipMediaEncryption media_encryption,
|
||||||
gboolean store_credentials);
|
gboolean store_credentials);
|
||||||
CallsSipOrigin *calls_sip_provider_add_origin_full (CallsSipProvider *self,
|
CallsSipOrigin *calls_sip_provider_add_origin_full (CallsSipProvider *self,
|
||||||
const char *id,
|
const char *id,
|
||||||
|
@ -54,6 +55,7 @@ CallsSipOrigin *calls_sip_provider_add_origin_full (CallsSipProvider *self,
|
||||||
const char *display_name,
|
const char *display_name,
|
||||||
const char *transport_protocol,
|
const char *transport_protocol,
|
||||||
gint port,
|
gint port,
|
||||||
|
SipMediaEncryption media_encryption,
|
||||||
gboolean auto_connect,
|
gboolean auto_connect,
|
||||||
gboolean direct_mode,
|
gboolean direct_mode,
|
||||||
gint local_port,
|
gint local_port,
|
||||||
|
|
|
@ -371,6 +371,7 @@ setup_sip_origins (SipFixture *fixture,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
0,
|
0,
|
||||||
|
SIP_MEDIA_ENCRYPTION_NONE,
|
||||||
FALSE,
|
FALSE,
|
||||||
TRUE,
|
TRUE,
|
||||||
5060,
|
5060,
|
||||||
|
@ -386,6 +387,7 @@ setup_sip_origins (SipFixture *fixture,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
0,
|
0,
|
||||||
|
SIP_MEDIA_ENCRYPTION_NONE,
|
||||||
FALSE,
|
FALSE,
|
||||||
TRUE,
|
TRUE,
|
||||||
5061,
|
5061,
|
||||||
|
@ -401,6 +403,7 @@ setup_sip_origins (SipFixture *fixture,
|
||||||
NULL,
|
NULL,
|
||||||
"UDP",
|
"UDP",
|
||||||
0,
|
0,
|
||||||
|
SIP_MEDIA_ENCRYPTION_NONE,
|
||||||
FALSE,
|
FALSE,
|
||||||
FALSE,
|
FALSE,
|
||||||
0,
|
0,
|
||||||
|
|
Loading…
Reference in a new issue