Merge pull request #1259 from GLolol/web/1236

Web: optionally hide the domain in titleSnarfer
This commit is contained in:
Valentin Lorentz 2016-08-09 20:30:24 +02:00 committed by GitHub
commit d416c3384e
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