0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-25 23:14:13 +01:00

modules/federation: Add get_groups_publicised stub to shut it up.

This commit is contained in:
Jason Volk 2018-03-28 00:14:05 -07:00
parent fc212e8399
commit 28c7494acb
2 changed files with 71 additions and 0 deletions

View file

@ -234,6 +234,7 @@ federation_moduledir = @moduledir@
federation_federation_send_la_SOURCES = federation/send.cc
federation_federation_event_la_SOURCES = federation/event.cc
federation_federation_get_missing_events_la_SOURCES = federation/get_missing_events.cc
federation_federation_get_groups_publicised_la_SOURCES = federation/get_groups_publicised.cc
federation_federation_version_la_SOURCES = federation/version.cc
federation_federation_sender_la_SOURCES = federation/sender.cc
@ -241,6 +242,7 @@ federation_module_LTLIBRARIES = \
federation/federation_send.la \
federation/federation_event.la \
federation/federation_get_missing_events.la \
federation/federation_get_groups_publicised.la \
federation/federation_version.la \
federation/federation_sender.la \
###

View file

@ -0,0 +1,69 @@
// 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.
using namespace ircd;
mapi::header
IRCD_MODULE
{
"Federation (undocumented) :Get groups publicised."
};
resource
get_groups_publicised_resource
{
"/_matrix/federation/v1/get_groups_publicised",
{
"Federation (undocumented) publicised groups handler"
}
};
static resource::response post__groups_publicised(client &, const resource::request &);
resource::method
method_post
{
get_groups_publicised_resource, "POST", post__groups_publicised,
{
method_post.VERIFY_ORIGIN
}
};
resource::response
post__groups_publicised(client &client,
const resource::request &request)
{
const json::array user_ids
{
request["user_ids"]
};
static const size_t max{512};
const size_t count{std::min(size(user_ids), max)};
std::vector<json::member> users;
users.reserve(count);
size_t i(0);
auto it(begin(user_ids));
for(; it != end(user_ids) && i < count; ++it, ++i)
{
const m::user::id user_id{unquote(*it)};
users.emplace_back(user_id, json::empty_array);
}
return resource::response
{
client, json::members
{
{ "users", json::value { users.data(), users.size() } }
}
};
}