Guarded IrcState.doMode to work only with channels.

This commit is contained in:
Jeremy Fincher 2003-09-29 07:44:27 +00:00
parent 1410d1af43
commit 6169822349
2 changed files with 20 additions and 14 deletions

View File

@ -268,7 +268,9 @@ class IrcState(IrcCommandDispatcher):
self.channels[channel] = chan
def doMode(self, irc, msg):
chan = self.channels[msg.args[0]]
channel = msg.args[0]
if ircutils.isChannel(channel):
chan = self.channels[channel]
for (mode, nick) in ircutils.separateModes(msg.args[1:]):
if mode == '-o':
chan.ops.discard(nick)

View File

@ -212,6 +212,10 @@ class IrcStateTestCase(unittest.TestCase):
st.addMsg(self.irc, ircmsgs.dehalfop('#foo', 'bar'))
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):
channel =