diff options
author | Erik Johnston <erik@matrix.org> | 2014-08-15 17:50:27 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2014-08-15 17:50:27 +0100 |
commit | 7f5c7ddea9db879e500a48b47ad4f782d2d8416b (patch) | |
tree | 3332c614902b5641451da530ac9d2a3bed538a15 /synapse/handlers | |
parent | Fix some of the tests to reflect changes in the storage layer. (diff) | |
parent | Get presence for members when you enter a room (it was coming down but wasn't... (diff) | |
download | synapse-7f5c7ddea9db879e500a48b47ad4f782d2d8416b.tar.xz |
Merge branch 'master' of github.com:matrix-org/synapse into sql_refactor
Diffstat (limited to 'synapse/handlers')
-rw-r--r-- | synapse/handlers/presence.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/synapse/handlers/presence.py b/synapse/handlers/presence.py index 351ff305dc..049891eaf8 100644 --- a/synapse/handlers/presence.py +++ b/synapse/handlers/presence.py @@ -380,14 +380,23 @@ class PresenceHandler(BaseHandler): logger.debug("Start polling for presence from %s", user) if target_user: - target_users = [target_user] + target_users = set(target_user) else: presence = yield self.store.get_presence_list( user.localpart, accepted=True ) - target_users = [ + target_users = set([ self.hs.parse_userid(x["observed_user_id"]) for x in presence - ] + ]) + + # Also include people in all my rooms + + rm_handler = self.homeserver.get_handlers().room_member_handler + room_ids = yield rm_handler.get_rooms_for_user(user) + + for room_id in room_ids: + for member in (yield rm_handler.get_room_members(room_id)): + target_users.add(member) if state is None: state = yield self.store.get_presence_state(user.localpart) |