[Telepathy-commits] [telepathy-stream-engine/master] Import code to create the channel here
Olivier Crête
olivier.crete at collabora.co.uk
Tue Dec 9 17:33:26 PST 2008
---
configure.ac | 2 +-
src/tp-stream-engine.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 59 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
index 9683aaa..7d8aa1e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -116,7 +116,7 @@ AC_SUBST(FARSIGHT2_LIBS)
dnl Check for telepathy-farsight
-PKG_CHECK_MODULES(TPFARSIGHT, [telepathy-farsight])
+PKG_CHECK_MODULES(TPFARSIGHT, [telepathy-farsight >= 0.0.3])
AC_SUBST(TPFARSIGHT_CFLAGS)
AC_SUBST(TPFARSIGHT_LIBS)
diff --git a/src/tp-stream-engine.c b/src/tp-stream-engine.c
index 7c9dbea..c9a107b 100644
--- a/src/tp-stream-engine.c
+++ b/src/tp-stream-engine.c
@@ -1191,6 +1191,63 @@ handler_result (TfChannel *chan G_GNUC_UNUSED,
dbus_g_method_return_error (context, error);
}
+
+/**
+ * _channel_new:
+ * @dbus_daemon: a #TpDBusDaemon
+ * @bus_name: the name of the bus to connect to
+ * @connection_path: the connection path to connect to
+ * @channel_path: the path of the channel to connect to
+ * @handle_type: the type of handle
+ * @handle: the handle
+ * @error: The location of a %GError or %NULL
+ *
+ * Creates a new #TfChannel by connecting to the D-Bus bus and finding
+ * an already existing channel object. This API would normally be used with the
+ * HandleChannel method.
+ *
+ * Returns: a new #TfChannel
+ */
+
+static TfChannel *
+_channel_new (TpDBusDaemon *dbus_daemon,
+ const gchar *bus_name,
+ const gchar *connection_path,
+ const gchar *channel_path,
+ guint handle_type,
+ guint handle,
+ GError **error)
+{
+ TpConnection *connection;
+ TpChannel *channel_proxy;
+ TfChannel *ret;
+
+ g_return_val_if_fail (bus_name != NULL, NULL);
+ g_return_val_if_fail (connection_path != NULL, NULL);
+ g_return_val_if_fail (channel_path != NULL, NULL);
+
+ connection = tp_connection_new (dbus_daemon,
+ bus_name, connection_path, error);
+
+ if (connection == NULL)
+ return NULL;
+
+ channel_proxy = tp_channel_new (connection, channel_path,
+ TP_IFACE_CHANNEL_TYPE_STREAMED_MEDIA, handle_type, handle, error);
+
+ if (channel_proxy == NULL)
+ return NULL;
+
+ g_object_unref (connection);
+
+ ret = tf_channel_new (channel_proxy);
+
+ g_object_unref (channel_proxy);
+
+ return ret;
+}
+
+
/**
* tp_stream_engine_attach_to_channel
*
@@ -1224,7 +1281,7 @@ tp_stream_engine_attach_to_channel (StreamEngineSvcStreamEngine *iface,
return;
}
- chan = tf_channel_new (self->priv->dbus_daemon, bus_name,
+ chan = _channel_new (self->priv->dbus_daemon, bus_name,
connection, channel, handle_type, handle, &error);
if (chan == NULL)
--
1.5.6.5
More information about the Telepathy-commits
mailing list