summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2014-02-25 14:35:42 +0100
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2014-02-25 14:35:42 +0100
commitbc7cdedbf761fc78ab176f77c8e31376527cc9fe (patch)
tree7d7ed86480d06272fc3eed346d512a372719273a
parent6d1aed685b8860d2e0cc4d12b251d19616617819 (diff)
add tp_account_channel_request_set_sms_channel()
-rw-r--r--docs/reference/telepathy-glib-sections.txt1
-rw-r--r--telepathy-glib/account-channel-request.c25
-rw-r--r--telepathy-glib/account-channel-request.h4
-rw-r--r--tests/dbus/account-channel-request.c6
4 files changed, 35 insertions, 1 deletions
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 */