aboutsummaryrefslogtreecommitdiff
path: root/external
diff options
context:
space:
mode:
Diffstat (limited to 'external')
-rwxr-xr-xexternal/messenger.py31
1 files changed, 24 insertions, 7 deletions
diff --git a/external/messenger.py b/external/messenger.py
index cd5d972..f857b46 100755
--- a/external/messenger.py
+++ b/external/messenger.py
@@ -389,7 +389,7 @@ class MessengerBridge:
"room": room,
}
})
- self.joined_map[key] = true
+ self.joined_map[key] = True
def onMessage(self, thread_id, thread_type, message_object, **kwargs):
if message_object.author == self.client.uid:
@@ -443,12 +443,29 @@ class MessengerBridge:
self.cache_put("last_seen_%s"%thread_id, message_object.uid)
- def onPeopleAdded(self, *args, **kwargs):
- pass
- def onPersonRemoved(self, *args, **kwargs):
- pass
- def onTitleChange(self, *args, **kwargs):
- pass
+ def onPeopleAdded(self, added_ids, thread_id, *args, **kwargs):
+ for user_id in added_ids:
+ self.ensureJoined(self.getUserIdFromUid(user_id), thread_id)
+
+ def onPersonRemoved(self, removed_id, thread_id, *args, **kwargs):
+ userId = self.getUserIdFromUid(removed_id),
+ self.write({
+ "_type": EVENT,
+ "data": {
+ "type": EVENT_JOIN,
+ "author": userId,
+ "room": thread_id,
+ }
+ })
+ del self.joined_map["{}--{}".format(userId, thread_id)]
+
+ def onTitleChange(self, author_id, new_title, thread_id, thread_type, *args, **kwargs):
+ if thread_type == ThreadType.GROUP:
+ self.bridge.write({
+ "_type": ROOM_INFO_UPDATED,
+ "room": thread_id,
+ "data": {"name": new_title},
+ })
if __name__ == "__main__":
bridge = MessengerBridge()