summaryrefslogtreecommitdiff
path: root/src/text_buffer.py
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2011-02-14 14:54:56 +0100
committerFlorent Le Coz <louiz@louiz.org>2011-02-14 14:54:56 +0100
commit85d645b7d27a940c262d0a1e333c61754877155e (patch)
tree3e6d25ffa0ce92f108076be05e80f791925b8533 /src/text_buffer.py
parent8d0ebdfc123890048f7d282077c4e3ab0b845bba (diff)
parent4b31e5acf142664c2f2ebd2e0cfa26e700d947d7 (diff)
downloadpoezio-85d645b7d27a940c262d0a1e333c61754877155e.tar.gz
poezio-85d645b7d27a940c262d0a1e333c61754877155e.tar.bz2
poezio-85d645b7d27a940c262d0a1e333c61754877155e.tar.xz
poezio-85d645b7d27a940c262d0a1e333c61754877155e.zip
Automated merge with http://hg.louiz.org/poezio
Diffstat (limited to 'src/text_buffer.py')
-rw-r--r--src/text_buffer.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/text_buffer.py b/src/text_buffer.py
index 9285a433..3b2ddd1a 100644
--- a/src/text_buffer.py
+++ b/src/text_buffer.py
@@ -24,15 +24,15 @@ log = logging.getLogger(__name__)
from message import Message
from datetime import datetime
import theme
-
-MESSAGE_NB_LIMIT = 8192
+from config import config
class TextBuffer(object):
"""
This class just keep trace of messages, in a list with various
informations and attributes.
"""
- def __init__(self):
+ def __init__(self, messages_nb_limit=config.get('max_messages_in_memory', 2048)):
+ self.messages_nb_limit = messages_nb_limit
self.messages = [] # Message objects
self.windows = [] # we keep track of one or more windows
# so we can pass the new messages to them, as they are added, so
@@ -47,7 +47,7 @@ class TextBuffer(object):
time = time or datetime.now()
msg = Message(txt, time, nickname, nick_color, color, colorized)
self.messages.append(msg)
- while len(self.messages) > MESSAGE_NB_LIMIT:
+ while len(self.messages) > self.messages_nb_limit:
self.messages.pop(0)
for window in self.windows: # make the associated windows
# build the lines from the new message