diff --git a/plugins/ShrinkUrl/config.py b/plugins/ShrinkUrl/config.py index b0b373c37..82a9c7920 100644 --- a/plugins/ShrinkUrl/config.py +++ b/plugins/ShrinkUrl/config.py @@ -1,5 +1,6 @@ ### # Copyright (c) 2005, Jeremiah Fincher +# Copyright (c) 2009, James Vega # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -49,6 +50,9 @@ conf.registerChannelValue(ShrinkUrl, 'shrinkSnarfer', supybot.plugins.ShrinkUrl.minimumLength) it will post a smaller URL from either ln-s.net or tinyurl.com, as denoted in supybot.plugins.ShrinkUrl.default.""")) +conf.registerChannelValue(ShrinkUrl.shrinkSnarfer, 'showDomain', + registry.Boolean(True, """Determines whether the snarfer will show the + domain of the URL being snarfed along with the shrunken URL.""")) conf.registerChannelValue(ShrinkUrl, 'minimumLength', registry.PositiveInteger(48, """The minimum length a URL must be before the bot will shrink it.""")) diff --git a/plugins/ShrinkUrl/plugin.py b/plugins/ShrinkUrl/plugin.py index 2d3f6e6c1..48c408bd3 100644 --- a/plugins/ShrinkUrl/plugin.py +++ b/plugins/ShrinkUrl/plugin.py @@ -1,5 +1,6 @@ ### # Copyright (c) 2002-2004, Jeremiah Fincher +# Copyright (c) 2009, James Vega # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -132,11 +133,14 @@ class ShrinkUrl(callbacks.PluginRegexp): if shorturl is None: self.log.info('Couldn\'t get shorturl for %u', url) return - domain = utils.web.getDomain(url) - if self.registryValue('bold'): - s = format('%u (at %s)', ircutils.bold(shorturl), domain) + if self.registryValue('shrinkSnarfer.showDomain', channel): + domain = ' (at %s)' % utils.web.getDomain(url) else: - s = format('%u (at %s)', shorturl, domain) + domain = '' + if self.registryValue('bold'): + s = format('%u%s', ircutils.bold(shorturl), domain) + else: + s = format('%u%s', shorturl, domain) m = irc.reply(s, prefixNick=False) m.tag('shrunken') shrinkSnarfer = urlSnarfer(shrinkSnarfer)