ManaPlus
Functions | Variables
Ea::LoginRecv Namespace Reference

Functions

void processUpdateHost (Net::MessageIn &msg)
 
void processLoginError (Net::MessageIn &msg)
 

Variables

std::string mUpdateHost
 
Worlds mWorlds
 
Token mToken
 
bool mVersionResponse = false
 
bool mRegistrationEnabled = true
 

Function Documentation

◆ processLoginError()

void Ea::LoginRecv::processLoginError ( Net::MessageIn msg)

Definition at line 67 of file loginrecv.cpp.

68 {
69  const uint8_t code = msg.readUInt8("error");
70  logger->log("Login::error code: %u", CAST_U32(code));
71  std::string date = msg.readString(20, "date");
72 
73  switch (code)
74  {
75  case 0:
76  // TRANSLATORS: error message
77  errorMessage = _("Unregistered ID.");
78  break;
79  case 1:
80  // TRANSLATORS: error message
81  errorMessage = _("Wrong password.");
83  break;
84  case 2:
85  // TRANSLATORS: error message
86  errorMessage = _("Account expired.");
87  break;
88  case 3:
89  // TRANSLATORS: error message
90  errorMessage = _("Rejected from server.");
91  break;
92  case 4:
93  // TRANSLATORS: error message
94  errorMessage = _("You have been permanently banned from "
95  "the game. Please contact the GM team.");
96  break;
97  case 5:
98  // TRANSLATORS: error message
99  errorMessage = _("Client too old or wrong server type.\n"
100  "Please update client on http://manaplus.org");
101  break;
102  case 6:
103  // TRANSLATORS: error message
104  errorMessage = strprintf(_("You have been temporarily "
105  "banned from the game until %s.\nPlease contact the GM "
106  "team via the forums."), date.c_str());
107  break;
108  case 7:
109  // TRANSLATORS: error message
110  errorMessage = _("Server overpopulated.");
111  break;
112  case 9:
113  // TRANSLATORS: error message
114  errorMessage = _("This user name is already taken.");
115  break;
116  case 10:
117  // TRANSLATORS: error message
118  errorMessage = _("Wrong name.");
119  break;
120  case 11:
121  // TRANSLATORS: error message
122  errorMessage = _("Incorrect email.");
123  break;
124  case 99:
125  // TRANSLATORS: error message
126  errorMessage = _("Username permanently erased.");
127  break;
128  default:
129  // TRANSLATORS: error message
130  errorMessage = _("Unknown error.");
131  break;
132  }
134 }
#define CAST_U32
Definition: cast.h:31
void setState(const StateT state)
Definition: client.h:66
void log(const char *const log_text,...)
Definition: logger.cpp:269
static std::string savedPassword
Definition: logindialog.h:80
Client * client
Definition: client.cpp:118
std::string errorMessage
Definition: client.cpp:116
#define _(s)
Definition: gettext.h:35
Logger * logger
Definition: logger.cpp:89
bool msg(InputEvent &event)
Definition: chat.cpp:39
@ ERROR
Definition: state.h:35
std::string strprintf(const char *const format,...)

References _, CAST_U32, client, State::ERROR, errorMessage, Logger::log(), logger, Actions::msg(), LoginDialog::savedPassword, Client::setState(), and strprintf().

◆ processUpdateHost()

void Ea::LoginRecv::processUpdateHost ( Net::MessageIn msg)

Definition at line 51 of file loginrecv.cpp.

52 {
53  const int len = msg.readInt16("len") - 4;
54  mUpdateHost = msg.readString(len, "update host");
55 
56  if (!checkPath(mUpdateHost))
57  {
58  mUpdateHost.clear();
59  logger->log1("Warning: incorrect update server name");
60  }
62 
63  logger->log("Received update host \"%s\" from login server.",
64  mUpdateHost.c_str());
65 }
void log1(const char *const log_text)
Definition: logger.cpp:238
std::string updateHost
Definition: logindata.h:62
LoginData loginData
Definition: client.cpp:185
std::string mUpdateHost
Definition: loginrecv.cpp:44
bool checkPath(const std::string &path)
Definition: paths.cpp:121

References checkPath(), Logger::log(), Logger::log1(), logger, loginData, Actions::msg(), mUpdateHost, and LoginData::updateHost.

Variable Documentation

◆ mRegistrationEnabled

bool Ea::LoginRecv::mRegistrationEnabled = true

◆ mToken

Token Ea::LoginRecv::mToken

◆ mUpdateHost

std::string Ea::LoginRecv::mUpdateHost

◆ mVersionResponse

bool Ea::LoginRecv::mVersionResponse = false

◆ mWorlds

Worlds Ea::LoginRecv::mWorlds