parent
859d13e59d
commit
e21690272e
|
|
@ -152,3 +152,7 @@ conf.registerGlobalValue(SpiffyTitles, 'ignoreActionLinks',
|
|||
|
||||
|
||||
|
||||
|
||||
conf.registerGlobalValue(SpiffyTitles, 'ignoredTitlePattern',
|
||||
registry.Regexp("", _("""Titles matching this pattern will be ignored.""")))
|
||||
|
||||
|
|
|
|||
21
plugin.py
21
plugin.py
|
|
@ -325,7 +325,13 @@ class SpiffyTitles(callbacks.Plugin):
|
|||
if title is not None and title:
|
||||
self.log.info("SpiffyTitles: title found: %s" % (title))
|
||||
|
||||
irc.sendMsg(ircmsgs.privmsg(channel, title))
|
||||
ignore_match = self.title_matches_ignore_pattern(title)
|
||||
|
||||
if ignore_match:
|
||||
self.log.info("SpiffyTitles: ignoring title due to ignoredTitlePattern match")
|
||||
return
|
||||
else:
|
||||
irc.sendMsg(ircmsgs.privmsg(channel, title))
|
||||
else:
|
||||
if self.default_handler_enabled:
|
||||
self.log.debug("SpiffyTitles: could not get a title for %s" % (url))
|
||||
|
|
@ -1052,6 +1058,19 @@ class SpiffyTitles(callbacks.Plugin):
|
|||
|
||||
return match
|
||||
|
||||
def title_matches_ignore_pattern(self, input):
|
||||
"""
|
||||
Checks message against ignoredTitlePattern to determine
|
||||
whether the title should be ignored.
|
||||
"""
|
||||
match = False
|
||||
pattern = self.registryValue("ignoredTitlePattern")
|
||||
|
||||
if pattern:
|
||||
match = re.search(pattern, input)
|
||||
|
||||
return match
|
||||
|
||||
def get_url_from_message(self, input):
|
||||
"""
|
||||
Find the first string that looks like a URL from the message
|
||||
|
|
|
|||
Loading…
Reference in New Issue