From aa643f1836a732d0b849d465b7777ac3265ef9a4 Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Tue, 25 Feb 2014 15:45:33 +0100 Subject: add tp_account_channel_request_set_conference_initial_channels() --- docs/reference/telepathy-glib-sections.txt | 1 + telepathy-glib/account-channel-request.c | 35 ++++++++++++++++++++++++++++++ telepathy-glib/account-channel-request.h | 7 ++++++ tests/dbus/account-channel-request.c | 14 +++++++++++- 4 files changed, 56 insertions(+), 1 deletion(-) diff --git a/docs/reference/telepathy-glib-sections.txt b/docs/reference/telepathy-glib-sections.txt index f75e5aebd..889d272fd 100644 --- a/docs/reference/telepathy-glib-sections.txt +++ b/docs/reference/telepathy-glib-sections.txt @@ -6283,6 +6283,7 @@ tp_account_channel_request_set_target_id tp_account_channel_request_set_request_property tp_account_channel_request_new_text tp_account_channel_request_set_sms_channel +tp_account_channel_request_set_conference_initial_channels tp_account_channel_request_new_audio_call tp_account_channel_request_new_audio_video_call tp_account_channel_request_new_file_transfer diff --git a/telepathy-glib/account-channel-request.c b/telepathy-glib/account-channel-request.c index da71b8741..656cbd100 100644 --- a/telepathy-glib/account-channel-request.c +++ b/telepathy-glib/account-channel-request.c @@ -2546,3 +2546,38 @@ tp_account_channel_request_set_sms_channel (TpAccountChannelRequest *self, g_strdup (TP_PROP_CHANNEL_INTERFACE_SMS_SMS_CHANNEL), tp_g_value_slice_new_boolean (is_sms_channel)); } + +/** + * tp_account_channel_request_set_conference_initial_channels: + * @self: a #TpAccountChannelRequest + * @channels: a #NULL-terminated array of channel paths + * + * Indicate that the channel which is going to be requested using @self + * is an upgrade of the channels whose object paths is listed in @channels. + * + * This function can't be called once @self has been used to request a + * channel. + * + * Since: UNRELEASED + */ +void +tp_account_channel_request_set_conference_initial_channels ( + TpAccountChannelRequest *self, + const gchar * const * channels) +{ + GPtrArray *chans; + guint i; + + g_return_if_fail (TP_IS_ACCOUNT_CHANNEL_REQUEST (self)); + g_return_if_fail (!self->priv->requested); + + chans = g_ptr_array_new (); + for (i = 0; channels != NULL && channels[i] != NULL; i++) + g_ptr_array_add (chans, (gpointer) channels[i]); + + g_hash_table_insert (self->priv->request, + g_strdup (TP_PROP_CHANNEL_INTERFACE_CONFERENCE_INITIAL_CHANNELS), + tp_g_value_slice_new_boxed (TP_ARRAY_TYPE_OBJECT_PATH_LIST, chans)); + + g_ptr_array_unref (chans); +} diff --git a/telepathy-glib/account-channel-request.h b/telepathy-glib/account-channel-request.h index 2077ff7fe..962c0ff5f 100644 --- a/telepathy-glib/account-channel-request.h +++ b/telepathy-glib/account-channel-request.h @@ -176,6 +176,13 @@ TpAccountChannelRequest *tp_account_channel_request_new_dbus_tube ( const gchar *service_name, gint64 user_action_time) G_GNUC_WARN_UNUSED_RESULT; +/* Conference */ + +_TP_AVAILABLE_IN_0_24 +void tp_account_channel_request_set_conference_initial_channels ( + TpAccountChannelRequest *self, + const gchar * const * channels); + /* Channel target (shared between all channel types) */ _TP_AVAILABLE_IN_0_20 diff --git a/tests/dbus/account-channel-request.c b/tests/dbus/account-channel-request.c index 401a46c78..410e582f4 100644 --- a/tests/dbus/account-channel-request.c +++ b/tests/dbus/account-channel-request.c @@ -1318,9 +1318,13 @@ test_no_handle_type (Test *test, { TpAccountChannelRequest *req; gboolean valid; + const gchar * const channels[] = { "/chan1", "/chan2", NULL }; + GPtrArray *chans; req = tp_account_channel_request_new_text (test->account, 0); + tp_account_channel_request_set_conference_initial_channels (req, channels); + /* Ask to the CR to fire the signal */ tp_account_channel_request_set_request_property (req, "FireFailed", g_variant_new_boolean (TRUE)); @@ -1342,8 +1346,16 @@ test_no_handle_type (Test *test, g_assert (valid); g_assert_cmpuint (tp_asv_get_boolean (test->cd_service->last_request, "FireFailed", NULL), ==, TRUE); - g_assert_cmpuint (tp_asv_size (test->cd_service->last_request), ==, 3); + g_assert_cmpuint (tp_asv_size (test->cd_service->last_request), ==, 4); g_assert_cmpuint (test->cd_service->last_user_action_time, ==, 0); + + chans = tp_asv_get_boxed (test->cd_service->last_request, + TP_PROP_CHANNEL_INTERFACE_CONFERENCE_INITIAL_CHANNELS, + TP_ARRAY_TYPE_OBJECT_PATH_LIST); + g_assert (chans != NULL); + g_assert_cmpuint (chans->len, ==, 2); + g_assert_cmpstr (g_ptr_array_index (chans, 0), ==, "/chan1"); + g_assert_cmpstr (g_ptr_array_index (chans, 1), ==, "/chan2"); } int -- cgit v1.2.1