LOC-11 Update last used time for all message types
LOC-11 Update last used time for all message types

We'll now update {{lastactivity}} when DMs are sent, or when SYSTEM sends a message.

Should avoid having the room close on you if you join a second before the auto-close would have triggered

--- a/server/LocalChat.py
+++ b/server/LocalChat.py
@@ -546,6 +546,11 @@
         msgid = self.cursor.lastrowid
         self.conn.commit()
         
+        # Update the last activity field in the DB
+        # See LOC-11
+        self.cursor.execute("UPDATE rooms set lastactivity=? where id=?",(time.time(),room))
+        self.conn.commit()        
+        
         # Check the latest message ID for that room
         self.cursor.execute("SELECT id from messages WHERE room=? and id != ? ORDER BY id DESC",(room,msgid))
         r = self.cursor.fetchone()
@@ -701,6 +706,11 @@
         
         self.cursor.execute("INSERT INTO messages (ts,room,msg,user) VALUES (?,?,?,'SYSTEM')",(time.time(),room,m))
         msgid = self.cursor.lastrowid
+        
+        # Update the last activity field in the DB
+        # See LOC-11
+        self.cursor.execute("UPDATE rooms set lastactivity=? where id=?",(time.time(),room))
+        
         self.conn.commit()
         return msgid