diff --git a/matrix-send b/matrix-send index de36628..23a0ed2 100755 --- a/matrix-send +++ b/matrix-send @@ -1,7 +1,7 @@ #!/usr/bin/env sh # matrix-send: send a message to a Matrix room -version="1.0" +version="1.0.1" ########################### #### Generic Functions #### @@ -106,6 +106,10 @@ NoCache () { nocache="true" } +PrettyPrint () { + prettyprint="true" +} + ############################ #### Specific Functions #### ############################ @@ -134,7 +138,10 @@ ClearCache () { } Send () { - curl -s -XPOST -d "{"'"'"msgtype"'"'":"'"'"$mtype"'"'", "'"'"body"'"'":"'"'"$message"'"'"}" "https://$server/_matrix/client/r0/rooms/%21$roomid/send/m.room.message?access_token=$token" + if [ -z "$prettyprint" ] + then curl -s -XPOST -d "{"'"'"msgtype"'"'":"'"'"$mtype"'"'", "'"'"body"'"'":"'"'"$message"'"'"}" "https://$server/_matrix/client/r0/rooms/%21$roomid/send/m.room.message?access_token=$token" + else curl -s -XPOST -d "{"'"'"msgtype"'"'":"'"'"$mtype"'"'", "'"'"body"'"'":"'"'"$message"'"'"}" "https://$server/_matrix/client/r0/rooms/%21$roomid/send/m.room.message?access_token=$token" | jq + fi } ########################