From fa9f556051aae7f4cd9c036eedacb519070b4319 Mon Sep 17 00:00:00 2001 From: John Locke Date: Thu, 18 Aug 2016 17:37:43 -0700 Subject: [PATCH] Apparently formatted_text is only rendered on m.notice or m.text msgtypes. Fix the parsing on the formatted/linked text, and add a plain-text version for other msgtypes. --- bin/out | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/bin/out b/bin/out index a052684..f27e69c 100755 --- a/bin/out +++ b/bin/out @@ -55,16 +55,19 @@ then text="$(eval printf ${text} )" [[ -z "${text}" ]] && text="_(missing notification text)_" - text="$(echo -n "${text}" | jq -R -s .)" - [ "${link}" == "true" ] && text="${text}" + [ "${link}" == "true" ] && formatted_body="${text}" if [ -n "$prefix" ]; then prefix="$(eval printf ${prefix} )" text="${prefix}: ${text}" + [ -n "${formatted_body}" ] && formatted_body="${prefix}: ${formatted_body}" fi + text="$(echo -n "${text}" | jq -R -s .)" + [ -n "${formatted_body}" ] && formatted_body="$(echo -n "${formatted_body}" | jq -R -s .)" + [[ "${token}" != "null" ]] && username="$(eval "printf ${token}" | jq -R -s .)" - [[ "${room_id}" != "null" ]] && room_id="$(eval "printf ${room_id}" | jq -R -s .)" + [[ "${room_id}" != "null" ]] && room_id="$(eval "printf ${room_id}" | jq -R -s .)" body="$(cat <