From: Matthew Vernon Date: Tue, 19 Apr 2011 14:23:16 +0000 (+0100) Subject: Add shibboleth support X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~matthewv/git?a=commitdiff_plain;h=0ca5b13d18e80c6fba5b7e51377469df555a09f5;p=irc.git Add shibboleth support You can now say "re url" or "re: url" without Servus nagging you --- diff --git a/commands.py b/commands.py index 0075272..20d207c 100644 --- a/commands.py +++ b/commands.py @@ -326,8 +326,10 @@ class UrlLog: return urlcomplaints[z] #(?:) is a regexp that doesn't group -urlre = re.compile("((?:(?:http)|(?:nsfw))s?://[^ ]+)( |$)") -hturlre= re.compile("(http)(s?://[^ ]+)( |$)") +urlre = re.compile(r"((?:(?:http)|(?:nsfw))s?://[^ ]+)( |$)") +hturlre= re.compile(r"(http)(s?://[^ ]+)( |$)") +#matches \bre\:?\s+ before a regexp; (?i)==case insensitive match +shibboleth = re.compile(r"(?i)\bre\:?\s+((?:(?:http)|(?:nsfw))s?://[^ ]+)( |$)") urlcomplaints = ["a contemporary","an interesting","a fascinating","an overused","a vastly overused"] ### Deal with /msg bot url or ~url in channel @@ -372,7 +374,8 @@ def dourl(bot,conn,nick,command,urldb): T=urldb[urlstring] message="observes %s URL, first mentioned %s by %s" % \ (T.urltype(),T.firstmen(),T.nick) - conn.action(bot.channel, message) + if shibbloleth.search(command)==None: + conn.action(bot.channel, message) T.lastseen=time.time() T.count+=1 else: