[Telepathy-commits] [telepathy-sofiasip/master] Addressed the review comments

Mikhail Zabaluev mikhail.zabaluev at nokia.com
Wed Nov 19 08:55:03 PST 2008


---
 src/media-factory.c     |   18 ++++--------------
 src/sip-connection.c    |   10 +++++++---
 src/sip-media-channel.c |   15 ++++++++-------
 src/sip-text-channel.c  |    3 ++-
 src/text-factory.c      |    2 +-
 5 files changed, 22 insertions(+), 26 deletions(-)

diff --git a/src/media-factory.c b/src/media-factory.c
index eb03a89..d1f5631 100644
--- a/src/media-factory.c
+++ b/src/media-factory.c
@@ -414,6 +414,8 @@ static const gchar * const named_channel_allowed_properties[] = {
     NULL
 };
 
+/* not advertised in foreach_channel_class - can only be requested with
+ * RequestChannel, not with CreateChannel/EnsureChannel */
 static const gchar * const anon_channel_allowed_properties[] = {
     NULL
 };
@@ -436,9 +438,6 @@ tpsip_media_factory_foreach_channel_class (TpChannelManager *manager,
   g_hash_table_insert (table, TP_IFACE_CHANNEL ".TargetHandleType",
       handle_type_value);
 
-  g_value_set_uint (handle_type_value, TP_HANDLE_TYPE_NONE);
-  func (manager, table, anon_channel_allowed_properties, user_data);
-
   g_value_set_uint (handle_type_value, TP_HANDLE_TYPE_CONTACT);
   func (manager, table, named_channel_allowed_properties, user_data);
 
@@ -515,13 +514,7 @@ tpsip_media_factory_requestotron (TpChannelManager *manager,
   switch (handle_type)
     {
     case TP_HANDLE_TYPE_NONE:
-      if (handle != 0)
-        {
-          g_set_error (&error, TP_ERRORS, TP_ERROR_INVALID_ARGUMENT,
-              "TargetHandle must be zero or omitted if TargetHandleType is "
-              "NONE");
-          goto error;
-        }
+      g_assert (handle == 0);
 
       if (require_target_handle)
         {
@@ -540,10 +533,7 @@ tpsip_media_factory_requestotron (TpChannelManager *manager,
       break;
 
     case TP_HANDLE_TYPE_CONTACT:
-      if (!tp_handle_is_valid (
-            tp_base_connection_get_handles (conn, TP_HANDLE_TYPE_CONTACT),
-            handle, &error))
-        goto error;
+      g_assert (handle != 0);
 
       if (tp_channel_manager_asv_has_unknown_properties (request_properties,
               media_channel_fixed_properties, named_channel_allowed_properties,
diff --git a/src/sip-connection.c b/src/sip-connection.c
index fefe500..2e8959d 100644
--- a/src/sip-connection.c
+++ b/src/sip-connection.c
@@ -218,7 +218,7 @@ tpsip_connection_set_property (GObject      *object,
   }
   case PROP_REGISTRAR: {
     priv->registrar_url = priv_url_from_string_value (priv->sofia_home, value);
-    if (priv->sofia_nua) 
+    if (priv->sofia_nua)
       nua_set_params(priv->sofia_nua,
                      NUTAG_REGISTRAR(priv->registrar_url),
                      TAG_END());
@@ -652,10 +652,10 @@ priv_handle_auth (TpsipConnection* self,
   g_assert (realm != NULL);
   if (user && method) {
     if (realm[0] == '"')
-      auth = g_strdup_printf ("%s:%s:%s:%s", 
+      auth = g_strdup_printf ("%s:%s:%s:%s",
                               method, realm, user, password);
     else
-      auth = g_strdup_printf ("%s:\"%s\":%s:%s", 
+      auth = g_strdup_printf ("%s:\"%s\":%s:%s",
                               method, realm, user, password);
 
     DEBUG("%s authenticating user='%s' realm=%s",
@@ -789,6 +789,10 @@ tpsip_connection_dispose (GObject *object)
       || base->status == TP_INTERNAL_CONNECTION_STATUS_NEW);
   g_assert (base->self_handle == 0);
 
+  /* the base class owns channel factories/managers,
+   * here we just nullify the references */
+  priv->media_factory = NULL;
+
   if (G_OBJECT_CLASS (tpsip_connection_parent_class)->dispose)
     G_OBJECT_CLASS (tpsip_connection_parent_class)->dispose (object);
 }
diff --git a/src/sip-media-channel.c b/src/sip-media-channel.c
index eb57ad5..3e5871d 100644
--- a/src/sip-media-channel.c
+++ b/src/sip-media-channel.c
@@ -438,6 +438,7 @@ tpsip_media_channel_get_property (GObject    *object,
               TP_IFACE_CHANNEL, "InitiatorHandle",
               TP_IFACE_CHANNEL, "InitiatorID",
               TP_IFACE_CHANNEL, "Requested",
+              TP_IFACE_CHANNEL, "Interfaces",
               NULL));
       break;
     default:
@@ -662,7 +663,7 @@ tpsip_media_channel_get_interfaces (TpSvcChannel *iface,
 }
 
 /***********************************************************************
- * Set: Channel.Interface.MediaSignalling Telepathy-0.13 interface 
+ * Set: Channel.Interface.MediaSignalling Telepathy-0.13 interface
  ***********************************************************************/
 
 /**
@@ -733,7 +734,7 @@ tpsip_media_channel_get_session_handlers (TpSvcChannelInterfaceMediaSignalling *
 
 
 /***********************************************************************
- * Set: Channel.Type.StreamedMedia Telepathy-0.13 interface 
+ * Set: Channel.Type.StreamedMedia Telepathy-0.13 interface
  ***********************************************************************/
 
 /**
@@ -906,7 +907,7 @@ tpsip_media_channel_request_streams (TpSvcChannelTypeStreamedMedia *iface,
  * has been created with initiator handle of the sender.
  */
 void
-tpsip_media_channel_receive_invite (TpsipMediaChannel *self, 
+tpsip_media_channel_receive_invite (TpsipMediaChannel *self,
                                     nua_handle_t *nh)
 {
   TpsipMediaChannelPrivate *priv = TPSIP_MEDIA_CHANNEL_GET_PRIVATE (self);
@@ -915,7 +916,7 @@ tpsip_media_channel_receive_invite (TpsipMediaChannel *self,
   g_assert (priv->initiator != conn->self_handle);
   g_assert (priv->session == NULL);
 
-  /* Start the local stream-engine; once the local 
+  /* Start the local stream-engine; once the local
    * media are ready, reply with nua_respond() */
   priv_create_session (self, nh, priv->initiator);
 
@@ -949,7 +950,7 @@ tpsip_media_channel_peer_error (TpsipMediaChannel *self,
   TpGroupMixin *mixin = TP_GROUP_MIXIN (self);
   TpIntSet *set;
   guint reason = TP_CHANNEL_GROUP_CHANGE_REASON_ERROR;
- 
+
   switch (status)
     {
     case 410:
@@ -1047,7 +1048,7 @@ priv_nua_i_cancel_cb (TpsipMediaChannel *self,
          reason != NULL;
          reason = reason->re_next)
       {
-        const char *protocol = reason->re_protocol; 
+        const char *protocol = reason->re_protocol;
         if (protocol == NULL || strcmp (protocol, "SIP") != 0)
           continue;
         if (reason->re_cause != NULL)
@@ -1139,7 +1140,7 @@ priv_nua_i_state_cb (TpsipMediaChannel *self,
         tpsip_media_channel_change_call_state (self, peer,
                 TP_CHANNEL_CALL_STATE_QUEUED, 0);
       break;
-    
+
     case nua_callstate_completing:
       /* In auto-ack mode, we don't need to call nua_ack(), see NUTAG_AUTOACK() */
       break;
diff --git a/src/sip-text-channel.c b/src/sip-text-channel.c
index 9099aa7..da19ea9 100644
--- a/src/sip-text-channel.c
+++ b/src/sip-text-channel.c
@@ -383,6 +383,7 @@ tpsip_text_channel_get_property(GObject *object,
               TP_IFACE_CHANNEL, "InitiatorHandle",
               TP_IFACE_CHANNEL, "InitiatorID",
               TP_IFACE_CHANNEL, "Requested",
+              TP_IFACE_CHANNEL, "Interfaces",
               NULL));
       break;
 
@@ -918,7 +919,7 @@ tpsip_text_channel_nua_r_message_cb (TpsipTextChannel *self,
       }
 
     tp_svc_channel_type_text_emit_send_error (self,
-	send_error, msg->timestamp, msg->type, msg->text);  
+	send_error, msg->timestamp, msg->type, msg->text);
   }
 
   g_queue_remove(priv->sending_messages, msg);
diff --git a/src/text-factory.c b/src/text-factory.c
index c842ff1..1350d40 100644
--- a/src/text-factory.c
+++ b/src/text-factory.c
@@ -452,7 +452,7 @@ tpsip_text_factory_lookup_channel (TpsipTextFactory *fac,
 {
   TpsipTextFactoryPrivate *priv = TPSIP_TEXT_FACTORY_GET_PRIVATE (fac);
 
-  return (TpsipTextChannel *)g_hash_table_lookup (priv->channels,
+  return g_hash_table_lookup (priv->channels,
       GUINT_TO_POINTER(handle));
 }
 
-- 
1.5.6.5




More information about the Telepathy-commits mailing list