documentation fixes and query.sh added

This commit is contained in:
nion@h4447.serverkompetenz.net 2007-02-03 12:58:13 +01:00
parent f763ac712f
commit b2188116d1
3 changed files with 51 additions and 4 deletions

15
FAQ
View File

@ -19,3 +19,18 @@ Which commands are supported?
j (join or msg), t (topic), a (away), n (nick), l (leave). The missing are
obsolete or can be easily used by typing the IRC commands itself (i.e. /WHO
instead of /who).
How can I recognize queries?
----------------------------
ii itself doesn't support this but the queries.sh script is an example
of how to get the new and changed files in your irc directory.
To get an instant notice of a new file other mechanisms like inotify/dnotify
could be used as well but I was too lazy to try it out since the script
is enough for me.
What other fancy stuff can I do with ii?
----------------------------------------
It is very easy to write irc bots in ii:
tail -f \#/out | while read foo; do name=echo $foo | awk '{print $2}' | sed 's,<\\(.*\\)>,\\1,'; if 0 -eq expr $RANDOM % 10 then echo "$name: WHAT??" ; fi; done
This will just spam a channel but think about using nagios2irc or you can
use ii to generate channel stats. Your imagination should be boundless.

8
README
View File

@ -6,11 +6,11 @@ nick name directories.
In every directory a FIFO file (in) and and normal file (out)
is placed.
The in file is used to communicate with the servers and the out
files includes the server messages. For every channel and every nick
files include the server messages. For every channel and every nick
name there will be new in and out files.
The basic idea of this is to be able to communicate with an IRC
server with basic command line tools.
For example if you will join a channel just do echo "/j #channel" > in
server with standard command line tools.
For example if you want to join a channel just do echo "/j #channel" > in
and ii creates a new channel directory with in and out file.
Installation
@ -36,6 +36,8 @@ to post to channels.
If you use the next editor line for a new posting you can use ctrl-p for nick
completion if you wrote the nick in the past.
Thanks to Matthias Kopfermann for this hint.
You can find an example of how this nested environment could look like on:
http://nion.modprobe.de/blog/archives/440-Using-the-ii-irc-client.html
Configuration
-------------

30
query.sh Executable file
View File

@ -0,0 +1,30 @@
#!/bin/sh
# ----------------------------------------------------
# Nico Golde <nico@ngolde.de>
# License: do whatever you want with this code
# Purpose: locate new queries for the ii irc client
# ----------------------------------------------------
IRCPATH=$HOME/irc
TMPFILE=$IRCPATH/queries.tmp
if [ ! -f $TMPFILE ]; then
touch $TMPFILE
fi
echo "searching new query data"
for i in `find $IRCPATH -newer $TMPFILE -name 'out'`
do
grep -v '\-!\-' $i > /dev/null 2>&1 # if file doesnt just contain server stuff
if [ $? -ne 1 ]; then
# strip server, nickserv and channel out files
echo $i | egrep -v -i "nickserv|#|$IRCPATH/(irc\.freenode\.net|irc\.oftc\.net)/out" > /dev/null 2>&1
if [ $? -ne 1 ]; then
echo -e "new data in: $i\n========================================================"
tail -5 $i
read
fi
fi
done
touch $TMPFILE