ManaPlus
Public Member Functions | Static Public Member Functions | Private Member Functions
TmwAthena::LoginHandler Class Reference

#include <loginhandler.h>

Inheritance diagram for TmwAthena::LoginHandler:
Ea::LoginHandler Net::LoginHandler

Public Member Functions

 LoginHandler ()
 
 ~LoginHandler ()
 
void connect () const
 
bool isConnected () const
 
void disconnect () const
 
unsigned int getMaxPasswordLength () const
 
void changePassword (const std::string &oldPassword, const std::string &newPassword) const
 
ServerInfogetCharServer () const A_CONST
 
void sendVersion () const
 
void ping () const
 
void updatePacketVersion () const
 
void sendMobileCode (const BeingId accountId, const std::string &code) const
 
void sendOtpCode (const std::string &code) const
 
- Public Member Functions inherited from Ea::LoginHandler
bool isRegistrationEnabled () const
 
void getRegistrationDetails () const
 
void loginAccount (LoginData *const loginData) const
 
void chooseServer (const unsigned int server, const bool persistentIp) const
 
void registerAccount (const LoginData *const loginData) const
 
const WorldsgetWorlds () const A_CONST
 
void clearWorlds () const
 
const TokengetToken () const A_CONST
 
void logout () const
 
void changeEmail (const std::string &email) const
 
void unregisterAccount (const std::string &username, const std::string &password) const
 
void loginOrRegister (LoginData *const data) const
 
- Public Member Functions inherited from Net::LoginHandler
void setServer (const ServerInfo &server)
 
const ServerInfogetServer () const
 
virtual unsigned int getMinUserNameLength () const
 
virtual unsigned int getMaxUserNameLength () const
 
virtual unsigned int getMinPasswordLength () const
 

Static Public Member Functions

static void requestUpdateHosts ()
 

Private Member Functions

void sendLoginRegister (const std::string &username, const std::string &password, const std::string &email) const
 

Additional Inherited Members

- Protected Member Functions inherited from Ea::LoginHandler
 LoginHandler ()
 
- Protected Member Functions inherited from Net::LoginHandler
 LoginHandler ()
 
- Protected Attributes inherited from Net::LoginHandler
ServerInfo mServer
 

Detailed Description

Definition at line 32 of file loginhandler.h.

Constructor & Destructor Documentation

◆ LoginHandler()

TmwAthena::LoginHandler::LoginHandler ( )

Definition at line 44 of file loginhandler.cpp.

44  :
46 {
47  loginHandler = this;
48 }
Net::LoginHandler * loginHandler
Definition: net.cpp:90

References loginHandler.

◆ ~LoginHandler()

TmwAthena::LoginHandler::~LoginHandler ( )
virtual

Reimplemented from Ea::LoginHandler.

Definition at line 50 of file loginhandler.cpp.

51 {
52  loginHandler = nullptr;
53 }

References loginHandler.

Member Function Documentation

◆ changePassword()

void TmwAthena::LoginHandler::changePassword ( const std::string &  oldPassword,
const std::string &  newPassword 
) const
virtual

Implements Net::LoginHandler.

Definition at line 85 of file loginhandler.cpp.

88 {
89  createOutPacket(CMSG_CHAR_PASSWORD_CHANGE);
90  outMsg.writeStringNoLog(oldPassword, 24, "old password");
91  outMsg.writeStringNoLog(newPassword, 24, "new password");
92 }
#define createOutPacket(name)
Definition: messageout.h:37

References createOutPacket.

◆ connect()

void TmwAthena::LoginHandler::connect ( ) const
virtual

Implements Net::LoginHandler.

Definition at line 55 of file loginhandler.cpp.

56 {
57  if (Network::mInstance == nullptr)
58  return;
59 
62  {
63  createOutPacket(CMSG_SERVER_VERSION_REQUEST);
64  }
65 }
bool connect(const ServerInfo &server)
Definition: network.cpp:101
ServerInfo mServer
Definition: loginhandler.h:116
virtual bool haveServerVersion() const =0
static Network * mInstance
Definition: network.h:54
Net::ServerFeatures * serverFeatures
Definition: net.cpp:101

References Ea::Network::connect(), createOutPacket, Net::ServerFeatures::haveServerVersion(), TmwAthena::Network::mInstance, Net::LoginHandler::mServer, and serverFeatures.

◆ disconnect()

void TmwAthena::LoginHandler::disconnect ( ) const
virtual

Implements Net::LoginHandler.

Definition at line 76 of file loginhandler.cpp.

77 {
78  if (Network::mInstance != nullptr &&
80  {
82  }
83 }
void disconnect()
Definition: network.cpp:139
const ServerInfo & getServer() const
Definition: loginhandler.h:46

References Ea::Network::disconnect(), Net::LoginHandler::getServer(), TmwAthena::Network::mInstance, and Net::LoginHandler::mServer.

◆ getCharServer()

ServerInfo * TmwAthena::LoginHandler::getCharServer ( ) const
virtual

Implements Ea::LoginHandler.

Definition at line 123 of file loginhandler.cpp.

124 {
125  return &charServer;
126 }
ServerInfo charServer

References TmwAthena::charServer.

◆ getMaxPasswordLength()

unsigned int TmwAthena::LoginHandler::getMaxPasswordLength ( ) const
inlinevirtual

Reimplemented from Ea::LoginHandler.

Definition at line 47 of file loginhandler.h.

48  { return 24; }

◆ isConnected()

bool TmwAthena::LoginHandler::isConnected ( ) const
virtual

Implements Net::LoginHandler.

Definition at line 67 of file loginhandler.cpp.

68 {
69  if (Network::mInstance == nullptr)
70  return false;
71 
74 }
bool isConnected() const
Definition: network.h:61
bool mVersionResponse
Definition: loginrecv.cpp:47

References Ea::Network::isConnected(), TmwAthena::Network::mInstance, and Ea::LoginRecv::mVersionResponse.

◆ ping()

void TmwAthena::LoginHandler::ping ( ) const
virtual

Implements Net::LoginHandler.

Definition at line 136 of file loginhandler.cpp.

137 {
138 }

◆ requestUpdateHosts()

void TmwAthena::LoginHandler::requestUpdateHosts ( )
static

Definition at line 128 of file loginhandler.cpp.

129 {
130 }

◆ sendLoginRegister()

void TmwAthena::LoginHandler::sendLoginRegister ( const std::string &  username,
const std::string &  password,
const std::string &  email 
) const
privatevirtual

Implements Ea::LoginHandler.

Definition at line 94 of file loginhandler.cpp.

98 {
99  createOutPacket(CMSG_LOGIN_REGISTER);
100  if (tmwServerVersion < 0x100408)
101  {
102  // hack to avoid bug in tmwa...
103  outMsg.writeInt32(5,
104  "client protocol version");
105  }
106  else
107  {
108  outMsg.writeInt32(CLIENT_PROTOCOL_VERSION,
109  "client protocol version");
110  }
111  outMsg.writeString(username, 24, "login");
112  outMsg.writeStringNoLog(password, 24, "password");
113 
114  /*
115  * eAthena calls the last byte "client version 2", but it isn't used at
116  * at all. We're retasking it, as a bit mask:
117  * 0 - can handle the 0x63 "update host" packet
118  * 1 - defaults to the first char-server (instead of the last)
119  */
120  outMsg.writeInt8(0x03, "flags");
121 }
#define CLIENT_PROTOCOL_VERSION
Definition: network.h:33
unsigned int tmwServerVersion
Definition: client.cpp:134

References CLIENT_PROTOCOL_VERSION, createOutPacket, and tmwServerVersion.

◆ sendMobileCode()

void TmwAthena::LoginHandler::sendMobileCode ( const BeingId  accountId,
const std::string &  code 
) const
virtual

Implements Net::LoginHandler.

Definition at line 145 of file loginhandler.cpp.

147 {
148 }

◆ sendOtpCode()

void TmwAthena::LoginHandler::sendOtpCode ( const std::string &  code) const
virtual

Implements Net::LoginHandler.

Definition at line 150 of file loginhandler.cpp.

151 {
152 }

◆ sendVersion()

void TmwAthena::LoginHandler::sendVersion ( ) const
virtual

Implements Net::LoginHandler.

Definition at line 132 of file loginhandler.cpp.

133 {
134 }

◆ updatePacketVersion()

void TmwAthena::LoginHandler::updatePacketVersion ( ) const
virtual

Implements Net::LoginHandler.

Definition at line 140 of file loginhandler.cpp.

141 {
142  itemIdLen = 2;
143 }
int itemIdLen
Definition: client.cpp:130

References itemIdLen.


The documentation for this class was generated from the following files: