2020-10-21 04:07:46 +02:00
|
|
|
// 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
|
|
|
|
{
|
|
|
|
struct app;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ircd::m::app
|
|
|
|
:instance_list<ircd::m::app>
|
|
|
|
{
|
|
|
|
static log::log log;
|
2020-10-27 09:58:02 +01:00
|
|
|
static conf::item<bool> enable;
|
2020-10-27 10:54:07 +01:00
|
|
|
static conf::item<bool> autorun;
|
2020-10-21 04:07:46 +02:00
|
|
|
static conf::item<std::string> path;
|
|
|
|
static std::set<std::string> bin;
|
|
|
|
|
|
|
|
m::event::idx event_idx;
|
|
|
|
std::string feature;
|
|
|
|
json::object config;
|
|
|
|
json::array arg;
|
2020-10-24 03:00:12 +02:00
|
|
|
std::string binpath;
|
2020-10-21 04:07:46 +02:00
|
|
|
std::vector<json::string> argv;
|
2020-10-28 08:42:32 +01:00
|
|
|
unique_mutable_buffer outbuf;
|
2020-10-21 04:07:46 +02:00
|
|
|
exec child;
|
2020-10-28 08:42:32 +01:00
|
|
|
id::user::buf user_id;
|
|
|
|
id::room::buf room_id;
|
|
|
|
id::event::buf event_id;
|
2020-10-28 12:57:01 +01:00
|
|
|
hookfn<vm::eval &> room_hook;
|
2020-10-21 04:07:46 +02:00
|
|
|
context worker_context;
|
|
|
|
|
2020-10-28 12:57:01 +01:00
|
|
|
void handle_stdin(const event &, const string_view &);
|
|
|
|
void handle_room_message(const event &, vm::eval &);
|
2020-10-28 08:42:32 +01:00
|
|
|
bool handle_stdout();
|
2020-10-21 04:07:46 +02:00
|
|
|
void worker();
|
|
|
|
|
|
|
|
app(const m::event::idx &);
|
|
|
|
~app() noexcept;
|
|
|
|
|
|
|
|
static void init(), fini();
|
|
|
|
};
|
2023-02-03 08:33:32 +01:00
|
|
|
|
|
|
|
template<>
|
|
|
|
decltype(ircd::m::app::list)
|
|
|
|
ircd::instance_list<ircd::m::app>::list;
|