Skip to content
Snippets Groups Projects
Commit 5406f8b4 authored by Yann Leboulanger's avatar Yann Leboulanger
Browse files

improve connection time to muc.

parent 67816009
No related branches found
No related tags found
No related merge requests found
......@@ -1754,6 +1754,25 @@ class Connection(ConnectionHandlers):
if show == 'invisible':
# Never join a room when invisible
return
# last date/time in history to avoid duplicate
if room_jid not in self.last_history_time:
# Not in memory, get it from DB
last_log = None
# Do not check if we are not logging for this room
if gajim.config.should_log(self.name, room_jid):
# Check time first in the FAST table
last_log = gajim.logger.get_room_last_message_time(room_jid)
if last_log is None:
# Not in special table, get it from messages DB
last_log = gajim.logger.get_last_date_that_has_logs(room_jid,
is_room=True)
# Create self.last_history_time[room_jid] even if not logging,
# could be used in connection_handlers
if last_log is None:
last_log = 0
self.last_history_time[room_jid] = last_log
p = common.xmpp.Presence(to = '%s/%s' % (room_jid, nick),
show = show, status = self.status)
if gajim.config.get('send_sha_in_gc_presence'):
......@@ -1761,9 +1780,8 @@ class Connection(ConnectionHandlers):
self.add_lang(p)
if not change_nick:
t = p.setTag(common.xmpp.NS_MUC + ' x')
last_date = gajim.logger.get_last_date_that_has_logs(room_jid,
self.name, is_room=True)
if last_date is None:
last_date = self.last_history_time[room_jid]
if last_date = 0:
last_date = time.time() - gajim.config.get(
'muc_restore_timeout') * 60
else:
......@@ -1776,24 +1794,6 @@ class Connection(ConnectionHandlers):
t.setTagData('password', password)
self.connection.send(p)
# last date/time in history to avoid duplicate
if room_jid not in self.last_history_time:
# Not in memory, get it from DB
last_log = None
# Do not check if we are not logging for this room
if gajim.config.should_log(self.name, room_jid):
# Check time first in the FAST table
last_log = gajim.logger.get_room_last_message_time(room_jid)
if last_log is None:
# Not in special table, get it from messages DB
last_log = gajim.logger.get_last_date_that_has_logs(room_jid,
is_room = True)
# Create self.last_history_time[room_jid] even if not logging,
# could be used in connection_handlers
if last_log is None:
last_log = 0
self.last_history_time[room_jid]= last_log
def send_gc_message(self, jid, msg, xhtml = None):
if not self.connection:
return
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment