From bc7cdedbf761fc78ab176f77c8e31376527cc9fe Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Tue, 25 Feb 2014 14:35:42 +0100 Subject: add tp_account_channel_request_set_sms_channel() --- docs/reference/telepathy-glib-sections.txt | 1 + telepathy-glib/account-channel-request.c | 25 +++++++++++++++++++++++++ telepathy-glib/account-channel-request.h | 4 ++++ tests/dbus/account-channel-request.c | 6 +++++- 4 files changed, 35 insertions(+), 1 deletion(-) diff --git a/docs/reference/telepathy-glib-sections.txt b/docs/reference/telepathy-glib-sections.txt index a34f64923..f75e5aebd 100644 --- a/docs/reference/telepathy-glib-sections.txt +++ b/docs/reference/telepathy-glib-sections.txt @@ -6282,6 +6282,7 @@ tp_account_channel_request_set_target_contact 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_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 a96fee931..b2908c5af 100644 --- a/telepathy-glib/account-channel-request.c +++ b/telepathy-glib/account-channel-request.c @@ -2524,3 +2524,28 @@ tp_account_channel_request_new_dbus_tube (TpAccount *account, g_hash_table_unref (request); return self; } + +/** + * tp_account_channel_request_set_sms_channel: + * @self: a #TpAccountChannelRequest + * @is_sms_channel: #TRUE if the channel should use SMS + * + * If @is_sms_channel is set to #TRUE, messages sent and received on the + * requested channel will be transmitted via SMS. + * + * This function can't be called once @self has been used to request a + * channel. + * + * Since: UNRELEASED + */ +void +tp_account_channel_request_set_sms_channel (TpAccountChannelRequest *self, + gboolean is_sms_channel) +{ + 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_SMS_SMS_CHANNEL), + tp_g_value_slice_new_boolean (is_sms_channel)); +} diff --git a/telepathy-glib/account-channel-request.h b/telepathy-glib/account-channel-request.h index 2c8043089..2077ff7fe 100644 --- a/telepathy-glib/account-channel-request.h +++ b/telepathy-glib/account-channel-request.h @@ -114,6 +114,10 @@ TpAccountChannelRequest *tp_account_channel_request_new_text ( TpAccount *account, gint64 user_action_time) G_GNUC_WARN_UNUSED_RESULT; +_TP_AVAILABLE_IN_0_24 +void tp_account_channel_request_set_sms_channel (TpAccountChannelRequest *self, + gboolean is_sms_channel); + /* Calls */ _TP_AVAILABLE_IN_0_20 diff --git a/tests/dbus/account-channel-request.c b/tests/dbus/account-channel-request.c index bd8b94575..b2bdd10fb 100644 --- a/tests/dbus/account-channel-request.c +++ b/tests/dbus/account-channel-request.c @@ -210,6 +210,8 @@ test_handle_create_success (Test *test, tp_account_channel_request_set_target_id (req, TP_HANDLE_TYPE_CONTACT, "alice"); + tp_account_channel_request_set_sms_channel (req, TRUE); + /* We didn't start requesting the channel yet, so there is no * ChannelRequest */ chan_req = tp_account_channel_request_get_channel_request (req); @@ -236,7 +238,9 @@ test_handle_create_success (Test *test, TP_PROP_CHANNEL_TARGET_ID), ==, "alice"); g_assert_cmpuint (tp_asv_get_uint32 (test->cd_service->last_request, TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, NULL), ==, TP_HANDLE_TYPE_CONTACT); - 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 (tp_asv_get_boolean (test->cd_service->last_request, + TP_PROP_CHANNEL_INTERFACE_SMS_SMS_CHANNEL, NULL)); } /* ChannelDispatcher.CreateChannel() call fails */ -- cgit v1.2.1