Changed IrcState.history to a RingBuffer instead of a MaxLengthQueue.

This commit is contained in:
Jeremy Fincher 2003-04-22 11:18:57 +00:00
parent ff54eecefc
commit 6eacfb6c26

View File

@ -30,7 +30,7 @@
### ###
from fix import * from fix import *
from structures import queue, MaxLengthQueue from structures import queue, RingBuffer
import copy import copy
import time import time
@ -171,7 +171,7 @@ class IrcState(object):
self.reset() self.reset()
def reset(self): def reset(self):
self.history = MaxLengthQueue(conf.maxHistory) self.history = RingBuffer(conf.maxHistory)
self.nicksToHostmasks = ircutils.IrcDict() self.nicksToHostmasks = ircutils.IrcDict()
self.channels = ircutils.IrcDict() self.channels = ircutils.IrcDict()
@ -192,7 +192,7 @@ class IrcState(object):
return ret return ret
def addMsg(self, irc, msg): def addMsg(self, irc, msg):
self.history.enqueue(msg) self.history.append(msg)
if ircutils.isUserHostmask(msg.prefix) and not msg.command == 'NICK': if ircutils.isUserHostmask(msg.prefix) and not msg.command == 'NICK':
self.nicksToHostmasks[msg.nick] = msg.prefix self.nicksToHostmasks[msg.nick] = msg.prefix
if msg.command == '352': # Response to a WHO command. if msg.command == '352': # Response to a WHO command.