ii

My fork of https://tools.suckless.org/ii/
git clone https://git.inz.fi/ii
Log | Files | Refs | README | LICENSE

commit b2188116d16b82c4f76dda1904c867928ae9e24a
parent f763ac712f2be5ca85cc7e538e57bff639959cc2
Author: nion@h4447.serverkompetenz.net <unknown>
Date:   Sat,  3 Feb 2007 12:58:13 +0100

documentation fixes and query.sh added
Diffstat:
MFAQ | 17++++++++++++++++-
MREADME | 8+++++---
Aquery.sh | 30++++++++++++++++++++++++++++++
3 files changed, 51 insertions(+), 4 deletions(-)

diff --git a/FAQ b/FAQ @@ -15,7 +15,22 @@ this. Actually I use ii in combination with vim, multitail and screen and it wor like a charm. 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. diff --git a/README b/README @@ -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 ------------- diff --git a/query.sh b/query.sh @@ -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