From 410e44a648eb3bd2eb5db31a39326b01ac953eac Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Tue, 25 Feb 2014 12:39:59 +0100 Subject: add tp_account_channel_request_set_file_transfer_hash() --- telepathy-glib/account-channel-request.c | 33 ++++++++++++++++++++++++++++++++ telepathy-glib/account-channel-request.h | 6 ++++++ 2 files changed, 39 insertions(+) (limited to 'telepathy-glib') diff --git a/telepathy-glib/account-channel-request.c b/telepathy-glib/account-channel-request.c index 5269a39f6..a1000f986 100644 --- a/telepathy-glib/account-channel-request.c +++ b/telepathy-glib/account-channel-request.c @@ -2390,3 +2390,36 @@ tp_account_channel_request_set_file_transfer_initial_offset ( tp_g_value_slice_new_uint64 (offset)); } } + +/** + * tp_account_channel_request_set_file_transfer_hash: + * @self: a #TpAccountChannelRequest + * @hash_type: a type of @hash + * @hash: hash of the contents of the file transfer + * + * Configure this channel request to accompany the file transfer with + * the hash of the file. + * + * This function can't be called once @self has been used to request a + * channel. + * + * Since: UNRELEASED + */ +void +tp_account_channel_request_set_file_transfer_hash ( + TpAccountChannelRequest *self, + TpFileHashType hash_type, + const gchar *hash) +{ + g_return_if_fail (TP_IS_ACCOUNT_CHANNEL_REQUEST (self)); + g_return_if_fail (!self->priv->requested); + g_return_if_fail (hash_type < TP_NUM_FILE_HASH_TYPES); + + g_hash_table_insert (self->priv->request, + g_strdup (TP_PROP_CHANNEL_TYPE_FILE_TRANSFER_CONTENT_HASH_TYPE), + tp_g_value_slice_new_uint (hash_type)); + + g_hash_table_insert (self->priv->request, + g_strdup (TP_PROP_CHANNEL_TYPE_FILE_TRANSFER_CONTENT_HASH), + tp_g_value_slice_new_string (hash)); +} diff --git a/telepathy-glib/account-channel-request.h b/telepathy-glib/account-channel-request.h index f05571417..f143df821 100644 --- a/telepathy-glib/account-channel-request.h +++ b/telepathy-glib/account-channel-request.h @@ -152,6 +152,12 @@ void tp_account_channel_request_set_file_transfer_initial_offset ( TpAccountChannelRequest *self, guint64 offset); +_TP_AVAILABLE_IN_0_24 +void tp_account_channel_request_set_file_transfer_hash ( + TpAccountChannelRequest *self, + TpFileHashType hash_type, + const gchar *hash); + /* Channel target (shared between all channel types) */ _TP_AVAILABLE_IN_0_20 -- cgit v1.2.1