Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add Status Viewer Sidebar to Client UI #363

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add getStatuses func to retrive Statuses
hossinasaadi committed Feb 11, 2022
commit 3ff95e2e06e03f95300325450734a6b5e6fdfb88
13 changes: 13 additions & 0 deletions backend/whatsapp.py
Original file line number Diff line number Diff line change
@@ -200,6 +200,7 @@ def onMessage(self, ws, message):
if isinstance(jsonObj, list) and len(jsonObj) > 0: # check if the result is an array
eprint(json.dumps(jsonObj));
if jsonObj[0] == "Conn":
self.getStatuses(); # request for contacts statuses
Timer(20.0, self.keepAlive).start() # Keepalive Request
self.connInfo["clientToken"] = jsonObj[1]["clientToken"];
self.connInfo["serverToken"] = jsonObj[1]["serverToken"];
@@ -300,6 +301,18 @@ def sortedContacts(self,processedData):
contacts[processedData[2][contact][1]['jid']] = processedData[2][contact][1]['name']
return contacts

def getStatuses(self):
messageId = "3EB0"+binascii.hexlify(Random.get_random_bytes(8)).upper()
encryptedMessage = WhatsAppEncrypt(
self.loginInfo["key"]["encKey"],
self.loginInfo["key"]["macKey"],
whatsappWriteBinary(["query", {"type": "status","jid":""}, None])
)
payload = bytearray(messageId) + bytearray(",") + bytearray(
to_bytes(WAMetrics.QUERY_MEDIA, 1)
) + bytearray([0x80]) + encryptedMessage
self.activeWs.send(payload, websocket.ABNF.OPCODE_BINARY)

def getLoginInfo(self, callback):
callback["func"]({ "type": "login_info", "data": self.loginInfo }, callback);