refactor: log_notify delegates to the generated .party-notify script

log_notify re-implemented the client-fanout loop that .party-notify
(written at host time) already provides. Call that script instead.
Wording changes from "logging this party" to "logging the party" to
match the script's "$user $verb the party" template.
This commit is contained in:
veg 2026-09-21 09:37:13 +00:00
parent 45368232b4
commit c789f4985b

16
party
View file

@ -548,7 +548,8 @@ tmux="$PARTY_TMUX"
EOF EOF
cat >> "$notify_script" <<'EOF' cat >> "$notify_script" <<'EOF'
# Auto-generated by party. Fan a display-message out to every client # Auto-generated by party. Fan a display-message out to every client
# of the party server. Args: $1 = socket, $2 = client_user, $3 = "joined"|"left" # of the party server. Args: $1 = socket, $2 = user, $3 = verb (e.g.
# "joined", "left", "started logging", "stopped logging")
sock="$1"; user="$2"; verb="$3" sock="$1"; user="$2"; verb="$3"
"$tmux" -S "$sock" list-clients -F '#{client_name}' 2>/dev/null \ "$tmux" -S "$sock" list-clients -F '#{client_name}' 2>/dev/null \
| while read -r c; do | while read -r c; do
@ -1069,15 +1070,12 @@ EOF
# Tell everyone in the room when recording starts or stops: a # Tell everyone in the room when recording starts or stops: a
# transcript nobody knew about is the kind of surprise the social # transcript nobody knew about is the kind of surprise the social
# design exists to avoid. Same fan-out shape as the .party-notify # design exists to avoid. Reuses the .party-notify script generated at
# helper, run inline because only the host (who is authorized by # host time, so the broadcast reads "$USER started logging the party"
# definition) calls it. # / "$USER stopped logging the party". Tolerant of failure: a missing
# or unreadable notify script shouldn't abort logging.
log_notify() { log_notify() {
"$PARTY_TMUX" -S "$RR_SOCKET" list-clients -F '#{client_name}' 2>/dev/null \ "${RR_SOCKET%/sock}/.party-notify" "$RR_SOCKET" "$USER" "$1 logging" || :
| while read -r _ln_c; do
"$PARTY_TMUX" -S "$RR_SOCKET" display-message -c "$_ln_c" \
"$USER $1 logging this party" 2>/dev/null || :
done
} }
cmd_log() { cmd_log() {