Web: optionally hide the domain in titleSnarfer

This adds a snarferShowDomain option to optionally hide the domain ("(at site.abc)" text) in titleSnarfer output. Closes #1236.
This commit is contained in:
James Lu 2016-08-09 11:22:00 -07:00
parent 2141174272
commit 66736b22d5
2 changed files with 6 additions and 1 deletions

View File

@ -52,6 +52,9 @@ conf.registerChannelValue(Web, 'titleSnarfer',
conf.registerChannelValue(Web, 'snarferReportIOExceptions', conf.registerChannelValue(Web, 'snarferReportIOExceptions',
registry.Boolean(False, _("""Determines whether the bot will notfiy the user registry.Boolean(False, _("""Determines whether the bot will notfiy the user
about network exceptions like hostnotfound, timeout ...."""))) about network exceptions like hostnotfound, timeout ....""")))
conf.registerChannelValue(Web, 'snarferShowDomain',
registry.Boolean(True, _("""Determines whether domain names should be
displayed by the title snarfer.""")))
conf.registerChannelValue(Web, 'snarferShowTargetDomain', conf.registerChannelValue(Web, 'snarferShowTargetDomain',
registry.Boolean(False, _("""Determines whether the domain name displayed registry.Boolean(False, _("""Determines whether the domain name displayed
by the snarfer will be the original one (posted on IRC) or the target one by the snarfer will be the original one (posted on IRC) or the target one

View File

@ -179,7 +179,9 @@ class Web(callbacks.PluginRegexp):
domain = utils.web.getDomain(target domain = utils.web.getDomain(target
if self.registryValue('snarferShowTargetDomain', channel) if self.registryValue('snarferShowTargetDomain', channel)
else url) else url)
s = format(_('Title: %s (at %s)'), title, domain) s = format(_('Title: %s'), title)
if self.registryValue('snarferShowDomain', channel):
s += format(_(' (at %s)'), domain)
irc.reply(s, prefixNick=False) irc.reply(s, prefixNick=False)
titleSnarfer = urlSnarfer(titleSnarfer) titleSnarfer = urlSnarfer(titleSnarfer)
titleSnarfer.__doc__ = utils.web._httpUrlRe titleSnarfer.__doc__ = utils.web._httpUrlRe