mirror of
https://github.com/matrix-construct/construct
synced 2024-11-26 00:32:35 +01:00
modules/console: Add net listen load and unload cmds.
This commit is contained in:
parent
560a5eda44
commit
16f6433230
1 changed files with 46 additions and 0 deletions
|
@ -2596,6 +2596,52 @@ console_cmd__net__listen(opt &out, const string_view &line)
|
|||
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
|
||||
//
|
||||
|
|
Loading…
Reference in a new issue