mirror of
https://github.com/matrix-construct/construct
synced 2024-11-28 17:52:54 +01:00
modules/client: Stub 14.13.1.3 notifications handler.
This commit is contained in:
parent
57119f2367
commit
a3ca9a986b
2 changed files with 69 additions and 0 deletions
|
@ -179,6 +179,7 @@ client_client_register_available_la_SOURCES = client/register_available.cc
|
|||
client_client_capabilities_la_SOURCES = client/capabilities.cc
|
||||
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_module_LTLIBRARIES = \
|
||||
client/client_versions.la \
|
||||
|
@ -203,6 +204,7 @@ client_module_LTLIBRARIES = \
|
|||
client/client_capabilities.la \
|
||||
client/client_send_to_device.la \
|
||||
client/client_delete_devices.la \
|
||||
client/client_notifications.la \
|
||||
###
|
||||
|
||||
#
|
||||
|
|
67
modules/client/notifications.cc
Normal file
67
modules/client/notifications.cc
Normal file
|
@ -0,0 +1,67 @@
|
|||
// Matrix Construct
|
||||
//
|
||||
// Copyright (C) Matrix Construct Developers, Authors & Contributors
|
||||
// Copyright (C) 2016-2019 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
|
||||
{
|
||||
"Client 14.13.1.3 :Listing Notifications"
|
||||
};
|
||||
|
||||
ircd::resource
|
||||
notifications_resource
|
||||
{
|
||||
"/_matrix/client/r0/notifications",
|
||||
{
|
||||
"(14.13.1.3) Listing Notifications"
|
||||
}
|
||||
};
|
||||
|
||||
conf::item<size_t>
|
||||
limit_default
|
||||
{
|
||||
{ "name", "ircd.client.notifications.limit.default" },
|
||||
{ "default", 256 }
|
||||
};
|
||||
|
||||
resource::response
|
||||
get__notifications(client &client,
|
||||
const resource::request &request)
|
||||
{
|
||||
const string_view &from
|
||||
{
|
||||
request.query["from"]
|
||||
};
|
||||
|
||||
const string_view &only
|
||||
{
|
||||
request.query["only"]
|
||||
};
|
||||
|
||||
const ushort limit
|
||||
{
|
||||
request.query.get<ushort>("limit", size_t(limit_default))
|
||||
};
|
||||
|
||||
return resource::response
|
||||
{
|
||||
client, http::OK
|
||||
};
|
||||
}
|
||||
|
||||
resource::method
|
||||
method_get
|
||||
{
|
||||
notifications_resource, "GET", get__notifications,
|
||||
{
|
||||
method_get.REQUIRES_AUTH
|
||||
}
|
||||
};
|
Loading…
Reference in a new issue