2018-06-18 05:34:03 +02: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.
|
|
|
|
|
2020-08-01 02:43:57 +02:00
|
|
|
namespace ircd::m::groups
|
|
|
|
{
|
|
|
|
static resource::response handle_get(client &, const resource::request &);
|
|
|
|
extern resource::method get_joined_groups;
|
|
|
|
extern resource joined_groups_resource;
|
|
|
|
}
|
2018-06-18 05:34:03 +02:00
|
|
|
|
2020-08-01 02:43:57 +02:00
|
|
|
ircd::mapi::header
|
2018-06-18 05:34:03 +02:00
|
|
|
IRCD_MODULE
|
|
|
|
{
|
|
|
|
"Client (unspecified) :Joined Groups",
|
|
|
|
};
|
|
|
|
|
2020-08-01 02:43:57 +02:00
|
|
|
decltype(ircd::m::groups::joined_groups_resource)
|
|
|
|
ircd::m::groups::joined_groups_resource
|
2018-06-18 05:34:03 +02:00
|
|
|
{
|
|
|
|
"/_matrix/client/r0/joined_groups",
|
|
|
|
{
|
2020-08-01 02:43:57 +02:00
|
|
|
"(Unspecified/undocumented)"
|
2018-06-18 05:34:03 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2020-08-01 02:43:57 +02:00
|
|
|
decltype(ircd::m::groups::get_joined_groups)
|
|
|
|
ircd::m::groups::get_joined_groups
|
2018-06-18 05:34:03 +02:00
|
|
|
{
|
2020-08-01 02:43:57 +02:00
|
|
|
joined_groups_resource, "GET", handle_get,
|
2018-06-18 05:34:03 +02:00
|
|
|
{
|
2020-08-01 02:43:57 +02:00
|
|
|
get_joined_groups.REQUIRES_AUTH
|
|
|
|
}
|
|
|
|
};
|
2018-06-18 05:34:03 +02:00
|
|
|
|
2020-08-01 02:43:57 +02:00
|
|
|
ircd::m::resource::response
|
|
|
|
ircd::m::groups::handle_get(client &client,
|
|
|
|
const resource::request &request)
|
2018-06-18 05:34:03 +02:00
|
|
|
{
|
2020-08-01 02:43:57 +02:00
|
|
|
resource::response::chunked response
|
|
|
|
{
|
|
|
|
client, http::OK
|
|
|
|
};
|
|
|
|
|
|
|
|
json::stack out
|
|
|
|
{
|
|
|
|
response.buf, response.flusher()
|
|
|
|
};
|
|
|
|
|
|
|
|
json::stack::object top
|
|
|
|
{
|
|
|
|
out
|
|
|
|
};
|
|
|
|
|
|
|
|
json::stack::array groups
|
|
|
|
{
|
|
|
|
top, "groups"
|
|
|
|
};
|
|
|
|
|
|
|
|
const m::id::group group_ids[]
|
|
|
|
{
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
// for(const auto &group_id : group_ids)
|
|
|
|
// groups.append(group_id);
|
|
|
|
|
2022-06-25 22:47:43 +02:00
|
|
|
return response;
|
2020-08-01 02:43:57 +02:00
|
|
|
}
|