add help command

This commit is contained in:
in1tiate 2021-03-10 18:47:22 -06:00
parent 1510d19f5b
commit a792c063ee
2 changed files with 16 additions and 0 deletions

View File

@ -171,6 +171,7 @@ class AOClient : public QObject {
//// Commands
void cmdDefault(int argc, QStringList argv);
void cmdHelp(int argc, QStringList argv);
// Authentication
void cmdLogin(int argc, QStringList argv);
void cmdChangeAuth(int argc, QStringList argv);
@ -276,6 +277,7 @@ class AOClient : public QObject {
{"switch", {ACLFlags.value("NONE"), 1, &AOClient::cmdSwitch}},
{"toggleglobal", {ACLFlags.value("NONE"), 0, &AOClient::cmdToggleGlobal}},
{"mods", {ACLFlags.value("NONE"), 0, &AOClient::cmdMods}},
{"help", {ACLFlags.value("NONE"), 0, &AOClient::cmdHelp}},
};
QString partial_packet;

View File

@ -716,6 +716,20 @@ void AOClient::cmdMods(int argc, QStringList argv)
sendServerMessage(entries.join("\n"));
}
void AOClient::cmdHelp(int argc, QStringList argv)
{
QStringList entries;
entries << "Allowed commands:";
QMap<QString, CommandInfo>::const_iterator i;
for (i = commands.constBegin(); i!= commands.constEnd(); ++i) {
CommandInfo info = i.value();
if (checkAuth(info.acl_mask)) {
entries << "/" + i.key();
}
}
sendServerMessage(entries.join("\n"));
}
QStringList AOClient::buildAreaList(int area_idx)
{
QStringList entries;