Termux API update

This commit is contained in:
Sasha MOREL 2022-01-01 20:00:17 +01:00
parent 87ffd22d35
commit 3be5af77c6
1 changed files with 5 additions and 3 deletions

8
sms.py
View File

@ -84,8 +84,10 @@ class SMS_Service (Thread):
l [i ['threadid']] [1] = i ['received'] l [i ['threadid']] [1] = i ['received']
l [i ['threadid']] [2] = i ['body'] l [i ['threadid']] [2] = i ['body']
l [i ['threadid']] [3] += 1 l [i ['threadid']] [3] += 1
if len (l [i ['threadid']]) == 4 and 'sender' in i and i ['type'] == 'inbox':
l [i ['threadid']].append (i ['sender'])
else: else:
if 'sender' in i: if 'sender' in i and i ['type'] == 'inbox':
l [i ['threadid']] = [i ['number'], i ['received'], i ['body'], 1, i ['sender']] l [i ['threadid']] = [i ['number'], i ['received'], i ['body'], 1, i ['sender']]
else: else:
l [i ['threadid']] = [i ['number'], i ['received'], i ['body'], 1] l [i ['threadid']] = [i ['number'], i ['received'], i ['body'], 1]
@ -100,6 +102,6 @@ class SMS_Service (Thread):
l.append ((i ['received'], True if i ['type'] == 'inbox' else False, i ['body'])) l.append ((i ['received'], True if i ['type'] == 'inbox' else False, i ['body']))
if number is None: if number is None:
number = i ['number'] number = i ['number']
if 'sender' in i: if name is None and i ['type'] == 'inbox' and 'sender' in i:
name = i ['sender'] name = i ['sender']
return (number, name, sorted (l, key = lambda item: item [0])) return (number, name, sorted (l, key = lambda item: item [0]))