diff options
author | Kegan Dougal <kegan@matrix.org> | 2015-02-11 10:36:08 +0000 |
---|---|---|
committer | Kegan Dougal <kegan@matrix.org> | 2015-02-11 10:36:08 +0000 |
commit | c7783d6feec9b69c24f3303cbb51cce3e6b8ffb3 (patch) | |
tree | 0b15fab036089ac0d9516c8b74a2976c5566b94d /synapse/handlers | |
parent | Merge branch 'develop' into application-services (diff) | |
download | synapse-c7783d6feec9b69c24f3303cbb51cce3e6b8ffb3.tar.xz |
Notify ASes for events sent by other users in a room which an AS user is a part of.
Diffstat (limited to 'synapse/handlers')
-rw-r--r-- | synapse/handlers/appservice.py | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/synapse/handlers/appservice.py b/synapse/handlers/appservice.py index 8591a77bf3..2c488a46f6 100644 --- a/synapse/handlers/appservice.py +++ b/synapse/handlers/appservice.py @@ -15,7 +15,7 @@ from twisted.internet import defer -from synapse.api.constants import EventTypes +from synapse.api.constants import EventTypes, Membership from synapse.api.errors import Codes, StoreError, SynapseError from synapse.appservice import ApplicationService from synapse.types import UserID @@ -154,14 +154,25 @@ class ApplicationServicesHandler(object): list<ApplicationService>: A list of services interested in this event based on the service regex. """ - # We need to know the aliases associated with this event.room_id, if any - if not alias_list: - alias_list = yield self.store.get_aliases_for_room(event.room_id) + member_list = None + if hasattr(event, "room_id"): + # We need to know the aliases associated with this event.room_id, + # if any. + if not alias_list: + alias_list = yield self.store.get_aliases_for_room( + event.room_id + ) + # We need to know the members associated with this event.room_id, + # if any. + member_list = yield self.store.get_room_members( + room_id=event.room_id, + membership=Membership.JOIN + ) services = yield self.store.get_app_services() interested_list = [ s for s in services if ( - s.is_interested(event, restrict_to, alias_list) + s.is_interested(event, restrict_to, alias_list, member_list) ) ] defer.returnValue(interested_list) |