mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-30 14:14:37 +01:00
Fixed ops, deops, halfops, dehalfops, voices, and devoices.
This commit is contained in:
parent
8e7416fd72
commit
7f3cafbfbd
@ -301,7 +301,7 @@ def ops(channel, nicks, prefix=''):
|
||||
assert isChannel(channel), repr(channel)
|
||||
assert all(isNick, nicks), nicks
|
||||
return IrcMsg(prefix=prefix, command=MODE,
|
||||
args=(channel, '+' + ('o'*len(nicks)), nicks))
|
||||
args=(channel, '+' + ('o'*len(nicks))) + tuple(nicks))
|
||||
|
||||
def deop(channel, nick, prefix=''):
|
||||
"""Returns a MODE to deop nick on channel."""
|
||||
@ -314,7 +314,7 @@ def deops(channel, nicks, prefix=''):
|
||||
assert isChannel(channel), repr(channel)
|
||||
assert all(isNick, nicks), nicks
|
||||
return IrcMsg(prefix=prefix, command=MODE,
|
||||
args=(channel, '-' + ('o'*len(nicks)), nicks))
|
||||
args=(channel, '-' + ('o'*len(nicks))) + tuple(nicks))
|
||||
|
||||
def halfop(channel, nick, prefix=''):
|
||||
"""Returns a MODE to halfop nick on channel."""
|
||||
@ -328,7 +328,7 @@ def halfops(channel, nicks, prefix=''):
|
||||
assert all(isNick, nicks), nicks
|
||||
return IrcMsg(prefix=prefix,
|
||||
command=MODE,
|
||||
args=(channel, '+' + ('h'*len(nicks)), nicks))
|
||||
args=(channel, '+' + ('h'*len(nicks))) + tuple(nicks))
|
||||
|
||||
def dehalfop(channel, nick, prefix=''):
|
||||
"""Returns a MODE to dehalfop nick on channel."""
|
||||
@ -341,7 +341,7 @@ def dehalfops(channel, nicks, prefix=''):
|
||||
assert isChannel(channel), repr(channel)
|
||||
assert all(isNick, nicks), nicks
|
||||
return IrcMsg(prefix=prefix, command=MODE,
|
||||
args=(channel, '-' + ('h'*len(nicks)), nicks))
|
||||
args=(channel, '-' + ('h'*len(nicks))) + tuple(nicks))
|
||||
|
||||
def voice(channel, nick, prefix=''):
|
||||
"""Returns a MODE to voice nick on channel."""
|
||||
@ -354,7 +354,7 @@ def voices(channel, nicks, prefix=''):
|
||||
assert isChannel(channel), repr(channel)
|
||||
assert all(isNick, nicks)
|
||||
return IrcMsg(prefix=prefix, command=MODE,
|
||||
args=(channel, '+' + ('v'*len(nicks)), nicks))
|
||||
args=(channel, '+' + ('v'*len(nicks))) + tuple(nicks))
|
||||
|
||||
def devoice(channel, nick, prefix=''):
|
||||
"""Returns a MODE to devoice nick on channel."""
|
||||
@ -367,7 +367,7 @@ def devoices(channel, nicks, prefix=''):
|
||||
assert isChannel(channel), repr(channel)
|
||||
assert all(isNick, nicks), nicks
|
||||
return IrcMsg(prefix=prefix, command=MODE,
|
||||
args=(channel, '-' + ('v'*len(nicks)), nicks))
|
||||
args=(channel, '-' + ('v'*len(nicks))) + tuple(nicks))
|
||||
|
||||
def ban(channel, hostmask, exception='', prefix=''):
|
||||
"""Returns a MODE to ban nick on channel."""
|
||||
|
@ -187,5 +187,29 @@ class FunctionsTestCase(unittest.TestCase):
|
||||
def testQuit(self):
|
||||
self.failUnless(ircmsgs.quit(prefix='foo!bar@baz'))
|
||||
|
||||
def testOps(self):
|
||||
m = ircmsgs.ops('#foo', ['foo', 'bar', 'baz'])
|
||||
self.assertEqual(str(m), 'MODE #foo +ooo foo bar :baz\r\n')
|
||||
|
||||
def testDeops(self):
|
||||
m = ircmsgs.deops('#foo', ['foo', 'bar', 'baz'])
|
||||
self.assertEqual(str(m), 'MODE #foo -ooo foo bar :baz\r\n')
|
||||
|
||||
def testVoices(self):
|
||||
m = ircmsgs.voices('#foo', ['foo', 'bar', 'baz'])
|
||||
self.assertEqual(str(m), 'MODE #foo +vvv foo bar :baz\r\n')
|
||||
|
||||
def testDevoices(self):
|
||||
m = ircmsgs.devoices('#foo', ['foo', 'bar', 'baz'])
|
||||
self.assertEqual(str(m), 'MODE #foo -vvv foo bar :baz\r\n')
|
||||
|
||||
def testHalfops(self):
|
||||
m = ircmsgs.halfops('#foo', ['foo', 'bar', 'baz'])
|
||||
self.assertEqual(str(m), 'MODE #foo +hhh foo bar :baz\r\n')
|
||||
|
||||
def testDehalfops(self):
|
||||
m = ircmsgs.dehalfops('#foo', ['foo', 'bar', 'baz'])
|
||||
self.assertEqual(str(m), 'MODE #foo -hhh foo bar :baz\r\n')
|
||||
|
||||
|
||||
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
||||
|
Loading…
Reference in New Issue
Block a user