Fix breaking login issue

This commit is contained in:
Jeremy 2022-08-03 16:25:38 +12:00
parent f61b8ce0b5
commit 0d0fbb27ae

View file

@ -68,7 +68,7 @@ Username () {
} }
Password () { Password () {
[ -z $1 ] && conf_error "No argument for directive Password" [ -z $1 ] && conf_error "No argument(s) for directive Password"
password="$@" password="$@"
} }
@ -88,7 +88,7 @@ CacheLocation () {
DefaultEvent () { DefaultEvent () {
[ -z $1 ] && conf_error "No argument for directive DefaultEvent" [ -z $1 ] && conf_error "No argument for directive DefaultEvent"
if vargrep "m\.(text|notice)" "$1" -Eo if vargrep "m\.(text|notice)" "$1" -Eq
then defaultevent="$1" then defaultevent="$1"
else conf_error "Invalid default event type"; fi else conf_error "Invalid default event type"; fi
} }
@ -130,6 +130,9 @@ ClearCache () {
Send () { Send () {
curl -s -XPOST -d "{"'"'"msgtype"'"'":"'"'"$mtype"'"'", "'"'"body"'"'":"'"'"$message"'"'"}" "https://$server/_matrix/client/r0/rooms/%21$roomid/send/m.room.message?access_token=$token" curl -s -XPOST -d "{"'"'"msgtype"'"'":"'"'"$mtype"'"'", "'"'"body"'"'":"'"'"$message"'"'"}" "https://$server/_matrix/client/r0/rooms/%21$roomid/send/m.room.message?access_token=$token"
#cat <<EOF
#"{"'"'"msgtype"'"'":"'"'"$mtype"'"'", "'"'"body"'"'":"'"'"$message"'"'"}" "https://$server/_matrix/client/r0/rooms/%21$roomid/send/m.room.message?access_token=$token"
#EOF
} }
######################## ########################
@ -137,12 +140,14 @@ Send () {
######################## ########################
[ -e /usr/local/bin/curl ] || [ -e /usr/bin/curl ] || error "curl not found" [ -e /usr/local/bin/curl ] || [ -e /usr/bin/curl ] || error "curl not found"
CacheLocation "$HOME/.cache"
[ -z "$1" ] && usage [ -z "$1" ] && usage
while getopts :t:chV opt while getopts :t:chV opt
do do
case $opt in case $opt in
t) t)
if vargrep "m\.(text|notice)" "$OPTARG" -Eo if vargrep "m\.(text|notice)" "$OPTARG" -Eq
then then
mtype="$OPTARG" mtype="$OPTARG"
optind="$OPTIND" optind="$OPTIND"
@ -159,9 +164,6 @@ done
#### Configuration loading #### #### Configuration loading ####
############################### ###############################
# Set default config settings
CacheLocation "$HOME/.cache"
# Load configuration # Load configuration
if [ -e $HOME/.config/matrix-send.conf ]; if [ -e $HOME/.config/matrix-send.conf ];
then . $HOME/.config/matrix-send.conf; then . $HOME/.config/matrix-send.conf;