]> Pileus Git - ~andy/rhawk/commitdiff
fix up commands
authorAndy Spencer <andy753421@gmail.com>
Mon, 11 Jun 2012 01:04:41 +0000 (01:04 +0000)
committerAndy Spencer <andy753421@gmail.com>
Mon, 11 Jun 2012 01:13:57 +0000 (01:13 +0000)
email.awk

index a417f9e3bf659304511703496c43ae7bb450e580..5aab62f820acba519360be5dbf695c544a6f6e8f 100644 (file)
--- a/email.awk
+++ b/email.awk
@@ -70,22 +70,43 @@ function mail_run(  user, chan, ready, time)
 }
 
 FROM ~ OWNER &&
+TO == NICK &&
 /^e?mail .* .*/ {
        reply("notifying " $2 " for " $3)
        mail_enable[$3] = $2
 }
 
+TO == NICK &&
 /^e?mail  *[^ ]*$/ {
-       reply("notifying " $2 " for " FROM)
-       mail_enable[FROM] = $2
+       _user = FROM
+       _addr = $2
+       gsub(/[^a-zA-Z0-9_+@.-]/, "", _user)
+       gsub(/[^a-zA-Z0-9_+@.-]/, "", _addr)
+       reply("notifying " _addr " for " _user)
+       mail_enable[_user] = _addr
 }
 
+FROM ~ OWNER &&
+TO == NICK &&
+/^stfu .*/ {
+       reply("well fine then")
+       delete mail_enable[$2]
+       delete mail_ready[$2]
+}
+
+TO == NICK &&
 /^stfu$/ {
        reply("well fine then")
        delete mail_enable[FROM]
        delete mail_ready[FROM]
 }
 
+TO == NICK &&
+/^who/ {
+       for (_user in mail_enable)
+               reply("\"" _user "\" <" mail_enable[_user] ">")
+}
+
 DST ~ /^#.*/ {
        for (_user in mail_enable)
                if ($0 ~ "\\<"_user"\\>") {