Add variable supybot.plugins.Web.snarferPrefix.

This commit is contained in:
Valentin Lorentz 2018-03-02 01:26:00 +01:00
parent c930edd943
commit e2180a1e08
2 changed files with 6 additions and 1 deletions

View File

@ -59,6 +59,9 @@ 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
(got after following redirects, if any)."""))) (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', conf.registerChannelValue(Web, 'nonSnarfingRegexp',
registry.Regexp(None, _("""Determines what URLs matching the given regexp 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 will not be snarfed. Give the empty string if you have no URLs that you'd

View File

@ -30,6 +30,7 @@
import re import re
import sys import sys
import string
import socket import socket
import supybot.conf as conf import supybot.conf as conf
@ -198,7 +199,8 @@ 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'), title) prefix = self.registryValue('snarferPrefix', channel)
s = prefix + title
if self.registryValue('snarferShowDomain', channel): if self.registryValue('snarferShowDomain', channel):
s += format(_(' (at %s)'), domain) s += format(_(' (at %s)'), domain)
irc.reply(s, prefixNick=False) irc.reply(s, prefixNick=False)