From 74ec6100c913a29146f04eacfae6b5541c2a99c0 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Fri, 15 Jan 2016 13:57:53 +0100 Subject: [PATCH] Implement media_upload --- src/matrix-http-api.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/matrix-http-api.c b/src/matrix-http-api.c index c5270bc..0994ebe 100644 --- a/src/matrix-http-api.c +++ b/src/matrix-http-api.c @@ -1214,6 +1214,21 @@ i_media_thumbnail(MatrixAPI *api, g_free(path); } +static void +i_media_upload(MatrixAPI *api, + MatrixAPICallback callback, + gpointer user_data, + const gchar *content_type, + GByteArray *content, + GError **error) +{ + _send(MATRIX_HTTP_API(api), + callback, user_data, + CALL_MEDIA, + "POST", "upload", NULL, content_type, NULL, content, + FALSE, error); +} + static void matrix_http_api_matrix_api_init(MatrixAPIInterface *iface) { @@ -1227,7 +1242,7 @@ matrix_http_api_matrix_api_init(MatrixAPIInterface *iface) /* Media */ iface->media_download = i_media_download; iface->media_thumbnail = i_media_thumbnail; - iface->media_upload = NULL; + iface->media_upload = i_media_upload; /* Presence */ iface->get_presence_list = i_get_presence_list;