From 5a93bfe1f03bf225bcf3b14089faefa3b5715499 Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Tue, 26 Aug 2014 17:21:48 +0100 Subject: Removed MessageRestServlet, use RoomSendEventRestServlet instead. Updated cmdclient, tests and webclient. All appears to work. --- synapse/rest/room.py | 49 ------------------------------------------------- 1 file changed, 49 deletions(-) (limited to 'synapse/rest/room.py') 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[^/]*)/messages/" - + "(?P[^/]*)/(?P[^/]*)$") - - 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[^/]*)/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) -- cgit 1.4.1