mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-14 14:49:21 +01:00
ShrinkUrl: Add shrinkSnarfer.showDomain config
As requested by BeteNoire, add a config option to disable showing the domain of the URL shrunk by the snarfer. Signed-off-by: James Vega <jamessan@users.sourceforge.net>
This commit is contained in:
parent
2314eb4406
commit
d59ac366b3
@ -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."""))
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user