Prevent wrapper.c from flooding the IRC server.
[iii.git] / query.sh
blob0d39d5573c6b14bcc7daa914f7266a9a86572a2f
1 #!/bin/sh
2 # ----------------------------------------------------
3 # Nico Golde <nico@ngolde.de>
4 # License: do whatever you want with this code
5 # Purpose: locate new queries for the ii irc client
6 # ----------------------------------------------------
8 IRCPATH=irc
9 TMPFILE=$IRCPATH/queries.tmp
11 if [ ! -f $TMPFILE ]; then
12 touch $TMPFILE
15 echo "searching new query data"
16 for i in `find $IRCPATH -newer $TMPFILE -name 'out'`
18 grep -v '\-!\-' $i > /dev/null 2>&1 # if file doesnt just contain server stuff
19 if [ $? -ne 1 ]; then
20 # strip server, nickserv, chanserv and channel out files
21 echo $i | egrep -v -i "(nick|chan)serv|#|$IRCPATH\/[a-z0-9\.\-]+\/out$" > /dev/null 2>&1
22 if [ $? -ne 1 ]; then
23 printf "new data in: %s\n========================================================\n" "$i"
24 tail -5 $i
27 done
29 touch $TMPFILE