diff options
author | Richard van der Hoff <github@rvanderhoff.org.uk> | 2016-11-20 22:56:55 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-20 22:56:55 +0000 |
commit | 61ffd59e2e658daec87f79a8d05a9d202d76e9a3 (patch) | |
tree | ab1e78ee65137bab21930165ec9282ac613cb7ec /matrix-api.h | |
parent | 4b67f72d4ca35a9f793cba7d20efbcb0dd0913d6 (diff) | |
parent | 4addb8ecd7eb0ef419ea3199d1ee2c25f5313057 (diff) | |
download | purple-matrix-61ffd59e2e658daec87f79a8d05a9d202d76e9a3.tar.gz |
Merge pull request #21 from penguin42/send-images
Receive images
Diffstat (limited to 'matrix-api.h')
-rw-r--r-- | matrix-api.h | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/matrix-api.h b/matrix-api.h index cdeb134..4245cd7 100644 --- a/matrix-api.h +++ b/matrix-api.h @@ -55,10 +55,17 @@ typedef struct _MatrixApiRequestData MatrixApiRequestData; * @param json_root NULL if there was no body, or it could not be * parsed as JSON; otherwise the root of the JSON * tree in the response + * @param body NULL if the body was parsable as JSON, else the raw + * body. + * @param body_len The length of the body (valid when body is) + * + * @param content_type The content type of the body */ typedef void (*MatrixApiCallback)(MatrixConnectionData *conn, gpointer user_data, - struct _JsonNode *json_root); + struct _JsonNode *json_root, + const char *body, + size_t body_len, const char *content_type); /** * Signature for functions which are called when there is an error calling the @@ -246,6 +253,29 @@ MatrixApiRequestData *matrix_api_upload_file(MatrixConnectionData *conn, MatrixApiBadResponseCallback bad_response_callback, gpointer user_data); +/** + * Download 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 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_file(MatrixConnectionData *conn, + const gchar *uri, + gsize max_size, + MatrixApiCallback callback, + MatrixApiErrorCallback error_callback, + MatrixApiBadResponseCallback bad_response_callback, + gpointer user_data); #if 0 /** |