mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 19:19:32 +01:00
Add snarfer toggle
This commit is contained in:
parent
0ea2f22517
commit
d55f5c489f
@ -93,11 +93,23 @@ class Bugzilla(callbacks.PrivmsgCommandAndRegexp):
|
|||||||
callbacks.PrivmsgCommandAndRegexp.__init__(self)
|
callbacks.PrivmsgCommandAndRegexp.__init__(self)
|
||||||
self.entre = re.compile('&(\S*?);')
|
self.entre = re.compile('&(\S*?);')
|
||||||
self.db = makeDb(dbfilename)
|
self.db = makeDb(dbfilename)
|
||||||
|
self.snarfer = True
|
||||||
|
|
||||||
def die(self):
|
def die(self):
|
||||||
self.db.close()
|
self.db.close()
|
||||||
del self.db
|
del self.db
|
||||||
|
|
||||||
|
def togglesnarfer(self, irc, msg, args):
|
||||||
|
"""takes no argument
|
||||||
|
|
||||||
|
Disables the snarfer that responds to all Bugzilla links
|
||||||
|
"""
|
||||||
|
self.snarfer = not self.snarfer
|
||||||
|
if self.snarfer:
|
||||||
|
irc.reply(msg, '%s (Snarfer is enabled)' % conf.replySuccess)
|
||||||
|
else:
|
||||||
|
irc.reply(msg, '%s (Snarfer is disabled)' % conf.replySuccess)
|
||||||
|
togglesnarfer=privmsgs.checkCapability(togglesnarfer,'admin')
|
||||||
def addzilla(self, irc, msg, args):
|
def addzilla(self, irc, msg, args):
|
||||||
"""shorthand url description
|
"""shorthand url description
|
||||||
Add a bugzilla to the list of defined bugzillae.
|
Add a bugzilla to the list of defined bugzillae.
|
||||||
@ -158,6 +170,8 @@ class Bugzilla(callbacks.PrivmsgCommandAndRegexp):
|
|||||||
return
|
return
|
||||||
def bzSnarfer(self, irc, msg, match):
|
def bzSnarfer(self, irc, msg, match):
|
||||||
r"(.*)/show_bug.cgi\?id=([0-9]+)"
|
r"(.*)/show_bug.cgi\?id=([0-9]+)"
|
||||||
|
if not self.snarfer:
|
||||||
|
return
|
||||||
queryurl = '%s/xml.cgi?id=%s' % (match.group(1), match.group(2))
|
queryurl = '%s/xml.cgi?id=%s' % (match.group(1), match.group(2))
|
||||||
try:
|
try:
|
||||||
summary = self._get_short_bug_summary(queryurl, "Snarfed Bugzilla URL", match.group(2))
|
summary = self._get_short_bug_summary(queryurl, "Snarfed Bugzilla URL", match.group(2))
|
||||||
|
Loading…
Reference in New Issue
Block a user