diff options
author | Florent Le Coz <louiz@louiz.org> | 2011-02-14 14:54:56 +0100 |
---|---|---|
committer | Florent Le Coz <louiz@louiz.org> | 2011-02-14 14:54:56 +0100 |
commit | 85d645b7d27a940c262d0a1e333c61754877155e (patch) | |
tree | 3e6d25ffa0ce92f108076be05e80f791925b8533 /src/room.py | |
parent | 8d0ebdfc123890048f7d282077c4e3ab0b845bba (diff) | |
parent | 4b31e5acf142664c2f2ebd2e0cfa26e700d947d7 (diff) | |
download | poezio-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/room.py')
-rw-r--r-- | src/room.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/room.py b/src/room.py index 29986142..df97c638 100644 --- a/src/room.py +++ b/src/room.py @@ -14,7 +14,7 @@ # You should have received a copy of the GNU General Public License # along with Poezio. If not, see <http://www.gnu.org/licenses/>. -from text_buffer import TextBuffer, MESSAGE_NB_LIMIT +from text_buffer import TextBuffer from datetime import datetime from random import randrange from config import config @@ -29,8 +29,8 @@ import logging log = logging.getLogger(__name__) class Room(TextBuffer): - def __init__(self, name, nick): - TextBuffer.__init__(self) + def __init__(self, name, nick, messages_nb_limit=config.get('max_messages_in_memory', 2048)): + TextBuffer.__init__(self, messages_nb_limit) self.name = name self.own_nick = nick self.color_state = theme.COLOR_TAB_NORMAL # color used in RoomInfo @@ -115,7 +115,7 @@ class Room(TextBuffer): time = time if time is not None else datetime.now() nick_color = nick_color or user.color if user else None message = Message(txt, time, nickname, nick_color, color, colorized, user=user) - while len(self.messages) > MESSAGE_NB_LIMIT: + while len(self.messages) > self.messages_nb_limit: self.messages.pop(0) self.messages.append(message) for window in self.windows: # make the associated windows |