Skip to content

Commit affdcb0

Browse files
johannesklouiz
authored andcommitted
added muc_history_length support
1 parent bf29554 commit affdcb0

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

data/default_config.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ alternative_nickname =
172172
# Limit the number of messages you want to receive when the
173173
# multiuserchat rooms send you recent history
174174
# 0: You won't receive any
175-
# -1: You will receive the maximum
175+
# -1: You will receive the server default
176176
# n: You will receive at most n messages
177177
muc_history_length = 50
178178

src/core.py

+12-1
Original file line numberDiff line numberDiff line change
@@ -1476,6 +1476,12 @@ def command_join(self, arg, histo_length=None):
14761476
if room.startswith('@'):
14771477
room = room[1:]
14781478
current_status = self.get_status()
1479+
if not histo_length:
1480+
histo_length= config.get('muc_history_length', 20)
1481+
if histo_length == -1:
1482+
histo_length= None
1483+
if histo_length:
1484+
histo_length= str(histo_length)
14791485
if tab and not tab.joined:
14801486
seconds = (int(time.time()) - tab.last_connection) if tab.last_connection != 0 else 0
14811487
muc.join_groupchat(self.xmpp, room, nick, password,
@@ -2539,7 +2545,12 @@ def on_session_start(self, event):
25392545
self.open_new_room(bm.jid, bm.nick, False)
25402546
nick = bm.nick if bm.nick else self.own_nick
25412547
self.initial_joins.append(bm.jid)
2542-
muc.join_groupchat(self.xmpp, bm.jid, nick)
2548+
histo_length= config.get('muc_history_length', 20)
2549+
if histo_length == -1:
2550+
histo_length= None
2551+
if histo_length:
2552+
histo_length= str(histo_length)
2553+
muc.join_groupchat(self.xmpp, bm.jid, nick, None, histo_length)
25432554

25442555
### Other handlers ###
25452556

0 commit comments

Comments
 (0)