From 941d4e152342bb2ced3b4fe638b375c207385496 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Sat, 31 Jan 2004 20:52:24 +0000 Subject: [PATCH] Updated to put just the domain rather than the whole url in snarfer replies. --- plugins/URL.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/plugins/URL.py b/plugins/URL.py index e61e13035..e24255aa8 100644 --- a/plugins/URL.py +++ b/plugins/URL.py @@ -87,11 +87,6 @@ conf.registerChannelValue(conf.supybot.plugins.URL.tinyurlSnarfer, conf.registerChannelValue(conf.supybot.plugins.URL, 'titleSnarfer', registry.Boolean(False, """Determines whether the bot will output the HTML title of URLs it sees in the channel.""")) -conf.registerChannelValue(conf.supybot.plugins.URL.titleSnarfer, - 'includesUrl', - registry.Boolean(True, """Determines whether the bot will include the - snarfed URL in its message. This is particularly useful when people have a - habit of putting multiple URLs in a message.""")) conf.registerChannelValue(conf.supybot.plugins.URL, 'nonSnarfingRegexp', registry.Regexp(None, """Determines what URLs are to be snarfed and stored in the database in the channel; URLs matchin the regexp given will not be @@ -188,7 +183,8 @@ class URL(callbacks.PrivmsgCommandAndRegexp, return elif updateDb: self._updateTinyDb(url, tinyurl, channel) - s = '%s (was <%s>)' % (ircutils.bold(tinyurl), url) + domain = webutils.getDomain(url) + s = '%s (at %s)' % (ircutils.bold(tinyurl), domain) irc.reply(s, prefixName=False) tinyurlSnarfer = privmsgs.urlSnarfer(tinyurlSnarfer) @@ -202,9 +198,9 @@ class URL(callbacks.PrivmsgCommandAndRegexp, text = webutils.getUrl(url, size=conf.supybot.httpPeekSize()) m = self._titleRe.search(text) if m is not None: - s = 'Title: %s' % utils.htmlToText(m.group(1).strip()) - if self.registryValue('titleSnarfer.includesUrl', channel): - s += ' (<%s>)' % url + domain = webutils.getDomain(url) + title = utils.htmlToText(m.group(1).strip()) + s = 'Title: %s (at %s)' % (title, domain) irc.reply(s, prefixName=False) titleSnarfer = privmsgs.urlSnarfer(titleSnarfer)