diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2021-05-28 23:11:44 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2021-06-11 22:49:59 +0200 |
commit | f8c22de413a690639574ef20dd2dcffc4e17c300 (patch) | |
tree | 7d48c6e4ff30accc93c884261c525eb26abf8a20 /matrix-room.c | |
parent | 2fcd5b8f901034980616e5f719750c48f37a332f (diff) | |
download | purple-matrix-f8c22de413a690639574ef20dd2dcffc4e17c300.tar.gz |
Add an option to get markdown, not HTML
Fixes #116
Diffstat (limited to 'matrix-room.c')
-rw-r--r-- | matrix-room.c | 10 |
1 files changed, 8 insertions, 2 deletions
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); } |