X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=rhawk;h=f1478f67d74f64c6db025f533e25bdff303fdc06;hb=ca2fedce197db031916fb0107a9263b5fe62ca71;hp=f68c93f453e463b44d5aba679fccff19f47a6c4a;hpb=45e718f0a1a39fb3a5f32889f3ec4140745ef90a;p=~andy%2Frhawk diff --git a/rhawk b/rhawk index f68c93f..f1478f6 100755 --- a/rhawk +++ b/rhawk @@ -3,7 +3,8 @@ @include "irc.awk" @include "json.awk" @include "spades.awk" -#@include "email.awk" +@include "email.awk" +@include "sfvlug.awk" # Initialization BEGIN { @@ -97,53 +98,6 @@ CMD == "NICK" && FROM in bots { json_save("var/nocolor.json", nocolor); } -# SFV Lug -function email(to, from, subj, body, sendmail) -{ - from = NICK "" - subj = "Update sfvlug.org!" - body = "The next SFVLUG meeting is TBA!" - sendmail = "/usr/sbin/sendmail '" to "'" - print "To: " to | sendmail - print "From: " from | sendmail - print "Subject: " subj | sendmail - print "" | sendmail - print body | sendmail - say("Topic out of date, emailing " to); - close(sendmail) -} - -BEGIN { pollchan = "#sfvlug" } -(CMD == "PING" && systime()-lastpoll > 60*60*24) || -(CMD == "PRIVMSG" && /^\.poll/) { - if (!TOPICS[pollchan]) { - debug("Unknown topic for " pollchan); - send("TOPIC " pollchan) - next - } - _curl = "curl -s http://sfvlug.org/" - _day = "(Sun|Mon|Tue|Wed|Thu|Fri|Sat)" - _web_tba = "next meeting is: TBA" - _web_ptrn = "next meeting.*" _day "\\w+[, ]+([A-Z]\\w+) +([0-9]+)[, ]+([0-9]+)" - _irc_ptrn = _day "\\w*[, ]+([A-Z]\\w+) +([0-9]+)" - while (_curl | getline _line) { - #if (match(_line, _web_tba)) - # email("Brian "); - if (match(_line, _web_ptrn, _parts)) { - _date = _parts[1] " " _parts[2] " " _parts[3] - _topic = TOPICS[pollchan] - sub(_irc_ptrn, _date, _topic) - if (_topic != TOPICS[pollchan]) - topic(pollchan, TOPICS[pollchan] = _topic) - else - debug("topic is already correct") - break - } - } - lastpoll = systime() - close(_curl) -} - # Versin/Uptime function head(cmd, var) { cmd | getline var @@ -160,13 +114,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 +153,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 +312,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!") } @@ -393,6 +348,14 @@ FROM == "rhnoise" && $2 == "slaps" && $3 == NICK { say("Springtime for Hitler and Germany!"); } +/^.drank mauchter/ { + if (!drank) { + system("sleep " 2) + say("\x02MD 20/20\x0f - \x02Morgen David\x0f - \x02Under an overpass\x0f - ***** (3 minutes ago)"); + } + drank=1 +} + # God damn commands FROM == "rhnoise" && load_mod { say(".load " load_mod) @@ -461,7 +424,8 @@ tolower($0) ~ /\/ { } # Vote relay -DST != "#rhnoise" && /\<[a-zA-Z0-9_]{3,16}(\+\+|--)/ { +DST != "#rhnoise" && DST != NICK && +/\<[a-zA-Z0-9_]{3,16}(\+\+|--)/ { say("#rhnoise", "(" DST ") " FROM ": " MSG); }