mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-25 19:44:13 +01:00
Started using source-nested plugins.
This commit is contained in:
parent
574e9509b7
commit
65fbb08c7f
@ -63,8 +63,7 @@ class Channel(callbacks.Plugin):
|
|||||||
itself.
|
itself.
|
||||||
"""
|
"""
|
||||||
self._sendMsg(irc, ircmsgs.mode(channel, modes))
|
self._sendMsg(irc, ircmsgs.mode(channel, modes))
|
||||||
mode = wrap(mode,
|
mode = wrap(mode, ['op', ('haveOp', 'change the mode'), many('something')])
|
||||||
['op', ('haveOp', 'change the mode'), many('something')])
|
|
||||||
|
|
||||||
def limit(self, irc, msg, args, channel, limit):
|
def limit(self, irc, msg, args, channel, limit):
|
||||||
"""[<channel>] [<limit>]
|
"""[<channel>] [<limit>]
|
||||||
@ -425,234 +424,264 @@ class Channel(callbacks.Plugin):
|
|||||||
if replyirc is not None:
|
if replyirc is not None:
|
||||||
replyIrc.error(format('There is no %s on this server.', nick))
|
replyIrc.error(format('There is no %s on this server.', nick))
|
||||||
|
|
||||||
def lobotomize(self, irc, msg, args, channel):
|
class lobotomy(callbacks.Commands):
|
||||||
"""[<channel>]
|
def add(self, irc, msg, args, channel):
|
||||||
|
"""[<channel>]
|
||||||
|
|
||||||
If you have the #channel,op capability, this will "lobotomize" the
|
If you have the #channel,op capability, this will "lobotomize" the
|
||||||
bot, making it silent and unanswering to all requests made in the
|
bot, making it silent and unanswering to all requests made in the
|
||||||
channel. <channel> is only necessary if the message isn't sent in the
|
channel. <channel> is only necessary if the message isn't sent in
|
||||||
channel itself.
|
the channel itself.
|
||||||
"""
|
"""
|
||||||
c = ircdb.channels.getChannel(channel)
|
c = ircdb.channels.getChannel(channel)
|
||||||
c.lobotomized = True
|
c.lobotomized = True
|
||||||
ircdb.channels.setChannel(channel, c)
|
ircdb.channels.setChannel(channel, c)
|
||||||
irc.replySuccess()
|
irc.replySuccess()
|
||||||
lobotomize = wrap(lobotomize, ['op'])
|
add = wrap(add, ['op'])
|
||||||
|
|
||||||
def unlobotomize(self, irc, msg, args, channel):
|
def remove(self, irc, msg, args, channel):
|
||||||
"""[<channel>]
|
"""[<channel>]
|
||||||
|
|
||||||
If you have the #channel,op capability, this will unlobotomize the bot,
|
If you have the #channel,op capability, this will unlobotomize the
|
||||||
making it respond to requests made in the channel again.
|
bot, making it respond to requests made in the channel again.
|
||||||
<channel> is only necessary if the message isn't sent in the channel
|
<channel> is only necessary if the message isn't sent in the channel
|
||||||
itself.
|
itself.
|
||||||
"""
|
"""
|
||||||
c = ircdb.channels.getChannel(channel)
|
c = ircdb.channels.getChannel(channel)
|
||||||
c.lobotomized = False
|
c.lobotomized = False
|
||||||
ircdb.channels.setChannel(channel, c)
|
ircdb.channels.setChannel(channel, c)
|
||||||
irc.replySuccess()
|
irc.replySuccess()
|
||||||
unlobotomize = wrap(unlobotomize, ['op'])
|
remove = wrap(remove, ['op'])
|
||||||
|
|
||||||
def permban(self, irc, msg, args, channel, banmask, expires):
|
def list(self, irc, msg, args):
|
||||||
"""[<channel>] <nick|hostmask> [<expires>]
|
"""takes no arguments
|
||||||
|
|
||||||
If you have the #channel,op capability, this will effect a permanent
|
Returns the channels in which this bot is lobotomized.
|
||||||
(persistent) ban from interacting with the bot on the given <hostmask>
|
"""
|
||||||
(or the current hostmask associated with <nick>. Other plugins may
|
L = []
|
||||||
enforce this ban by actually banning users with matching hostmasks when
|
for (channel, c) in ircdb.channels.iteritems():
|
||||||
they join. <expires> is an optional argument specifying when (in
|
if c.lobotomized:
|
||||||
"seconds from now") the ban should expire; if none is given, the ban
|
chancap = ircdb.makeChannelCapability(channel, 'op')
|
||||||
will never automatically expire. <channel> is only necessary if the
|
if ircdb.checkCapability(msg.prefix, 'admin') or \
|
||||||
message isn't sent in the channel itself.
|
ircdb.checkCapability(msg.prefix, chancap) or \
|
||||||
"""
|
(channel in irc.state.channels and \
|
||||||
c = ircdb.channels.getChannel(channel)
|
msg.nick in irc.state.channels[channel].users):
|
||||||
c.addBan(banmask, expires)
|
L.append(channel)
|
||||||
ircdb.channels.setChannel(channel, c)
|
if L:
|
||||||
irc.replySuccess()
|
L.sort()
|
||||||
permban = wrap(permban, ['op', 'hostmask', additional('expiry', 0)])
|
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.')
|
||||||
|
list = wrap(list)
|
||||||
|
|
||||||
def unpermban(self, irc, msg, args, channel, banmask):
|
class ban(callbacks.Commands):
|
||||||
"""[<channel>] <hostmask>
|
def add(self, irc, msg, args, channel, banmask, expires):
|
||||||
|
"""[<channel>] <nick|hostmask> [<expires>]
|
||||||
|
|
||||||
If you have the #channel,op capability, this will remove the permanent
|
If you have the #channel,op capability, this will effect a
|
||||||
ban on <hostmask>. <channel> is only necessary if the message isn't
|
persistent ban from interacting with the bot on the given
|
||||||
sent in the channel itself.
|
<hostmask> (or the current hostmask associated with <nick>. Other
|
||||||
"""
|
plugins may enforce this ban by actually banning users with
|
||||||
c = ircdb.channels.getChannel(channel)
|
matching hostmasks when they join. <expires> is an optional
|
||||||
c.removeBan(banmask)
|
argument specifying when (in "seconds from now") the ban should
|
||||||
ircdb.channels.setChannel(channel, c)
|
expire; if none is given, the ban will never automatically expire.
|
||||||
irc.replySuccess()
|
<channel> is only necessary if the message isn't sent in the
|
||||||
unpermban = wrap(unpermban, ['op', 'hostmask'])
|
channel itself.
|
||||||
|
"""
|
||||||
|
c = ircdb.channels.getChannel(channel)
|
||||||
|
c.addBan(banmask, expires)
|
||||||
|
ircdb.channels.setChannel(channel, c)
|
||||||
|
irc.replySuccess()
|
||||||
|
add = wrap(add, ['op', 'hostmask', additional('expiry', 0)])
|
||||||
|
|
||||||
def permbans(self, irc, msg, args, channel):
|
def remove(self, irc, msg, args, channel, banmask):
|
||||||
"""[<channel>]
|
"""[<channel>] <hostmask>
|
||||||
|
|
||||||
If you have the #channel,op capability, this will show you the
|
If you have the #channel,op capability, this will remove the
|
||||||
current bans on #channel.
|
persistent ban on <hostmask>. <channel> is only necessary if the
|
||||||
"""
|
message isn't sent in the channel itself.
|
||||||
# XXX Add the expirations.
|
"""
|
||||||
c = ircdb.channels.getChannel(channel)
|
c = ircdb.channels.getChannel(channel)
|
||||||
if c.bans:
|
c.removeBan(banmask)
|
||||||
irc.reply(format('%L', map(utils.str.dqrepr, c.bans)))
|
ircdb.channels.setChannel(channel, c)
|
||||||
else:
|
irc.replySuccess()
|
||||||
irc.reply('There are currently no permanent bans on %s' % channel)
|
remove = wrap(remove, ['op', 'hostmask'])
|
||||||
permbans = wrap(permbans, ['op'])
|
|
||||||
|
|
||||||
def ignore(self, irc, msg, args, channel, banmask, expires):
|
def list(self, irc, msg, args, channel):
|
||||||
"""[<channel>] <nick|hostmask> [<expires>]
|
"""[<channel>]
|
||||||
|
|
||||||
If you have the #channel,op capability, this will set a permanent
|
If you have the #channel,op capability, this will show you the
|
||||||
(persistent) ignore on <hostmask> or the hostmask currently associated
|
current bans on #channel.
|
||||||
with <nick>. <expires> is an optional argument specifying when (in
|
"""
|
||||||
"seconds from now") the ignore will expire; if it isn't given, the
|
# XXX Add the expirations.
|
||||||
ignore will never automatically expire. <channel> is only necessary
|
c = ircdb.channels.getChannel(channel)
|
||||||
if the message isn't sent in the channel itself.
|
if c.bans:
|
||||||
"""
|
irc.reply(format('%L', map(utils.str.dqrepr, c.bans)))
|
||||||
c = ircdb.channels.getChannel(channel)
|
else:
|
||||||
c.addIgnore(banmask, expires)
|
irc.reply(format('There are no persistent bans on %s.',
|
||||||
ircdb.channels.setChannel(channel, c)
|
channel))
|
||||||
irc.replySuccess()
|
list = wrap(list, ['op'])
|
||||||
ignore = wrap(ignore, ['op', 'hostmask', additional('expiry', 0)])
|
|
||||||
|
|
||||||
def unignore(self, irc, msg, args, channel, banmask):
|
class ignore(callbacks.Commands):
|
||||||
"""[<channel>] <hostmask>
|
def add(self, irc, msg, args, channel, banmask, expires):
|
||||||
|
"""[<channel>] <nick|hostmask> [<expires>]
|
||||||
|
|
||||||
If you have the #channel,op capability, this will remove the permanent
|
If you have the #channel,op capability, this will set a persistent
|
||||||
ignore on <hostmask> in the channel. <channel> is only necessary if the
|
ignore on <hostmask> or the hostmask currently
|
||||||
message isn't sent in the channel itself.
|
associated with <nick>. <expires> is an optional argument
|
||||||
"""
|
specifying when (in "seconds from now") the ignore will expire; if
|
||||||
c = ircdb.channels.getChannel(channel)
|
it isn't given, the ignore will never automatically expire.
|
||||||
c.removeIgnore(banmask)
|
<channel> is only necessary if the message isn't sent in the
|
||||||
ircdb.channels.setChannel(channel, c)
|
channel itself.
|
||||||
irc.replySuccess()
|
"""
|
||||||
unignore = wrap(unignore, ['op', 'hostmask'])
|
c = ircdb.channels.getChannel(channel)
|
||||||
|
c.addIgnore(banmask, expires)
|
||||||
|
ircdb.channels.setChannel(channel, c)
|
||||||
|
irc.replySuccess()
|
||||||
|
add = wrap(add, ['op', 'hostmask', additional('expiry', 0)])
|
||||||
|
|
||||||
def ignores(self, irc, msg, args, channel):
|
def remove(self, irc, msg, args, channel, banmask):
|
||||||
"""[<channel>]
|
"""[<channel>] <hostmask>
|
||||||
|
|
||||||
Lists the hostmasks that the bot is ignoring on the given channel.
|
If you have the #channel,op capability, this will remove the
|
||||||
<channel> is only necessary if the message isn't sent in the channel
|
persistent ignore on <hostmask> in the channel. <channel> is only
|
||||||
itself.
|
necessary if the message isn't sent in the channel itself.
|
||||||
"""
|
"""
|
||||||
# XXX Add the expirations.
|
c = ircdb.channels.getChannel(channel)
|
||||||
c = ircdb.channels.getChannel(channel)
|
c.removeIgnore(banmask)
|
||||||
if len(c.ignores) == 0:
|
ircdb.channels.setChannel(channel, c)
|
||||||
s = format('I\'m not currently ignoring any hostmasks in %q',
|
irc.replySuccess()
|
||||||
channel)
|
remove = wrap(remove, ['op', 'hostmask'])
|
||||||
irc.reply(s)
|
|
||||||
else:
|
|
||||||
L = sorted(c.ignores)
|
|
||||||
irc.reply(utils.str.commaAndify(map(repr, L)))
|
|
||||||
ignores = wrap(ignores, ['op'])
|
|
||||||
|
|
||||||
def addcapability(self, irc, msg, args, channel, user, capabilities):
|
def list(self, irc, msg, args, channel):
|
||||||
"""[<channel>] <nick|username> <capability> [<capability> ...]
|
"""[<channel>]
|
||||||
|
|
||||||
If you have the #channel,op capability, this will give the user
|
Lists the hostmasks that the bot is ignoring on the given channel.
|
||||||
<name> (or the user to whom <nick> maps)
|
<channel> is only necessary if the message isn't sent in the
|
||||||
the capability <capability> in the channel. <channel> is only necessary
|
channel itself.
|
||||||
if the message isn't sent in the channel itself.
|
"""
|
||||||
"""
|
# XXX Add the expirations.
|
||||||
for c in capabilities.split():
|
c = ircdb.channels.getChannel(channel)
|
||||||
c = ircdb.makeChannelCapability(channel, c)
|
if len(c.ignores) == 0:
|
||||||
user.addCapability(c)
|
s = format('I\'m not currently ignoring any hostmasks in %q',
|
||||||
ircdb.users.setUser(user)
|
channel)
|
||||||
irc.replySuccess()
|
irc.reply(s)
|
||||||
addcapability = wrap(addcapability, ['op', 'otherUser', 'capability'])
|
else:
|
||||||
|
L = sorted(c.ignores)
|
||||||
|
irc.reply(utils.str.commaAndify(map(repr, L)))
|
||||||
|
list = wrap(list, ['op'])
|
||||||
|
|
||||||
def removecapability(self, irc, msg, args, channel, user, capabilities):
|
class capability(callbacks.Commands):
|
||||||
"""[<channel>] <name|hostmask> <capability> [<capability> ...]
|
def add(self, irc, msg, args, channel, user, capabilities):
|
||||||
|
"""[<channel>] <nick|username> <capability> [<capability> ...]
|
||||||
|
|
||||||
If you have the #channel,op capability, this will take from the user
|
If you have the #channel,op capability, this will give the user
|
||||||
currently identified as <name> (or the user to whom <hostmask> maps)
|
<name> (or the user to whom <nick> maps)
|
||||||
the capability <capability> in the channel. <channel> is only necessary
|
the capability <capability> in the channel. <channel> is only
|
||||||
if the message isn't sent in the channel itself.
|
necessary if the message isn't sent in the channel itself.
|
||||||
"""
|
"""
|
||||||
fail = []
|
for c in capabilities.split():
|
||||||
for c in capabilities.split():
|
c = ircdb.makeChannelCapability(channel, c)
|
||||||
cap = ircdb.makeChannelCapability(channel, c)
|
user.addCapability(c)
|
||||||
try:
|
ircdb.users.setUser(user)
|
||||||
user.removeCapability(cap)
|
irc.replySuccess()
|
||||||
except KeyError:
|
add = wrap(add, ['op', 'otherUser', 'capability'])
|
||||||
fail.append(c)
|
|
||||||
ircdb.users.setUser(user)
|
|
||||||
if fail:
|
|
||||||
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.replySuccess()
|
|
||||||
removecapability = wrap(removecapability,['op', 'otherUser', 'capability'])
|
|
||||||
|
|
||||||
# XXX This needs to be fix0red to be like Owner.defaultcapability. Or
|
def remove(self, irc, msg, args, channel, user, capabilities):
|
||||||
# something else. This is a horrible interface.
|
"""[<channel>] <name|hostmask> <capability> [<capability> ...]
|
||||||
def setdefaultcapability(self, irc, msg, args, channel, v):
|
|
||||||
"""[<channel>] {True|False}
|
|
||||||
|
|
||||||
If you have the #channel,op capability, this will set the default
|
If you have the #channel,op capability, this will take from the
|
||||||
response to non-power-related (that is, not {op, halfop, voice}
|
user currently identified as <name> (or the user to whom <hostmask>
|
||||||
capabilities to be the value you give. <channel> is only necessary if
|
maps) the capability <capability> in the channel. <channel> is only
|
||||||
the message isn't sent in the channel itself.
|
necessary if the message isn't sent in the channel itself.
|
||||||
"""
|
"""
|
||||||
c = ircdb.channels.getChannel(channel)
|
fail = []
|
||||||
if v:
|
for c in capabilities.split():
|
||||||
c.setDefaultCapability(True)
|
cap = ircdb.makeChannelCapability(channel, c)
|
||||||
else:
|
try:
|
||||||
c.setDefaultCapability(False)
|
user.removeCapability(cap)
|
||||||
ircdb.channels.setChannel(channel, c)
|
except KeyError:
|
||||||
irc.replySuccess()
|
fail.append(c)
|
||||||
setdefaultcapability = wrap(setdefaultcapability, ['op', 'boolean'])
|
ircdb.users.setUser(user)
|
||||||
|
if fail:
|
||||||
|
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.replySuccess()
|
||||||
|
remove = wrap(remove, ['op', 'otherUser', 'capability'])
|
||||||
|
|
||||||
def setcapability(self, irc, msg, args, channel, capabilities):
|
# XXX This needs to be fix0red to be like Owner.defaultcapability. Or
|
||||||
"""[<channel>] <capability> [<capability> ...]
|
# something else. This is a horrible interface.
|
||||||
|
def setdefault(self, irc, msg, args, channel, v):
|
||||||
|
"""[<channel>] {True|False}
|
||||||
|
|
||||||
If you have the #channel,op capability, this will add the channel
|
If you have the #channel,op capability, this will set the default
|
||||||
capability <capability> for all users in the channel. <channel> is
|
response to non-power-related (that is, not {op, halfop, voice}
|
||||||
only necessary if the message isn't sent in the channel itself.
|
capabilities to be the value you give. <channel> is only necessary
|
||||||
"""
|
if the message isn't sent in the channel itself.
|
||||||
chan = ircdb.channels.getChannel(channel)
|
"""
|
||||||
for c in capabilities:
|
c = ircdb.channels.getChannel(channel)
|
||||||
chan.addCapability(c)
|
if v:
|
||||||
ircdb.channels.setChannel(channel, chan)
|
c.setDefaultCapability(True)
|
||||||
irc.replySuccess()
|
else:
|
||||||
setcapability = wrap(setcapability, ['op', many('capability')])
|
c.setDefaultCapability(False)
|
||||||
|
ircdb.channels.setChannel(channel, c)
|
||||||
|
irc.replySuccess()
|
||||||
|
setdefault = wrap(setdefault, ['op', 'boolean'])
|
||||||
|
|
||||||
def unsetcapability(self, irc, msg, args, channel, capabilities):
|
def set(self, irc, msg, args, channel, capabilities):
|
||||||
"""[<channel>] <capability> [<capability> ...]
|
"""[<channel>] <capability> [<capability> ...]
|
||||||
|
|
||||||
If you have the #channel,op capability, this will unset the channel
|
If you have the #channel,op capability, this will add the channel
|
||||||
capability <capability> so each user's specific capability or the
|
capability <capability> for all users in the channel. <channel> is
|
||||||
channel default capability will take precedence. <channel> is only
|
only necessary if the message isn't sent in the channel itself.
|
||||||
necessary if the message isn't sent in the channel itself.
|
"""
|
||||||
"""
|
chan = ircdb.channels.getChannel(channel)
|
||||||
chan = ircdb.channels.getChannel(channel)
|
for c in capabilities:
|
||||||
fail = []
|
chan.addCapability(c)
|
||||||
for c in capabilities:
|
ircdb.channels.setChannel(channel, chan)
|
||||||
try:
|
irc.replySuccess()
|
||||||
chan.removeCapability(c)
|
set = wrap(set, ['op', many('capability')])
|
||||||
except KeyError:
|
|
||||||
fail.append(c)
|
|
||||||
ircdb.channels.setChannel(channel, chan)
|
|
||||||
if fail:
|
|
||||||
s = 'capability'
|
|
||||||
if len(fail) > 1:
|
|
||||||
s = utils.str.pluralize(s)
|
|
||||||
irc.error(format('I do not know about the %L %s.', fail, s),
|
|
||||||
Raise=True)
|
|
||||||
irc.replySuccess()
|
|
||||||
unsetcapability = wrap(unsetcapability, ['op', many('capability')])
|
|
||||||
|
|
||||||
def capabilities(self, irc, msg, args, channel):
|
def unset(self, irc, msg, args, channel, capabilities):
|
||||||
"""[<channel>]
|
"""[<channel>] <capability> [<capability> ...]
|
||||||
|
|
||||||
Returns the capabilities present on the <channel>. <channel> is only
|
If you have the #channel,op capability, this will unset the channel
|
||||||
necessary if the message isn't sent in the channel itself.
|
capability <capability> so each user's specific capability or the
|
||||||
"""
|
channel default capability will take precedence. <channel> is only
|
||||||
c = ircdb.channels.getChannel(channel)
|
necessary if the message isn't sent in the channel itself.
|
||||||
L = sorted(c.capabilities)
|
"""
|
||||||
irc.reply(' '.join(L))
|
chan = ircdb.channels.getChannel(channel)
|
||||||
capabilities = wrap(capabilities, ['channel'])
|
fail = []
|
||||||
|
for c in capabilities:
|
||||||
|
try:
|
||||||
|
chan.removeCapability(c)
|
||||||
|
except KeyError:
|
||||||
|
fail.append(c)
|
||||||
|
ircdb.channels.setChannel(channel, chan)
|
||||||
|
if fail:
|
||||||
|
s = 'capability'
|
||||||
|
if len(fail) > 1:
|
||||||
|
s = utils.str.pluralize(s)
|
||||||
|
irc.error(format('I do not know about the %L %s.', fail, s),
|
||||||
|
Raise=True)
|
||||||
|
irc.replySuccess()
|
||||||
|
unset = wrap(unset, ['op', many('capability')])
|
||||||
|
|
||||||
|
def list(self, irc, msg, args, channel):
|
||||||
|
"""[<channel>]
|
||||||
|
|
||||||
|
Returns the capabilities present on the <channel>. <channel> is
|
||||||
|
only necessary if the message isn't sent in the channel itself.
|
||||||
|
"""
|
||||||
|
c = ircdb.channels.getChannel(channel)
|
||||||
|
L = sorted(c.capabilities)
|
||||||
|
irc.reply(' '.join(L))
|
||||||
|
list = wrap(list, ['channel'])
|
||||||
|
|
||||||
def disable(self, irc, msg, args, channel, plugin, command):
|
def disable(self, irc, msg, args, channel, plugin, command):
|
||||||
"""[<channel>] [<plugin>] [<command>]
|
"""[<channel>] [<plugin>] [<command>]
|
||||||
@ -737,22 +766,6 @@ class Channel(callbacks.Plugin):
|
|||||||
optional(('plugin', False)),
|
optional(('plugin', False)),
|
||||||
additional('commandName')])
|
additional('commandName')])
|
||||||
|
|
||||||
def lobotomies(self, irc, msg, args):
|
|
||||||
"""takes no arguments
|
|
||||||
|
|
||||||
Returns the channels in which this bot is lobotomized.
|
|
||||||
"""
|
|
||||||
L = []
|
|
||||||
for (channel, c) in ircdb.channels.iteritems():
|
|
||||||
if c.lobotomized:
|
|
||||||
L.append(channel)
|
|
||||||
if L:
|
|
||||||
L.sort()
|
|
||||||
s = format('I\'m currently lobotomized in %L.', L)
|
|
||||||
irc.reply(s)
|
|
||||||
else:
|
|
||||||
irc.reply('I\'m not currently lobotomized in any channels.')
|
|
||||||
|
|
||||||
def nicks(self, irc, msg, args, channel):
|
def nicks(self, irc, msg, args, channel):
|
||||||
"""[<channel>]
|
"""[<channel>]
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ class ChannelTestCase(ChannelPluginTestCase):
|
|||||||
self.irc.state.channels[self.channel].addUser('bar')
|
self.irc.state.channels[self.channel].addUser('bar')
|
||||||
|
|
||||||
def testLobotomies(self):
|
def testLobotomies(self):
|
||||||
self.assertRegexp('lobotomies', 'not.*any')
|
self.assertRegexp('lobotomy list', 'not.*any')
|
||||||
|
|
||||||
## def testCapabilities(self):
|
## def testCapabilities(self):
|
||||||
## self.prefix = 'foo!bar@baz'
|
## self.prefix = 'foo!bar@baz'
|
||||||
@ -59,29 +59,29 @@ class ChannelTestCase(ChannelPluginTestCase):
|
|||||||
## self.assertResponse('user capabilities foo', '[]')
|
## self.assertResponse('user capabilities foo', '[]')
|
||||||
|
|
||||||
def testCapabilities(self):
|
def testCapabilities(self):
|
||||||
self.assertNotError('channel capabilities')
|
self.assertNotError('channel capability list')
|
||||||
self.assertNotError('channel setcapability -foo')
|
self.assertNotError('channel capability set -foo')
|
||||||
self.assertNotError('channel unsetcapability -foo')
|
self.assertNotError('channel capability unset -foo')
|
||||||
self.assertError('channel unsetcapability -foo')
|
self.assertError('channel capability unset -foo')
|
||||||
self.assertNotError('channel setcapability -foo bar baz')
|
self.assertNotError('channel capability set -foo bar baz')
|
||||||
self.assertRegexp('channel capabilities', 'baz')
|
self.assertRegexp('channel capability list', 'baz')
|
||||||
self.assertNotError('channel unsetcapability -foo baz')
|
self.assertNotError('channel capability unset -foo baz')
|
||||||
self.assertError('channel unsetcapability baz')
|
self.assertError('channel capability unset baz')
|
||||||
|
|
||||||
def testEnableDisable(self):
|
def testEnableDisable(self):
|
||||||
self.assertNotRegexp('channel capabilities', '-Channel')
|
self.assertNotRegexp('channel capability list', '-Channel')
|
||||||
self.assertError('channel enable channel')
|
self.assertError('channel enable channel')
|
||||||
self.assertNotError('channel disable channel')
|
self.assertNotError('channel disable channel')
|
||||||
self.assertRegexp('channel capabilities', '-Channel')
|
self.assertRegexp('channel capability list', '-Channel')
|
||||||
self.assertNotError('channel enable channel')
|
self.assertNotError('channel enable channel')
|
||||||
self.assertNotRegexp('channel capabilities', '-Channel')
|
self.assertNotRegexp('channel capability list', '-Channel')
|
||||||
self.assertNotError('channel disable channel nicks')
|
self.assertNotError('channel disable channel nicks')
|
||||||
self.assertRegexp('channel capabilities', '-Channel.nicks')
|
self.assertRegexp('channel capability list', '-Channel.nicks')
|
||||||
self.assertNotError('channel enable channel nicks')
|
self.assertNotError('channel enable channel nicks')
|
||||||
self.assertNotRegexp('channel capabilities', '-Channel.nicks')
|
self.assertNotRegexp('channel capability list', '-Channel.nicks')
|
||||||
self.assertNotRegexp('channel capabilities', 'nicks')
|
self.assertNotRegexp('channel capability list', 'nicks')
|
||||||
self.assertNotError('channel disable nicks')
|
self.assertNotError('channel disable nicks')
|
||||||
self.assertRegexp('channel capabilities', 'nicks')
|
self.assertRegexp('channel capability list', 'nicks')
|
||||||
self.assertNotError('channel enable nicks')
|
self.assertNotError('channel enable nicks')
|
||||||
self.assertError('channel disable invalidPlugin')
|
self.assertError('channel disable invalidPlugin')
|
||||||
self.assertError('channel disable channel invalidCommand')
|
self.assertError('channel disable channel invalidCommand')
|
||||||
@ -167,24 +167,24 @@ class ChannelTestCase(ChannelPluginTestCase):
|
|||||||
## self.assertNotRegexp('kban foobar time', 'ValueError')
|
## self.assertNotRegexp('kban foobar time', 'ValueError')
|
||||||
## self.assertError('kban %s' % self.irc.nick)
|
## self.assertError('kban %s' % self.irc.nick)
|
||||||
|
|
||||||
def testPermban(self):
|
def testBan(self):
|
||||||
self.assertNotError('permban foo!bar@baz')
|
self.assertNotError('ban add foo!bar@baz')
|
||||||
self.assertNotError('unpermban foo!bar@baz')
|
self.assertNotError('ban remove foo!bar@baz')
|
||||||
orig = conf.supybot.protocols.irc.strictRfc()
|
orig = conf.supybot.protocols.irc.strictRfc()
|
||||||
try:
|
try:
|
||||||
conf.supybot.protocols.irc.strictRfc.setValue(True)
|
conf.supybot.protocols.irc.strictRfc.setValue(True)
|
||||||
# something wonky is going on here. irc.error (src/Channel.py|449)
|
# something wonky is going on here. irc.error (src/Channel.py|449)
|
||||||
# is being called but the assert is failing
|
# is being called but the assert is failing
|
||||||
self.assertError('permban not!a.hostmask')
|
self.assertError('ban add not!a.hostmask')
|
||||||
self.assertNotRegexp('permban not!a.hostmask', 'KeyError')
|
self.assertNotRegexp('ban add not!a.hostmask', 'KeyError')
|
||||||
finally:
|
finally:
|
||||||
conf.supybot.protocols.irc.strictRfc.setValue(orig)
|
conf.supybot.protocols.irc.strictRfc.setValue(orig)
|
||||||
|
|
||||||
def testIgnore(self):
|
def testIgnore(self):
|
||||||
self.assertNotError('Channel ignore foo!bar@baz')
|
self.assertNotError('channel ignore add foo!bar@baz')
|
||||||
self.assertResponse('Channel ignores', "'foo!bar@baz'")
|
self.assertResponse('channel ignore list', "'foo!bar@baz'")
|
||||||
self.assertNotError('Channel unignore foo!bar@baz')
|
self.assertNotError('channel ignore remove foo!bar@baz')
|
||||||
self.assertError('permban not!a.hostmask')
|
self.assertError('ban add not!a.hostmask')
|
||||||
|
|
||||||
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user