0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-26 08:42:34 +01:00

modules/console: Add net listen load and unload cmds.

This commit is contained in:
Jason Volk 2018-08-30 19:24:17 -07:00
parent 560a5eda44
commit 16f6433230

View file

@ -2596,6 +2596,52 @@ console_cmd__net__listen(opt &out, const string_view &line)
return true; return true;
} }
bool
console_cmd__net__listen__load(opt &out, const string_view &line)
{
using prototype = bool (const string_view &);
static m::import<prototype> load_listener
{
"s_listen", "load_listener"
};
const params params{line, " ",
{
"name",
}};
if(load_listener(params.at("name")))
out << "loaded listener '" << params.at("name") << "'" << std::endl;
else
out << "failed to load listener '" << params.at("name") << "'" << std::endl;
return true;
}
bool
console_cmd__net__listen__unload(opt &out, const string_view &line)
{
using prototype = bool (const string_view &);
static m::import<prototype> unload_listener
{
"s_listen", "unload_listener"
};
const params params{line, " ",
{
"name",
}};
if(unload_listener(params.at("name")))
out << "unloaded listener '" << params.at("name") << "'" << std::endl;
else
out << "failed to unload listener '" << params.at("name") << "'" << std::endl;
return true;
}
// //
// client // client
// //