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} {"SUPER", ~0ULL}
}; };
bool is_shaken;
bool is_disemvoweled;
bool is_gimped;
public slots: public slots:
void clientDisconnected(); void clientDisconnected();
void clientData(); 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."); sendServerMessage("No modpass is set! Please set a modpass before authenticating.");
} }
else if(argv[0] == modpass) { 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; authenticated = true;
} }
else { else {
sendPacket("AUTH", {"0"}); // Client: "Login unsuccessful."
sendServerMessage("Incorrect password."); sendServerMessage("Incorrect password.");
} }
server->areas.value(current_area)->logger->logLogin(this, authenticated, "moderator"); 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)) { if (server->db_manager->authenticate(username, password)) {
moderator_name = username; moderator_name = username;
authenticated = true; 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); sendServerMessage("Welcome, " + username);
} }
else { else {
sendPacket("AUTH", {"0"}); // Client: "Login unsuccessful."
sendServerMessage("Incorrect password."); sendServerMessage("Incorrect password.");
} }
server->areas.value(current_area)->logger->logLogin(this, authenticated, username); server->areas.value(current_area)->logger->logLogin(this, authenticated, username);
@ -404,7 +409,7 @@ void AOClient::cmdLogout(int argc, QStringList argv)
} }
authenticated = false; authenticated = false;
moderator_name = ""; moderator_name = "";
sendServerMessage("You have been logged out."); sendPacket("AUTH", {"-1"}); // Client: "You were logged out."
} }
void AOClient::cmdPos(int argc, QStringList argv) 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 // The only ones that are critical to ensuring the server works are
// "noencryption" and "fastloading" // "noencryption" and "fastloading"
QStringList feature_list = { QStringList feature_list = {
"noencryption", "yellowtext", "prezoom", "noencryption", "yellowtext", "prezoom",
"flipping", "customobjections", "fastloading", "flipping", "customobjections", "fastloading",
"deskmod", "evidence", "cccc_ic_support", "deskmod", "evidence", "cccc_ic_support",
"arup", "casing_alerts", "modcall_reason", "arup", "casing_alerts", "modcall_reason",
"looping_sfx", "additive", "effects", "looping_sfx", "additive", "effects",
"y_offset" "y_offset", "expanded_desk_mods", "auth_packet"
}; };
@ -382,15 +382,14 @@ AOPacket AOClient::validateIcPacket(AOPacket packet)
incoming_args.append(QVariant(arg)); incoming_args.append(QVariant(arg));
} }
// message type // desk modifier
if (incoming_args[0].toInt() == 1) QStringList allowed_desk_mods;
args.append("1"); allowed_desk_mods << "chat" << "0" << "1" << "2" << "3" << "4" << "5";
else if (incoming_args[0].toInt() == 0) { if (allowed_desk_mods.contains(incoming_args[0].toString())) {
if (incoming_args[0].toString() == "chat") args.append(incoming_args[0].toString());
args.append("chat");
else
args.append("0");
} }
else
return invalid;
// preanim // preanim
args.append(incoming_args[1].toString()); args.append(incoming_args[1].toString());