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 ## MATRIX
room=$(hostname) room=$(hostname)
[ -n "$togroup" ] && room=$togroup [ -n "$togroup" ] && room=$togroup
room=${room// /}
if ps ax | grep -v grep | grep -q synapse.app.homeserver if ps ax | grep -v grep | grep -q synapse.app.homeserver
then then
if [ -p "/usr/local/share/$(hostname).fifo" ] if [ -p "/usr/local/share/$(hostname).fifo" ]
then then
matrix_message=$(echo "<h3>${subj}</h3><pre>${orig_message}</pre>") matrix_message=$(echo "<h3>${subj}</h3><pre>${orig_message}</pre>")
matrix_target="/usr/local/share/$(hostname).fifo" matrix_target="/usr/local/share/matrix-room-$(hostname).fifo"
[ -n "$togroup" ] && [ -p "/usr/local/share/$(hostname)-${togroup}.fifo" ] && matrix_target="/usr/local/share/$(hostname)-${togroup}.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" echo "$matrix_message" | perl -pe 's/\n/<br>/' | perl -pe 's/\<br\>$/\n/; s/^\<br\>//;' >"$matrix_target"
else 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
fi fi