summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorKegan Dougal <kegan@matrix.org>2014-08-26 17:21:48 +0100
committerKegan Dougal <kegan@matrix.org>2014-08-26 17:21:48 +0100
commit5a93bfe1f03bf225bcf3b14089faefa3b5715499 (patch)
tree8fdd0868de29108aa3de5a9bb524b516c343e326 /synapse
parentAdded RoomSendEventRestServlet to send generic non-state events. It even appe... (diff)
downloadsynapse-5a93bfe1f03bf225bcf3b14089faefa3b5715499.tar.xz
Removed MessageRestServlet, use RoomSendEventRestServlet instead. Updated cmdclient, tests and webclient. All appears to work.
Diffstat (limited to 'synapse')
-rw-r--r--synapse/rest/room.py49
1 files changed, 0 insertions, 49 deletions
diff --git a/synapse/rest/room.py b/synapse/rest/room.py
index 27a622b57d..e00f74cf19 100644
--- a/synapse/rest/room.py
+++ b/synapse/rest/room.py
@@ -228,54 +228,6 @@ class JoinRoomAliasServlet(RestServlet):
         defer.returnValue((200, ret_dict))
 
 
-class MessageRestServlet(RestServlet):
-    PATTERN = client_path_pattern("/rooms/(?P<room_id>[^/]*)/messages/"
-                                  + "(?P<sender_id>[^/]*)/(?P<msg_id>[^/]*)$")
-
-    def get_event_type(self):
-        return MessageEvent.TYPE
-
-    @defer.inlineCallbacks
-    def on_GET(self, request, room_id, sender_id, msg_id):
-        user = yield self.auth.get_user_by_req(request)
-
-        msg_handler = self.handlers.message_handler
-        msg = yield msg_handler.get_message(room_id=urllib.unquote(room_id),
-                                            sender_id=urllib.unquote(sender_id),
-                                            msg_id=msg_id,
-                                            user_id=user.to_string(),
-                                            )
-
-        if not msg:
-            raise SynapseError(404, "Message not found.",
-                               errcode=Codes.NOT_FOUND)
-
-        defer.returnValue((200, json.loads(msg.content)))
-
-    @defer.inlineCallbacks
-    def on_PUT(self, request, room_id, sender_id, msg_id):
-        user = yield self.auth.get_user_by_req(request)
-
-        if user.to_string() != urllib.unquote(sender_id):
-            raise SynapseError(403, "Must send messages as yourself.",
-                               errcode=Codes.FORBIDDEN)
-
-        content = _parse_json(request)
-
-        event = self.event_factory.create_event(
-            etype=self.get_event_type(),
-            room_id=urllib.unquote(room_id),
-            user_id=user.to_string(),
-            msg_id=msg_id,
-            content=content
-            )
-
-        msg_handler = self.handlers.message_handler
-        yield msg_handler.send_message(event)
-
-        defer.returnValue((200, ""))
-
-
 class FeedbackRestServlet(RestServlet):
     PATTERN = client_path_pattern(
         "/rooms/(?P<room_id>[^/]*)/messages/" +
@@ -495,7 +447,6 @@ def register_txn_path(servlet, regex_string, http_server, with_get=False):
 
 def register_servlets(hs, http_server):
     RoomStateEventRestServlet(hs).register(http_server)
-    MessageRestServlet(hs).register(http_server)
     FeedbackRestServlet(hs).register(http_server)
     RoomCreateRestServlet(hs).register(http_server)
     RoomMemberListRestServlet(hs).register(http_server)