diff --git a/include/ircd/m/m.h b/include/ircd/m/m.h index cab33f3ea..581bbe21e 100644 --- a/include/ircd/m/m.h +++ b/include/ircd/m/m.h @@ -51,7 +51,6 @@ namespace ircd #include "user.h" #include "filter.h" #include "request.h" -#include "session.h" #include "v1/v1.h" #include "vm.h" #include "keys.h" diff --git a/include/ircd/m/session.h b/include/ircd/m/session.h deleted file mode 100644 index 702068a37..000000000 --- a/include/ircd/m/session.h +++ /dev/null @@ -1,88 +0,0 @@ -// 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_SESSION_H - -namespace ircd::m -{ - struct session; -} - -struct ircd::m::session -{ - net::remote remote; - std::string access_token; - - server::request operator()(const server::out &out, const server::in &in) const; - template server::request operator()(const mutable_buffer &buf, args&&...) const; - - session(const net::remote &remote) - :remote{remote} - {} - - session(const net::hostport &remote) - :remote{remote} - {} - - session() = default; -}; - -template -ircd::server::request -ircd::m::session::operator()(const mutable_buffer &buf, - args&&... a) -const -{ - m::request request - { - std::forward(a)... - }; - - if(!defined(json::get<"destination"_>(request))) - json::get<"destination"_>(request) = remote.hostname; - - if(!defined(json::get<"origin"_>(request))) - json::get<"origin"_>(request) = my_host(); - - const auto head - { - request(buf) - }; - - const server::out out - { - head - }; - - const auto in_max - { - std::max(ssize_t(size(buf) - size(head)), ssize_t(0)) - }; - - assert(in_max >= ssize_t(size(buf) / 2)); - const server::in in - { - { data(buf) + size(head), size_t(in_max) } - }; - - return operator()(out, in); -} - -inline ircd::server::request -ircd::m::session::operator()(const server::out &out, - const server::in &in) -const -{ - return - { - remote, out, in - }; -}