Ignore read flag

This modification is to avoid duplicate messages when some of them is read on the phone.
This commit is contained in:
Sasha MOREL 2021-09-04 10:57:15 +02:00
parent f86fa0d6a7
commit 84d8c8bcc8
1 changed files with 6 additions and 2 deletions

8
sms.py
View File

@ -98,13 +98,17 @@ class SMS_Service (Thread):
if len (msgs) < limit_fast_get: if len (msgs) < limit_fast_get:
break break
offset += limit_fast_get offset += limit_fast_get
for msg in self.sms_list:
del (msg ['read'])
while True: while True:
sleep (10) sleep (5)
getting_new = True getting_new = True
offset = 0 offset = 0
while getting_new: while getting_new:
msgs = self.get_sms (limit = limit_normal_get, offset = offset) msgs = self.get_sms (limit = limit_normal_get, offset = offset)
getting_new = False getting_new = False
for msg in msgs:
del (msg ['read'])
for msg in msgs: for msg in msgs:
if msg not in self.sms_list: if msg not in self.sms_list:
getting_new = True getting_new = True
@ -266,7 +270,7 @@ class Web_Service (BaseHTTPRequestHandler):
self.send_header ('Content-type', 'text/html; charset=UTF-8') self.send_header ('Content-type', 'text/html; charset=UTF-8')
self.end_headers () self.end_headers ()
t = [] t = []
for i in sorted (conv, key = lambda item: item [0], reverse = True) [0:5000]: for i in sorted (conv, key = lambda item: item [0], reverse = True) [0:2000]:
if i [1]: if i [1]:
t.append ([i [2], '' + i [0]]) t.append ([i [2], '' + i [0]])
else: else: