From 91257d599b670ca42594a4bd8b00f4959190db69 Mon Sep 17 00:00:00 2001 From: Alex King <89047260+Kinglykrab@users.noreply.github.com> Date: Fri, 17 Mar 2023 19:21:08 -0400 Subject: [PATCH] [Cleanup] Remove unused methods in loginserver/client.h (#3116) * [Cleanup] Remove LoginOnNewConnection(), LoginOnPacketRecv(), and LoginOnStatusChange() from loginserver/client.h # Notes - These are unused. * Cleanup. --- loginserver/client.cpp | 140 ----------------------------------------- loginserver/client.h | 15 ----- 2 files changed, 155 deletions(-) diff --git a/loginserver/client.cpp b/loginserver/client.cpp index 97eb2a0dc..06b1b6e3d 100644 --- a/loginserver/client.cpp +++ b/loginserver/client.cpp @@ -658,146 +658,6 @@ void Client::CreateEQEmuAccount( } } -/** - * @param connection - */ -void Client::LoginOnNewConnection(std::shared_ptr connection) -{ - m_login_connection = connection; -} - -/** - * @param conn - * @param from - * @param to - */ -void Client::LoginOnStatusChange( - std::shared_ptr conn, - EQ::Net::DbProtocolStatus from, - EQ::Net::DbProtocolStatus to -) -{ - if (to == EQ::Net::StatusConnected) { - LogDebug("EQ::Net::StatusConnected"); - LoginSendSessionReady(); - } - - if (to == EQ::Net::StatusDisconnecting || to == EQ::Net::StatusDisconnected) { - LogDebug("EQ::Net::StatusDisconnecting || EQ::Net::StatusDisconnected"); - - DoFailedLogin(); - } -} - -/** - * @param conn - * @param from - * @param to - */ -void Client::LoginOnStatusChangeIgnored( - std::shared_ptr conn, - EQ::Net::DbProtocolStatus from, - EQ::Net::DbProtocolStatus to -) -{ -} - -/** - * @param conn - * @param p - */ -void Client::LoginOnPacketRecv(std::shared_ptr conn, const EQ::Net::Packet &p) -{ - auto opcode = p.GetUInt16(0); - switch (opcode) { - case 0x0017: //OP_ChatMessage - LoginSendLogin(); - break; - case 0x0018: - LoginProcessLoginResponse(p); - break; - } -} - -void Client::LoginSendSessionReady() -{ - EQ::Net::DynamicPacket p; - p.PutUInt16(0, 1); //OP_SessionReady - p.PutUInt32(2, 2); - - m_login_connection->QueuePacket(p); -} - -void Client::LoginSendLogin() -{ - size_t buffer_len = m_stored_user.length() + m_stored_pass.length() + 2; - std::unique_ptr buffer(new char[buffer_len]); - - strcpy(&buffer[0], m_stored_user.c_str()); - strcpy(&buffer[m_stored_user.length() + 1], m_stored_pass.c_str()); - - size_t encrypted_len = buffer_len; - - if (encrypted_len % 8 > 0) { - encrypted_len = ((encrypted_len / 8) + 1) * 8; - } - - EQ::Net::DynamicPacket p; - p.Resize(12 + encrypted_len); - p.PutUInt16(0, 2); //OP_Login - p.PutUInt32(2, 3); - - eqcrypt_block(&buffer[0], buffer_len, (char *) p.Data() + 12, true); - - m_login_connection->QueuePacket(p); -} - -/** - * @param p - */ -void Client::LoginProcessLoginResponse(const EQ::Net::Packet &p) -{ - auto encrypt_size = p.Length() - 12; - - if (encrypt_size % 8 > 0) { - encrypt_size = (encrypt_size / 8) * 8; - } - - std::unique_ptr decrypted(new char[encrypt_size]); - - eqcrypt_block((char *) p.Data() + 12, encrypt_size, &decrypted[0], false); - - EQ::Net::StaticPacket sp(&decrypted[0], encrypt_size); - auto response_error = sp.GetUInt16(1); - - m_login_connection_manager->OnConnectionStateChange( - std::bind( - &Client::LoginOnStatusChangeIgnored, - this, - std::placeholders::_1, - std::placeholders::_2, - std::placeholders::_3 - ) - ); - - if (response_error > 101) { - LogDebug("response [{0}] failed login", response_error); - DoFailedLogin(); - m_login_connection->Close(); - } - else { - LogDebug( - "response [{0}] login succeeded user [{1}]", - response_error, - m_stored_user - ); - - auto m_dbid = sp.GetUInt32(8); - - CreateEQEmuAccount(m_stored_user, m_stored_pass, m_dbid); - m_login_connection->Close(); - } -} bool Client::ProcessHealthCheck(std::string username) { if (username == "healthcheckuser") { diff --git a/loginserver/client.h b/loginserver/client.h index d96bc5302..708e1582d 100644 --- a/loginserver/client.h +++ b/loginserver/client.h @@ -198,21 +198,6 @@ private: std::string m_stored_user; std::string m_stored_pass; - void LoginOnNewConnection(std::shared_ptr connection); - void LoginOnStatusChange( - std::shared_ptr conn, - EQ::Net::DbProtocolStatus from, - EQ::Net::DbProtocolStatus to - ); - void LoginOnStatusChangeIgnored( - std::shared_ptr conn, - EQ::Net::DbProtocolStatus from, - EQ::Net::DbProtocolStatus to - ); - void LoginOnPacketRecv(std::shared_ptr conn, const EQ::Net::Packet &p); - void LoginSendSessionReady(); - void LoginSendLogin(); - void LoginProcessLoginResponse(const EQ::Net::Packet &p); static bool ProcessHealthCheck(std::string username); };