mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-18 08:02:49 +01:00
Fixed bug in irclib.IrcState's handling of KICK messages; they wouldn't remove the channel if the bot was kicked from it.
This commit is contained in:
parent
5fd6bbb52d
commit
c08d435267
@ -498,7 +498,11 @@ class IrcState(IrcCommandDispatcher):
|
|||||||
(channel, users) = msg.args[:2]
|
(channel, users) = msg.args[:2]
|
||||||
chan = self.channels[channel]
|
chan = self.channels[channel]
|
||||||
for user in users.split(','):
|
for user in users.split(','):
|
||||||
chan.removeUser(user)
|
if ircutils.strEqual(user, irc.nick):
|
||||||
|
del self.channels[channel]
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
chan.removeUser(user)
|
||||||
|
|
||||||
def doQuit(self, irc, msg):
|
def doQuit(self, irc, msg):
|
||||||
for channel in self.channels.itervalues():
|
for channel in self.channels.itervalues():
|
||||||
|
@ -210,6 +210,13 @@ class IrcStateTestCase(SupyTestCase):
|
|||||||
nick = 'nick'
|
nick = 'nick'
|
||||||
prefix = 'nick!user@host'
|
prefix = 'nick!user@host'
|
||||||
irc = FakeIrc()
|
irc = FakeIrc()
|
||||||
|
def testKickRemovesChannel(self):
|
||||||
|
st = irclib.IrcState()
|
||||||
|
st.channels['#foo'] = irclib.ChannelState()
|
||||||
|
m = ircmsgs.kick('#foo', self.irc.nick, prefix=self.irc.prefix)
|
||||||
|
st.addMsg(self.irc, m)
|
||||||
|
self.failIf('#foo' in st.channels)
|
||||||
|
|
||||||
def testAddMsgRemovesOpsProperly(self):
|
def testAddMsgRemovesOpsProperly(self):
|
||||||
st = irclib.IrcState()
|
st = irclib.IrcState()
|
||||||
st.channels['#foo'] = irclib.ChannelState()
|
st.channels['#foo'] = irclib.ChannelState()
|
||||||
|
Loading…
Reference in New Issue
Block a user