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 () {
[ -z $1 ] && conf_error "No argument for directive Password"
[ -z $1 ] && conf_error "No argument(s) for directive Password"
password="$@"
}
@ -88,7 +88,7 @@ CacheLocation () {
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"
else conf_error "Invalid default event type"; fi
}
@ -130,6 +130,9 @@ 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"
#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"
CacheLocation "$HOME/.cache"
[ -z "$1" ] && usage
while getopts :t:chV opt
do
case $opt in
t)
if vargrep "m\.(text|notice)" "$OPTARG" -Eo
if vargrep "m\.(text|notice)" "$OPTARG" -Eq
then
mtype="$OPTARG"
optind="$OPTIND"
@ -159,9 +164,6 @@ done
#### Configuration loading ####
###############################
# Set default config settings
CacheLocation "$HOME/.cache"
# Load configuration
if [ -e $HOME/.config/matrix-send.conf ];
then . $HOME/.config/matrix-send.conf;