diff options
author | Erik Johnston <erik@matrix.org> | 2014-09-03 19:47:32 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2014-09-03 19:47:32 +0100 |
commit | 0538a4098d797eaa901c168e3a76df2ac94da2ed (patch) | |
tree | bc1ef822fdb3184daf6d39a2ab4da1afb6370dd9 /synapse/handlers/room.py | |
parent | Add database upgrade script (diff) | |
parent | Bump versions. Update change logs. (diff) | |
download | synapse-0538a4098d797eaa901c168e3a76df2ac94da2ed.tar.xz |
Merge branch 'release-v0.2.1' v0.2.1
Diffstat (limited to 'synapse/handlers/room.py')
-rw-r--r-- | synapse/handlers/room.py | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/synapse/handlers/room.py b/synapse/handlers/room.py index 53aa77405c..8171e9eb45 100644 --- a/synapse/handlers/room.py +++ b/synapse/handlers/room.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2014 matrix.org +# Copyright 2014 OpenMarket Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -49,6 +49,7 @@ class RoomCreationHandler(BaseRoomHandler): SynapseError if the room ID was taken, couldn't be stored, or something went horribly wrong. """ + self.ratelimit(user_id) if "room_alias_name" in config: room_alias = RoomAlias.create_local( @@ -110,8 +111,6 @@ class RoomCreationHandler(BaseRoomHandler): servers=[self.hs.hostname], ) - federation_handler = self.hs.get_handlers().federation_handler - @defer.inlineCallbacks def handle_event(event): snapshot = yield self.store.snapshot_room( @@ -138,6 +137,17 @@ class RoomCreationHandler(BaseRoomHandler): ) yield handle_event(name_event) + elif room_alias: + name = room_alias.to_string() + name_event = self.event_factory.create_event( + etype=RoomNameEvent.TYPE, + room_id=room_id, + user_id=user_id, + required_power_level=5, + content={"name": name}, + ) + + yield handle_event(name_event) if "topic" in config: topic = config["topic"] |