[calls] sip: origin: Set and update name of origin



commit e9f155678e18b4bc550d48c372630c2a10674d2a
Author: Evangelos Ribeiro Tzaras <evangelos tzaras puri sm>
Date:   Tue Jul 6 13:42:47 2021 +0200

    sip: origin: Set and update name of origin

 plugins/sip/calls-sip-origin.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
---
diff --git a/plugins/sip/calls-sip-origin.c b/plugins/sip/calls-sip-origin.c
index f3e6a99b..1fc78308 100644
--- a/plugins/sip/calls-sip-origin.c
+++ b/plugins/sip/calls-sip-origin.c
@@ -1030,6 +1030,19 @@ supports_protocol (CallsOrigin *origin,
 }
 
 
+static void
+update_name (CallsSipOrigin *self)
+{
+  g_assert (CALLS_IS_SIP_ORIGIN (self));
+
+  if (self->display_name && self->display_name[0] != '\0')
+    self->name = self->display_name;
+  else
+    self->name = self->user;
+
+  g_object_notify_by_pspec (G_OBJECT (self), props[PROP_NAME]);
+}
+
 static void
 calls_sip_origin_set_property (GObject      *object,
                                guint         property_id,
@@ -1189,6 +1202,8 @@ calls_sip_origin_constructed (GObject *object)
     g_warning ("Error initializing the SIP account: %s", error->message);
   }
 
+  update_name (self);
+
   self->media_manager = calls_sip_media_manager_default ();
 
   G_OBJECT_CLASS (calls_sip_origin_parent_class)->constructed (object);
@@ -1418,6 +1433,8 @@ calls_sip_origin_set_credentials (CallsSipOrigin *self,
 
   self->port = port;
 
+  update_name (self);
+
   /* Propagate changes to nua stack */
   update_nua (self);
 }


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