From 9a8b8d093aa83407c7f03a48339b7d715f26b835 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 16 Apr 2012 19:34:59 +0100 Subject: [PATCH 07/14] tp_account_channel_request_set_request_property: add Signed-off-by: Simon McVittie --- 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(+) diff --git a/docs/reference/telepathy-glib-sections.txt b/docs/reference/telepathy-glib-sections.txt index f393351..f76f5c2 100644 --- a/docs/reference/telepathy-glib-sections.txt +++ b/docs/reference/telepathy-glib-sections.txt @@ -6026,6 +6026,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 3c52472..eb57efe 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 ( -- 1.7.10