improve connection time to muc.
This commit is contained in:
parent
6781600942
commit
5406f8b49c
1 changed files with 23 additions and 23 deletions
|
@ -1754,27 +1754,6 @@ class Connection(ConnectionHandlers):
|
||||||
if show == 'invisible':
|
if show == 'invisible':
|
||||||
# Never join a room when invisible
|
# Never join a room when invisible
|
||||||
return
|
return
|
||||||
p = common.xmpp.Presence(to = '%s/%s' % (room_jid, nick),
|
|
||||||
show = show, status = self.status)
|
|
||||||
if gajim.config.get('send_sha_in_gc_presence'):
|
|
||||||
p = self.add_sha(p)
|
|
||||||
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 = time.time() - gajim.config.get(
|
|
||||||
'muc_restore_timeout') * 60
|
|
||||||
else:
|
|
||||||
last_time = min(last_date, time.time() - gajim.config.get(
|
|
||||||
'muc_restore_timeout') * 60)
|
|
||||||
last_date = time.strftime('%Y-%m-%dT%H:%M:%SZ', time.gmtime(last_date))
|
|
||||||
t.setTag('history', {'maxstanzas': gajim.config.get(
|
|
||||||
'muc_restore_lines'), 'since': last_date})
|
|
||||||
if password:
|
|
||||||
t.setTagData('password', password)
|
|
||||||
self.connection.send(p)
|
|
||||||
|
|
||||||
# last date/time in history to avoid duplicate
|
# last date/time in history to avoid duplicate
|
||||||
if room_jid not in self.last_history_time:
|
if room_jid not in self.last_history_time:
|
||||||
|
@ -1787,12 +1766,33 @@ class Connection(ConnectionHandlers):
|
||||||
if last_log is None:
|
if last_log is None:
|
||||||
# Not in special table, get it from messages DB
|
# Not in special table, get it from messages DB
|
||||||
last_log = gajim.logger.get_last_date_that_has_logs(room_jid,
|
last_log = gajim.logger.get_last_date_that_has_logs(room_jid,
|
||||||
is_room = True)
|
is_room=True)
|
||||||
# Create self.last_history_time[room_jid] even if not logging,
|
# Create self.last_history_time[room_jid] even if not logging,
|
||||||
# could be used in connection_handlers
|
# could be used in connection_handlers
|
||||||
if last_log is None:
|
if last_log is None:
|
||||||
last_log = 0
|
last_log = 0
|
||||||
self.last_history_time[room_jid]= last_log
|
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'):
|
||||||
|
p = self.add_sha(p)
|
||||||
|
self.add_lang(p)
|
||||||
|
if not change_nick:
|
||||||
|
t = p.setTag(common.xmpp.NS_MUC + ' x')
|
||||||
|
last_date = self.last_history_time[room_jid]
|
||||||
|
if last_date = 0:
|
||||||
|
last_date = time.time() - gajim.config.get(
|
||||||
|
'muc_restore_timeout') * 60
|
||||||
|
else:
|
||||||
|
last_time = min(last_date, time.time() - gajim.config.get(
|
||||||
|
'muc_restore_timeout') * 60)
|
||||||
|
last_date = time.strftime('%Y-%m-%dT%H:%M:%SZ', time.gmtime(last_date))
|
||||||
|
t.setTag('history', {'maxstanzas': gajim.config.get(
|
||||||
|
'muc_restore_lines'), 'since': last_date})
|
||||||
|
if password:
|
||||||
|
t.setTagData('password', password)
|
||||||
|
self.connection.send(p)
|
||||||
|
|
||||||
def send_gc_message(self, jid, msg, xhtml = None):
|
def send_gc_message(self, jid, msg, xhtml = None):
|
||||||
if not self.connection:
|
if not self.connection:
|
||||||
|
|
Loading…
Add table
Reference in a new issue