Add undocumented _onSeen callback

Mostly just to slowly document unknown events
This commit is contained in:
Mads Marquart
2020-01-06 00:00:19 +01:00
parent 3bb99541e7
commit cf4c22898c

View File

@@ -2231,6 +2231,12 @@ class Client(object):
msg=delta, msg=delta,
) )
elif delta_class == "MarkFolderSeen":
locations = [
ThreadLocation(folder.lstrip("FOLDER_")) for folder in delta["folders"]
]
self._onSeen(locations=locations, ts=delta["timestamp"], msg=delta)
# Emoji change # Emoji change
elif delta_type == "change_thread_icon": elif delta_type == "change_thread_icon":
new_emoji = delta["untypedData"]["thread_icon"] new_emoji = delta["untypedData"]["thread_icon"]
@@ -2741,6 +2747,8 @@ class Client(object):
) )
# Typing # Typing
# /thread_typing {'sender_fbid': X, 'state': 1, 'type': 'typ', 'thread': 'Y'}
# /orca_typing_notifications {'type': 'typ', 'sender_fbid': X, 'state': 0}
elif topic in ("/thread_typing", "/orca_typing_notifications"): elif topic in ("/thread_typing", "/orca_typing_notifications"):
author_id = str(m["sender_fbid"]) author_id = str(m["sender_fbid"])
thread_id = m.get("thread", author_id) thread_id = m.get("thread", author_id)
@@ -2756,13 +2764,6 @@ class Client(object):
msg=m, msg=m,
) )
# Delivered
# Seen
# elif mtype == "m_read_receipt":
#
# self.onSeen(m.get('realtime_viewer_fbid'), m.get('reader'), m.get('time'))
elif topic == "jewel_requests_add": elif topic == "jewel_requests_add":
from_id = m["from"] from_id = m["from"]
self.onFriendRequest(from_id=from_id, msg=m) self.onFriendRequest(from_id=from_id, msg=m)
@@ -3299,6 +3300,17 @@ class Client(object):
""" """
log.info("Friend request from {}".format(from_id)) log.info("Friend request from {}".format(from_id))
def _onSeen(self, locations=None, ts=None, msg=None):
"""
Todo:
Document this, and make it public
Args:
locations: ---
ts: A timestamp of the action
msg: A full set of the data received
"""
def onInbox(self, unseen=None, unread=None, recent_unread=None, msg=None): def onInbox(self, unseen=None, unread=None, recent_unread=None, msg=None):
""" """
Todo: Todo: