mirror of
https://github.com/Sneed-Group/pypush-plus-plus
synced 2025-01-09 17:33:47 +00:00
add group chat sending and fix bugs
This commit is contained in:
parent
84fe9ed44a
commit
a4dbc56d8d
2 changed files with 13 additions and 9 deletions
17
demo.py
17
demo.py
|
@ -126,10 +126,10 @@ threading.Thread(target=input_thread, daemon=True).start()
|
||||||
|
|
||||||
print("Type 'help' for help")
|
print("Type 'help' for help")
|
||||||
|
|
||||||
current_chat = None
|
current_participants = []
|
||||||
while True:
|
while True:
|
||||||
msg = im.receive()
|
msg = im.receive()
|
||||||
if msg is not None and msg.sender != user.handles[0]:
|
if msg is not None:
|
||||||
print(f'[{msg.sender}] {msg.text}')
|
print(f'[{msg.sender}] {msg.text}')
|
||||||
|
|
||||||
if len(INPUT_QUEUE) > 0:
|
if len(INPUT_QUEUE) > 0:
|
||||||
|
@ -147,17 +147,18 @@ while True:
|
||||||
elif msg.startswith('filter ') or msg.startswith('f '):
|
elif msg.startswith('filter ') or msg.startswith('f '):
|
||||||
# Set the curernt chat
|
# Set the curernt chat
|
||||||
msg = msg.split(' ')
|
msg = msg.split(' ')
|
||||||
if len(msg) < 2:
|
if len(msg) < 2 or msg[1] == '':
|
||||||
print('filter [recipient]')
|
print('filter [recipients]')
|
||||||
else:
|
else:
|
||||||
current_chat = msg[1]
|
print(f'Filtering to {msg[1:]}')
|
||||||
elif current_chat is not None:
|
current_participants = msg[1:]
|
||||||
|
elif current_participants != []:
|
||||||
if msg.startswith('\\'):
|
if msg.startswith('\\'):
|
||||||
msg = msg[1:]
|
msg = msg[1:]
|
||||||
im.send(imessage.iMessage(
|
im.send(imessage.iMessage(
|
||||||
text=msg,
|
text=msg,
|
||||||
participants=[current_chat, user.handles[0]],
|
participants=current_participants,
|
||||||
#sender=user.handles[0]
|
sender=user.handles[0]
|
||||||
))
|
))
|
||||||
else:
|
else:
|
||||||
print('No chat selected, use help for help')
|
print('No chat selected, use help for help')
|
||||||
|
|
|
@ -386,6 +386,9 @@ class iMessageUser:
|
||||||
bundled_payloads = []
|
bundled_payloads = []
|
||||||
for participant in message.participants:
|
for participant in message.participants:
|
||||||
for push_token in self.USER_CACHE[participant]:
|
for push_token in self.USER_CACHE[participant]:
|
||||||
|
if push_token == self.connection.token:
|
||||||
|
continue # Don't send to ourselves
|
||||||
|
|
||||||
identity_keys = ids.identity.IDSIdentity.decode(
|
identity_keys = ids.identity.IDSIdentity.decode(
|
||||||
self.KEY_CACHE[push_token][0]
|
self.KEY_CACHE[push_token][0]
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue