matrix notify respect -g

This commit is contained in:
olli 2024-08-20 14:29:55 +02:00
parent 3fa540eb85
commit ea87404f11

View File

@ -765,16 +765,17 @@
## MATRIX
room=$(hostname)
[ -n "$togroup" ] && room=$togroup
room=${room// /}
if ps ax | grep -v grep | grep -q synapse.app.homeserver
then
if [ -p "/usr/local/share/$(hostname).fifo" ]
then
matrix_message=$(echo "<h3>${subj}</h3><pre>${orig_message}</pre>")
matrix_target="/usr/local/share/$(hostname).fifo"
[ -n "$togroup" ] && [ -p "/usr/local/share/$(hostname)-${togroup}.fifo" ] && matrix_target="/usr/local/share/$(hostname)-${togroup}.fifo"
matrix_target="/usr/local/share/matrix-room-$(hostname).fifo"
[ -n "$togroup" ] && [ -p "/usr/local/share/matrix-room-${room}.fifo" ] && matrix_target="/usr/local/share/matrix-room-${room}.fifo"
echo "$matrix_message" | perl -pe 's/\n/<br>/' | perl -pe 's/\<br\>$/\n/; s/^\<br\>//;' >"$matrix_target"
else
sudo /usr/bin/docker compose -f /home/docker/matrix.$(hostname)/docker-compose.yml run -T matrix.$(hostname)--commander -m "$message" -k --room $room --log-level WARNING WARNING
echo "$default group seems nit to exist"
fi
fi