local nickfile="${chatfile%/channel}/nicks"
case $1 in
enter)
- trap 'sed -i -E "/^${SESSION_KEY%%-*} $$ /d" "$nickfile"' INT QUIT
+ trap 'nicklist leave' INT QUIT
sed -i -E "/^${SESSION_KEY%%-*} /d" "$nickfile"
printf '%s %i %s\n' "${SESSION_KEY%%-*}" "$$" "$nickname" >>"$nickfile"
;;
nicklist='NICKNAMES: '
while read -r s p nick; do
- nicklist="${nicklist}/$nick/"
+ [ -d "/proc/$p" ] && nicklist="${nicklist}/$nick/" \
+ || sed -i -E "/^$s $p /d" "$nickfile"
done <"$nickfile"
- if ! tail -n20 "$chatfile" |grep -qxF "$nicklist"; then
+ if ! tail -n20 "$chatfile" |tac |grep -m1 '^NICKNAMES: ' |grep -qxF "$nicklist"; then
printf '%s\n' "$nicklist" >>"$chatfile"
fi
}
if [ ! -f "$chatfile" ]; then
yield_page create <<-EOF
+ [h1 No such Channel]
[form #nonexist method="POST"
There is no channel named $(HTML "$LOCATION")
- [submit "action" "create" Create]
+ [submit "action" "create" Set Up]
]
EOF
else