]> Pileus Git - ~andy/rhawk/blobdiff - rhawk
Improve email message format
[~andy/rhawk] / rhawk
diff --git a/rhawk b/rhawk
index f68c93f453e463b44d5aba679fccff19f47a6c4a..bb9c032906999d2fe5dceebacbc2efde7c272aa8 100755 (executable)
--- a/rhawk
+++ b/rhawk
@@ -3,7 +3,7 @@
 @include "irc.awk"
 @include "json.awk"
 @include "spades.awk"
-#@include "email.awk"
+@include "email.awk"
 
 # Initialization
 BEGIN {
@@ -160,13 +160,15 @@ function uptime(time,  fmt) {
                time / (1       ) % 60)
 }
 BEGIN {
-       up_version = head("git describe --always --dirty")
+       up_version = head("git describe --always")
+       up_dirty   = head("git describe --always --dirty")
        up_author  = head("git log -n1 --format=format:%an")
        up_message = head("git log -n1 --format=format:%s")
        up_reload  = systime();
 }
 /^\.(version|rev)/ {
-       say("version: " up_version " - " up_author " - " up_message)
+       say("version: " up_dirty " - " up_author " - " up_message)
+       say("http://pileus.org/git/?p=~andy/rhawk;h=" up_version)
 }
 /^\.uptime/ {
        _now = systime();
@@ -197,14 +199,19 @@ function geoip(ip,  dat, cmd, line, parts) {
 
        if (split(line, parts, /[:,] /) >= 9)
                return parts[8] ","  parts[9] " -- " \
-                      parts[6] ", " parts[4] ", " parts[3] " -- " ip
+                      parts[6] ", " parts[4] ", " parts[3]
        else
-               return "not found -- " ip
+               return "not found"
 }
 
 /^\.geoip (([0-9a-zA-Z_.-]+) *)*$/ {
-       for (_i=2; _i<=NF; _i++)
-               say(geoip($_i))
+       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
@@ -351,12 +358,6 @@ MSG !~ /^\./ &&
        say("Awk, awk, awk! I'm a bird!")
 }
 
-!(FROM in bots) &&
-((TO == NICK && /(help|halp)/) ||
- /^[^.](help|halp)/) {
-       reply("Nothing can help you now..")
-}
-
 /(\<[Hh][Oo]\>.*){3}/ {
        say("\00309Merry \00304Christmas!")
 }