summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-01-05 14:06:23 +0000
committerErik Johnston <erik@matrix.org>2016-01-05 14:06:23 +0000
commitd74c4e90d4e012a5441a783d6b1ca2592a3da0c7 (patch)
treeccfb4e56f09e4035d56f2e5b0ea87c5550065ea5
parentMerge branch 'master' of github.com:matrix-org/synapse into develop (diff)
parentUse named args (diff)
downloadsynapse-d74c4e90d4e012a5441a783d6b1ca2592a3da0c7.tar.xz
Merge pull request #460 from matrix-org/erikj/create_room_3pid_invite
Support inviting 3pids in /createRoom
-rw-r--r--synapse/handlers/room.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/synapse/handlers/room.py b/synapse/handlers/room.py
index 13f66e0df0..0cfeda10d8 100644
--- a/synapse/handlers/room.py
+++ b/synapse/handlers/room.py
@@ -115,6 +115,8 @@ class RoomCreationHandler(BaseHandler):
             except:
                 raise SynapseError(400, "Invalid user_id: %s" % (i,))
 
+        invite_3pid_list = config.get("invite_3pid", [])
+
         is_public = config.get("visibility", None) == "public"
 
         if room_id:
@@ -220,6 +222,20 @@ class RoomCreationHandler(BaseHandler):
                 "content": {"membership": Membership.INVITE},
             }, ratelimit=False)
 
+        for invite_3pid in invite_3pid_list:
+            id_server = invite_3pid["id_server"]
+            address = invite_3pid["address"]
+            medium = invite_3pid["medium"]
+            yield self.hs.get_handlers().room_member_handler.do_3pid_invite(
+                room_id,
+                user,
+                medium,
+                address,
+                id_server,
+                token_id=None,
+                txn_id=None,
+            )
+
         result = {"room_id": room_id}
 
         if room_alias: