Mercurial > libervia-backend
comparison frontends/src/primitivus/chat.py @ 521:3f8c2a0f20e5
primitivus: fixed double messages discarding
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 21 Oct 2012 13:23:21 +0200 |
parents | 4d7248f4c577 |
children | 3bd8f84f920d |
comparison
equal
deleted
inserted
replaced
520:4d7248f4c577 | 521:3f8c2a0f20e5 |
---|---|
249 current_text = self.content[idx] | 249 current_text = self.content[idx] |
250 if new_text.timestamp < current_text.timestamp and idx > 0: | 250 if new_text.timestamp < current_text.timestamp and idx > 0: |
251 continue #the new message is older, we need to insert it upper | 251 continue #the new message is older, we need to insert it upper |
252 | 252 |
253 #we discard double messages, to avoid backlog / history conflict | 253 #we discard double messages, to avoid backlog / history conflict |
254 if idx and self.content[idx-1].message == msg: | 254 if ((idx and self.content[idx-1].message == msg) or |
255 return | 255 (self.content[idx].message == msg) or |
256 if idx<len(self.content)-2 and self.content[idx+1].message == msg: | 256 (idx<len(self.content)-2 and self.content[idx+1].message)): |
257 return | 257 return |
258 | 258 |
259 self.content.insert(idx+1, new_text) | 259 self.content.insert(idx+1, new_text) |
260 break | 260 break |
261 else: | 261 else: |