2019-02-17 02:29:58 +01:00
|
|
|
// Matrix Construct
|
|
|
|
//
|
|
|
|
// Copyright (C) Matrix Construct Developers, Authors & Contributors
|
|
|
|
// Copyright (C) 2016-2019 Jason Volk <jason@zemos.net>
|
|
|
|
//
|
|
|
|
// Permission to use, copy, modify, and/or distribute this software for any
|
|
|
|
// purpose with or without fee is hereby granted, provided that the above
|
|
|
|
// copyright notice and this permission notice is present in all copies. The
|
|
|
|
// full license for this software is available in the LICENSE file.
|
|
|
|
|
|
|
|
#include "rooms.h"
|
|
|
|
|
|
|
|
using namespace ircd;
|
|
|
|
|
|
|
|
resource::response
|
|
|
|
get__event(client &client,
|
|
|
|
const resource::request &request,
|
|
|
|
const m::room::id &room_id)
|
|
|
|
{
|
|
|
|
if(request.parv.size() < 3)
|
2019-03-04 23:36:49 +01:00
|
|
|
throw m::NEED_MORE_PARAMS
|
2019-02-17 02:29:58 +01:00
|
|
|
{
|
2019-03-04 23:36:49 +01:00
|
|
|
"event_id path parameter required"
|
2019-02-17 02:29:58 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
m::event::id::buf event_id
|
|
|
|
{
|
|
|
|
url::decode(event_id, request.parv[2])
|
|
|
|
};
|
|
|
|
|
|
|
|
const m::room room
|
|
|
|
{
|
|
|
|
room_id, event_id
|
|
|
|
};
|
|
|
|
|
2019-08-14 10:01:46 +02:00
|
|
|
if(!visible(room, request.user_id))
|
2019-02-17 02:29:58 +01:00
|
|
|
throw m::ACCESS_DENIED
|
|
|
|
{
|
|
|
|
"You are not permitted to view the room at this event"
|
|
|
|
};
|
|
|
|
|
2019-03-14 22:28:58 +01:00
|
|
|
m::event::fetch::opts fopts;
|
|
|
|
fopts.query_json_force = true;
|
2019-02-17 02:29:58 +01:00
|
|
|
const m::event::fetch event
|
|
|
|
{
|
2019-03-14 22:28:58 +01:00
|
|
|
event_id, fopts
|
2019-02-17 02:29:58 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
return resource::response
|
|
|
|
{
|
2019-03-14 22:28:58 +01:00
|
|
|
client, event.source
|
2019-02-17 02:29:58 +01:00
|
|
|
};
|
|
|
|
}
|