telepathy-glib: tp_account_channel_request_set_request_property: add

Simon McVittie smcv at kemper.freedesktop.org
Mon Apr 30 11:57:29 PDT 2012


Module: telepathy-glib
Branch: master
Commit: 199fd080e4a6ad07936d295a30bba7fab8b05e30
URL:    http://cgit.freedesktop.org/telepathy/telepathy-glib/commit/?id=199fd080e4a6ad07936d295a30bba7fab8b05e30

Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date:   Mon Apr 16 19:34:59 2012 +0100

tp_account_channel_request_set_request_property: add

Signed-off-by: Simon McVittie <simon.mcvittie at collabora.co.uk>
Reviewed-by: Jonny Lamb <jonny.lamb at collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=48780

---

 docs/reference/telepathy-glib-sections.txt |    1 +
 telepathy-glib/account-channel-request.c   |   53 ++++++++++++++++++++++++++++
 telepathy-glib/account-channel-request.h   |    7 ++++
 3 files changed, 61 insertions(+), 0 deletions(-)

diff --git a/docs/reference/telepathy-glib-sections.txt b/docs/reference/telepathy-glib-sections.txt
index b7294c6..a3ab225 100644
--- a/docs/reference/telepathy-glib-sections.txt
+++ b/docs/reference/telepathy-glib-sections.txt
@@ -6032,6 +6032,7 @@ tp_account_channel_request_get_user_action_time
 tp_account_channel_request_get_account
 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_create_and_handle_channel_async
 tp_account_channel_request_create_and_handle_channel_finish
diff --git a/telepathy-glib/account-channel-request.c b/telepathy-glib/account-channel-request.c
index 16174fa..f84f2f5 100644
--- a/telepathy-glib/account-channel-request.c
+++ b/telepathy-glib/account-channel-request.c
@@ -1831,3 +1831,56 @@ tp_account_channel_request_new_text (
   g_hash_table_unref (request);
   return self;
 }
+
+/**
+ * tp_account_channel_request_set_request_property:
+ * @self: a #TpAccountChannelRequest
+ * @name: a D-Bus property name
+ * @value: an arbitrary value for the property
+ *
+ * Configure this channel request to include the given property, as
+ * documented in the Telepathy D-Bus API Specification or an
+ * implementation-specific extension.
+ *
+ * Using this method is not recommended, but it can be necessary for
+ * experimental or implementation-specific interfaces.
+ *
+ * If the property is not supported by the protocol or channel type, the
+ * channel request will fail. Use #TpCapabilities and the Telepathy
+ * D-Bus API Specification to determine which properties are available.
+ *
+ * If @value is a floating reference, this method takes ownership of it
+ * by using g_variant_ref_sink(). This allows convenient inline use of
+ * #GVariant constructors:
+ *
+ * |[
+ * tp_account_channel_request_set_request_property (acr, "com.example.Int",
+ *     g_variant_new_int32 (17));
+ * tp_account_channel_request_set_request_property (acr, "com.example.String",
+ *     g_variant_new_string ("ferret"));
+ * ]|
+ *
+ * It is an error to provide a @value which contains types not supported by
+ * D-Bus.
+ *
+ * This function can't be called once @self has been used to request a
+ * channel.
+ *
+ * Since: 0.19.UNRELEASED
+ */
+void
+tp_account_channel_request_set_request_property (
+    TpAccountChannelRequest *self,
+    const gchar *name,
+    GVariant *value)
+{
+  GValue *v;
+
+  g_return_if_fail (TP_IS_ACCOUNT_CHANNEL_REQUEST (self));
+  g_return_if_fail (!self->priv->requested);
+
+  v = g_slice_new0 (GValue);
+  dbus_g_value_parse_g_variant (value, v);
+
+  g_hash_table_insert (self->priv->request, g_strdup (name), v);
+}
diff --git a/telepathy-glib/account-channel-request.h b/telepathy-glib/account-channel-request.h
index 022c282..dd523fa 100644
--- a/telepathy-glib/account-channel-request.h
+++ b/telepathy-glib/account-channel-request.h
@@ -102,6 +102,13 @@ void tp_account_channel_request_set_target_id (TpAccountChannelRequest *self,
     TpHandleType handle_type,
     const gchar *identifier);
 
+/* Generic low-level */
+
+void tp_account_channel_request_set_request_property (
+    TpAccountChannelRequest *self,
+    const gchar *name,
+    GVariant *value);
+
 /* Request and handle API */
 
 void tp_account_channel_request_create_and_handle_channel_async (



More information about the telepathy-commits mailing list