hysteria

ii wrapper script
git clone git://git.2f30.org/hysteria
Log | Files | Refs | README | LICENSE

commit a0d3d1bd8ab349cc3f35df93e378e8b7199117cc
parent 435185d923dac2f0df2705b85b14353ddbe32952
Author: sin <sin@2f30.org>
Date:   Mon, 14 Apr 2014 23:10:08 +0100

Add monitoring for private messages

Diffstat:
Mhysteria | 4++--
Amonitor | 29+++++++++++++++++++++++++++++
2 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/hysteria b/hysteria @@ -14,8 +14,8 @@ waitfile() { init() { rm -rf irc - tmux new-session -s hysteria -d - tmux rename-window shell + tmux new-session -s hysteria -d ./monitor + tmux rename-window "event-monitor" } connectserver() { diff --git a/monitor b/monitor @@ -0,0 +1,29 @@ +#!/bin/sh +# +# Monitor for private messages and create a new split tmux window + +while :; do + for n in $(find irc -type f -name "out" 2>/dev/null); do + echo $n | awk -F/ '{if (NF == 4) print $3}' | \ + grep '^#' >/dev/null 2>/dev/null + if [ $? -eq 0 ]; then + continue + fi + title=$(echo $n | awk -F/ '{if (NF == 4) print $2":"$3}') + if test -z $title; then + continue + fi + found=0 + for t in $(tmux list-windows -F '#W'); do + if test "$t" == "$title"; then + found=1 + fi + done + if test $found -eq 0; then + tmux new-window "tail -f $n | ./hiii" + tmux split-window "cat > $(dirname $n)/in" + tmux rename-window "$title" + fi + done + sleep 1 +done