mirror of
https://github.com/EQEmu/Server.git
synced 2026-01-07 10:23:53 +00:00
[Cleanup] Remove unused methods in loginserver/client.h (#3116)
* [Cleanup] Remove LoginOnNewConnection(), LoginOnPacketRecv(), and LoginOnStatusChange() from loginserver/client.h # Notes - These are unused. * Cleanup.
This commit is contained in:
parent
491b358e28
commit
91257d599b
@ -658,146 +658,6 @@ void Client::CreateEQEmuAccount(
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param connection
|
||||
*/
|
||||
void Client::LoginOnNewConnection(std::shared_ptr<EQ::Net::DaybreakConnection> connection)
|
||||
{
|
||||
m_login_connection = connection;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param conn
|
||||
* @param from
|
||||
* @param to
|
||||
*/
|
||||
void Client::LoginOnStatusChange(
|
||||
std::shared_ptr<EQ::Net::DaybreakConnection> 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<EQ::Net::DaybreakConnection> conn,
|
||||
EQ::Net::DbProtocolStatus from,
|
||||
EQ::Net::DbProtocolStatus to
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @param conn
|
||||
* @param p
|
||||
*/
|
||||
void Client::LoginOnPacketRecv(std::shared_ptr<EQ::Net::DaybreakConnection> 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<char[]> 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<char[]> 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") {
|
||||
|
||||
@ -198,21 +198,6 @@ private:
|
||||
|
||||
std::string m_stored_user;
|
||||
std::string m_stored_pass;
|
||||
void LoginOnNewConnection(std::shared_ptr<EQ::Net::DaybreakConnection> connection);
|
||||
void LoginOnStatusChange(
|
||||
std::shared_ptr<EQ::Net::DaybreakConnection> conn,
|
||||
EQ::Net::DbProtocolStatus from,
|
||||
EQ::Net::DbProtocolStatus to
|
||||
);
|
||||
void LoginOnStatusChangeIgnored(
|
||||
std::shared_ptr<EQ::Net::DaybreakConnection> conn,
|
||||
EQ::Net::DbProtocolStatus from,
|
||||
EQ::Net::DbProtocolStatus to
|
||||
);
|
||||
void LoginOnPacketRecv(std::shared_ptr<EQ::Net::DaybreakConnection> conn, const EQ::Net::Packet &p);
|
||||
void LoginSendSessionReady();
|
||||
void LoginSendLogin();
|
||||
void LoginProcessLoginResponse(const EQ::Net::Packet &p);
|
||||
static bool ProcessHealthCheck(std::string username);
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user