forked from erlehmann/uii
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dialog-ii
executable file
·22 lines (22 loc) · 1011 Bytes
/
dialog-ii
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/sh
IRC="${XDG_DATA_HOME:-$HOME/.local/share}/uii/logs"
HEIGHT=`tput lines`; WIDTH=`tput cols`
FORBIDDEN=`printf "\001-\011\013-\037"`
TEMPFILE=`mktemp -t "uii-$3-XXXXXX" 2>/dev/null`
trap "rm -f $TEMPFILE" 0 1 2 5 15
while true; do
NAMES=`tail -n80 $IRC/$1/out | grep "=\ $2" | tail -1 | cut -f5- -d' ' | \
tr ' ' '\n' | sort | tr -d "$FORBIDDEN"`
TOPIC=`tail -n80 $IRC/$1/out | grep "[1234567890]\ $2" | tail -2 | \
head -1 | cut -f4- -d' ' | tr -d "$FORBIDDEN"`
dialog --no-lines --no-shadow --begin 4 0 \
--tailboxbg "$IRC/$1/$2/out" `expr $HEIGHT - 8` `expr $WIDTH - 20` \
--and-widget --keep-window --begin 0 `expr $WIDTH - 20` \
--infobox "$NAMES" "$HEIGHT" 20 \
--and-widget --keep-window --begin 0 0 \
--infobox "$TOPIC" 5 `expr $WIDTH - 20` \
--and-widget --keep-window --begin `expr $HEIGHT - 6` 0 \
--nook --nocancel \
--inputbox "$1 $2 $3" 7 `expr $WIDTH - 20` 2> "$TEMPFILE" || break
echo `cat "$TEMPFILE"` > "$IRC/$1/$2/in"
done;