aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/courtroom.cpp23
-rw-r--r--src/packet_distribution.cpp11
2 files changed, 30 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)
diff --git a/src/packet_distribution.cpp b/src/packet_distribution.cpp
index ea4c77aa..e8f98e17 100644
--- a/src/packet_distribution.cpp
+++ b/src/packet_distribution.cpp
@@ -199,6 +199,7 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
additive_enabled = false;
effects_enabled = false;
expanded_desk_mods_enabled = false;
+ auth_packet_enabled = false;
if (f_packet.contains("yellowtext", Qt::CaseInsensitive))
yellow_text_enabled = true;
if (f_packet.contains("prezoom", Qt::CaseInsensitive))
@@ -229,6 +230,8 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
y_offset_enabled = true;
if (f_packet.contains("expanded_desk_mods", Qt::CaseInsensitive))
expanded_desk_mods_enabled = true;
+ if (f_packet.contains("auth_packet", Qt::CaseInsensitive))
+ auth_packet_enabled = true;
}
else if (header == "PN") {
if (f_contents.size() < 2)
@@ -683,6 +686,14 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
if (f_contents.size() > 1 && f_contents.at(1) == "1")
w_courtroom->on_reload_theme_clicked();
}
+ // Auth packet
+ else if (header == "AUTH") {
+ if (!courtroom_constructed || !auth_packet_enabled || f_contents.size() < 1)
+ goto end;
+ int authenticated = f_contents.at(0).toInt();
+
+ w_courtroom->on_authentication_state_received(authenticated);
+ }
end: