summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlouiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13>2010-08-05 21:32:17 +0000
committerlouiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13>2010-08-05 21:32:17 +0000
commit27c1cee035abcff01d06f8138fb669e24d169080 (patch)
treecbe61a8b279f12c0e5f9375ffc21a5603dd6d8c3
parent9a822ed7aaf76c5b75e5f55aecbe6c5f15bf829b (diff)
downloadpoezio-27c1cee035abcff01d06f8138fb669e24d169080.tar.gz
poezio-27c1cee035abcff01d06f8138fb669e24d169080.tar.bz2
poezio-27c1cee035abcff01d06f8138fb669e24d169080.tar.xz
poezio-27c1cee035abcff01d06f8138fb669e24d169080.zip
Allow the user to limit the number of history messages. fixed #1658
-rw-r--r--src/multiuserchat.py17
-rw-r--r--src/poezio.py1
2 files changed, 13 insertions, 5 deletions
diff --git a/src/multiuserchat.py b/src/multiuserchat.py
index 431b33a8..0fbedd72 100644
--- a/src/multiuserchat.py
+++ b/src/multiuserchat.py
@@ -150,12 +150,19 @@ class MultiUserChat(object):
"""Join a new room"""
pres = Presence(to='%s/%s' % (room, nick))
pres.setFrom('%s'%self.own_jid)
- if not password:
- pres.addChild(name='x', namespace=NS_MUC)
- else:
- item = pres.addChild(name='x', namespace=NS_MUC)
- passwd = item.addChild(name='password')
+ x_tag = pres.addChild(name='x', namespace=NS_MUC)
+ if password:
+ passwd = x_tag.addChild(name='password')
passwd.setData(password)
+ muc_history_length = config.get('muc_history_length', -1)
+ if muc_history_length >= 0:
+ history_tag = x_tag.addChild(name='history')
+ if muc_history_length == 0:
+ history_tag.setAttr('maxchars', 0)
+ else:
+ history_tag.setAttr('maxstanzas', muc_history_length)
+ from common import debug
+ debug('%s\n'% pres)
self.connection.send(pres)
def quit_room(self, room, nick, msg=None):
diff --git a/src/poezio.py b/src/poezio.py
index 83eba23c..da306c22 100644
--- a/src/poezio.py
+++ b/src/poezio.py
@@ -23,6 +23,7 @@ Starting point of poezio. Launches both the Connection and Gui
import threading
import sys
+import traceback
def installThreadExcepthook():
"""