Merge pull request #18 from AttorneyOnline/feature/net-auth

Network authentication and support for expanded_desk_mods.
This commit is contained in:
scatterflower 2021-03-15 18:53:33 -05:00 committed by GitHub
commit 12f470435b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 18 deletions

View File

@ -83,6 +83,10 @@ class AOClient : public QObject {
{"SUPER", ~0ULL}
};
bool is_shaken;
bool is_disemvoweled;
bool is_gimped;
public slots:
void clientDisconnected();
void clientData();

View File

@ -42,10 +42,12 @@ void AOClient::cmdLogin(int argc, QStringList argv)
sendServerMessage("No modpass is set! Please set a modpass before authenticating.");
}
else if(argv[0] == modpass) {
sendServerMessage("Logged in as a moderator."); // This string has to be exactly this, because it is hardcoded in the client
sendPacket("AUTH", {"1"}); // Client: "You were granted the Disable Modcalls button."
sendServerMessage("Logged in as a moderator."); // pre-2.9.1 clients are hardcoded to display the mod UI when this string is sent in OOC
authenticated = true;
}
}
else {
sendPacket("AUTH", {"0"}); // Client: "Login unsuccessful."
sendServerMessage("Incorrect password.");
}
server->areas.value(current_area)->logger->logLogin(this, authenticated, "moderator");
@ -60,10 +62,13 @@ void AOClient::cmdLogin(int argc, QStringList argv)
if (server->db_manager->authenticate(username, password)) {
moderator_name = username;
authenticated = true;
sendServerMessage("Logged in as a moderator.");
sendPacket("AUTH", {"1"}); // Client: "You were granted the Disable Modcalls button."
if (version.release <= 2 && version.major <= 9 && version.minor <= 0)
sendServerMessage("Logged in as a moderator."); // pre-2.9.1 clients are hardcoded to display the mod UI when this string is sent in OOC
sendServerMessage("Welcome, " + username);
}
else {
sendPacket("AUTH", {"0"}); // Client: "Login unsuccessful."
sendServerMessage("Incorrect password.");
}
server->areas.value(current_area)->logger->logLogin(this, authenticated, username);
@ -404,7 +409,7 @@ void AOClient::cmdLogout(int argc, QStringList argv)
}
authenticated = false;
moderator_name = "";
sendServerMessage("You have been logged out.");
sendPacket("AUTH", {"-1"}); // Client: "You were logged out."
}
void AOClient::cmdPos(int argc, QStringList argv)

View File

@ -46,12 +46,12 @@ void AOClient::pktSoftwareId(AreaData* area, int argc, QStringList argv, AOPacke
// The only ones that are critical to ensuring the server works are
// "noencryption" and "fastloading"
QStringList feature_list = {
"noencryption", "yellowtext", "prezoom",
"flipping", "customobjections", "fastloading",
"deskmod", "evidence", "cccc_ic_support",
"arup", "casing_alerts", "modcall_reason",
"looping_sfx", "additive", "effects",
"y_offset"
"noencryption", "yellowtext", "prezoom",
"flipping", "customobjections", "fastloading",
"deskmod", "evidence", "cccc_ic_support",
"arup", "casing_alerts", "modcall_reason",
"looping_sfx", "additive", "effects",
"y_offset", "expanded_desk_mods", "auth_packet"
};
@ -382,15 +382,14 @@ AOPacket AOClient::validateIcPacket(AOPacket packet)
incoming_args.append(QVariant(arg));
}
// message type
if (incoming_args[0].toInt() == 1)
args.append("1");
else if (incoming_args[0].toInt() == 0) {
if (incoming_args[0].toString() == "chat")
args.append("chat");
else
args.append("0");
// desk modifier
QStringList allowed_desk_mods;
allowed_desk_mods << "chat" << "0" << "1" << "2" << "3" << "4" << "5";
if (allowed_desk_mods.contains(incoming_args[0].toString())) {
args.append(incoming_args[0].toString());
}
else
return invalid;
// preanim
args.append(incoming_args[1].toString());