Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/aoapplication.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ class AOApplication : public QApplication {
bool effects_enabled = false;
bool y_offset_enabled = false;
bool expanded_desk_mods_enabled = false;
bool auth_packet_enabled = false;

///////////////loading info///////////////////

Expand Down
2 changes: 2 additions & 0 deletions include/courtroom.h
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,8 @@ class Courtroom : public QMainWindow {
// Truncates text so it fits within theme-specified boundaries and sets the tooltip to the full string
void truncate_label_text(QWidget* p_widget, QString p_identifier);

void on_authentication_state_received(int p_state);

~Courtroom();
private:
AOApplication *ao_app;
Expand Down
23 changes: 19 additions & 4 deletions src/courtroom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
11 changes: 11 additions & 0 deletions src/packet_distribution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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:

Expand Down