Changed irclib.Channel to irclib.ChannelState.

This commit is contained in:
Jeremy Fincher 2003-10-01 11:15:31 +00:00
parent 2ea1052d06
commit 3891360527
2 changed files with 6 additions and 6 deletions

View File

@ -152,7 +152,7 @@ class IrcMsgQueue(object):
# Maintains the state of IRC connection -- the most recent messages, the
# status of various modes (especially ops/halfops/voices) in channels, etc.
###
class Channel(object):
class ChannelState(object):
__slots__ = ('users', 'ops', 'halfops', 'voices', 'topic')
def __init__(self):
self.topic = ''
@ -265,7 +265,7 @@ class IrcState(IrcCommandDispatcher):
if channel in self.channels:
self.channels[channel].addUser(msg.nick)
else:
chan = Channel()
chan = ChannelState()
chan.addUser(msg.nick)
self.channels[channel] = chan

View File

@ -116,14 +116,14 @@ class IrcMsgQueueTestCase(unittest.TestCase):
self.assertEqual(self.msg, q.dequeue())
class ChannelTestCase(unittest.TestCase):
class ChannelStateTestCase(unittest.TestCase):
def testPickleCopy(self):
c = irclib.Channel()
c = irclib.ChannelState()
c1 = pickle.loads(pickle.dumps(c))
self.assertEqual(pickle.loads(pickle.dumps(c)), c)
def testAddUser(self):
c = irclib.Channel()
c = irclib.ChannelState()
c.addUser('foo')
self.failUnless('foo' in c.users)
self.failIf('foo' in c.ops)
@ -214,7 +214,7 @@ class IrcStateTestCase(unittest.TestCase):
def testDoModeOnlyChannels(self):
st = irclib.IrcState()
st.addMsg(self.irc, ircmsgs.IrcMsg('MODE foo +i'))
self.assert_(st.addMsg(self.irc, ircmsgs.IrcMsg('MODE foo +i')) or 1)
"""
def testChannels(self):