2019-02-12 20:32:13 +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.
|
|
|
|
|
2019-07-07 03:11:03 +02:00
|
|
|
namespace ircd::m::client_capabilities
|
|
|
|
{
|
|
|
|
static resource::response get(client &, const resource::request &);
|
|
|
|
|
|
|
|
extern resource::method method_get;
|
2019-09-29 01:12:07 +02:00
|
|
|
extern m::resource resource;
|
2019-07-07 03:11:03 +02:00
|
|
|
}
|
2019-02-12 20:32:13 +01:00
|
|
|
|
2019-07-07 03:11:03 +02:00
|
|
|
ircd::mapi::header
|
2019-02-12 20:32:13 +01:00
|
|
|
IRCD_MODULE
|
|
|
|
{
|
|
|
|
"Client 6 :Capabilities Negotiation"
|
|
|
|
};
|
|
|
|
|
2019-07-07 03:11:03 +02:00
|
|
|
decltype(ircd::m::client_capabilities::resource)
|
|
|
|
ircd::m::client_capabilities::resource
|
2019-02-12 20:32:13 +01:00
|
|
|
{
|
|
|
|
"/_matrix/client/r0/capabilities",
|
|
|
|
{
|
|
|
|
"(6.1) Gets information about the server's supported feature "
|
|
|
|
"set and other relevant capabilities. ",
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2019-07-07 03:11:03 +02:00
|
|
|
decltype(ircd::m::client_capabilities::method_get)
|
|
|
|
ircd::m::client_capabilities::method_get
|
|
|
|
{
|
|
|
|
resource, "GET", get,
|
|
|
|
{
|
|
|
|
method_get.REQUIRES_AUTH
|
|
|
|
| method_get.RATE_LIMITED
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
ircd::resource::response
|
|
|
|
ircd::m::client_capabilities::get(client &client,
|
|
|
|
const resource::request &request)
|
2019-02-12 20:32:13 +01:00
|
|
|
{
|
|
|
|
const bool m_change_password__enabled
|
|
|
|
{
|
|
|
|
mods::loaded("client_account")
|
|
|
|
};
|
|
|
|
|
2019-07-07 03:13:41 +02:00
|
|
|
const json::value default_room_version
|
|
|
|
{
|
2019-08-16 07:36:14 +02:00
|
|
|
string_view{m::createroom::version_default}, json::STRING
|
2019-07-07 03:13:41 +02:00
|
|
|
};
|
|
|
|
|
2019-02-12 20:32:13 +01:00
|
|
|
return resource::response
|
|
|
|
{
|
|
|
|
client, json::members
|
|
|
|
{
|
|
|
|
{ "capabilities", json::members
|
|
|
|
{
|
|
|
|
{ "m.change_password", json::members
|
|
|
|
{
|
|
|
|
{ "enabled", m_change_password__enabled },
|
|
|
|
}},
|
|
|
|
{ "m.room_version", json::members
|
|
|
|
{
|
2019-07-07 03:13:41 +02:00
|
|
|
{ "default", default_room_version },
|
2019-02-12 20:32:13 +01:00
|
|
|
{ "available", json::members
|
|
|
|
{
|
2019-07-10 16:24:20 +02:00
|
|
|
{ "1", "stable" },
|
|
|
|
{ "2", "stable" },
|
|
|
|
{ "3", "stable" },
|
|
|
|
{ "4", "stable" },
|
|
|
|
{ "5", "stable" },
|
2019-02-12 20:32:13 +01:00
|
|
|
}},
|
|
|
|
}},
|
|
|
|
}},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|