From bf0b1ee111621247fdd83025d02cf42ab67aba5e Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Tue, 25 Feb 2014 15:57:33 +0100 Subject: add tp_account_channel_request_set_initial_invitee_ids() --- docs/reference/telepathy-glib-sections.txt | 1 + telepathy-glib/account-channel-request.c | 27 +++++++++++++++++++++++++++ telepathy-glib/account-channel-request.h | 5 +++++ tests/dbus/account-channel-request.c | 15 ++++++++++++++- 4 files changed, 47 insertions(+), 1 deletion(-) diff --git a/docs/reference/telepathy-glib-sections.txt b/docs/reference/telepathy-glib-sections.txt index 889d272fd..465ee1bff 100644 --- a/docs/reference/telepathy-glib-sections.txt +++ b/docs/reference/telepathy-glib-sections.txt @@ -6284,6 +6284,7 @@ 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_set_initial_invitee_ids 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 656cbd100..b8b127e23 100644 --- a/telepathy-glib/account-channel-request.c +++ b/telepathy-glib/account-channel-request.c @@ -2581,3 +2581,30 @@ tp_account_channel_request_set_conference_initial_channels ( g_ptr_array_unref (chans); } + +/** + * tp_account_channel_request_set_initial_invitee_ids: + * @self: a #TpAccountChannelRequest + * @ids: a #NULL-terminated array of contact ids + * + * Indicate that the contacts listed in @ids have to be invited to the + * conference represented by the channel which is going to be requested + * using @self. + * + * This function can't be called once @self has been used to request a + * channel. + * + * Since: UNRELEASED + */ +void +tp_account_channel_request_set_initial_invitee_ids ( + TpAccountChannelRequest *self, + const gchar * const * ids) +{ + g_return_if_fail (TP_IS_ACCOUNT_CHANNEL_REQUEST (self)); + g_return_if_fail (!self->priv->requested); + + g_hash_table_insert (self->priv->request, + g_strdup (TP_PROP_CHANNEL_INTERFACE_CONFERENCE_INITIAL_INVITEE_IDS), + tp_g_value_slice_new_boxed (G_TYPE_STRV, ids)); +} diff --git a/telepathy-glib/account-channel-request.h b/telepathy-glib/account-channel-request.h index 962c0ff5f..f414e888f 100644 --- a/telepathy-glib/account-channel-request.h +++ b/telepathy-glib/account-channel-request.h @@ -183,6 +183,11 @@ void tp_account_channel_request_set_conference_initial_channels ( TpAccountChannelRequest *self, const gchar * const * channels); +_TP_AVAILABLE_IN_0_24 +void tp_account_channel_request_set_initial_invitee_ids ( + TpAccountChannelRequest *self, + const gchar * const * ids); + /* 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 410e582f4..258ec6d63 100644 --- a/tests/dbus/account-channel-request.c +++ b/tests/dbus/account-channel-request.c @@ -1320,11 +1320,16 @@ test_no_handle_type (Test *test, gboolean valid; const gchar * const channels[] = { "/chan1", "/chan2", NULL }; GPtrArray *chans; + const gchar * const invitees[] = { "badger@badger.com", + "snake@badger.com", NULL }; + const gchar * const *strv; req = tp_account_channel_request_new_text (test->account, 0); tp_account_channel_request_set_conference_initial_channels (req, channels); + tp_account_channel_request_set_initial_invitee_ids (req, invitees); + /* Ask to the CR to fire the signal */ tp_account_channel_request_set_request_property (req, "FireFailed", g_variant_new_boolean (TRUE)); @@ -1346,7 +1351,7 @@ 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), ==, 4); + g_assert_cmpuint (tp_asv_size (test->cd_service->last_request), ==, 5); g_assert_cmpuint (test->cd_service->last_user_action_time, ==, 0); chans = tp_asv_get_boxed (test->cd_service->last_request, @@ -1356,6 +1361,14 @@ test_no_handle_type (Test *test, 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"); + + strv = tp_asv_get_boxed (test->cd_service->last_request, + TP_PROP_CHANNEL_INTERFACE_CONFERENCE_INITIAL_INVITEE_IDS, + G_TYPE_STRV); + g_assert (strv != NULL); + g_assert_cmpuint (g_strv_length ((GStrv) strv), ==, 2); + g_assert (tp_strv_contains (strv, "badger@badger.com")); + g_assert (tp_strv_contains (strv, "snake@badger.com")); } int -- cgit v1.2.3