irctk

libircclient binding for scripts
git clone https://a3nm.net/git/irctk/
Log | Files | Refs | README

commit 1d943409c64e3a7c03ccf0459730963ce87ad589
parent 5291afc676f6d45f227cc6743d4c9e91ebd73d33
Author: Antoine Amarilli <a3nm@a3nm.net>
Date:   Fri,  7 Sep 2012 18:04:27 +0200

reword, remove ./

Diffstat:
README | 16++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/README b/README @@ -86,7 +86,7 @@ channel as they appear in the feed: $ rsstail -u 'http://feeds2.feedburner.com/fmylife' -NdzH -n 1 -i 300 | grep --line-buffered '^ Today' | - ./irctk fmlbot@example.com '#fml' + irctk fmlbot@example.com '#fml' === 4.3. Using irctk's stdout === @@ -94,14 +94,10 @@ You can log what is happening on a channel by setting stdout to be a file: $ irctk logger@example.com '#chan' >file -Here is a more complex example to log multiple channels in separate files and -with timestamps: +You can add timestamps: - $ irctk logger@example.com '#chan1' '#chan2' | while read line; do - CHAN=$(echo "$line" | cut -d ']' -f 1 | cut -d '[' -f 2) - MSG=$(echo "$line" | cut -d ' ' -f 2-) - echo "`date +%s` $MSG" >> "$CHAN.log" - done + $ irctk logger@example.com '#chan' | + awk '{ print strftime("%s"), $0; fflush() }' > file Caution, if you want to run irctk in the background to do something like this, you need to prevent it from reading stdin (to avoid it being suspended) without @@ -149,7 +145,7 @@ say to irctk in return. To do so, we will need a named FIFO: As an extremely simple interactive program, consider the following: - $ cat fifo | ./irctk pongbot@example.com '#chat' | + $ cat fifo | irctk pongbot@example.com '#chat' | awk '/[^<]ping/ { print "pong"; fflush() }' > fifo The awk invocation outputs "pong" whenever it sees a line containing "ping" @@ -166,7 +162,7 @@ even no networking support), all you need to do is write some code which reads incoming lines on stdin, posts outgoing lines on stdout, and *does not do buffering*. You can then lift it to IRC very simply: - $ cat fifo | ./irctk example.com '#chat' | program > fifo + $ cat fifo | irctk example.com '#chat' | program > fifo === 4.5. Input and output format ===