;;
esac
+nicklist(){
+ local nickfile="${chatfile%/channel}/nicks"
+ case $1 in
+ enter)
+ trap 'sed -i -E "/^${SESSION_KEY%%-*} $$ /d" "$nickfile"' INT QUIT
+ sed -i -E "/^${SESSION_KEY%%-*} /d" "$nickfile"
+ printf '%s %i %s\n' "${SESSION_KEY%%-*}" "$$" "$nickname" >>"$nickfile"
+ ;;
+ leave)
+ sed -i -E "/^${SESSION_KEY%%-*} $$ /d" "$nickfile"
+ ;;
+ esac
+
+ nicklist='NICKNAMES: '
+ while read -r s p nick; do
+ nicklist="${nicklist}/$nick/"
+ done <"$nickfile"
+ if ! tail -n20 "$chatfile" |grep -qxF "$nicklist"; then
+ printf '%s\n' "$nicklist" >>"$chatfile"
+ fi
+}
+
if [ ! -f "$chatfile" ]; then
yield_page create <<-EOF
[form #nonexist method="POST"
]
EOF
else
+ nicklist enter
+
printf '%s: %s\r\n' Refresh 1
{ printf '
[form #channel method="POST"
printf '[div #chat'
tail --pid $$ -n50 -f "$chatfile" \
| sed -nuE '
- /^[^ ]+ [^ ]+ [^ ]+$/{
+ /^[0-9-]{10}_[0-9:]{8}+ [^ ]+ [^ ]+$/{
h; s;^([^ ]+) ([^ ]+) ([^ ]+)$;\1;; s;.*_;;; s;.+;[p .message [span .date &];p;
g; s;^([^ ]+) ([^ ]+) ([^ ]+)$;a\2;; bESC; :A s;.;;; s;(.)(.+);[span .nick [span .indicator \1]\2];p;
g; s;^([^ ]+) ([^ ]+) ([^ ]+)$;b\3;; bESC; :B s;.;;; s;.+;[span .message &]];p;
+ b;
+ }
+ /^NICKNAMES: .*/{
+ s;^NICKNAMES: ;;; h; s;^.*$;[div .nicklist [h2 Nicknames];p; g;
+ :NICKLIST
+ h; s;^/([^/]+)/.*$;c\1;; bESC :C
+ s;^.([^?])(.*)$;[a .nick href="/~\1\2" \1\2];p;
+ s;^.(\?)(.*)$;[span .nick [span .indcator \1]\2];p;
+ g; s;/[^/]+/;;; /.+/bNICKLIST s;^.*$;];p;
+ b;
}
b; :ESC
'"$UNSTRING"' '"$SHESCAPE"'
- /^a/bA; /^b/bB;
+ /^a/bA; /^b/bB; /^c/bC;
'
} |yield_page channel
+
+ nicklist leave
fi
background-color: #FFF;
border: 1px solid;
border-radius: 1ex 1ex .5ex .5ex;
+ z-index: 2;
}
#settings h1 {
background-color: #08b;
left: 0; right: 0;
padding: 1ex;
margin: .5ex;
- z-index: -1;
+ -z-index: -1;
}
#chat p.message {
border-radius: 0 .5em .5em 0;
padding-right: .5em;
}
+
+#chat div.nicklist {
+ position: fixed;
+ top: 1em; bottom: 3em;
+ right: 0; width: 1em;
+ background-color: rgba(255, 255, 255, .875);
+ padding: .5em;
+ z-index: 1;
+ border: 1px solid black;
+ border-width: 1px 0 1px 1px;
+ overflow-y: auto;
+ white-space: nowrap;
+}
+#chat div.nicklist:hover {
+ width: 20%;
+ min-width: 10em;
+ white-space: normal;
+}
+#chat div.nicklist h2 {
+ font-weight: bold;
+ border-bottom: 1px solid black;
+}
+#chat div.nicklist .nick {
+ margin-top: .5em;
+ display: block;
+ line-height: 1.5em;
+}
+#chat div.nicklist a.nick {
+ color: #00F;
+}