do not duplicate messages in the room when the connection is lost
This commit is contained in:
parent
aa369ccce3
commit
09942f48e0
|
@ -2304,7 +2304,8 @@ class Connection(CommonConnection, ConnectionHandlers):
|
||||||
room_id=resp.getTag('unique').getData()))
|
room_id=resp.getTag('unique').getData()))
|
||||||
self.connection.SendAndCallForResponse(iq, _on_response)
|
self.connection.SendAndCallForResponse(iq, _on_response)
|
||||||
|
|
||||||
def join_gc(self, nick, room_jid, password, change_nick=False):
|
def join_gc(self, nick, room_jid, password, change_nick=False,
|
||||||
|
rejoin=False):
|
||||||
# FIXME: This room JID needs to be normalized; see #1364
|
# FIXME: This room JID needs to be normalized; see #1364
|
||||||
if not gajim.account_is_connected(self.name):
|
if not gajim.account_is_connected(self.name):
|
||||||
return
|
return
|
||||||
|
@ -2353,6 +2354,10 @@ class Connection(CommonConnection, ConnectionHandlers):
|
||||||
last_date = time.strftime('%Y-%m-%dT%H:%M:%SZ', time.gmtime(
|
last_date = time.strftime('%Y-%m-%dT%H:%M:%SZ', time.gmtime(
|
||||||
last_date))
|
last_date))
|
||||||
tags['since'] = last_date
|
tags['since'] = last_date
|
||||||
|
if rejoin:
|
||||||
|
tags['since'] = time.strftime('%Y-%m-%dT%H:%M:%SZ',
|
||||||
|
time.gmtime(gajim.logger.get_last_date_that_has_logs(
|
||||||
|
room_jid, is_room=True) + 1))
|
||||||
nb = gajim.config.get('muc_restore_lines')
|
nb = gajim.config.get('muc_restore_lines')
|
||||||
if nb >= 0:
|
if nb >= 0:
|
||||||
tags['maxstanzas'] = nb
|
tags['maxstanzas'] = nb
|
||||||
|
|
|
@ -1274,7 +1274,7 @@ class GroupchatControl(ChatControlBase):
|
||||||
gajim.gc_connected[obj.conn.name][self.room_jid]:
|
gajim.gc_connected[obj.conn.name][self.room_jid]:
|
||||||
return
|
return
|
||||||
password = gajim.gc_passwords.get(self.room_jid, '')
|
password = gajim.gc_passwords.get(self.room_jid, '')
|
||||||
obj.conn.join_gc(self.nick, self.room_jid, password)
|
obj.conn.join_gc(self.nick, self.room_jid, password, rejoin=True)
|
||||||
|
|
||||||
def _nec_decrypted_message_received(self, obj):
|
def _nec_decrypted_message_received(self, obj):
|
||||||
if obj.conn.name != self.account:
|
if obj.conn.name != self.account:
|
||||||
|
@ -1351,7 +1351,7 @@ class GroupchatControl(ChatControlBase):
|
||||||
return False
|
return False
|
||||||
password = gajim.gc_passwords.get(self.room_jid, '')
|
password = gajim.gc_passwords.get(self.room_jid, '')
|
||||||
gajim.connections[self.account].join_gc(self.nick, self.room_jid,
|
gajim.connections[self.account].join_gc(self.nick, self.room_jid,
|
||||||
password)
|
password, rejoin=True)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def draw_roster(self):
|
def draw_roster(self):
|
||||||
|
|
Loading…
Reference in New Issue