]> Pileus Git - ~andy/rhawk/commitdiff
Better?
authorAndy Spencer <andy753421@gmail.com>
Sat, 18 Feb 2012 19:29:07 +0000 (19:29 +0000)
committerAndy Spencer <andy753421@gmail.com>
Sat, 18 Feb 2012 19:29:07 +0000 (19:29 +0000)
irc.awk
rhawk
spades.awk

diff --git a/irc.awk b/irc.awk
index 84b88f458c7dba90ca121fd9769acbae656bb8a0..3fbd613bc8de1604e69e938c6e1f7952b459a6a0 100644 (file)
--- a/irc.awk
+++ b/irc.awk
@@ -36,13 +36,14 @@ function debug(msg) {
 }
 
 function set() {
-       debug("CMD:  " CMD)
-       debug("SRC:  " SRC)
-       debug("DST:  " DST)
-       debug("FROM: " FROM)
-       debug("TO:   " TO)
-       debug("ARG:  " ARG)
-       debug("MSG:  " MSG)
+       debug("CMD:  [" CMD  "]")
+       debug("SRC:  [" SRC  "]")
+       debug("DST:  [" DST  "]")
+       debug("FROM: [" FROM "]")
+       debug("TO:   [" TO   "]")
+       debug("ARG:  [" ARG  "]")
+       debug("MSG:  [" MSG  "]")
+       debug("$0:   [" $0   "]")
 }
 
 # Functions
@@ -109,10 +110,10 @@ function reload() {
 
 # Input parsing
 // {
+       gsub(/\s+/,     " ")
+       gsub(/^ | $/,    "")
+       gsub(/\3[0-9]*/, "")
        match($0, /(:([^ ]+) +)?(([A-Z0-9]+) +)(([^ ]+) +)?(([^: ]+) +)?(:(.*))/, arr);
-       gsub(/\s+/,     " ", arr[8])
-       gsub(/^ | $/,    "", arr[8])
-       gsub(/\3[0-9]*/, "", arr[8])
        SRC = arr[2]
        CMD = arr[4]
        DST = arr[6]
@@ -128,6 +129,8 @@ function reload() {
 
        if (CMD == "PRIVMSG" && DST == NICK && FROM)
                TO = DST
+
+       set()
 }
 
 # IRC client
diff --git a/rhawk b/rhawk
index 75c9e3f9068b270e9db9d8b9aa79eb57ead218f0..282fa0efd2858182e964b32fb986d973b90df1a3 100755 (executable)
--- a/rhawk
+++ b/rhawk
@@ -116,7 +116,7 @@ TO == NICK && DST ~ /^#/ {
 
 !(FROM in bots) &&
 MSG !~ /^\./ &&
-/\<awk\>/ {
+/awk/ {
        say("Awk, awk, awk! I'm a bird!")
 }
 
index 51d18d6824be8c592074b39ba8c442b27db9f50d..efd4769c375905fb880528fa57d6ed8df56a76f2 100644 (file)
@@ -270,7 +270,7 @@ FROM == OWNER &&
 
 
 # Setup
-/^\.newgame ?([0-9]+)?$/ {
+/^\.newgame ?([0-9]+)?/ {
        if (sp_state != "new") {
                reply("There is already a game in progress.")
        } else {