irctk

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

commit 1c7b2eb80d2959b92c41dae5650f0c340d87aa90
parent 8e2f24dc239e6b552cae446bb101cb2cb0d6ceab
Author: Antoine Amarilli <ant.amarilli@free.fr>
Date:   Sun, 30 Jan 2011 19:21:43 +0100

update examples and license information in irctk.c

Diffstat:
README | 32++++++++++++++++++--------------
irctk.c | 26++------------------------
2 files changed, 20 insertions(+), 38 deletions(-)

diff --git a/README b/README @@ -44,41 +44,45 @@ See above. Post FMLs on irc. $ cat fifo | ./irctk pongbot@example.com '#chat' \ - | cut -d '>' -f 2- + | cut -d '>' -f 2- \ | grep --line-buffered 'ping' \ | while read line; do echo "pong"; done \ | tee fifo -TOTEST answer "pong" whenever someone says something containing "ping". +Answer "pong" whenever someone says something containing "ping" (or if +his nick contains "ping"). $ cat fifo | ./irctk -r pongbot@example.com '#chat' \ - | cut -d '>' -f 2- | grep --line-buffered 'ping' \ - | while read line; do - echo "nite"; echo; - done | tee fifo + | while read line; do echo "pong"; echo; done \ + | tee fifo -TOTEST same, but address the message specifically to the person. TOTEST +Same, but address the message specifically to the person. The empty +"echo" indicates the end of our answer to the person. Explain the "echo". $ cat fifo | ./irctk -Ffr wikibot@example.com '#chat' \ | while read line; do Q=$(echo "$line" | tr -dc 'a-zA-Z_()'); - echo -n "$Q: "; dig +short txt $Q.wp.dg.cx; echo; done | tee fifo -TOTEST A bot which queries on wikipedia whatever is said to him +A bot which queries on wikipedia whatever is said to him. $ cat fifo | ./irctk -Ff DM@example.com '#adventure' \ | while true; do socat EXEC:adventure,pty,ctty,echo=0 STDIO; done | tee fifo -TOTEST Multiplayer adventure! (Beware, people can overwrite files when -saving their game.) The "while true" loop is to restart the game -whenever someone exits. The socat invocation is used to disable -buffering. +Multiplayer adventure! (Beware, people can overwrite files when saving +their game, so run as a suitably unpriviledged user.) The "while true" +loop is to restart the game whenever it exits. The socat invocation +is used to disable buffering. + + $ ./irctk -v listener@source.com '#chan1' '#chan2' \ + | ./irctk -v repeater@destination.com + +Repeat on destination.com whatever is said on channels #chan1 and #chan2 +of source.com. -netcat diff --git a/irctk.c b/irctk.c @@ -1,28 +1,6 @@ /* - * Copyright (C) 2004-2009 Georgy Yunaev gyunaev@ulduzsoft.com - * - * This example is free, and not covered by LGPL license. There is no - * restriction applied to their modification, redistribution, using and so on. - * You can study them, modify them, use them in your own program - either - * completely or partially. By using it you may give me some credits in your - * program, but you don't have to. - * - * - * This example tests most features of libirc. It can join the specific - * channel, welcoming all the people there, and react on some messages - - * 'help', 'quit', 'dcc chat', 'dcc send', 'ctcp'. Also it can reply to - * CTCP requests, receive DCC files and accept DCC chats. - * - * Features used: - * - nickname parsing; - * - handling 'channel' event to track the messages; - * - handling dcc and ctcp events; - * - using internal ctcp rely procedure; - * - generating channel messages; - * - handling dcc send and dcc chat events; - * - initiating dcc send and dcc chat. - * - * $Id: irctest.c 73 2009-01-03 11:14:59Z gyunaev $ + * Copyright (C) Antoine Amarilli 2010-2011 + * Inspired by a libircclient example by Georgy Yunaev gyunaev@ulduzsoft.com */