0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-25 16:22:35 +01:00

ircd:Ⓜ️:app: Add initial application service registration structure; start app handler directory.

This commit is contained in:
Jason Volk 2018-12-02 16:50:26 -08:00
parent f44f1cf89d
commit b088ebf228
5 changed files with 144 additions and 0 deletions

96
include/ircd/m/app.h Normal file
View file

@ -0,0 +1,96 @@
// 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.
#pragma once
#define HAVE_IRCD_M_APP_H
namespace ircd::m::app
{
struct namespace_;
struct namespaces;
struct registration;
}
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsubobject-linkage"
struct ircd::m::app::namespace_
:json::tuple
<
/// Required. A true or false value stating whether this application
/// service has exclusive access to events within this namespace.
json::property<name::exclusive, bool>,
/// Required. A regular expression defining which values this namespace
/// includes.
json::property<name::regex, json::string>
>
{
using super_type::tuple;
};
#pragma GCC diagnostic pop
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsubobject-linkage"
struct ircd::m::app::namespaces
:json::tuple
<
/// Events which are sent from certain users.
json::property<name::users, namespace_>,
/// Events which are sent in rooms with certain room aliases.
json::property<name::aliases, namespace_>,
/// Events which are sent in rooms with certain room IDs.
json::property<name::rooms, namespace_>
>
{
using super_type::tuple;
};
#pragma GCC diagnostic pop
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsubobject-linkage"
struct ircd::m::app::registration
:json::tuple
<
/// Required. A unique, user-defined ID of the application service which
/// will never change.
json::property<name::id, json::string>,
/// Required. The URL for the application service. May include a path
/// after the domain name. Optionally set to null if no traffic is
/// required.
json::property<name::url, json::string>,
/// Required. A unique token for application services to use to
/// authenticate requests to Homeservers.
json::property<name::as_token, json::string>,
/// Required. A unique token for Homeservers to use to authenticate
/// requests to application services.
json::property<name::hs_token, json::string>,
/// Required. The localpart of the user associated with the application
/// service.
json::property<name::sender_localpart, json::string>,
/// Required. A list of users, aliases and rooms namespaces that the application service controls.
json::property<name::namespaces, namespaces>,
/// Whether requests from masqueraded users are rate-limited. The sender is excluded.
json::property<name::rate_limited, bool>,
/// The external protocols which the application service provides (e.g. IRC).
json::property<name::protocols, json::array>
>
{
using super_type::tuple;
};
#pragma GCC diagnostic pop

View file

@ -58,6 +58,7 @@ namespace ircd::m::vm
#include "hook.h"
#include "visible.h"
#include "feds.h"
#include "app.h"
struct ircd::m::init
{

View file

@ -129,4 +129,19 @@ namespace ircd::m::name
constexpr const char *const guest_can_join {"guest_can_join"};
constexpr const char *const id_server {"id_server"};
constexpr const char *const id {"id"};
constexpr const char *const url {"url"};
constexpr const char *const as_token {"as_token"};
constexpr const char *const hs_token {"hs_token"};
constexpr const char *const sender_localpart {"sender_localpart"};
constexpr const char *const namespaces {"namespaces"};
constexpr const char *const rate_limited {"rate_limited"};
constexpr const char *const protocols {"protocols"};
constexpr const char *const users {"users"};
constexpr const char *const aliases {"aliases"};
constexpr const char *const exclusive {"exclusive"};
constexpr const char *const regex {"regex"};
}

View file

@ -337,6 +337,21 @@ media_module_LTLIBRARIES = \
media/media_media.la \
###
###############################################################################
#
# /_matrix/app/
#
app_moduledir = @moduledir@
app_app_register_la_SOURCES = \
app/register.cc \
###
app_module_LTLIBRARIES = \
app/app_register.la \
###
###############################################################################
#
# JavaScript

17
modules/app/register.cc Normal file
View file

@ -0,0 +1,17 @@
// 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
{
"2.1 :Application Services :Registration",
};