X-Git-Url: http://pileus.org/git/?p=~andy%2Frhawk;a=blobdiff_plain;f=email.awk;h=57b56d40c0c5fd1ecbf00959766ad3a10be2eb98;hp=fbcf7dbc91b0fdaf08b0339fe166a21403e35cb9;hb=HEAD;hpb=3c3c400eb65785a84b03e21bc01f690078882fc8 diff --git a/email.awk b/email.awk index fbcf7db..57b56d4 100644 --- a/email.awk +++ b/email.awk @@ -18,23 +18,24 @@ BEGIN { mail_hist = 5*60 # If the users has not spoken withn mail_before before mail_before = 5*60 # someone mentions their name and does not reply within mail_after = 5*60 # mail_after seconds, email them hist seconds of the backlog - - mail_from = NICK "<" NICK "@pileus.org>" - mail_err = "If you received this message in error,\n" \ - "someone in #rhnoise is being a jerk" } function mail_send(addr, subj, body, - sendmail, errmsg) + from, error, sendmail, errmsg) { + from = NICK "<" NICK "@pileus.org>" + error = "If you received this message in error,\n" \ + "someone in #rhnoise is being a jerk" + gsub(/[^a-zA-Z0-9_+@.-]/, "", addr) sendmail = "/usr/sbin/sendmail " addr - print "To: " addr | sendmail - print "From: " mail_from | sendmail - print "Subject: " subj | sendmail - print "" | sendmail - print body | sendmail - print mail_err | sendmail + print "To: " addr | sendmail + print "From: " from | sendmail + print "Subject: " subj | sendmail + print "" | sendmail + print body | sendmail + print "" | sendmail + print error | sendmail close(sendmail) } @@ -88,9 +89,9 @@ function mail_save(file) /^\.help e?mail$/ { say("Mail -- email users when they are mentioned") - say(".subscribe [addr] -- set your mailing address to [addr]") - say(".unsubscribe [addr] -- remove your subscription") - say(".addresses -- show your subscription address") + say(NICK ": subscribe [addr] -- set your mailing address to [addr]") + say(NICK ": unsubscribe [addr] -- remove your subscription") + say(NICK ": addresses -- show your subscription address") next }