[calls] sip: provider: Add API to remove origins



commit 1749dcec60098d335cae06781c8421694c7d89f3
Author: Evangelos Ribeiro Tzaras <evangelos tzaras puri sm>
Date:   Tue Jul 6 01:36:11 2021 +0200

    sip: provider: Add API to remove origins

 plugins/sip/calls-sip-origin.c   |  3 +++
 plugins/sip/calls-sip-origin.h   |  1 +
 plugins/sip/calls-sip-provider.c | 17 +++++++++++++++++
 plugins/sip/calls-sip-provider.h |  2 ++
 4 files changed, 23 insertions(+)
---
diff --git a/plugins/sip/calls-sip-origin.c b/plugins/sip/calls-sip-origin.c
index 83801b7d..f3e6a99b 100644
--- a/plugins/sip/calls-sip-origin.c
+++ b/plugins/sip/calls-sip-origin.c
@@ -1380,6 +1380,7 @@ calls_sip_origin_set_credentials (CallsSipOrigin *self,
                                   const char     *password,
                                   const char     *display_name,
                                   const char     *transport_protocol,
+                                  gint            port,
                                   gboolean        auto_connect)
 {
   g_return_if_fail (CALLS_IS_SIP_ORIGIN (self));
@@ -1415,6 +1416,8 @@ calls_sip_origin_set_credentials (CallsSipOrigin *self,
   else
     self->transport_protocol = g_strdup ("UDP");
 
+  self->port = port;
+
   /* Propagate changes to nua stack */
   update_nua (self);
 }
diff --git a/plugins/sip/calls-sip-origin.h b/plugins/sip/calls-sip-origin.h
index e224047e..5a14b3b6 100644
--- a/plugins/sip/calls-sip-origin.h
+++ b/plugins/sip/calls-sip-origin.h
@@ -38,6 +38,7 @@ void              calls_sip_origin_set_credentials          (CallsSipOrigin *sel
                                                              const char     *password,
                                                              const char     *display_name,
                                                              const char     *transport_protocol,
+                                                             gint            port,
                                                              gboolean        auto_connect);
 
 G_END_DECLS
diff --git a/plugins/sip/calls-sip-provider.c b/plugins/sip/calls-sip-provider.c
index 807bb552..5f7339f1 100644
--- a/plugins/sip/calls-sip-provider.c
+++ b/plugins/sip/calls-sip-provider.c
@@ -496,6 +496,23 @@ calls_sip_provider_add_origin_full (CallsSipProvider *self,
 }
 
 
+gboolean
+calls_sip_provider_remove_origin (CallsSipProvider *self,
+                                  CallsSipOrigin   *origin)
+{
+  guint position;
+
+  g_return_val_if_fail (CALLS_IS_SIP_PROVIDER (self), FALSE);
+  g_return_val_if_fail (CALLS_IS_SIP_ORIGIN (origin), FALSE);
+
+  if (g_list_store_find (self->origins, origin, &position)) {
+    g_list_store_remove (self->origins, position);
+    return TRUE;
+  }
+  return FALSE;
+}
+
+
 CallsSipProvider *
 calls_sip_provider_new (void)
 {
diff --git a/plugins/sip/calls-sip-provider.h b/plugins/sip/calls-sip-provider.h
index 5676e8a3..32c3e850 100644
--- a/plugins/sip/calls-sip-provider.h
+++ b/plugins/sip/calls-sip-provider.h
@@ -54,6 +54,8 @@ CallsSipOrigin   *calls_sip_provider_add_origin_full        (CallsSipProvider *s
                                                              gboolean          auto_connect,
                                                              gboolean          direct_mode,
                                                              gint              local_port);
+gboolean          calls_sip_provider_remove_origin          (CallsSipProvider *self,
+                                                             CallsSipOrigin   *origin);
 void              calls_sip_provider_load_accounts          (CallsSipProvider *self,
                                                              GKeyFile         *key_file);
 void              peas_register_types                       (PeasObjectModule *module);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]