Internationalize Channel

This commit is contained in:
Valentin Lorentz 2010-10-16 10:17:51 +02:00
parent 24ac2c0729
commit 83c066eeab
3 changed files with 724 additions and 62 deletions

View File

@ -32,6 +32,8 @@
import supybot.conf as conf
import supybot.utils as utils
import supybot.registry as registry
from supybot.i18n import PluginInternationalization, internationalizeDocstring
_ = PluginInternationalization('Channel')
def configure(advanced):
# This will be called by supybot to configure this module. advanced is
@ -43,8 +45,8 @@ def configure(advanced):
Channel = conf.registerPlugin('Channel')
conf.registerChannelValue(Channel, 'alwaysRejoin',
registry.Boolean(True, """Determines whether the bot will always try to
rejoin a channel whenever it's kicked from the channel."""))
registry.Boolean(True, _("""Determines whether the bot will always try to
rejoin a channel whenever it's kicked from the channel.""")))
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:

View File

@ -0,0 +1,621 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR ORGANIZATION
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2010-10-16 10:17+CEST\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: ENCODING\n"
"Generated-By: pygettext.py 1.5\n"
#: config.py:48
msgid ""
"Determines whether the bot will always try to\n"
" rejoin a channel whenever it's kicked from the channel."
msgstr ""
#: plugin.py:69
#, docstring
msgid ""
"[<channel>] <mode> [<arg> ...]\n"
"\n"
" Sets the mode in <channel> to <mode>, sending the arguments given.\n"
" <channel> is only necessary if the message isn't sent in the channel\n"
" itself.\n"
" "
msgstr ""
#: plugin.py:76
msgid "change the mode"
msgstr ""
#: plugin.py:80
#, docstring
msgid ""
"[<channel>] [<limit>]\n"
"\n"
" Sets the channel limit to <limit>. If <limit> is 0, or isn't given,\n"
" removes the channel limit. <channel> is only necessary if the message\n"
" isn't sent in the channel itself.\n"
" "
msgstr ""
#: plugin.py:90
msgid "change the limit"
msgstr ""
#: plugin.py:95
#, docstring
msgid ""
"[<channel>]\n"
"\n"
" Sets +m on <channel>, making it so only ops and voiced users can\n"
" send messages to the channel. <channel> is only necessary if the\n"
" message isn't sent in the channel itself.\n"
" "
msgstr ""
#: plugin.py:102
msgid "moderate the channel"
msgstr ""
#: plugin.py:106
#, docstring
msgid ""
"[<channel>]\n"
"\n"
" Sets -m on <channel>, making it so everyone can\n"
" send messages to the channel. <channel> is only necessary if the\n"
" message isn't sent in the channel itself.\n"
" "
msgstr ""
#: plugin.py:114
msgid "unmoderate the channel"
msgstr ""
#: plugin.py:118
#, docstring
msgid ""
"[<channel>] [<key>]\n"
"\n"
" Sets the keyword in <channel> to <key>. If <key> is not given, removes\n"
" the keyword requirement to join <channel>. <channel> is only necessary\n"
" if the message isn't sent in the channel itself.\n"
" "
msgstr ""
#: plugin.py:130
msgid "change the keyword"
msgstr ""
#: plugin.py:135
#, docstring
msgid ""
"[<channel>] [<nick> ...]\n"
"\n"
" If you have the #channel,op capability, this will give all the <nick>s\n"
" you provide ops. If you don't provide any <nick>s, this will op you.\n"
" <channel> is only necessary if the message isn't sent in the channel\n"
" itself.\n"
" "
msgstr ""
#: plugin.py:147
msgid "op someone"
msgstr ""
#: plugin.py:151
#, docstring
msgid ""
"[<channel>] [<nick> ...]\n"
"\n"
" If you have the #channel,halfop capability, this will give all the\n"
" <nick>s you provide halfops. If you don't provide any <nick>s, this\n"
" will give you halfops. <channel> is only necessary if the message isn't\n"
" sent in the channel itself.\n"
" "
msgstr ""
#: plugin.py:163
msgid "halfop someone"
msgstr ""
#: plugin.py:168
#, docstring
msgid ""
"[<channel>] [<nick> ...]\n"
"\n"
" If you have the #channel,voice capability, this will voice all the\n"
" <nick>s you provide. If you don't provide any <nick>s, this will\n"
" voice you. <channel> is only necessary if the message isn't sent in the\n"
" channel itself.\n"
" "
msgstr ""
#: plugin.py:190
msgid "voice someone"
msgstr ""
#: plugin.py:195
#, docstring
msgid ""
"[<channel>] [<nick> ...]\n"
"\n"
" If you have the #channel,op capability, this will remove operator\n"
" privileges from all the nicks given. If no nicks are given, removes\n"
" operator privileges from the person sending the message.\n"
" "
msgstr ""
#: plugin.py:202
msgid "I cowardly refuse to deop myself. If you really want me deopped, tell me to op you and then deop me yourself."
msgstr ""
#: plugin.py:210
msgid "deop someone"
msgstr ""
#: plugin.py:215
#, docstring
msgid ""
"[<channel>] [<nick> ...]\n"
"\n"
" If you have the #channel,op capability, this will remove half-operator\n"
" privileges from all the nicks given. If no nicks are given, removes\n"
" half-operator privileges from the person sending the message.\n"
" "
msgstr ""
#: plugin.py:222
msgid "I cowardly refuse to dehalfop myself. If you really want me dehalfopped, tell me to op you and then dehalfop me yourself."
msgstr ""
#: plugin.py:230
msgid "dehalfop someone"
msgstr ""
#: plugin.py:235
#, docstring
msgid ""
"[<channel>] [<nick> ...]\n"
"\n"
" If you have the #channel,op capability, this will remove voice from all\n"
" the nicks given. If no nicks are given, removes voice from the person\n"
" sending the message.\n"
" "
msgstr ""
#: plugin.py:242
msgid "I cowardly refuse to devoice myself. If you really want me devoiced, tell me to op you and then devoice me yourself."
msgstr ""
#: plugin.py:255
#, docstring
msgid ""
"[<channel>]\n"
"\n"
" If you have the #channel,op capability, this will cause the bot to\n"
" \"cycle\", or PART and then JOIN the channel. <channel> is only necessary\n"
" if the message isn't sent in the channel itself.\n"
" "
msgstr ""
#: plugin.py:268
#, docstring
msgid ""
"[<channel>] <nick>[, <nick>, ...] [<reason>]\n"
"\n"
" Kicks <nick>(s) from <channel> for <reason>. If <reason> isn't given,\n"
" uses the nick of the person making the command as the reason.\n"
" <channel> is only necessary if the message isn't sent in the channel\n"
" itself.\n"
" "
msgstr ""
#: plugin.py:276
msgid "I cowardly refuse to kick myself."
msgstr ""
#: plugin.py:281
msgid "The reason you gave is longer than the allowed length for a KICK reason on this server."
msgstr ""
#: plugin.py:286
msgid "kick someone"
msgstr ""
#: plugin.py:292
#, docstring
msgid ""
"[<channel>] [--{exact,nick,user,host}] <nick> [<seconds>] [<reason>]\n"
"\n"
" If you have the #channel,op capability, this will kickban <nick> for\n"
" as many seconds as you specify, or else (if you specify 0 seconds or\n"
" don't specify a number of seconds) it will ban the person indefinitely.\n"
" --exact bans only the exact hostmask; --nick bans just the nick;\n"
" --user bans just the user, and --host bans just the host. You can\n"
" combine these options as you choose. <reason> is a reason to give for\n"
" the kick.\n"
" <channel> is only necessary if the message isn't sent in the channel\n"
" itself.\n"
" "
msgstr ""
#: plugin.py:311
msgid "I cowardly refuse to kickban myself."
msgstr ""
#: plugin.py:318
msgid "I haven't seen %s."
msgstr ""
#: plugin.py:326
msgid "I cowardly refuse to ban myself."
msgstr ""
#: plugin.py:352
msgid "%s has %s too, you can't ban him/her/it."
msgstr ""
#: plugin.py:364
msgid "kick or ban someone"
msgstr ""
#: plugin.py:371
#, docstring
msgid ""
"[<channel>] [<hostmask>]\n"
"\n"
" Unbans <hostmask> on <channel>. If <hostmask> is not given, unbans\n"
" any hostmask currently banned on <channel> that matches your current\n"
" hostmask. Especially useful for unbanning yourself when you get\n"
" unexpectedly (or accidentally) banned from the channel. <channel> is\n"
" only necessary if the message isn't sent in the channel itself.\n"
" "
msgstr ""
#: plugin.py:388
msgid "All bans on %s matching %s have been removed."
msgstr ""
#: plugin.py:392
msgid "No bans matching %s were found on %s."
msgstr ""
#: plugin.py:395
msgid "unban someone"
msgstr ""
#: plugin.py:400
#, docstring
msgid ""
"[<channel>] <nick>\n"
"\n"
" If you have the #channel,op capability, this will invite <nick>\n"
" to join <channel>. <channel> is only necessary if the message isn't\n"
" sent in the channel itself.\n"
" "
msgstr ""
#: plugin.py:409
msgid "haveOp"
msgstr ""
#: plugin.py:409
msgid "invite someone"
msgstr ""
#: plugin.py:428
msgid "%s is already in %s."
msgstr ""
#: plugin.py:435
msgid "There is no %s on this network."
msgstr ""
#: plugin.py:447
#, docstring
msgid ""
"[<channel>]\n"
"\n"
" If you have the #channel,op capability, this will \"lobotomize\" the\n"
" bot, making it silent and unanswering to all requests made in the\n"
" channel. <channel> is only necessary if the message isn't sent in\n"
" the channel itself.\n"
" "
msgstr ""
#: plugin.py:462
#, docstring
msgid ""
"[<channel>]\n"
"\n"
" If you have the #channel,op capability, this will unlobotomize the\n"
" bot, making it respond to requests made in the channel again.\n"
" <channel> is only necessary if the message isn't sent in the channel\n"
" itself.\n"
" "
msgstr ""
#: plugin.py:477
#, docstring
msgid ""
"takes no arguments\n"
"\n"
" Returns the channels in which this bot is lobotomized.\n"
" "
msgstr ""
#: plugin.py:492
msgid "I'm currently lobotomized in %L."
msgstr ""
#: plugin.py:495
msgid "I'm not currently lobotomized in any channels that you're in."
msgstr ""
#: plugin.py:502
#, docstring
msgid ""
"[<channel>] <nick|hostmask> [<expires>]\n"
"\n"
" If you have the #channel,op capability, this will effect a\n"
" persistent ban from interacting with the bot on the given\n"
" <hostmask> (or the current hostmask associated with <nick>. Other\n"
" plugins may enforce this ban by actually banning users with\n"
" matching hostmasks when they join. <expires> is an optional\n"
" argument specifying when (in \"seconds from now\") the ban should\n"
" expire; if none is given, the ban will never automatically expire.\n"
" <channel> is only necessary if the message isn't sent in the\n"
" channel itself.\n"
" "
msgstr ""
#: plugin.py:522
#, docstring
msgid ""
"[<channel>] <hostmask>\n"
"\n"
" If you have the #channel,op capability, this will remove the\n"
" persistent ban on <hostmask>. <channel> is only necessary if the\n"
" message isn't sent in the channel itself.\n"
" "
msgstr ""
#: plugin.py:534
msgid "There are no persistent bans for that hostmask."
msgstr ""
#: plugin.py:539
#, docstring
msgid ""
"[<channel>]\n"
"\n"
" If you have the #channel,op capability, this will show you the\n"
" current persistent bans on #channel.\n"
" "
msgstr ""
#: plugin.py:549
msgid "%q (expires %t)"
msgstr ""
#: plugin.py:552
msgid "%q (never expires)"
msgstr ""
#: plugin.py:556
msgid "There are no persistent bans on %s."
msgstr ""
#: plugin.py:563
#, docstring
msgid ""
"[<channel>] <nick|hostmask> [<expires>]\n"
"\n"
" If you have the #channel,op capability, this will set a persistent\n"
" ignore on <hostmask> or the hostmask currently\n"
" associated with <nick>. <expires> is an optional argument\n"
" specifying when (in \"seconds from now\") the ignore will expire; if\n"
" it isn't given, the ignore will never automatically expire.\n"
" <channel> is only necessary if the message isn't sent in the\n"
" channel itself.\n"
" "
msgstr ""
#: plugin.py:581
#, docstring
msgid ""
"[<channel>] <hostmask>\n"
"\n"
" If you have the #channel,op capability, this will remove the\n"
" persistent ignore on <hostmask> in the channel. <channel> is only\n"
" necessary if the message isn't sent in the channel itself.\n"
" "
msgstr ""
#: plugin.py:593
msgid "There are no ignores for that hostmask."
msgstr ""
#: plugin.py:598
#, docstring
msgid ""
"[<channel>]\n"
"\n"
" Lists the hostmasks that the bot is ignoring on the given channel.\n"
" <channel> is only necessary if the message isn't sent in the\n"
" channel itself.\n"
" "
msgstr ""
#: plugin.py:607
msgid "I'm not currently ignoring any hostmasks in %q"
msgstr ""
#: plugin.py:618
#, docstring
msgid ""
"[<channel>] <nick|username> <capability> [<capability> ...]\n"
"\n"
" If you have the #channel,op capability, this will give the user\n"
" <name> (or the user to whom <nick> maps)\n"
" the capability <capability> in the channel. <channel> is only\n"
" necessary if the message isn't sent in the channel itself.\n"
" "
msgstr ""
#: plugin.py:634
#, docstring
msgid ""
"[<channel>] <name|hostmask> <capability> [<capability> ...]\n"
"\n"
" If you have the #channel,op capability, this will take from the\n"
" user currently identified as <name> (or the user to whom <hostmask>\n"
" maps) the capability <capability> in the channel. <channel> is only\n"
" necessary if the message isn't sent in the channel itself.\n"
" "
msgstr ""
#: plugin.py:653
msgid "That user didn't have the %L %s."
msgstr ""
#: plugin.py:662
#, docstring
msgid ""
"[<channel>] {True|False}\n"
"\n"
" If you have the #channel,op capability, this will set the default\n"
" response to non-power-related (that is, not {op, halfop, voice}\n"
" capabilities to be the value you give. <channel> is only necessary\n"
" if the message isn't sent in the channel itself.\n"
" "
msgstr ""
#: plugin.py:680
#, docstring
msgid ""
"[<channel>] <capability> [<capability> ...]\n"
"\n"
" If you have the #channel,op capability, this will add the channel\n"
" capability <capability> for all users in the channel. <channel> is\n"
" only necessary if the message isn't sent in the channel itself.\n"
" "
msgstr ""
#: plugin.py:695
#, docstring
msgid ""
"[<channel>] <capability> [<capability> ...]\n"
"\n"
" If you have the #channel,op capability, this will unset the channel\n"
" capability <capability> so each user's specific capability or the\n"
" channel default capability will take precedence. <channel> is only\n"
" necessary if the message isn't sent in the channel itself.\n"
" "
msgstr ""
#: plugin.py:711
msgid "capability"
msgstr ""
#: plugin.py:714
msgid "I do not know about the %L %s."
msgstr ""
#: plugin.py:721
#, docstring
msgid ""
"[<channel>]\n"
"\n"
" Returns the capabilities present on the <channel>. <channel> is\n"
" only necessary if the message isn't sent in the channel itself.\n"
" "
msgstr ""
#: plugin.py:733
#, docstring
msgid ""
"[<channel>] [<plugin>] [<command>]\n"
"\n"
" If you have the #channel,op capability, this will disable the <command>\n"
" in <channel>. If <plugin> is provided, <command> will be disabled only\n"
" for that plugin. If only <plugin> is provided, all commands in the\n"
" given plugin will be disabled. <channel> is only necessary if the\n"
" message isn't sent in the channel itself.\n"
" "
msgstr ""
#: plugin.py:749 plugin.py:788
msgid "The %s plugin does not have a command called %s."
msgstr ""
#: plugin.py:756 plugin.py:795
msgid "No plugin or command named %s could be found."
msgstr ""
#: plugin.py:772
#, docstring
msgid ""
"[<channel>] [<plugin>] [<command>]\n"
"\n"
" If you have the #channel,op capability, this will enable the <command>\n"
" in <channel> if it has been disabled. If <plugin> is provided,\n"
" <command> will be enabled only for that plugin. If only <plugin> is\n"
" provided, all commands in the given plugin will be enabled. <channel>\n"
" is only necessary if the message isn't sent in the channel itself.\n"
" "
msgstr ""
#: plugin.py:809
msgid "%s was not disabled."
msgstr ""
#: plugin.py:818
#, docstring
msgid ""
"[<channel>]\n"
"\n"
" Returns the nicks in <channel>. <channel> is only necessary if the\n"
" message isn't sent in the channel itself.\n"
" "
msgstr ""
#: plugin.py:829
msgid "You don't have access to that information."
msgstr ""
#: plugin.py:837
#, docstring
msgid ""
"Internal message for notifying all the #channel,ops in a channel of\n"
" a given situation."
msgstr ""
#: plugin.py:840
msgid "Alert to all %s ops: %s"
msgstr ""
#: plugin.py:842
msgid " (from %s)"
msgstr ""
#: plugin.py:850
#, docstring
msgid ""
"[<channel>] <text>\n"
"\n"
" Sends <text> to all the users in <channel> who have the <channel>,op\n"
" capability.\n"
" "
msgstr ""

View File

@ -38,6 +38,8 @@ import supybot.ircmsgs as ircmsgs
import supybot.schedule as schedule
import supybot.ircutils as ircutils
import supybot.callbacks as callbacks
from supybot.i18n import PluginInternationalization, internationalizeDocstring
_ = PluginInternationalization('Channel')
class Channel(callbacks.Plugin):
def __init__(self, irc):
@ -62,6 +64,7 @@ class Channel(callbacks.Plugin):
irc.queueMsg(f(nicks[i:i + numModes]))
irc.noReply()
@internationalizeDocstring
def mode(self, irc, msg, args, channel, modes):
"""[<channel>] <mode> [<arg> ...]
@ -70,8 +73,9 @@ class Channel(callbacks.Plugin):
itself.
"""
self._sendMsg(irc, ircmsgs.mode(channel, modes))
mode = wrap(mode, ['op', ('haveOp', 'change the mode'), many('something')])
mode = wrap(mode, ['op', ('haveOp', _('change the mode')), many('something')])
@internationalizeDocstring
def limit(self, irc, msg, args, channel, limit):
"""[<channel>] [<limit>]
@ -83,9 +87,10 @@ class Channel(callbacks.Plugin):
self._sendMsg(irc, ircmsgs.mode(channel, ['+l', limit]))
else:
self._sendMsg(irc, ircmsgs.mode(channel, ['-l']))
limit = wrap(limit, ['op', ('haveOp', 'change the limit'),
limit = wrap(limit, ['op', ('haveOp', _('change the limit')),
additional('nonNegativeInt', 0)])
@internationalizeDocstring
def moderate(self, irc, msg, args, channel):
"""[<channel>]
@ -94,8 +99,9 @@ class Channel(callbacks.Plugin):
message isn't sent in the channel itself.
"""
self._sendMsg(irc, ircmsgs.mode(channel, ['+m']))
moderate = wrap(moderate, ['op', ('haveOp', 'moderate the channel')])
moderate = wrap(moderate, ['op', ('haveOp', _('moderate the channel'))])
@internationalizeDocstring
def unmoderate(self, irc, msg, args, channel):
"""[<channel>]
@ -104,8 +110,10 @@ class Channel(callbacks.Plugin):
message isn't sent in the channel itself.
"""
self._sendMsg(irc, ircmsgs.mode(channel, ['-m']))
unmoderate = wrap(unmoderate, ['op', ('haveOp', 'unmoderate the channel')])
unmoderate = wrap(unmoderate, ['op', ('haveOp',
_('unmoderate the channel'))])
@internationalizeDocstring
def key(self, irc, msg, args, channel, key):
"""[<channel>] [<key>]
@ -119,9 +127,10 @@ class Channel(callbacks.Plugin):
self._sendMsg(irc, ircmsgs.mode(channel, ['+k', key]))
else:
self._sendMsg(irc, ircmsgs.mode(channel, ['-k']))
key = wrap(key, ['op', ('haveOp', 'change the keyword'),
key = wrap(key, ['op', ('haveOp', _('change the keyword')),
additional('somethingWithoutSpaces', '')])
@internationalizeDocstring
def op(self, irc, msg, args, channel, nicks):
"""[<channel>] [<nick> ...]
@ -135,8 +144,9 @@ class Channel(callbacks.Plugin):
def f(L):
return ircmsgs.ops(channel, L)
self._sendMsgs(irc, nicks, f)
op = wrap(op, ['op', ('haveOp', 'op someone'), any('nickInChannel')])
op = wrap(op, ['op', ('haveOp', _('op someone')), any('nickInChannel')])
@internationalizeDocstring
def halfop(self, irc, msg, args, channel, nicks):
"""[<channel>] [<nick> ...]
@ -150,9 +160,10 @@ class Channel(callbacks.Plugin):
def f(L):
return ircmsgs.halfops(channel, L)
self._sendMsgs(irc, nicks, f)
halfop = wrap(halfop, ['halfop', ('haveOp', 'halfop someone'),
halfop = wrap(halfop, ['halfop', ('haveOp', _('halfop someone')),
any('nickInChannel')])
@internationalizeDocstring
def voice(self, irc, msg, args, channel, nicks):
"""[<channel>] [<nick> ...]
@ -176,9 +187,10 @@ class Channel(callbacks.Plugin):
self._sendMsgs(irc, nicks, f)
else:
irc.errorNoCapability(capability)
voice = wrap(voice, ['channel', ('haveOp', 'voice someone'),
voice = wrap(voice, ['channel', ('haveOp', _('voice someone')),
any('nickInChannel')])
@internationalizeDocstring
def deop(self, irc, msg, args, channel, nicks):
"""[<channel>] [<nick> ...]
@ -187,17 +199,18 @@ class Channel(callbacks.Plugin):
operator privileges from the person sending the message.
"""
if irc.nick in nicks:
irc.error('I cowardly refuse to deop myself. If you really want '
'me deopped, tell me to op you and then deop me '
'yourself.', Raise=True)
irc.error(_('I cowardly refuse to deop myself. If you really '
'want me deopped, tell me to op you and then deop me '
'yourself.'), Raise=True)
if not nicks:
nicks = [msg.nick]
def f(L):
return ircmsgs.deops(channel, L)
self._sendMsgs(irc, nicks, f)
deop = wrap(deop, ['op', ('haveOp', 'deop someone'),
deop = wrap(deop, ['op', ('haveOp', _('deop someone')),
any('nickInChannel')])
@internationalizeDocstring
def dehalfop(self, irc, msg, args, channel, nicks):
"""[<channel>] [<nick> ...]
@ -206,17 +219,18 @@ class Channel(callbacks.Plugin):
half-operator privileges from the person sending the message.
"""
if irc.nick in nicks:
irc.error('I cowardly refuse to dehalfop myself. If you really '
irc.error(_('I cowardly refuse to dehalfop myself. If you really '
'want me dehalfopped, tell me to op you and then '
'dehalfop me yourself.', Raise=True)
'dehalfop me yourself.'), Raise=True)
if not nicks:
nicks = [msg.nick]
def f(L):
return ircmsgs.dehalfops(channel, L)
self._sendMsgs(irc, nicks, f)
dehalfop = wrap(dehalfop, ['halfop', ('haveOp', 'dehalfop someone'),
dehalfop = wrap(dehalfop, ['halfop', ('haveOp', _('dehalfop someone')),
any('nickInChannel')])
@internationalizeDocstring
def devoice(self, irc, msg, args, channel, nicks):
"""[<channel>] [<nick> ...]
@ -225,9 +239,9 @@ class Channel(callbacks.Plugin):
sending the message.
"""
if irc.nick in nicks:
irc.error('I cowardly refuse to devoice myself. If you really '
irc.error(_('I cowardly refuse to devoice myself. If you really '
'want me devoiced, tell me to op you and then devoice '
'me yourself.', Raise=True)
'me yourself.'), Raise=True)
if not nicks:
nicks = [msg.nick]
def f(L):
@ -236,6 +250,7 @@ class Channel(callbacks.Plugin):
devoice = wrap(devoice, ['voice', ('haveOp', 'devoice someone'),
any('nickInChannel')])
@internationalizeDocstring
def cycle(self, irc, msg, args, channel):
"""[<channel>]
@ -248,6 +263,7 @@ class Channel(callbacks.Plugin):
self._sendMsg(irc, networkGroup.channels.join(channel))
cycle = wrap(cycle, ['op'])
@internationalizeDocstring
def kick(self, irc, msg, args, channel, nicks, reason):
"""[<channel>] <nick>[, <nick>, ...] [<reason>]
@ -257,19 +273,20 @@ class Channel(callbacks.Plugin):
itself.
"""
if utils.iter.any(lambda n: ircutils.strEqual(n, irc.nick), nicks):
irc.error('I cowardly refuse to kick myself.', Raise=True)
irc.error(_('I cowardly refuse to kick myself.'), Raise=True)
if not reason:
reason = msg.nick
kicklen = irc.state.supported.get('kicklen', sys.maxint)
if len(reason) > kicklen:
irc.error('The reason you gave is longer than the allowed '
'length for a KICK reason on this server.',
irc.error(_('The reason you gave is longer than the allowed '
'length for a KICK reason on this server.'),
Raise=True)
for nick in nicks:
self._sendMsg(irc, ircmsgs.kick(channel, nick, reason))
kick = wrap(kick, ['op', ('haveOp', 'kick someone'),
kick = wrap(kick, ['op', ('haveOp', _('kick someone')),
commalist('nickInChannel'), additional('text')])
@internationalizeDocstring
def kban(self, irc, msg, args,
channel, optlist, bannedNick, expiry, reason):
"""[<channel>] [--{exact,nick,user,host}] <nick> [<seconds>] [<reason>]
@ -291,14 +308,14 @@ class Channel(callbacks.Plugin):
raise callbacks.ArgumentError
elif bannedNick == irc.nick:
self.log.warning('%q tried to make me kban myself.', msg.prefix)
irc.error('I cowardly refuse to kickban myself.')
irc.error(_('I cowardly refuse to kickban myself.'))
return
if not reason:
reason = msg.nick
try:
bannedHostmask = irc.state.nickToHostmask(bannedNick)
except KeyError:
irc.error(format('I haven\'t seen %s.', bannedNick), Raise=True)
irc.error(format(_('I haven\'t seen %s.'), bannedNick), Raise=True)
capability = ircdb.makeChannelCapability(channel, 'op')
banmaskstyle = conf.supybot.protocols.irc.banmask
banmask = banmaskstyle.makeBanmask(bannedHostmask, [o[0] for o in optlist])
@ -306,7 +323,7 @@ class Channel(callbacks.Plugin):
if ircutils.hostmaskPatternEqual(banmask, irc.prefix):
if ircutils.hostmaskPatternEqual(bannedHostmask, irc.prefix):
self.log.warning('%q tried to make me kban myself.',msg.prefix)
irc.error('I cowardly refuse to ban myself.')
irc.error(_('I cowardly refuse to ban myself.'))
return
else:
self.log.warning('Using exact hostmask since banmask would '
@ -332,8 +349,8 @@ class Channel(callbacks.Plugin):
if ircdb.checkCapability(bannedHostmask, capability):
self.log.warning('%s tried to ban %q, but both have %s',
msg.prefix, bannedHostmask, capability)
irc.error(format('%s has %s too, you can\'t ban him/her/it.',
bannedNick, capability))
irc.error(format(_('%s has %s too, you can\'t ban '
'him/her/it.'), bannedNick, capability))
else:
doBan()
else:
@ -344,11 +361,12 @@ class Channel(callbacks.Plugin):
kban = wrap(kban,
['op',
getopts({'exact':'', 'nick':'', 'user':'', 'host':''}),
('haveOp', 'kick or ban someone'),
('haveOp', _('kick or ban someone')),
'nickInChannel',
optional('expiry', 0),
additional('text')])
@internationalizeDocstring
def unban(self, irc, msg, args, channel, hostmask):
"""[<channel>] [<hostmask>]
@ -367,16 +385,17 @@ class Channel(callbacks.Plugin):
bans.append(banmask)
if bans:
irc.queueMsg(ircmsgs.unbans(channel, bans))
irc.replySuccess(format('All bans on %s matching %s '
'have been removed.',
irc.replySuccess(format(_('All bans on %s matching %s '
'have been removed.'),
channel, msg.prefix))
else:
irc.error('No bans matching %s were found on %s.' %
irc.error(_('No bans matching %s were found on %s.') %
(msg.prefix, channel))
unban = wrap(unban, ['op',
('haveOp', 'unban someone'),
('haveOp', _('unban someone')),
additional('hostmask')])
@internationalizeDocstring
def invite(self, irc, msg, args, channel, nick):
"""[<channel>] <nick>
@ -387,7 +406,7 @@ class Channel(callbacks.Plugin):
nick = nick or msg.nick
self._sendMsg(irc, ircmsgs.invite(nick, channel))
self.invites[(irc.getRealIrc(), ircutils.toLower(nick))] = irc
invite = wrap(invite, ['op', ('haveOp', 'invite someone'),
invite = wrap(invite, ['op', (_('haveOp'), _('invite someone')),
additional('nick')])
def do341(self, irc, msg):
@ -406,14 +425,14 @@ class Channel(callbacks.Plugin):
nick = ircutils.toLower(nick)
replyIrc = self.invites.pop((irc, nick), None)
if replyIrc is not None:
replyIrc.error(format('%s is already in %s.', nick, channel))
replyIrc.error(format(_('%s is already in %s.'), nick, channel))
def do401(self, irc, msg):
nick = msg.args[1]
nick = ircutils.toLower(nick)
replyIrc = self.invites.pop((irc, nick), None)
if replyIrc is not None:
replyIrc.error(format('There is no %s on this network.', nick))
replyIrc.error(format(_('There is no %s on this network.'), nick))
def do504(self, irc, msg):
nick = msg.args[1]
@ -423,6 +442,7 @@ class Channel(callbacks.Plugin):
replyIrc.error(format('There is no %s on this server.', nick))
class lobotomy(callbacks.Commands):
@internationalizeDocstring
def add(self, irc, msg, args, channel):
"""[<channel>]
@ -437,6 +457,7 @@ class Channel(callbacks.Plugin):
irc.replySuccess()
add = wrap(add, ['op'])
@internationalizeDocstring
def remove(self, irc, msg, args, channel):
"""[<channel>]
@ -451,6 +472,7 @@ class Channel(callbacks.Plugin):
irc.replySuccess()
remove = wrap(remove, ['op'])
@internationalizeDocstring
def list(self, irc, msg, args):
"""takes no arguments
@ -467,14 +489,15 @@ class Channel(callbacks.Plugin):
L.append(channel)
if L:
L.sort()
s = format('I\'m currently lobotomized in %L.', L)
s = format(_('I\'m currently lobotomized in %L.'), L)
irc.reply(s)
else:
irc.reply('I\'m not currently lobotomized in any channels '
'that you\'re in.')
irc.reply(_('I\'m not currently lobotomized in any channels '
'that you\'re in.'))
list = wrap(list)
class ban(callbacks.Commands):
@internationalizeDocstring
def add(self, irc, msg, args, channel, banmask, expires):
"""[<channel>] <nick|hostmask> [<expires>]
@ -494,6 +517,7 @@ class Channel(callbacks.Plugin):
irc.replySuccess()
add = wrap(add, ['op', 'banmask', additional('expiry', 0)])
@internationalizeDocstring
def remove(self, irc, msg, args, channel, banmask):
"""[<channel>] <hostmask>
@ -507,9 +531,10 @@ class Channel(callbacks.Plugin):
ircdb.channels.setChannel(channel, c)
irc.replySuccess()
except KeyError:
irc.error('There are no persistent bans for that hostmask.')
irc.error(_('There are no persistent bans for that hostmask.'))
remove = wrap(remove, ['op', 'hostmask'])
@internationalizeDocstring
def list(self, irc, msg, args, channel):
"""[<channel>]
@ -521,18 +546,19 @@ class Channel(callbacks.Plugin):
bans = []
for ban in c.bans:
if c.bans[ban]:
bans.append(format('%q (expires %t)',
bans.append(format(_('%q (expires %t)'),
ban, c.bans[ban]))
else:
bans.append(format('%q (never expires)',
bans.append(format(_('%q (never expires)'),
ban, c.bans[ban]))
irc.reply(format('%L', bans))
else:
irc.reply(format('There are no persistent bans on %s.',
irc.reply(format(_('There are no persistent bans on %s.'),
channel))
list = wrap(list, ['op'])
class ignore(callbacks.Commands):
@internationalizeDocstring
def add(self, irc, msg, args, channel, banmask, expires):
"""[<channel>] <nick|hostmask> [<expires>]
@ -550,6 +576,7 @@ class Channel(callbacks.Plugin):
irc.replySuccess()
add = wrap(add, ['op', 'banmask', additional('expiry', 0)])
@internationalizeDocstring
def remove(self, irc, msg, args, channel, banmask):
"""[<channel>] <hostmask>
@ -563,9 +590,10 @@ class Channel(callbacks.Plugin):
ircdb.channels.setChannel(channel, c)
irc.replySuccess()
except KeyError:
irc.error('There are no ignores for that hostmask.')
irc.error(_('There are no ignores for that hostmask.'))
remove = wrap(remove, ['op', 'hostmask'])
@internationalizeDocstring
def list(self, irc, msg, args, channel):
"""[<channel>]
@ -576,8 +604,8 @@ class Channel(callbacks.Plugin):
# XXX Add the expirations.
c = ircdb.channels.getChannel(channel)
if len(c.ignores) == 0:
s = format('I\'m not currently ignoring any hostmasks in %q',
channel)
s = format(_('I\'m not currently ignoring any hostmasks in '
'%q'), channel)
irc.reply(s)
else:
L = sorted(c.ignores)
@ -585,6 +613,7 @@ class Channel(callbacks.Plugin):
list = wrap(list, ['op'])
class capability(callbacks.Commands):
@internationalizeDocstring
def add(self, irc, msg, args, channel, user, capabilities):
"""[<channel>] <nick|username> <capability> [<capability> ...]
@ -600,6 +629,7 @@ class Channel(callbacks.Plugin):
irc.replySuccess()
add = wrap(add, ['op', 'otherUser', 'capability'])
@internationalizeDocstring
def remove(self, irc, msg, args, channel, user, capabilities):
"""[<channel>] <name|hostmask> <capability> [<capability> ...]
@ -620,13 +650,14 @@ class Channel(callbacks.Plugin):
s = 'capability'
if len(fail) > 1:
s = utils.str.pluralize(s)
irc.error(format('That user didn\'t have the %L %s.', fail, s),
Raise=True)
irc.error(format(_('That user didn\'t have the %L %s.'), fail,
s), Raise=True)
irc.replySuccess()
remove = wrap(remove, ['op', 'otherUser', 'capability'])
# XXX This needs to be fix0red to be like Owner.defaultcapability. Or
# something else. This is a horrible interface.
@internationalizeDocstring
def setdefault(self, irc, msg, args, channel, v):
"""[<channel>] {True|False}
@ -644,6 +675,7 @@ class Channel(callbacks.Plugin):
irc.replySuccess()
setdefault = wrap(setdefault, ['op', 'boolean'])
@internationalizeDocstring
def set(self, irc, msg, args, channel, capabilities):
"""[<channel>] <capability> [<capability> ...]
@ -658,6 +690,7 @@ class Channel(callbacks.Plugin):
irc.replySuccess()
set = wrap(set, ['op', many('capability')])
@internationalizeDocstring
def unset(self, irc, msg, args, channel, capabilities):
"""[<channel>] <capability> [<capability> ...]
@ -675,14 +708,15 @@ class Channel(callbacks.Plugin):
fail.append(c)
ircdb.channels.setChannel(channel, chan)
if fail:
s = 'capability'
s = _('capability')
if len(fail) > 1:
s = utils.str.pluralize(s)
irc.error(format('I do not know about the %L %s.', fail, s),
irc.error(format(_('I do not know about the %L %s.'), fail, s),
Raise=True)
irc.replySuccess()
unset = wrap(unset, ['op', many('capability')])
@internationalizeDocstring
def list(self, irc, msg, args, channel):
"""[<channel>]
@ -694,6 +728,7 @@ class Channel(callbacks.Plugin):
irc.reply(' '.join(L))
list = wrap(list, ['channel'])
@internationalizeDocstring
def disable(self, irc, msg, args, channel, plugin, command):
"""[<channel>] [<plugin>] [<command>]
@ -711,15 +746,15 @@ class Channel(callbacks.Plugin):
if plugin.isCommand(command):
s = '-%s.%s' % (plugin.name(), command)
else:
failMsg = format('The %s plugin does not have a command '
'called %s.', plugin.name(), command)
failMsg = format(_('The %s plugin does not have a command '
'called %s.'), plugin.name(), command)
elif command:
# findCallbackForCommand
if filter(None, irc.findCallbacksForArgs([command])):
s = '-%s' % command
else:
failMsg = format('No plugin or command named %s could be '
'found.', command)
failMsg = format(_('No plugin or command named %s could be '
'found.'), command)
else:
raise callbacks.ArgumentError
if failMsg:
@ -732,6 +767,7 @@ class Channel(callbacks.Plugin):
optional(('plugin', False)),
additional('commandName')])
@internationalizeDocstring
def enable(self, irc, msg, args, channel, plugin, command):
"""[<channel>] [<plugin>] [<command>]
@ -749,15 +785,15 @@ class Channel(callbacks.Plugin):
if plugin.isCommand(command):
s = '-%s.%s' % (plugin.name(), command)
else:
failMsg = format('The %s plugin does not have a command '
'called %s.', plugin.name(), command)
failMsg = format(_('The %s plugin does not have a command '
'called %s.'), plugin.name(), command)
elif command:
# findCallbackForCommand
if filter(None, irc.findCallbacksForArgs([command])):
s = '-%s' % command
else:
failMsg = format('No plugin or command named %s could be '
'found.', command)
failMsg = format(_('No plugin or command named %s could be '
'found.'), command)
else:
raise callbacks.ArgumentError
if failMsg:
@ -770,13 +806,14 @@ class Channel(callbacks.Plugin):
fail.append(s)
ircdb.channels.setChannel(channel, chan)
if fail:
irc.error(format('%s was not disabled.', s[1:]))
irc.error(format(_('%s was not disabled.'), s[1:]))
else:
irc.replySuccess()
enable = wrap(enable, ['op',
optional(('plugin', False)),
additional('commandName')])
@internationalizeDocstring
def nicks(self, irc, msg, args, channel):
"""[<channel>]
@ -789,24 +826,26 @@ class Channel(callbacks.Plugin):
msg.args[0] != channel and \
(ircutils.isChannel(msg.args[0]) or \
msg.nick not in irc.state.channels[channel].users):
irc.error('You don\'t have access to that information.')
irc.error(_('You don\'t have access to that information.'))
L = list(irc.state.channels[channel].users)
utils.sortBy(str.lower, L)
irc.reply(utils.str.commaAndify(L))
nicks = wrap(nicks, ['inChannel'])
@internationalizeDocstring
def alertOps(self, irc, channel, s, frm=None):
"""Internal message for notifying all the #channel,ops in a channel of
a given situation."""
capability = ircdb.makeChannelCapability(channel, 'op')
s = format('Alert to all %s ops: %s', channel, s)
s = format(_('Alert to all %s ops: %s'), channel, s)
if frm is not None:
s += format(' (from %s)', frm)
s += format(_(' (from %s)'), frm)
for nick in irc.state.channels[channel].users:
hostmask = irc.state.nickToHostmask(nick)
if ircdb.checkCapability(hostmask, capability):
irc.reply(s, to=nick, private=True)
@internationalizeDocstring
def alert(self, irc, msg, args, channel, text):
"""[<channel>] <text>