|
|
|
@ -44,6 +44,10 @@ import logging |
|
|
|
|
logger = logging.getLogger(__name__) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def user_joined_room(distributor, user, room_id): |
|
|
|
|
return distributor.fire("user_joined_room", user, room_id) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class FederationHandler(BaseHandler): |
|
|
|
|
"""Handles events that originated from federation. |
|
|
|
|
Responsible for: |
|
|
|
@ -60,10 +64,7 @@ class FederationHandler(BaseHandler): |
|
|
|
|
|
|
|
|
|
self.hs = hs |
|
|
|
|
|
|
|
|
|
self.distributor.observe( |
|
|
|
|
"user_joined_room", |
|
|
|
|
self._on_user_joined |
|
|
|
|
) |
|
|
|
|
self.distributor.observe("user_joined_room", self.user_joined_room) |
|
|
|
|
|
|
|
|
|
self.waiting_for_join_list = {} |
|
|
|
|
|
|
|
|
@ -234,9 +235,7 @@ class FederationHandler(BaseHandler): |
|
|
|
|
if event.type == EventTypes.Member: |
|
|
|
|
if event.membership == Membership.JOIN: |
|
|
|
|
user = UserID.from_string(event.state_key) |
|
|
|
|
yield self.distributor.fire( |
|
|
|
|
"user_joined_room", user=user, room_id=event.room_id |
|
|
|
|
) |
|
|
|
|
yield user_joined_room(self.distributor, user, event.room_id) |
|
|
|
|
|
|
|
|
|
@defer.inlineCallbacks |
|
|
|
|
def _filter_events_for_server(self, server_name, room_id, events): |
|
|
|
@ -733,9 +732,7 @@ class FederationHandler(BaseHandler): |
|
|
|
|
if event.type == EventTypes.Member: |
|
|
|
|
if event.content["membership"] == Membership.JOIN: |
|
|
|
|
user = UserID.from_string(event.state_key) |
|
|
|
|
yield self.distributor.fire( |
|
|
|
|
"user_joined_room", user=user, room_id=event.room_id |
|
|
|
|
) |
|
|
|
|
yield user_joined_room(self.distributor, user, event.room_id) |
|
|
|
|
|
|
|
|
|
new_pdu = event |
|
|
|
|
|
|
|
|
@ -1082,7 +1079,7 @@ class FederationHandler(BaseHandler): |
|
|
|
|
return self.store.get_min_depth(context) |
|
|
|
|
|
|
|
|
|
@log_function |
|
|
|
|
def _on_user_joined(self, user, room_id): |
|
|
|
|
def user_joined_room(self, user, room_id): |
|
|
|
|
waiters = self.waiting_for_join_list.get( |
|
|
|
|
(user.to_string(), room_id), |
|
|
|
|
[] |
|
|
|
|