[Jim++] keep in mem las muc message time, and save it in database when we quit. Fixes #5490
This commit is contained in:
parent
ae3a0b6db6
commit
88a149035b
|
@ -2087,12 +2087,11 @@ class Connection(CommonConnection, ConnectionHandlers):
|
|||
"""
|
||||
A groupchat got disconnected. This can be or purpose or not
|
||||
|
||||
Save the time we quit to avoid duplicate logs AND be faster than get that
|
||||
date from DB. Save it in mem AND in a small table (with fast access)
|
||||
Save the time we had last message to avoid duplicate logs AND be faster
|
||||
than get that date from DB. Save time that we have in mem in a small
|
||||
table (with fast access)
|
||||
"""
|
||||
log_time = time_time()
|
||||
self.last_history_time[room_jid] = log_time
|
||||
gajim.logger.set_room_last_message_time(room_jid, log_time)
|
||||
gajim.logger.set_room_last_message_time(room_jid, self.last_history_time[room_jid])
|
||||
|
||||
def gc_set_role(self, room_jid, nick, role, reason = ''):
|
||||
"""
|
||||
|
|
|
@ -2198,6 +2198,11 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream,
|
|||
# so don't store it in logs
|
||||
try:
|
||||
gajim.logger.write('gc_msg', frm, msgtxt, tim=tim)
|
||||
# store in memory time of last message logged.
|
||||
# this will also be saved in rooms_last_message_time table
|
||||
# when we quit this muc
|
||||
self.last_history_time[jid] = mktime(tim)
|
||||
|
||||
except exceptions.PysqliteOperationalError, e:
|
||||
self.dispatch('ERROR', (_('Disk Write Error'), str(e)))
|
||||
except exceptions.DatabaseMalformed:
|
||||
|
|
Loading…
Reference in New Issue