summary refs log tree commit diff
path: root/synapse/handlers
diff options
context:
space:
mode:
authorDaniel Wagner-Hall <daniel@matrix.org>2015-10-13 15:48:12 +0100
committerDaniel Wagner-Hall <daniel@matrix.org>2015-10-13 15:48:12 +0100
commit17dffef5ec74d789f68096c95d29cdcad57ce5c7 (patch)
treec28e54f40c79a4640aaeb1671efe8c1133980c13 /synapse/handlers
parentMerge branch 'develop' into daniel/3pidinvites (diff)
downloadsynapse-17dffef5ec74d789f68096c95d29cdcad57ce5c7.tar.xz
Move event contents into third_party_layout field
Diffstat (limited to 'synapse/handlers')
-rw-r--r--synapse/handlers/_base.py2
-rw-r--r--synapse/handlers/federation.py5
-rw-r--r--synapse/handlers/room.py11
3 files changed, 11 insertions, 7 deletions
diff --git a/synapse/handlers/_base.py b/synapse/handlers/_base.py
index faf99f5bd3..4165c56bed 100644
--- a/synapse/handlers/_base.py
+++ b/synapse/handlers/_base.py
@@ -127,7 +127,7 @@ class BaseHandler(object):
         if (
             event.type == EventTypes.Member and
             event.content["membership"] == Membership.JOIN and
-            ThirdPartyInvites.has_join_keys(event.content)
+            ThirdPartyInvites.join_has_third_party_invite(event.content)
         ):
             yield ThirdPartyInvites.check_key_valid(
                 self.hs.get_simple_http_client(),
diff --git a/synapse/handlers/federation.py b/synapse/handlers/federation.py
index 8197d8b2d0..8606c0d285 100644
--- a/synapse/handlers/federation.py
+++ b/synapse/handlers/federation.py
@@ -705,7 +705,8 @@ class FederationHandler(BaseHandler):
         """
         event_content = {"membership": Membership.JOIN}
         if ThirdPartyInvites.has_join_keys(query):
-            ThirdPartyInvites.copy_join_keys(query, event_content)
+            event_content["third_party_invite"] = {}
+            ThirdPartyInvites.copy_join_keys(query, event_content["third_party_invite"])
 
         builder = self.event_builder_factory.new({
             "type": EventTypes.Member,
@@ -721,7 +722,7 @@ class FederationHandler(BaseHandler):
 
         self.auth.check(event, auth_events=context.current_state)
 
-        if ThirdPartyInvites.has_join_keys(event.content):
+        if ThirdPartyInvites.join_has_third_party_invite(event.content):
             ThirdPartyInvites.check_key_valid(self.hs.get_simple_http_client(), event)
 
         defer.returnValue(event)
diff --git a/synapse/handlers/room.py b/synapse/handlers/room.py
index b856b424a7..e07472b4b9 100644
--- a/synapse/handlers/room.py
+++ b/synapse/handlers/room.py
@@ -483,10 +483,13 @@ class RoomMemberHandler(BaseHandler):
 
                 should_do_dance = not self.hs.is_mine(inviter)
                 room_hosts = [inviter.domain]
-            elif "sender" in event.content:
-                inviter = UserID.from_string(event.content["sender"])
-                should_do_dance = not self.hs.is_mine(inviter)
-                room_hosts = [inviter.domain]
+            elif "third_party_invite" in event.content:
+                if "sender" in event.content["third_party_invite"]:
+                    inviter = UserID.from_string(
+                        event.content["third_party_invite"]["sender"]
+                    )
+                    should_do_dance = not self.hs.is_mine(inviter)
+                    room_hosts = [inviter.domain]
             else:
                 # return the same error as join_room_alias does
                 raise SynapseError(404, "No known servers")