mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-30 06:49:24 +01:00
Guarded IrcState.doMode to work only with channels.
This commit is contained in:
parent
1410d1af43
commit
6169822349
@ -268,20 +268,22 @@ class IrcState(IrcCommandDispatcher):
|
|||||||
self.channels[channel] = chan
|
self.channels[channel] = chan
|
||||||
|
|
||||||
def doMode(self, irc, msg):
|
def doMode(self, irc, msg):
|
||||||
chan = self.channels[msg.args[0]]
|
channel = msg.args[0]
|
||||||
for (mode, nick) in ircutils.separateModes(msg.args[1:]):
|
if ircutils.isChannel(channel):
|
||||||
if mode == '-o':
|
chan = self.channels[channel]
|
||||||
chan.ops.discard(nick)
|
for (mode, nick) in ircutils.separateModes(msg.args[1:]):
|
||||||
elif mode == '+o':
|
if mode == '-o':
|
||||||
chan.ops.add(nick)
|
chan.ops.discard(nick)
|
||||||
if mode == '-h':
|
elif mode == '+o':
|
||||||
chan.halfops.discard(nick)
|
chan.ops.add(nick)
|
||||||
elif mode == '+h':
|
if mode == '-h':
|
||||||
chan.halfops.add(nick)
|
chan.halfops.discard(nick)
|
||||||
if mode == '-v':
|
elif mode == '+h':
|
||||||
chan.voices.discard(nick)
|
chan.halfops.add(nick)
|
||||||
elif mode == '+v':
|
if mode == '-v':
|
||||||
chan.voices.add(nick)
|
chan.voices.discard(nick)
|
||||||
|
elif mode == '+v':
|
||||||
|
chan.voices.add(nick)
|
||||||
|
|
||||||
def do353(self, irc, msg):
|
def do353(self, irc, msg):
|
||||||
(_, _, channel, users) = msg.args
|
(_, _, channel, users) = msg.args
|
||||||
|
@ -212,6 +212,10 @@ class IrcStateTestCase(unittest.TestCase):
|
|||||||
st.addMsg(self.irc, ircmsgs.dehalfop('#foo', 'bar'))
|
st.addMsg(self.irc, ircmsgs.dehalfop('#foo', 'bar'))
|
||||||
self.failIf('bar' in st.channels['#foo'].halfops)
|
self.failIf('bar' in st.channels['#foo'].halfops)
|
||||||
|
|
||||||
|
def testDoModeOnlyChannels(self):
|
||||||
|
st = irclib.IrcState()
|
||||||
|
self.assert_(st.addMsg(self.irc, ircmsgs.IrcMsg('MODE foo +i')) or 1)
|
||||||
|
|
||||||
"""
|
"""
|
||||||
def testChannels(self):
|
def testChannels(self):
|
||||||
channel =
|
channel =
|
||||||
|
Loading…
Reference in New Issue
Block a user