diff --git a/matrix-send b/matrix-send old mode 100644 new mode 100755 index 2b3452e..d758ce2 --- a/matrix-send +++ b/matrix-send @@ -101,7 +101,7 @@ GetAccessToken () { [ -z "$manualAuth" ] && printf "Getting access token...\n" if [ "$manualAuth" = "true" ]; then printf ""; # printf "" basically means do nothing - else token=$(curl -XPOST -d "{"'"'"type"'"'":"'"'"m.login.password"'"'", "'"'"user"'"'":"'"'"$username"'"'", "'"'"password"'"'":"'"'"$password"'"'"}" "https://$server/_matrix/client/r0/login" | grep -oE 'syt_.+_...................._......'); + else token=$(curl -s -XPOST -d "{"'"'"type"'"'":"'"'"m.login.password"'"'", "'"'"user"'"'":"'"'"$username"'"'", "'"'"password"'"'":"'"'"$password"'"'"}" "https://$server/_matrix/client/r0/login" | grep -oE 'syt_.+_...................._......'); fi } @@ -121,7 +121,7 @@ ClearCache () { } Send () { - curl -XPOST -d "{"'"'"msgtype"'"'":"'"'"m.text"'"'", "'"'"body"'"'":"'"'"$message"'"'"}" "https://$server/_matrix/client/r0/rooms/%21$roomid/send/m.room.message?access_token=$token" + curl -s -XPOST -d "{"'"'"msgtype"'"'":"'"'"m.text"'"'", "'"'"body"'"'":"'"'"$message"'"'"}" "https://$server/_matrix/client/r0/rooms/%21$roomid/send/m.room.message?access_token=$token" } ######################## @@ -131,9 +131,18 @@ Send () { [ -e /usr/local/bin/curl ] || [ -e /usr/bin/curl ] || error "curl not found" [ -z "$1" ] && usage -[ "$1" = "-c" ] && ClearCache -[ "$1" = "-h" ] && help -[ "$1" = "-V" ] && version +#[ "$1" = "-c" ] && ClearCache +#[ "$1" = "-h" ] && help +#[ "$1" = "-V" ] && version + +while getopts :chV opt +do + case $opt in + c) ClearCache ;; + h) help ;; + V) version ;; + esac +done ############################### #### Configuration loading ####