From 66736b22d52415fdfcb844f5faca45e2fc7f5765 Mon Sep 17 00:00:00 2001 From: James Lu Date: Tue, 9 Aug 2016 11:22:00 -0700 Subject: [PATCH] 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. --- plugins/Web/config.py | 3 +++ plugins/Web/plugin.py | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/Web/config.py b/plugins/Web/config.py index 6b565eec8..10e699f2a 100644 --- a/plugins/Web/config.py +++ b/plugins/Web/config.py @@ -52,6 +52,9 @@ conf.registerChannelValue(Web, 'titleSnarfer', conf.registerChannelValue(Web, 'snarferReportIOExceptions', registry.Boolean(False, _("""Determines whether the bot will notfiy the user 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', registry.Boolean(False, _("""Determines whether the domain name displayed by the snarfer will be the original one (posted on IRC) or the target one diff --git a/plugins/Web/plugin.py b/plugins/Web/plugin.py index 218874ea2..2a930432b 100644 --- a/plugins/Web/plugin.py +++ b/plugins/Web/plugin.py @@ -179,7 +179,9 @@ class Web(callbacks.PluginRegexp): domain = utils.web.getDomain(target if self.registryValue('snarferShowTargetDomain', channel) 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) titleSnarfer = urlSnarfer(titleSnarfer) titleSnarfer.__doc__ = utils.web._httpUrlRe