2018-02-14 21:23:20 +01:00
|
|
|
// Matrix Construct
|
|
|
|
//
|
|
|
|
// Copyright (C) Matrix Construct Developers, Authors & Contributors
|
|
|
|
// Copyright (C) 2016-2018 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;
|
|
|
|
|
2019-09-29 01:12:07 +02:00
|
|
|
m::resource::response
|
2018-02-14 21:23:20 +01:00
|
|
|
post__join(client &client,
|
2019-09-29 01:12:07 +02:00
|
|
|
const m::resource::request &request,
|
2019-08-26 03:28:53 +02:00
|
|
|
const m::room::id &room_id)
|
2018-02-14 21:23:20 +01:00
|
|
|
{
|
2020-04-22 05:02:27 +02:00
|
|
|
static const size_t server_name_maxarg{16U};
|
|
|
|
const auto server_name_count
|
2018-02-22 10:35:00 +01:00
|
|
|
{
|
2020-04-22 05:02:27 +02:00
|
|
|
std::min(request.query.count("server_name"), server_name_maxarg)
|
|
|
|
};
|
|
|
|
|
|
|
|
string_view server_name[server_name_maxarg];
|
|
|
|
const unique_mutable_buffer server_name_buf
|
|
|
|
{
|
|
|
|
rfc3986::DOMAIN_BUFSIZE * server_name_count
|
|
|
|
};
|
|
|
|
|
|
|
|
const auto query_server_names
|
|
|
|
{
|
|
|
|
request.query.array(server_name_buf, "server_name", server_name)
|
2018-02-22 10:35:00 +01:00
|
|
|
};
|
|
|
|
|
2020-04-22 05:02:27 +02:00
|
|
|
//XXX ???
|
|
|
|
const json::string &content_server_names
|
2018-06-12 09:29:00 +02:00
|
|
|
{
|
2019-08-26 03:28:53 +02:00
|
|
|
request["server_name"]
|
2018-06-12 09:29:00 +02:00
|
|
|
};
|
|
|
|
|
2020-04-22 05:02:27 +02:00
|
|
|
const auto &server_names
|
|
|
|
{
|
|
|
|
query_server_names
|
|
|
|
};
|
|
|
|
|
|
|
|
const json::string &third_party_signed
|
|
|
|
{
|
|
|
|
request["third_party_signed"]
|
|
|
|
};
|
|
|
|
|
2019-04-22 22:21:05 +02:00
|
|
|
const m::room room
|
|
|
|
{
|
|
|
|
room_id
|
|
|
|
};
|
|
|
|
|
2020-04-17 02:11:20 +02:00
|
|
|
const auto event_id
|
|
|
|
{
|
2020-04-22 05:02:27 +02:00
|
|
|
m::join(room, request.user_id, server_names)
|
2020-04-17 02:11:20 +02:00
|
|
|
};
|
2018-02-14 21:23:20 +01:00
|
|
|
|
2019-09-29 01:12:07 +02:00
|
|
|
return m::resource::response
|
2018-02-14 21:23:20 +01:00
|
|
|
{
|
|
|
|
client, json::members
|
|
|
|
{
|
|
|
|
{ "room_id", room_id }
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|