mirror of
https://github.com/matrix-construct/construct
synced 2024-11-25 00:02:34 +01:00
ircd:Ⓜ️:groups: Preliminary stub for client/create_group.
This commit is contained in:
parent
2f6f2af06f
commit
9c3cd55639
3 changed files with 71 additions and 0 deletions
|
@ -133,6 +133,7 @@ ircd::m::matrix::module_names
|
|||
"client_presence",
|
||||
"client_joined_groups",
|
||||
"client_publicised_groups",
|
||||
"client_create_group",
|
||||
"client_login",
|
||||
"client_logout",
|
||||
"client_register_available",
|
||||
|
|
|
@ -292,6 +292,7 @@ client_client_send_to_device_la_SOURCES = client/send_to_device.cc
|
|||
client_client_delete_devices_la_SOURCES = client/delete_devices.cc
|
||||
client_client_notifications_la_SOURCES = client/notifications.cc
|
||||
client_client_register_email_la_SOURCES = client/register_email.cc
|
||||
client_client_create_group_la_SOURCES = client/create_group.cc
|
||||
|
||||
client_module_LTLIBRARIES = \
|
||||
client/client_versions.la \
|
||||
|
@ -318,6 +319,7 @@ client_module_LTLIBRARIES = \
|
|||
client/client_delete_devices.la \
|
||||
client/client_notifications.la \
|
||||
client/client_register_email.la \
|
||||
client/client_create_group.la \
|
||||
###
|
||||
|
||||
#
|
||||
|
|
68
modules/client/create_group.cc
Normal file
68
modules/client/create_group.cc
Normal file
|
@ -0,0 +1,68 @@
|
|||
// The Construct
|
||||
//
|
||||
// Copyright (C) The Construct Developers, Authors & Contributors
|
||||
// Copyright (C) 2016-2020 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.
|
||||
|
||||
namespace ircd::m::groups
|
||||
{
|
||||
static resource::response handle_post(client &, const resource::request &);
|
||||
extern resource::method create_group_post;
|
||||
extern resource create_group_resource;
|
||||
}
|
||||
|
||||
ircd::mapi::header
|
||||
IRCD_MODULE
|
||||
{
|
||||
"Client (unspecified) :Create Group",
|
||||
};
|
||||
|
||||
decltype(ircd::m::groups::create_group_resource)
|
||||
ircd::m::groups::create_group_resource
|
||||
{
|
||||
"/_matrix/client/r0/create_group",
|
||||
{
|
||||
"(undocumented/unspecified) Create Group",
|
||||
}
|
||||
};
|
||||
|
||||
decltype(ircd::m::groups::create_group_post)
|
||||
ircd::m::groups::create_group_post
|
||||
{
|
||||
create_group_resource, "POST", handle_post,
|
||||
{
|
||||
create_group_post.REQUIRES_AUTH
|
||||
}
|
||||
};
|
||||
|
||||
ircd::m::resource::response
|
||||
ircd::m::groups::handle_post(client &client,
|
||||
const resource::request &request)
|
||||
{
|
||||
const json::string &localpart
|
||||
{
|
||||
request["localpart"]
|
||||
};
|
||||
|
||||
const json::object &profile
|
||||
{
|
||||
request["profile"]
|
||||
};
|
||||
|
||||
const m::id::group::buf group_id
|
||||
{
|
||||
localpart, origin(my(request.user_id.host()))
|
||||
};
|
||||
|
||||
return resource::response
|
||||
{
|
||||
client, http::CREATED, json::members
|
||||
{
|
||||
{ "group_id", group_id }
|
||||
},
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue