remote group

This commit is contained in:
olli 2024-08-20 17:52:41 +02:00
parent ea87404f11
commit 8f9fb58a13

View File

@ -746,7 +746,8 @@
# If message should be sent by another host # If message should be sent by another host
if [ -n "$tohost" ] if [ -n "$tohost" ]
then then
echo "$message" | ssh -o BatchMode=yes -o StrictHostKeyChecking=accept-new -p33 $tohost " $(printf ' %q' "$@")" [ -z "$togroup" ] && group="-g $(hostname)"
echo "$message" | ssh -o BatchMode=yes -o StrictHostKeyChecking=accept-new -p33 $tohost " $(printf ' %q' "$@ $group")"
fi fi
# Subject to message # Subject to message
@ -766,16 +767,17 @@
room=$(hostname) room=$(hostname)
[ -n "$togroup" ] && room=$togroup [ -n "$togroup" ] && room=$togroup
room=${room// /} room=${room// /}
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/matrix-room-$(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/matrix-room-$(hostname).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" [ -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
echo "$default group seems nit to exist" echo "default group (/usr/local/share/matrix-room-$(hostname).fifo) seems not to exist"
fi fi
fi fi