Merge branch 'testing' into admin/configurable-partmsg

This commit is contained in:
James Lu 2015-02-07 10:00:48 -08:00
commit 32de4e8270
17 changed files with 250 additions and 204 deletions

View File

@ -47,6 +47,10 @@ Channel = conf.registerPlugin('Channel')
conf.registerChannelValue(Channel, 'alwaysRejoin', conf.registerChannelValue(Channel, 'alwaysRejoin',
registry.Boolean(True, _("""Determines whether the bot will always try to registry.Boolean(True, _("""Determines whether the bot will always try to
rejoin a channel whenever it's kicked from the channel."""))) rejoin a channel whenever it's kicked from the channel.""")))
conf.registerChannelValue(Channel, 'nicksInPrivate',
registry.Boolean(True, _("""Determines whether the output of 'nicks' will
be sent in private. This prevents mass-highlights of a channel's users,
accidental or on purpose.""")))
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: # vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:

View File

@ -910,7 +910,8 @@ class Channel(callbacks.Plugin):
keys = [option for (option, arg) in optlist] keys = [option for (option, arg) in optlist]
if 'count' not in keys: if 'count' not in keys:
utils.sortBy(str.lower, L) utils.sortBy(str.lower, L)
irc.reply(utils.str.commaAndify(L)) private = self.registryValue("nicksInPrivate", channel)
irc.reply(utils.str.commaAndify(L), private=private)
else: else:
irc.reply(str(len(L))) irc.reply(str(len(L)))
nicks = wrap(nicks, ['inChannel', nicks = wrap(nicks, ['inChannel',

View File

@ -66,5 +66,8 @@ conf.registerChannelValue(Karma, 'allowSelfRating',
conf.registerChannelValue(Karma, 'allowUnaddressedKarma', conf.registerChannelValue(Karma, 'allowUnaddressedKarma',
registry.Boolean(True, _("""Determines whether the bot will registry.Boolean(True, _("""Determines whether the bot will
increase/decrease karma without being addressed."""))) increase/decrease karma without being addressed.""")))
conf.registerChannelValue(Karma, 'onlyNicks',
registry.Boolean(False, _("""Determines whether the bot will
only increase/decrease karma for nicks in the current channel.""")))
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: # vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:

View File

@ -246,25 +246,34 @@ class Karma(callbacks.Plugin):
def _doKarma(self, irc, msg, channel, thing): def _doKarma(self, irc, msg, channel, thing):
inc = self.registryValue('incrementChars', channel) inc = self.registryValue('incrementChars', channel)
dec = self.registryValue('decrementChars', channel) dec = self.registryValue('decrementChars', channel)
if thing.endswith(tuple(inc + dec)): onlynicks = self.registryValue('onlyNicks', channel)
for s in inc: karma = ''
if thing.endswith(s): for s in inc:
thing = thing[:-len(s)] if thing.endswith(s):
if ircutils.strEqual(thing, msg.nick) and \ thing = thing[:-len(s)]
not self.registryValue('allowSelfRating', channel): # Don't reply if the target isn't a nick
if onlynicks and thing.lower() not in map(ircutils.toLower,
irc.state.channels[channel].users):
return
if ircutils.strEqual(thing, msg.nick) and \
not self.registryValue('allowSelfRating', channel):
irc.error(_('You\'re not allowed to adjust your own karma.')) irc.error(_('You\'re not allowed to adjust your own karma.'))
return return
self.db.increment(channel, self._normalizeThing(thing)) self.db.increment(channel, self._normalizeThing(thing))
karma = self.db.get(channel, self._normalizeThing(thing)) karma = self.db.get(channel, self._normalizeThing(thing))
for s in dec: for s in dec:
if thing.endswith(s): if thing.endswith(s):
thing = thing[:-len(s)] thing = thing[:-len(s)]
if ircutils.strEqual(thing, msg.nick) and \ if onlynicks and thing.lower() not in map(ircutils.toLower,
not self.registryValue('allowSelfRating', channel): irc.state.channels[channel].users):
irc.error(_('You\'re not allowed to adjust your own karma.')) return
return if ircutils.strEqual(thing, msg.nick) and \
self.db.decrement(channel, self._normalizeThing(thing)) not self.registryValue('allowSelfRating', channel):
karma = self.db.get(channel, self._normalizeThing(thing)) irc.error(_('You\'re not allowed to adjust your own karma.'))
return
self.db.decrement(channel, self._normalizeThing(thing))
karma = self.db.get(channel, self._normalizeThing(thing))
if karma:
self._respond(irc, channel, thing, karma[0]-karma[1]) self._respond(irc, channel, thing, karma[0]-karma[1])
def invalidCommand(self, irc, msg, tokens): def invalidCommand(self, irc, msg, tokens):

View File

@ -204,4 +204,21 @@ class KarmaTestCase(ChannelPluginTestCase):
karma.response.setValue(resp) karma.response.setValue(resp)
karma.allowUnaddressedKarma.setValue(unaddressed) karma.allowUnaddressedKarma.setValue(unaddressed)
def testOnlyNicks(self):
# We use this to join a dummy user to test upon
msg = ircmsgs.join(self.channel, prefix='hello!foo@bar')
self.irc.feedMsg(msg)
karma = conf.supybot.plugins.Karma
resp = karma.response()
onlynicks = karma.onlyNicks()
try:
karma.onlynicks.setValue(True)
karma.response.setValue(True)
self.assertSnarfNoResponse('abcd++')
self.assertSnarfRegexp('hello--', 'is now')
self.assertSnarfNoResponse('abcd--')
self.assertSnarfRegexp('hello++', 'is now')
finally:
karma.onlynicks.setValue(onlynicks)
karma.response.setValue(resp)
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: # vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:

View File

@ -42,11 +42,11 @@ def configure(advanced):
conf.supybot.plugins.ShrinkUrl.shrinkSnarfer.setValue(True) conf.supybot.plugins.ShrinkUrl.shrinkSnarfer.setValue(True)
class ShrinkService(registry.OnlySomeStrings): class ShrinkService(registry.OnlySomeStrings):
"""Valid values include 'ln', 'tiny', 'xrl', 'goo', 'ur1', and 'x0'.""" """Valid values include 'ln', 'tiny', 'goo', 'ur1', and 'x0'."""
validStrings = ('ln', 'tiny', 'xrl', 'goo', 'ur1', 'x0') validStrings = ('ln', 'tiny', 'goo', 'ur1', 'x0')
class ShrinkCycle(registry.SpaceSeparatedListOfStrings): class ShrinkCycle(registry.SpaceSeparatedListOfStrings):
"""Valid values include 'ln', 'tiny', 'xrl', 'goo', 'ur1', and 'x0'.""" """Valid values include 'ln', 'tiny', 'goo', 'ur1', and 'x0'."""
Value = ShrinkService Value = ShrinkService
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):

View File

@ -5,8 +5,8 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Limnoria\n" "Project-Id-Version: Limnoria\n"
"POT-Creation-Date: 2014-12-20 11:59+EET\n" "POT-Creation-Date: 2015-01-24 19:31+CET\n"
"PO-Revision-Date: 2014-12-20 12:21+0200\n" "PO-Revision-Date: 2015-01-24 19:31+0100\n"
"Last-Translator: Mikaela Suomalainen <mikaela.suomalainen@outlook.com>\n" "Last-Translator: Mikaela Suomalainen <mikaela.suomalainen@outlook.com>\n"
"Language-Team: suomi <>\n" "Language-Team: suomi <>\n"
"Language: fi\n" "Language: fi\n"
@ -28,8 +28,8 @@ msgstr ""
" tämän kaappaajan olevan käytössä?" " tämän kaappaajan olevan käytössä?"
#: config.py:45 config.py:49 #: config.py:45 config.py:49
msgid "Valid values include 'ln', 'tiny', 'xrl', 'goo', 'ur1', and 'x0'." msgid "Valid values include 'ln', 'tiny', 'goo', 'ur1', and 'x0'."
msgstr "Kelvolliset arvot ovat 'ln', 'tiny', 'xrl', 'goo', 'ur1' ja 'x0' ." msgstr "Kelvolliset arvot ovat 'ln', 'tiny', 'goo', 'ur1' ja 'x0' ."
#: config.py:70 #: config.py:70
msgid "" msgid ""
@ -145,19 +145,7 @@ msgstr ""
"osoitteesta>.\n" "osoitteesta>.\n"
" " " "
#: plugin.py:248 #: plugin.py:252
msgid ""
"<url>\n"
"\n"
" Returns an xrl.us version of <url>.\n"
" "
msgstr ""
"<URL-osoite>\n"
"\n"
" Palauttaa xrl.us palvelun lyhentämän version <URL-osoitteesta>.\n"
" "
#: plugin.py:281
msgid "" msgid ""
"<url>\n" "<url>\n"
"\n" "\n"
@ -168,7 +156,7 @@ msgstr ""
"\n" "\n"
" Palauttaa goo.gl-palvelun lyhentämän version <URL-osoitteesta>." " Palauttaa goo.gl-palvelun lyhentämän version <URL-osoitteesta>."
#: plugin.py:311 #: plugin.py:282
msgid "" msgid ""
"<url>\n" "<url>\n"
"\n" "\n"
@ -179,7 +167,7 @@ msgstr ""
" Palauttaa ur1-version <url:stä>.\n" " Palauttaa ur1-version <url:stä>.\n"
" " " "
#: plugin.py:338 #: plugin.py:309
msgid "" msgid ""
"<url>\n" "<url>\n"
"\n" "\n"
@ -191,7 +179,7 @@ msgstr ""
" Palauttaa x0.no palvelun lyhentämän version <URL-osoitteesta>.\n" " Palauttaa x0.no palvelun lyhentämän version <URL-osoitteesta>.\n"
" " " "
#: plugin.py:365 #: plugin.py:336
msgid "" msgid ""
"<url>\n" "<url>\n"
"\n" "\n"
@ -202,5 +190,16 @@ msgstr ""
" Palauttaa laajennetun version <url-osoitteesta>.\n" " Palauttaa laajennetun version <url-osoitteesta>.\n"
" " " "
#~ msgid ""
#~ "<url>\n"
#~ "\n"
#~ " Returns an xrl.us version of <url>.\n"
#~ " "
#~ msgstr ""
#~ "<URL-osoite>\n"
#~ "\n"
#~ " Palauttaa xrl.us palvelun lyhentämän version <URL-osoitteesta>.\n"
#~ " "
#~ msgid "Valid values include 'ln', 'tiny', 'xrl', 'goo', and 'x0'." #~ msgid "Valid values include 'ln', 'tiny', 'xrl', 'goo', and 'x0'."
#~ msgstr "Kelvolliset arvot ovat 'ln', 'tiny', 'xrl', 'goo' ja 'x0' ." #~ msgstr "Kelvolliset arvot ovat 'ln', 'tiny', 'xrl', 'goo' ja 'x0' ."

View File

@ -1,10 +1,11 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Limnoria\n" "Project-Id-Version: Limnoria\n"
"POT-Creation-Date: 2013-03-03 19:39+CET\n" "POT-Creation-Date: 2015-01-24 19:31+CET\n"
"PO-Revision-Date: \n" "PO-Revision-Date: 2015-01-24 19:32+0100\n"
"Last-Translator: Valentin Lorentz <progval@gmail.com>\n" "Last-Translator: Valentin Lorentz <progval@gmail.com>\n"
"Language-Team: Limnoria <progval@gmail.com>\n" "Language-Team: Limnoria <progval@gmail.com>\n"
"Language: \n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
@ -21,16 +22,12 @@ msgstr ""
"canal pour en envoyer une version plus courte. Voulez-vous activer ce " "canal pour en envoyer une version plus courte. Voulez-vous activer ce "
"snarfer ?" "snarfer ?"
#: config.py:45 #: config.py:45 config.py:49
msgid "Valid values include 'ln', 'tiny', 'xrl', 'goo', and 'x0'." msgid "Valid values include 'ln', 'tiny', 'goo', 'ur1', and 'x0'."
msgstr "Les valeurs valides incluent 'ln', 'tiny', 'xrl', 'goo', et 'x0'."
#: config.py:49
msgid "Valid values include 'ln', 'tiny', 'xrl', 'goo', 'ur1', and 'x0'."
msgstr "" msgstr ""
"Les valeurs valides incluent 'ln', 'tiny', 'xrl', 'goo', 'ur1', et 'x0'." "Les valeurs valides incluent 'ln', 'tiny', 'goo', 'ur1', et 'x0'."
#: config.py:71 #: config.py:70
msgid "" msgid ""
"Determines whether the\n" "Determines whether the\n"
" shrink snarfer is enabled. This snarfer will watch for URLs in the\n" " shrink snarfer is enabled. This snarfer will watch for URLs in the\n"
@ -45,7 +42,7 @@ msgstr ""
"URL raccourcie avec ln-s.net ou tinyurl.com, comme défini par supybot." "URL raccourcie avec ln-s.net ou tinyurl.com, comme défini par supybot."
"plugins.ShrinkUrl.default." "plugins.ShrinkUrl.default."
#: config.py:78 #: config.py:77
msgid "" msgid ""
"Determines whether the snarfer will show the\n" "Determines whether the snarfer will show the\n"
" domain of the URL being snarfed along with the shrunken URL." " domain of the URL being snarfed along with the shrunken URL."
@ -53,13 +50,13 @@ msgstr ""
"Détermine si le snarfer affichera le domaine de l'URL snarfée avec l'URL " "Détermine si le snarfer affichera le domaine de l'URL snarfée avec l'URL "
"raccourcie." "raccourcie."
#: config.py:81 #: config.py:80
msgid "" msgid ""
"The minimum length a URL must be before\n" "The minimum length a URL must be before\n"
" the bot will shrink it." " the bot will shrink it."
msgstr "La taille minimum d'une URL pour que le bot la raccourcice." msgstr "La taille minimum d'une URL pour que le bot la raccourcice."
#: config.py:84 #: config.py:83
msgid "" msgid ""
"Determines what URLs are to be snarfed; URLs\n" "Determines what URLs are to be snarfed; URLs\n"
" matching the regexp given will not be snarfed. Give the empty string " " matching the regexp given will not be snarfed. Give the empty string "
@ -70,7 +67,7 @@ msgstr ""
"l'expression régulière ne seront par snarfées. Donnez une chaîne vide si il " "l'expression régulière ne seront par snarfées. Donnez une chaîne vide si il "
"n'y a pas d'URL que vous voulez exclure." "n'y a pas d'URL que vous voulez exclure."
#: config.py:88 #: config.py:87
msgid "" msgid ""
"Determines whether the bot will shrink the\n" "Determines whether the bot will shrink the\n"
" URLs of outgoing messages if those URLs are longer than\n" " URLs of outgoing messages if those URLs are longer than\n"
@ -79,20 +76,20 @@ msgstr ""
"Détermine si le bot raccourcira les URLs des messages sortant si ces URLs " "Détermine si le bot raccourcira les URLs des messages sortant si ces URLs "
"sont plus longues que supybot.plugins.ShrinkUrl.minimumLength." "sont plus longues que supybot.plugins.ShrinkUrl.minimumLength."
#: config.py:92 #: config.py:91
msgid "" msgid ""
"Determines what website the bot will use when\n" "Determines what website the bot will use when\n"
" shrinking a URL." " shrinking a URL."
msgstr "Détermine quel site web le bot utilisera pour raccourcir une URL" msgstr "Détermine quel site web le bot utilisera pour raccourcir une URL"
#: config.py:95 #: config.py:94
msgid "" msgid ""
"Determines whether this plugin will bold\n" "Determines whether this plugin will bold\n"
" certain portions of its replies." " certain portions of its replies."
msgstr "" msgstr ""
"Détermine si ce plugin mettra en gras certaines portions de ses réponses." "Détermine si ce plugin mettra en gras certaines portions de ses réponses."
#: config.py:98 #: config.py:97
msgid "" msgid ""
"If set to a non-empty value, specifies the list of\n" "If set to a non-empty value, specifies the list of\n"
" services to rotate through for the shrinkSnarfer and outFilter." " services to rotate through for the shrinkSnarfer and outFilter."
@ -100,7 +97,13 @@ msgstr ""
"Si définit à une valeur non vide, définit la liste des services à faire " "Si définit à une valeur non vide, définit la liste des services à faire "
"tourner pour shrinkSnarfer et outFilter." "tourner pour shrinkSnarfer et outFilter."
#: plugin.py:189 #: plugin.py:90
msgid ""
"This plugin features commands to shorten URLs through different services,\n"
" like tinyurl."
msgstr ""
#: plugin.py:192
msgid "" msgid ""
"<url>\n" "<url>\n"
"\n" "\n"
@ -111,7 +114,7 @@ msgstr ""
"\n" "\n"
"Retourne une version de ln-s.net de l'<url>." "Retourne une version de ln-s.net de l'<url>."
#: plugin.py:216 #: plugin.py:219
msgid "" msgid ""
"<url>\n" "<url>\n"
"\n" "\n"
@ -122,18 +125,7 @@ msgstr ""
"\n" "\n"
"Retourne une version de TinyURL.com de l'<url>." "Retourne une version de TinyURL.com de l'<url>."
#: plugin.py:245 #: plugin.py:252
msgid ""
"<url>\n"
"\n"
" Returns an xrl.us version of <url>.\n"
" "
msgstr ""
"<url>\n"
"\n"
"Retourne une version de xrl.us de l'<url>."
#: plugin.py:275
msgid "" msgid ""
"<url>\n" "<url>\n"
"\n" "\n"
@ -144,7 +136,7 @@ msgstr ""
"\n" "\n"
"Retourne une version de goo.gl de l'<url>." "Retourne une version de goo.gl de l'<url>."
#: plugin.py:305 #: plugin.py:282
msgid "" msgid ""
"<url>\n" "<url>\n"
"\n" "\n"
@ -155,7 +147,7 @@ msgstr ""
"\n" "\n"
"Retourne une version de ur1 de l'<url>." "Retourne une version de ur1 de l'<url>."
#: plugin.py:332 #: plugin.py:309
msgid "" msgid ""
"<url>\n" "<url>\n"
"\n" "\n"
@ -166,7 +158,7 @@ msgstr ""
"\n" "\n"
"Retourne une version de x0.no de l'<url>." "Retourne une version de x0.no de l'<url>."
#: plugin.py:359 #: plugin.py:336
msgid "" msgid ""
"<url>\n" "<url>\n"
"\n" "\n"
@ -176,3 +168,16 @@ msgstr ""
"<url>\n" "<url>\n"
"\n" "\n"
"Retourne la version large de l'<url>." "Retourne la version large de l'<url>."
#~ msgid ""
#~ "<url>\n"
#~ "\n"
#~ " Returns an xrl.us version of <url>.\n"
#~ " "
#~ msgstr ""
#~ "<url>\n"
#~ "\n"
#~ "Retourne une version de xrl.us de l'<url>."
#~ msgid "Valid values include 'ln', 'tiny', 'xrl', 'goo', and 'x0'."
#~ msgstr "Les valeurs valides incluent 'ln', 'tiny', 'xrl', 'goo', et 'x0'."

View File

@ -1,8 +1,8 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Limnoria\n" "Project-Id-Version: Limnoria\n"
"POT-Creation-Date: 2011-02-26 09:49+CET\n" "POT-Creation-Date: 2015-01-24 19:31+CET\n"
"PO-Revision-Date: 2012-06-09 09:03+0200\n" "PO-Revision-Date: 2015-01-24 11:45+0100\n"
"Last-Translator: skizzhg <skizzhg@gmx.com>\n" "Last-Translator: skizzhg <skizzhg@gmx.com>\n"
"Language-Team: Italian <skizzhg@gmx.com>\n" "Language-Team: Italian <skizzhg@gmx.com>\n"
"Language: it\n" "Language: it\n"
@ -10,7 +10,6 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
#: config.py:39 #: config.py:39
msgid "" msgid ""
"This plugin offers a snarfer that will go retrieve a shorter\n" "This plugin offers a snarfer that will go retrieve a shorter\n"
@ -20,17 +19,13 @@ msgstr ""
"Questo plugin offre un cattura URL che riporterà una versione accorciata\n" "Questo plugin offre un cattura URL che riporterà una versione accorciata\n"
" di quelli lunghi inviati al canale. Lo si vuole abilitare?\n" " di quelli lunghi inviati al canale. Lo si vuole abilitare?\n"
#: config.py:45 #: config.py:45 config.py:49
#, docstring #, fuzzy
msgid "Valid values include 'ln', 'tiny', 'xrl', 'goo', and 'x0'." msgid "Valid values include 'ln', 'tiny', 'goo', 'ur1', and 'x0'."
msgstr "I valori validi comprendono \"ln\", \"tiny\", \"xrl\", \"goo\" e \"x0\"." msgstr ""
"I valori validi comprendono \"ln\", \"tiny\", \"goo\" e \"x0\"."
#: config.py:49 #: config.py:70
#, docstring
msgid "Valid values include 'ln', 'tiny', 'xrl', 'goo', and 'x0'."
msgstr "I valori validi comprendono \"ln\", \"tiny\", \"xrl\" \"goo\" e \"x0\"."
#: config.py:71
msgid "" msgid ""
"Determines whether the\n" "Determines whether the\n"
" shrink snarfer is enabled. This snarfer will watch for URLs in the\n" " shrink snarfer is enabled. This snarfer will watch for URLs in the\n"
@ -39,59 +34,67 @@ msgid ""
" smaller URL from either ln-s.net or tinyurl.com, as denoted in\n" " smaller URL from either ln-s.net or tinyurl.com, as denoted in\n"
" supybot.plugins.ShrinkUrl.default." " supybot.plugins.ShrinkUrl.default."
msgstr "" msgstr ""
"Determina se l'accorcia URL è abilitato. Questo controllerà gli URL che passano\n" "Determina se l'accorcia URL è abilitato. Questo controllerà gli URL che "
"passano\n"
" in canale e se sono sufficientemente lunghi (determinato da\n" " in canale e se sono sufficientemente lunghi (determinato da\n"
" supybot.plugins.ShrinkUrl.minimumLength) il bot ne invierà uno più corto\n" " supybot.plugins.ShrinkUrl.minimumLength) il bot ne invierà uno più "
" tramite ln-s.net o tinyurl.com, come definito in supybot.plugins.ShrinkUrl.default." "corto\n"
" tramite ln-s.net o tinyurl.com, come definito in supybot.plugins."
"ShrinkUrl.default."
#: config.py:78 #: config.py:77
msgid "" msgid ""
"Determines whether the snarfer will show the\n" "Determines whether the snarfer will show the\n"
" domain of the URL being snarfed along with the shrunken URL." " domain of the URL being snarfed along with the shrunken URL."
msgstr "" msgstr ""
"Determina se l'accorcia URL mostrerà il dominio dell'URL originale assieme a quello accorciato." "Determina se l'accorcia URL mostrerà il dominio dell'URL originale assieme a "
"quello accorciato."
#: config.py:81 #: config.py:80
msgid "" msgid ""
"The minimum length a URL must be before\n" "The minimum length a URL must be before\n"
" the bot will shrink it." " the bot will shrink it."
msgstr "" msgstr ""
"La lunghezza minima che un URL deve avere affinché il bot decida di accorciarlo." "La lunghezza minima che un URL deve avere affinché il bot decida di "
"accorciarlo."
#: config.py:84 #: config.py:83
msgid "" msgid ""
"Determines what URLs are to be snarfed; URLs\n" "Determines what URLs are to be snarfed; URLs\n"
" matching the regexp given will not be snarfed. Give the empty string if\n" " matching the regexp given will not be snarfed. Give the empty string "
"if\n"
" you have no URLs that you'd like to exclude from being snarfed." " you have no URLs that you'd like to exclude from being snarfed."
msgstr "" msgstr ""
"Determina quali URL debbano essere intercettati; quelli che corrispondono alla\n" "Determina quali URL debbano essere intercettati; quelli che corrispondono "
" regexp fornita non verranno coinvolti. Se non si vuole escludere alcun URL,\n" "alla\n"
" regexp fornita non verranno coinvolti. Se non si vuole escludere alcun "
"URL,\n"
" aggiungere una stringa vuota." " aggiungere una stringa vuota."
#: config.py:88 #: config.py:87
msgid "" msgid ""
"Determines whether the bot will shrink the\n" "Determines whether the bot will shrink the\n"
" URLs of outgoing messages if those URLs are longer than\n" " URLs of outgoing messages if those URLs are longer than\n"
" supybot.plugins.ShrinkUrl.minimumLength." " supybot.plugins.ShrinkUrl.minimumLength."
msgstr "" msgstr ""
"Determina se il bot accorcerà gli URL dei messaggi in uscita se questi sono più\n" "Determina se il bot accorcerà gli URL dei messaggi in uscita se questi sono "
"più\n"
" lunghi del valore di supybot.plugins.ShrinkUrl.minimumLength." " lunghi del valore di supybot.plugins.ShrinkUrl.minimumLength."
#: config.py:92 #: config.py:91
msgid "" msgid ""
"Determines what website the bot will use when\n" "Determines what website the bot will use when\n"
" shrinking a URL." " shrinking a URL."
msgstr "" msgstr "Determina quale sito web il bot userà per accorciare un URL."
"Determina quale sito web il bot userà per accorciare un URL."
#: config.py:95 #: config.py:94
msgid "" msgid ""
"Determines whether this plugin will bold\n" "Determines whether this plugin will bold\n"
" certain portions of its replies." " certain portions of its replies."
msgstr "" msgstr ""
"Determina se il plugin riporterà in grassetto alcune porzioni delle risposte." "Determina se il plugin riporterà in grassetto alcune porzioni delle risposte."
#: config.py:98 #: config.py:97
msgid "" msgid ""
"If set to a non-empty value, specifies the list of\n" "If set to a non-empty value, specifies the list of\n"
" services to rotate through for the shrinkSnarfer and outFilter." " services to rotate through for the shrinkSnarfer and outFilter."
@ -99,8 +102,13 @@ msgstr ""
"Se impostato ad un valore non vuoto, specifica l'elenco dei servizi a cui\n" "Se impostato ad un valore non vuoto, specifica l'elenco dei servizi a cui\n"
" rivolgersi per le variabili shrinkSnarfer e outFilter." " rivolgersi per le variabili shrinkSnarfer e outFilter."
#: plugin.py:171 #: plugin.py:90
#, docstring msgid ""
"This plugin features commands to shorten URLs through different services,\n"
" like tinyurl."
msgstr ""
#: plugin.py:192
msgid "" msgid ""
"<url>\n" "<url>\n"
"\n" "\n"
@ -112,8 +120,7 @@ msgstr ""
" Restituisce una versione di ln-s.net di <url>.\n" " Restituisce una versione di ln-s.net di <url>.\n"
" " " "
#: plugin.py:196 #: plugin.py:219
#, docstring
msgid "" msgid ""
"<url>\n" "<url>\n"
"\n" "\n"
@ -125,21 +132,7 @@ msgstr ""
" Restituisce una versione di TinyURL.com di <url>\n" " Restituisce una versione di TinyURL.com di <url>\n"
" " " "
#: plugin.py:224 #: plugin.py:252
#, docstring
msgid ""
"<url>\n"
"\n"
" Returns an xrl.us version of <url>.\n"
" "
msgstr ""
"<url>\n"
"\n"
" Restituisce una versione di xrl.us di <url>.\n"
" "
#: plugin.py:255
#, docstring
msgid "" msgid ""
"<url>\n" "<url>\n"
"\n" "\n"
@ -151,8 +144,20 @@ msgstr ""
" Restituisce una versione di goo.gl di <url>.\n" " Restituisce una versione di goo.gl di <url>.\n"
" " " "
#: plugin.py:281 #: plugin.py:282
#, docstring #, fuzzy
msgid ""
"<url>\n"
"\n"
" Returns an ur1 version of <url>.\n"
" "
msgstr ""
"<url>\n"
"\n"
" Restituisce una versione di xrl.us di <url>.\n"
" "
#: plugin.py:309
msgid "" msgid ""
"<url>\n" "<url>\n"
"\n" "\n"
@ -164,3 +169,26 @@ msgstr ""
" Restituisce una versione di x0.no di <url>.\n" " Restituisce una versione di x0.no di <url>.\n"
" " " "
#: plugin.py:336
#, fuzzy
msgid ""
"<url>\n"
"\n"
" Returns an expanded version of <url>.\n"
" "
msgstr ""
"<url>\n"
"\n"
" Restituisce una versione di x0.no di <url>.\n"
" "
#~ msgid ""
#~ "<url>\n"
#~ "\n"
#~ " Returns an xrl.us version of <url>.\n"
#~ " "
#~ msgstr ""
#~ "<url>\n"
#~ "\n"
#~ " Restituisce una versione di xrl.us di <url>.\n"
#~ " "

View File

@ -5,7 +5,7 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2014-12-20 11:59+EET\n" "POT-Creation-Date: 2015-01-24 19:31+CET\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -24,7 +24,7 @@ msgstr ""
#: config.py:45 config.py:49 #: config.py:45 config.py:49
#, docstring #, docstring
msgid "Valid values include 'ln', 'tiny', 'xrl', 'goo', 'ur1', and 'x0'." msgid "Valid values include 'ln', 'tiny', 'goo', 'ur1', and 'x0'."
msgstr "" msgstr ""
#: config.py:70 #: config.py:70
@ -106,16 +106,7 @@ msgid ""
" " " "
msgstr "" msgstr ""
#: plugin.py:248 #: plugin.py:252
#, docstring
msgid ""
"<url>\n"
"\n"
" Returns an xrl.us version of <url>.\n"
" "
msgstr ""
#: plugin.py:281
#, docstring #, docstring
msgid "" msgid ""
"<url>\n" "<url>\n"
@ -124,7 +115,7 @@ msgid ""
" " " "
msgstr "" msgstr ""
#: plugin.py:311 #: plugin.py:282
#, docstring #, docstring
msgid "" msgid ""
"<url>\n" "<url>\n"
@ -133,7 +124,7 @@ msgid ""
" " " "
msgstr "" msgstr ""
#: plugin.py:338 #: plugin.py:309
#, docstring #, docstring
msgid "" msgid ""
"<url>\n" "<url>\n"
@ -142,7 +133,7 @@ msgid ""
" " " "
msgstr "" msgstr ""
#: plugin.py:365 #: plugin.py:336
#, docstring #, docstring
msgid "" msgid ""
"<url>\n" "<url>\n"

View File

@ -229,35 +229,6 @@ class ShrinkUrl(callbacks.PluginRegexp):
irc.errorPossibleBug(str(e)) irc.errorPossibleBug(str(e))
tiny = thread(wrap(tiny, ['httpUrl'])) tiny = thread(wrap(tiny, ['httpUrl']))
_xrlApi = 'http://metamark.net/api/rest/simple'
@retry
def _getXrlUrl(self, url):
quotedurl = utils.web.urlquote(url)
try:
return self.db.get('xrl', quotedurl)
except KeyError:
data = utils.web.urlencode({'long_url': url})
text = utils.web.getUrl(self._xrlApi, data=data).decode()
if text.startswith('ERROR:'):
raise ShrinkError(text[6:])
self.db.set('xrl', quotedurl, text)
return text
@internationalizeDocstring
def xrl(self, irc, msg, args, url):
"""<url>
Returns an xrl.us version of <url>.
"""
try:
xrlurl = self._getXrlUrl(url)
m = irc.reply(xrlurl)
if m is not None:
m.tag('shrunken')
except ShrinkError as e:
irc.error(str(e))
xrl = thread(wrap(xrl, ['httpUrl']))
_gooApi = 'https://www.googleapis.com/urlshortener/v1/url' _gooApi = 'https://www.googleapis.com/urlshortener/v1/url'
@retry @retry
def _getGooUrl(self, url): def _getGooUrl(self, url):

View File

@ -41,8 +41,6 @@ class ShrinkUrlTestCase(ChannelPluginTestCase):
(udUrl, r'http://tinyurl.com/u479')], (udUrl, r'http://tinyurl.com/u479')],
'ln': [(sfUrl, r'http://ln-s.net/\+PE-'), 'ln': [(sfUrl, r'http://ln-s.net/\+PE-'),
(udUrl, r'http://ln-s.net/2\$K')], (udUrl, r'http://ln-s.net/2\$K')],
'xrl': [(sfUrl, r'http://xrl.us/bfq8ik'),
(udUrl, r'http://xrl.us/bfnyji')],
'goo': [(sfUrl, r'http://goo.gl/3c59N'), 'goo': [(sfUrl, r'http://goo.gl/3c59N'),
(udUrl, r'http://goo.gl/ocTga')], (udUrl, r'http://goo.gl/ocTga')],
'ur1': [(sfUrl, r'http://ur1.ca/9xl25'), 'ur1': [(sfUrl, r'http://ur1.ca/9xl25'),
@ -98,9 +96,6 @@ class ShrinkUrlTestCase(ChannelPluginTestCase):
def testLnsnarf(self): def testLnsnarf(self):
self._snarf('ln') self._snarf('ln')
def testXrlsnarf(self):
self._snarf('xrl')
def testGoosnarf(self): def testGoosnarf(self):
self._snarf('goo') self._snarf('goo')

View File

@ -500,6 +500,7 @@ class User(callbacks.Plugin):
r'-----BEGIN PGP SIGNATURE-----\r?\n.*' r'-----BEGIN PGP SIGNATURE-----\r?\n.*'
r'\r?\n-----END PGP SIGNATURE-----', r'\r?\n-----END PGP SIGNATURE-----',
re.S) re.S)
@internationalizeDocstring @internationalizeDocstring
def auth(self, irc, msg, args, url): def auth(self, irc, msg, args, url):
"""<url> """<url>
@ -523,7 +524,7 @@ class User(callbacks.Plugin):
'Authentication aborted.'), Raise=True) 'Authentication aborted.'), Raise=True)
verified = gpg.keyring.verify(data) verified = gpg.keyring.verify(data)
if verified and verified.valid: if verified and verified.valid:
keyid = verified.key_id keyid = verified.pubkey_fingerprint[-16:]
prefix, expiry = self._tokens.pop(token) prefix, expiry = self._tokens.pop(token)
found = False found = False
for (id, user) in ircdb.users.items(): for (id, user) in ircdb.users.items():

View File

@ -36,6 +36,7 @@ import time
import datetime import datetime
import tempfile import tempfile
import subprocess import subprocess
from math import ceil
debug = '--debug' in sys.argv debug = '--debug' in sys.argv
@ -142,7 +143,7 @@ try:
if self._total_files//10 != 0 and \ if self._total_files//10 != 0 and \
self._refactored_files % (self._total_files//10) == 0: self._refactored_files % (self._total_files//10) == 0:
print('Refactoring files: %i%% (%i on %i).' % print('Refactoring files: %i%% (%i on %i).' %
(self._refactored_files/(self._total_files//10)*10, (ceil(self._refactored_files*100./self._total_files),
self._refactored_files, self._total_files)) self._refactored_files, self._total_files))
self._refactored_files += 1 self._refactored_files += 1
return super(DistutilsRefactoringTool, self).refactor_file( return super(DistutilsRefactoringTool, self).refactor_file(

View File

@ -70,7 +70,8 @@ def import_conf():
conf = __import__('supybot.conf').conf conf = __import__('supybot.conf').conf
conf.registerGlobalValue(conf.supybot, 'language', conf.registerGlobalValue(conf.supybot, 'language',
conf.registry.String(currentLocale, """Determines the bot's default conf.registry.String(currentLocale, """Determines the bot's default
language. Valid values are things like en, fr, de, etc.""")) language if translations exist. Currently supported are 'en', 'de',
'es', 'fi', 'fr' and 'it'."""))
conf.supybot.language.addCallback(reloadLocalesIfRequired) conf.supybot.language.addCallback(reloadLocalesIfRequired)
def getPluginDir(plugin_name): def getPluginDir(plugin_name):

View File

@ -667,40 +667,17 @@ for (k, v) in mircColors.items():
def standardSubstitute(irc, msg, text, env=None): def standardSubstitute(irc, msg, text, env=None):
"""Do the standard set of substitutions on text, and return it""" """Do the standard set of substitutions on text, and return it"""
if isChannel(msg.args[0]):
channel = msg.args[0]
else:
channel = 'somewhere'
def randInt(): def randInt():
return str(random.randint(-1000, 1000)) return str(random.randint(-1000, 1000))
def randDate(): def randDate():
t = pow(2,30)*random.random()+time.time()/4.0 t = pow(2,30)*random.random()+time.time()/4.0
return time.ctime(t) return time.ctime(t)
def randNick():
if channel != 'somewhere':
L = list(irc.state.channels[channel].users)
if len(L) > 1:
n = msg.nick
while n == msg.nick:
n = utils.iter.choice(L)
return n
else:
return msg.nick
else:
return 'someone'
ctime = time.strftime("%a %b %d %H:%M:%S %Y") ctime = time.strftime("%a %b %d %H:%M:%S %Y")
localtime = time.localtime() localtime = time.localtime()
gmtime = time.strftime("%a %b %d %H:%M:%S %Y", time.gmtime()) gmtime = time.strftime("%a %b %d %H:%M:%S %Y", time.gmtime())
vars = CallableValueIrcDict({ vars = CallableValueIrcDict({
'who': msg.nick,
'nick': msg.nick,
'user': msg.user,
'host': msg.host,
'channel': channel,
'botnick': irc.nick,
'now': ctime, 'ctime': ctime, 'now': ctime, 'ctime': ctime,
'utc': gmtime, 'gmt': gmtime, 'utc': gmtime, 'gmt': gmtime,
'randnick': randNick, 'randomnick': randNick,
'randdate': randDate, 'randomdate': randDate, 'randdate': randDate, 'randomdate': randDate,
'rand': randInt, 'randint': randInt, 'randomint': randInt, 'rand': randInt, 'randint': randInt, 'randomint': randInt,
'today': time.strftime('%d %b %Y', localtime), 'today': time.strftime('%d %b %Y', localtime),
@ -715,8 +692,48 @@ def standardSubstitute(irc, msg, text, env=None):
'tz': time.strftime('%Z', localtime), 'tz': time.strftime('%Z', localtime),
'version': 'Supybot %s' % version, 'version': 'Supybot %s' % version,
}) })
if msg.reply_env: if irc:
vars.update(msg.reply_env) vars.update({
'botnick': irc.nick,
})
if msg:
vars.update({
'who': msg.nick,
'nick': msg.nick,
'user': msg.user,
'host': msg.host,
})
if msg.reply_env:
vars.update(msg.reply_env)
if irc and msg:
if isChannel(msg.args[0]):
channel = msg.args[0]
else:
channel = 'somewhere'
def randNick():
if channel != 'somewhere':
L = list(irc.state.channels[channel].users)
if len(L) > 1:
n = msg.nick
while n == msg.nick:
n = utils.iter.choice(L)
return n
else:
return msg.nick
else:
return 'someone'
vars.update({
'randnick': randNick, 'randomnick': randNick,
'channel': channel,
})
else:
vars.update({
'channel': 'somewhere',
'randnick': 'someone', 'randomnick': 'someone',
})
if env is not None: if env is not None:
vars.update(env) vars.update(env)
t = string.Template(text) t = string.Template(text)

View File

@ -216,6 +216,9 @@ class FunctionsTestCase(SupyTestCase):
vars = {'foo': 'bar', 'b': 'c', 'i': 100, vars = {'foo': 'bar', 'b': 'c', 'i': 100,
'f': lambda: 'called'} 'f': lambda: 'called'}
self.assertEqual(f(irc, msg, '$foo', vars), 'bar') self.assertEqual(f(irc, msg, '$foo', vars), 'bar')
self.assertEqual(f(irc, None, '$foo', vars), 'bar')
self.assertEqual(f(None, None, '$foo', vars), 'bar')
self.assertEqual(f(None, msg, '$foo', vars), 'bar')
self.assertEqual(f(irc, msg, '${foo}', vars), 'bar') self.assertEqual(f(irc, msg, '${foo}', vars), 'bar')
self.assertEqual(f(irc, msg, '$b', vars), 'c') self.assertEqual(f(irc, msg, '$b', vars), 'c')
self.assertEqual(f(irc, msg, '${b}', vars), 'c') self.assertEqual(f(irc, msg, '${b}', vars), 'c')