aboutsummaryrefslogtreecommitdiff
path: root/src/courtroom.cpp
diff options
context:
space:
mode:
authorin1tiate <32779090+in1tiate@users.noreply.github.com>2021-03-15 17:56:42 -0500
committerGitHub <noreply@github.com>2021-03-15 17:56:42 -0500
commite4483719d495ec7fca50ce0e39480d01d565f9de (patch)
tree21a767b104d4dc7eadbc2b945279f316820c5a15 /src/courtroom.cpp
parent3cac87737809ce7beb48323be77405ef25622d70 (diff)
Deprecate hardcoded string-based authentication, add AUTH packet (#489)
Co-authored-by: oldmud0 <oldmud0@users.noreply.github.com>
Diffstat (limited to 'src/courtroom.cpp')
-rw-r--r--src/courtroom.cpp23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/courtroom.cpp b/src/courtroom.cpp
index a89b8143..d68038c1 100644
--- a/src/courtroom.cpp
+++ b/src/courtroom.cpp
@@ -1634,15 +1634,30 @@ void Courtroom::append_server_chatmessage(QString p_name, QString p_message,
color =
ao_app->get_color("server_chatlog_sender_color", "courtroom_fonts.ini")
.name();
- if (p_message == "Logged in as a moderator.") {
- ui_guard->show();
- append_server_chatmessage(
- tr("CLIENT"), tr("You were granted the Disable Modcalls button."), "1");
+ if (!ao_app->auth_packet_enabled && p_message == "Logged in as a moderator.") {
+ // Emulate successful authentication
+ on_authentication_state_received(1);
}
+
ui_server_chatlog->append_chatmessage(p_name, p_message, color);
}
+void Courtroom::on_authentication_state_received(int p_state)
+{
+ if (p_state >= 1) {
+ ui_guard->show();
+ append_server_chatmessage(tr("CLIENT"), tr("You were granted the Disable Modcalls button."), "1");
+ }
+ else if (p_state == 0) {
+ append_server_chatmessage(tr("CLIENT"), tr("Login unsuccessful."), "1");
+ }
+ else if (p_state < 0) {
+ ui_guard->hide();
+ append_server_chatmessage(tr("CLIENT"), tr("You were logged out."), "1");
+ }
+}
+
void Courtroom::on_chat_return_pressed()
{
if (is_muted)