From cecb130106f980e243e55bd577b5e0a77f5f05d2 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Thu, 2 Oct 2003 22:36:20 +0000 Subject: [PATCH] Added disablegooglesnarfer command to disable the snarfer. --- plugins/Google.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/plugins/Google.py b/plugins/Google.py index eafd203f0..291972e03 100644 --- a/plugins/Google.py +++ b/plugins/Google.py @@ -119,6 +119,7 @@ class Google(callbacks.PrivmsgCommandAndRegexp): callbacks.PrivmsgCommandAndRegexp.__init__(self) self.total = 0 self.totalTime = 0 + self.snarfer = True self.last24hours = structures.queue() def formatData(self, data): @@ -147,6 +148,16 @@ class Google(callbacks.PrivmsgCommandAndRegexp): irc.reply(msg, conf.replySuccess) googlelicensekey = privmsgs.checkCapability(googlelicensekey, 'admin') + def disablegooglesnarfer(self, irc, msg, args): + """takes no argument + + Disables the snarfer that responds to all messages that begin with + 'google' + """ + self.snarfer = False + irc.reply(msg, conf.replySuccess) + disablegooglesnarfer=privmsgs.checkCapability(disablegooglesnarfer,'admin') + def google(self, irc, msg, args): """ [--{language,restrict}=] [--{notsafe,similar}] @@ -258,6 +269,8 @@ class Google(callbacks.PrivmsgCommandAndRegexp): def googleSnarfer(self, irc, msg, match): r"^google\s+(.*)$" + if not self.snarfer: + return searchString = match.group(1) data = search(searchString, safeSearch=1) if data.results: