From 4ef92710e04bbc0b6bf870cb7dad4dc08caba3e0 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Fri, 15 Jan 2016 16:51:24 +0100 Subject: [PATCH] Implement send_message_event --- src/matrix-http-api.c | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/src/matrix-http-api.c b/src/matrix-http-api.c index ce686d6..7ca44cc 100644 --- a/src/matrix-http-api.c +++ b/src/matrix-http-api.c @@ -1983,6 +1983,37 @@ i_redact_event(MatrixAPI *api, g_free(path); } +static void +i_send_message_event(MatrixAPI *api, + MatrixAPICallback callback, + gpointer user_data, + const gchar *room_id, + const gchar *event_type, + const gchar *txn_id, + JsonNode *content, + GError **error) +{ + gchar *encoded_room_id, *encoded_event_type, *encoded_txn_id, *path; + + encoded_room_id = soup_uri_encode(room_id, NULL); + encoded_event_type = soup_uri_encode(event_type, NULL); + encoded_txn_id = soup_uri_encode(txn_id, NULL); + path = g_strdup_printf("rooms/%s/send/%s/%s", + encoded_room_id, + encoded_event_type, + encoded_txn_id); + g_free(encoded_room_id); + g_free(encoded_event_type); + g_free(encoded_txn_id); + + _send(MATRIX_HTTP_API(api), + callback, user_data, + CALL_API, + "PUT", path, NULL, NULL, content, NULL, + FALSE, error); + g_free(path); +} + static void matrix_http_api_matrix_api_init(MatrixAPIInterface *iface) { @@ -2041,7 +2072,7 @@ matrix_http_api_matrix_api_init(MatrixAPIInterface *iface) iface->list_room_messages = i_list_room_messages; iface->send_event_receipt = i_send_event_receipt; iface->redact_event = i_redact_event; - iface->send_message_event = NULL; + iface->send_message_event = i_send_message_event; iface->get_room_state = NULL; iface->send_room_event = NULL; iface->notify_room_typing = NULL;