@include "irc.awk"
@include "json.awk"
@include "spades.awk"
-#@include "email.awk"
+@include "email.awk"
+@include "remind.awk"
+@include "sfvlug.awk"
# Initialization
BEGIN {
join("#rhspades")
join("#sfvlug")
}
+
+ PROCINFO["sorted_in"] = "@ind_str_asc";
}
# Admin
json_save("var/nocolor.json", nocolor);
}
-# SFV Lug
-function email(to, from, subj, body, sendmail)
-{
- from = NICK "<andy@pileus.org>"
- 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 <brian@zimage.com>");
- 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
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();
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
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!")
}
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)
}
# 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);
}
+# Fun operators
+function bang(a, b) {
+ if (a=="nan") return "nan";
+ if (b=="nan") return "nan";
+ if (a==b) return "nan";
+ if (a==0) return "+0";
+ if (b==0) return "-0";
+ return 1/(1/a - 1/b);
+}
+
+/^ *[+-]?[0-9]*\.?[0-9]+( *\? *[+-]?[0-9]*\.?[0-9]+)+ *$/ {
+ gsub(/?/, " ");
+ _num = $1+0;
+ for (_i=2; _i<=NF; _i++)
+ _num = bang(_num, $_i+0);
+ reply(_num);
+}
+
# Misc
{ fflush("") }