From e2180a1e08feebbd4cd3ecef5f954043a16b1a1c Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Fri, 2 Mar 2018 01:26:00 +0100 Subject: [PATCH] Add variable supybot.plugins.Web.snarferPrefix. --- 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 3bba79f94..6c587acf4 100644 --- a/plugins/Web/config.py +++ b/plugins/Web/config.py @@ -59,6 +59,9 @@ 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 (got after following redirects, if any)."""))) +conf.registerChannelValue(Web, 'snarferPrefix', + registry.String(_('Title: '), _("""Determines the string used at before + a web page's title."""))) conf.registerChannelValue(Web, 'nonSnarfingRegexp', registry.Regexp(None, _("""Determines what URLs matching the given regexp will not be snarfed. Give the empty string if you have no URLs that you'd diff --git a/plugins/Web/plugin.py b/plugins/Web/plugin.py index c33300605..18af3ea21 100644 --- a/plugins/Web/plugin.py +++ b/plugins/Web/plugin.py @@ -30,6 +30,7 @@ import re import sys +import string import socket import supybot.conf as conf @@ -198,7 +199,8 @@ class Web(callbacks.PluginRegexp): domain = utils.web.getDomain(target if self.registryValue('snarferShowTargetDomain', channel) else url) - s = format(_('Title: %s'), title) + prefix = self.registryValue('snarferPrefix', channel) + s = prefix + title if self.registryValue('snarferShowDomain', channel): s += format(_(' (at %s)'), domain) irc.reply(s, prefixNick=False)