// Matrix Construct // // Copyright (C) Matrix Construct Developers, Authors & Contributors // Copyright (C) 2016-2018 Jason Volk // // 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_BRIDGE_H namespace ircd::m::bridge { struct namespace_; struct namespaces; struct config; struct query; string_view make_uri(const mutable_buffer &, const config &, const string_view &path); bool exists(const config &, const m::user::id &); bool exists(const config &, const m::room::alias &); extern log::log log; } struct ircd::m::bridge::query { static conf::item timeout; rfc3986::uri base_url; unique_mutable_buffer buf; string_view uri; window_buffer wb; http::request hypertext; server::request::opts sopts; server::request request; http::code code; query(const config &, const string_view &uri, const mutable_buffer &resp_body = {}); }; struct ircd::m::bridge::namespace_ :json::tuple < /// Required. A true or false value stating whether this application /// service has exclusive access to events within this namespace. json::property, /// Required. A regular expression defining which values this namespace /// includes. json::property > { using super_type::tuple; }; struct ircd::m::bridge::namespaces :json::tuple < /// Events which are sent from certain users. json::property, /// Events which are sent in rooms with certain room aliases. json::property, /// Events which are sent in rooms with certain room IDs. json::property > { using super_type::tuple; }; struct ircd::m::bridge::config :json::tuple < /// Required. A unique, user-defined ID of the application service which /// will never change. json::property, /// 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, /// Required. A unique token for application services to use to /// authenticate requests to Homeservers. json::property, /// Required. A unique token for Homeservers to use to authenticate /// requests to application services. json::property, /// Required. The localpart of the user associated with the application /// service. json::property, /// Required. A list of users, aliases and rooms namespaces that the application service controls. json::property, /// Whether requests from masqueraded users are rate-limited. The sender is excluded. json::property, /// The external protocols which the application service provides (e.g. IRC). json::property > { using closure_bool = std::function; using closure = std::function; static bool for_each(const closure_bool &); static bool get(std::nothrow_t, const string_view &id, const closure &); static void get(const string_view &id, const closure &); static bool exists(const string_view &id); using super_type::tuple; };