diff options
author | Dr. David Alan Gilbert <dave@treblig.org> | 2016-11-13 20:29:12 +0000 |
---|---|---|
committer | Dr. David Alan Gilbert <dave@treblig.org> | 2016-12-27 20:19:05 +0000 |
commit | 187aa40e245f007e307356a4d2afcf8cbb15df89 (patch) | |
tree | 3309e8150f1cfbe8f7013f3fae4aa7f54138939b /matrix-api.h | |
parent | 61ffd59e2e658daec87f79a8d05a9d202d76e9a3 (diff) | |
download | purple-matrix-187aa40e245f007e307356a4d2afcf8cbb15df89.tar.gz |
Add matrix_api_download_thumb
Allow downloading of a thumbnail for a file.
Note: Synapse really doesn't like it if you don't specify
the height (I get a 500); so the caller has to give some
guess of dimensions, but the server gives something
reasonable.
Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
Diffstat (limited to 'matrix-api.h')
-rw-r--r-- | matrix-api.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/matrix-api.h b/matrix-api.h index 4245cd7..8448af5 100644 --- a/matrix-api.h +++ b/matrix-api.h @@ -277,6 +277,34 @@ MatrixApiRequestData *matrix_api_download_file(MatrixConnectionData *conn, MatrixApiBadResponseCallback bad_response_callback, gpointer user_data); +/** + * Download a thumbnail for a file + * + * @param conn The connection with which to make the request + * @param uri The Matrix uri to fetch starting mxc:// + * @param max_size A maximum size of file to receive. + * @param width Desired width; the server might not obey + * @param height Desired height; the server might not obey + * @param scale True to scale, false to crop + * @param callback Function to be called when the request completes + * @param error_callback Function to be called if there is an error making + * the request. If NULL, matrix_api_error will be + * used. + * @param bad_response_callback Function to be called if the API gives a non-200 + * response. If NULL, matrix_api_bad_response will be + * used. + * @param user_data Opaque data to be passed to the callbacks + * + */ +MatrixApiRequestData *matrix_api_download_thumb(MatrixConnectionData *conn, + const gchar *uri, + gsize max_size, + unsigned int width, unsigned int height, gboolean scale, + MatrixApiCallback callback, + MatrixApiErrorCallback error_callback, + MatrixApiBadResponseCallback bad_response_callback, + gpointer user_data); + #if 0 /** * Get the current state of a room |