From f8c22de413a690639574ef20dd2dcffc4e17c300 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Fri, 28 May 2021 23:11:44 +0200 Subject: Add an option to get markdown, not HTML Fixes #116 --- matrix-room.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'matrix-room.c') diff --git a/matrix-room.c b/matrix-room.c index b26d036..cd17ae7 100644 --- a/matrix-room.c +++ b/matrix-room.c @@ -1094,8 +1094,14 @@ void matrix_room_handle_timeline_event(PurpleConversation *conv, } flags = PURPLE_MESSAGE_RECV; - if (purple_strequal(matrix_json_object_get_string_member(json_content_obj, "format"), "org.matrix.custom.html")) { - escaped_body = g_strdup(matrix_json_object_get_string_member(json_content_obj, "formatted_body")); + gboolean prefer_markdown = purple_account_get_bool(conv->account, + PRPL_ACCOUNT_OPT_PREFER_MARKDOWN, FALSE); + if (!prefer_markdown) { + if (purple_strequal(matrix_json_object_get_string_member(json_content_obj, "format"), "org.matrix.custom.html")) { + escaped_body = g_strdup(matrix_json_object_get_string_member(json_content_obj, "formatted_body")); + } else { + escaped_body = purple_markup_escape_text(tmp_body ? tmp_body : msg_body, -1); + } } else { escaped_body = purple_markup_escape_text(tmp_body ? tmp_body : msg_body, -1); } -- cgit