Add "w" and "l" commands.

This commit is contained in:
bʰedoh₂ swé 2025-01-12 03:57:45 +05:00
parent d74f7490a0
commit 8e3887d96c

View File

@ -66,6 +66,14 @@ case "${mode}" in
exit
esac
print_messages() {
open_socket
echo -n 2 >&3
head -c "${1}" <&3 | sed -e 's/\x1B/ESC/g'
close_socket
}
length=0
while :; do
read cmd
case "${cmd}" in
@ -86,16 +94,25 @@ while :; do
read a
send_message 0"${nick}${a}"
;;
l)
echo "${length}"
;;
w)
oldlength="${length}"
while :; do
length="$(get_message 1)"
if [ "${oldlength}" -lt "${length}" ]; then
break
fi
echo -n .
sleep 1
done
echo
print_messages "${length}"
;;
p)
length="$(get_message 1)"
if [ -z "${length}" ]; then
echo !;
else
open_socket
echo -n 2 >&3
head -c "${length}" <&3 | sed -e 's/\x1B/ESC/g'
close_socket
fi
print_messages "${length}"
;;
q)
exit