]> Pileus Git - ~andy/rhawk/blobdiff - rhawk
Add more jargon and a reply message
[~andy/rhawk] / rhawk
diff --git a/rhawk b/rhawk
index 58ea55e710ae5c78d06456064dddaaf24424073d..5420d6363ab3dcf8c54ffa1da563a0d09ea4633c 100755 (executable)
--- a/rhawk
+++ b/rhawk
@@ -187,6 +187,31 @@ BEGIN {
                say("no auth info for " _who)
 }
 
+# GeoIP Lookup
+function geoip(ip,  dat, cmd, line, parts) {
+       dat = "/usr/share/GeoIP/GeoIPCity.dat"
+
+       cmd = "geoiplookup -f " dat " " ip
+       cmd | getline line
+       close(cmd)
+
+       if (split(line, parts, /[:,] /) >= 9)
+               return parts[8] ","  parts[9] " -- " \
+                      parts[6] ", " parts[4] ", " parts[3]
+       else
+               return "not found"
+}
+
+/^\.geoip (([0-9a-zA-Z_.-]+) *)*$/ {
+       for (_i=2; _i<=NF; _i++) {
+               if ($_i in USERS)
+                       say(geoip(USERS[$_i]["host"]) " -- " \
+                           $_i " -> " USERS[$_i]["host"])
+               else
+                       say(geoip($_i) " -- " $_i)
+       }
+}
+
 # Fortune
 TO == NICK && /^/               { extra = ""   }
 TO == NICK && /^\.?fortune.*-o/ { extra = "-o" }
@@ -318,6 +343,11 @@ TO == NICK && DST ~ /^#/ {
        #say("Hello, " FROM)
 }
 
+/^\.nestroyeti/ {
+       say(sprintf("Temperature: %4.1f F Humidity: %2d%%",
+               rand()*20+65, rand()*20+40))
+}
+
 #DST != "#sfvlug" &&
 !(FROM in bots) &&
 CMD == "PRIVMSG" &&
@@ -400,6 +430,7 @@ FROM == "rhnoise" && load_mod {
 # Decrementer
 BEGIN {
        user_scores[0] = 1;
+       delete user_scores
 }
 
 /^\.(scores|scoreboard)$/ {