diff options
author | Olivier CrĂȘte <olivier.crete@collabora.com> | 2012-02-16 12:51:15 -0500 |
---|---|---|
committer | Olivier CrĂȘte <olivier.crete@collabora.com> | 2012-02-16 12:54:24 -0500 |
commit | 67ab1ed9edc0ce716557bf8db4fb68267b54bf45 (patch) | |
tree | d373877eaf2615bae6d2254112032fea5ecf7eea | |
parent | 24e5776b0225f4095372fc9bfe8be33d026b195a (diff) | |
download | telepathy-glib-67ab1ed9edc0ce716557bf8db4fb68267b54bf45.tar.gz |
Add direction parameter to AddContent
-rw-r--r-- | examples/cm/call/call-channel.c | 2 | ||||
-rw-r--r-- | telepathy-glib/base-call-channel.c | 10 | ||||
-rw-r--r-- | telepathy-glib/base-call-channel.h | 1 | ||||
-rw-r--r-- | telepathy-glib/call-channel.c | 4 | ||||
-rw-r--r-- | telepathy-glib/call-channel.h | 1 | ||||
-rw-r--r-- | tests/dbus/call-channel.c | 18 |
6 files changed, 31 insertions, 5 deletions
diff --git a/examples/cm/call/call-channel.c b/examples/cm/call/call-channel.c index a5361dd7f..677c4951a 100644 --- a/examples/cm/call/call-channel.c +++ b/examples/cm/call/call-channel.c @@ -310,6 +310,7 @@ static void call_accept (TpBaseCallChannel *self); static TpBaseCallContent * call_add_content (TpBaseCallChannel *self, const gchar *name, TpMediaStreamType media, + TpMediaStreamDirection initial_direction, GError **error); static void call_hangup (TpBaseCallChannel *self, guint reason, @@ -675,6 +676,7 @@ static TpBaseCallContent * call_add_content (TpBaseCallChannel *base, const gchar *content_name, guint content_type, + TpMediaStreamDirection initial_direction, GError **error) { ExampleCallChannel *self = EXAMPLE_CALL_CHANNEL (base); diff --git a/telepathy-glib/base-call-channel.c b/telepathy-glib/base-call-channel.c index b66bd500c..41e691eff 100644 --- a/telepathy-glib/base-call-channel.c +++ b/telepathy-glib/base-call-channel.c @@ -1433,6 +1433,7 @@ static void tp_base_call_channel_add_content_dbus (TpSvcChannelTypeCall *iface, const gchar *name, TpMediaStreamType mtype, + TpMediaStreamDirection initial_direction, DBusGMethodInvocation *context) { TpBaseCallChannel *self = TP_BASE_CALL_CHANNEL (iface); @@ -1454,6 +1455,13 @@ tp_base_call_channel_add_content_dbus (TpSvcChannelTypeCall *iface, goto error; } + if (initial_direction >= NUM_TP_MEDIA_STREAM_DIRECTIONS) + { + g_set_error (&error, TP_ERRORS, TP_ERROR_INVALID_ARGUMENT, + "Invalid initial direction"); + goto error; + } + if (!self->priv->mutable_contents || klass->add_content == NULL) { g_set_error (&error, TP_ERRORS, TP_ERROR_NOT_CAPABLE, @@ -1461,7 +1469,7 @@ tp_base_call_channel_add_content_dbus (TpSvcChannelTypeCall *iface, goto error; } - content = klass->add_content (self, name, mtype, &error); + content = klass->add_content (self, name, mtype, initial_direction, &error); if (content == NULL) goto error; diff --git a/telepathy-glib/base-call-channel.h b/telepathy-glib/base-call-channel.h index 8f682851c..7f054c223 100644 --- a/telepathy-glib/base-call-channel.h +++ b/telepathy-glib/base-call-channel.h @@ -36,6 +36,7 @@ typedef TpBaseCallContent * (*TpBaseCallChannelAddContentFunc) ( TpBaseCallChannel *self, const gchar *name, TpMediaStreamType media, + TpMediaStreamDirection initial_direction, GError **error); typedef void (*TpBaseCallChannelHangupFunc) (TpBaseCallChannel *self, TpCallStateChangeReason reason, diff --git a/telepathy-glib/call-channel.c b/telepathy-glib/call-channel.c index 46153c5a2..4c59edd77 100644 --- a/telepathy-glib/call-channel.c +++ b/telepathy-glib/call-channel.c @@ -1465,6 +1465,7 @@ add_content_cb (TpChannel *channel, * @name: the suggested name of the content to add * @type: the media stream type of the content to be added to the call, from * #TpMediaStreamType + * @initial_direction: The initial direction of the content * @callback: a callback to call when the operation finishes * @user_data: data to pass to @callback * @@ -1478,6 +1479,7 @@ void tp_call_channel_add_content_async (TpCallChannel *self, gchar *name, TpMediaStreamType type, + TpMediaStreamDirection initial_direction, GAsyncReadyCallback callback, gpointer user_data) { @@ -1489,7 +1491,7 @@ tp_call_channel_add_content_async (TpCallChannel *self, user_data, tp_call_channel_add_content_async); tp_cli_channel_type_call_call_add_content (TP_CHANNEL (self), -1, - name, type, + name, type, initial_direction, add_content_cb, result, g_object_unref, G_OBJECT (self)); } diff --git a/telepathy-glib/call-channel.h b/telepathy-glib/call-channel.h index a48da5152..6193f4749 100644 --- a/telepathy-glib/call-channel.h +++ b/telepathy-glib/call-channel.h @@ -122,6 +122,7 @@ gboolean tp_call_channel_hangup_finish (TpCallChannel *self, void tp_call_channel_add_content_async (TpCallChannel *self, gchar *name, TpMediaStreamType type, + TpMediaStreamDirection initial_direction, GAsyncReadyCallback callback, gpointer user_data); TpCallContent *tp_call_channel_add_content_finish (TpCallChannel *self, diff --git a/tests/dbus/call-channel.c b/tests/dbus/call-channel.c index 024eefd3e..90b77bc53 100644 --- a/tests/dbus/call-channel.c +++ b/tests/dbus/call-channel.c @@ -632,16 +632,28 @@ test_basics (Test *test, /* AddContent with bad content-type must fail */ tp_call_channel_add_content_async (test->call_chan, - "", 31337, add_content_cb, test); + "", 31337, TP_MEDIA_STREAM_DIRECTION_BIDIRECTIONAL, + add_content_cb, test); g_main_loop_run (test->mainloop); g_assert (test->error != NULL); g_assert (test->added_content == NULL); g_clear_error (&test->error); - /* AddContent again, to add a video stream */ + /* AddContent with bad initial-direction must fail */ tp_call_channel_add_content_async (test->call_chan, - "", TP_MEDIA_STREAM_TYPE_VIDEO, add_content_cb, test); + "", TP_MEDIA_STREAM_TYPE_AUDIO, 31337, + add_content_cb, test); + g_main_loop_run (test->mainloop); + g_assert (test->error != NULL); + g_assert (test->added_content == NULL); + g_clear_error (&test->error); + + /* AddContent again, to add a video stream */ + + tp_call_channel_add_content_async (test->call_chan, + "", TP_MEDIA_STREAM_TYPE_VIDEO, TP_MEDIA_STREAM_DIRECTION_BIDIRECTIONAL, + add_content_cb, test); g_main_loop_run (test->mainloop); g_assert_no_error (test->error); |