[next] telepathy-glib: add tp_account_channel_request_set_sms_channel()

Guillaume Desmottes gdesmott at kemper.freedesktop.org
Thu Feb 27 08:38:41 PST 2014


Module: telepathy-glib
Branch: next
Commit: bc7cdedbf761fc78ab176f77c8e31376527cc9fe
URL:    http://cgit.freedesktop.org/telepathy/telepathy-glib/commit/?id=bc7cdedbf761fc78ab176f77c8e31376527cc9fe

Author: Guillaume Desmottes <guillaume.desmottes at collabora.co.uk>
Date:   Tue Feb 25 14:35:42 2014 +0100

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 a34f649..f75e5ae 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 a96fee9..b2908c5 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 2c80430..2077ff7 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 bd8b945..b2bdd10 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 */



More information about the telepathy-commits mailing list