Add a test tool.
authorEric S. Raymond <esr@thyrsus.com>
Fri, 5 Oct 2012 13:34:33 +0000 (09:34 -0400)
committerEric S. Raymond <esr@thyrsus.com>
Fri, 5 Oct 2012 13:34:33 +0000 (09:34 -0400)
Makefile
irk [new file with mode: 0755]

index 6f6640387e062d23711b47bdd89d1a81096733f6..f77624c45fa827a568f91c8184efbfece51ccc38 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -46,7 +46,7 @@ loc:
        @echo -n "LLOC: "; grep -vE '(^ *#|^ *$$)' irkerd irkerhook.py | wc -l
 
 SOURCES = README COPYING NEWS install.txt security.txt hacking.txt \
-       irkerd irkerhook.py filter-example.py filter-test.py \
+       irkerd irkerhook.py filter-example.py filter-test.py irk \
        Makefile irkerd.xml irkerhook.xml
 EXTRA_DIST = irker-logo.png org.catb.irkerd.plist
 
diff --git a/irk b/irk
new file mode 100755 (executable)
index 0000000..2ccab51
--- /dev/null
+++ b/irk
@@ -0,0 +1,17 @@
+#!/bin/sh
+# Illustrates how to test irkerd.
+#
+# First argument must be a channel URL. If it does not begin with "irc", 
+# the base URL for freenode is prepended.
+#
+# Second argument must be a payload string.
+#
+channel=$1
+message=$2
+
+case $channel in
+irc:*) ;;
+*) channel="irc://chat.freenode.net/$channel"
+esac
+
+echo "{\"to\":\"$channel\",\"privmsg\":\"$message\"}" | netcat localhost 6659