00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "account-server/accounthandler.hpp"
00023
00024 #include "defines.h"
00025 #include "point.h"
00026 #include "account-server/account.hpp"
00027 #include "account-server/accountclient.hpp"
00028 #include "account-server/character.hpp"
00029 #include "account-server/dalstorage.hpp"
00030 #include "account-server/serverhandler.hpp"
00031 #include "chat-server/chathandler.hpp"
00032 #include "common/configuration.hpp"
00033 #include "common/transaction.hpp"
00034 #include "net/connectionhandler.hpp"
00035 #include "net/messagein.hpp"
00036 #include "net/messageout.hpp"
00037 #include "net/netcomputer.hpp"
00038 #include "utils/logger.h"
00039 #include "utils/stringfilter.h"
00040 #include "utils/tokencollector.hpp"
00041 #include "utils/tokendispenser.hpp"
00042 #include "utils/sha256.h"
00043
00044 class AccountHandler : public ConnectionHandler
00045 {
00046 public:
00050 AccountHandler();
00051
00056 void tokenMatched(AccountClient *computer, int accountID);
00057
00062 void deletePendingClient(AccountClient *computer);
00063
00067 void deletePendingConnect(int) {}
00068
00073 TokenCollector< AccountHandler, AccountClient *, int > mTokenCollector;
00074
00075 protected:
00079 void processMessage(NetComputer *computer, MessageIn &message);
00080
00081 NetComputer *computerConnected(ENetPeer *peer);
00082
00083 void computerDisconnected(NetComputer *comp);
00084 };
00085
00086 static AccountHandler *accountHandler;
00087
00088 AccountHandler::AccountHandler():
00089 mTokenCollector(this)
00090 {
00091 }
00092
00093 bool AccountClientHandler::initialize(int port)
00094 {
00095 accountHandler = new AccountHandler;
00096 LOG_INFO("Account handler started:");
00097 return accountHandler->startListen(port);
00098 }
00099
00100 void AccountClientHandler::deinitialize()
00101 {
00102 accountHandler->stopListen();
00103 delete accountHandler;
00104 }
00105
00106 void AccountClientHandler::process()
00107 {
00108 accountHandler->process(50);
00109 }
00110
00111 void AccountClientHandler::prepareReconnect(const std::string &token, int id)
00112 {
00113 accountHandler->mTokenCollector.addPendingConnect(token, id);
00114 }
00115
00116 NetComputer* AccountHandler::computerConnected(ENetPeer *peer)
00117 {
00118 return new AccountClient(peer);
00119 }
00120
00121 void AccountHandler::computerDisconnected(NetComputer *comp)
00122 {
00123 AccountClient* computer = static_cast< AccountClient * >(comp);
00124
00125 if (computer->status == CLIENT_QUEUED)
00126
00127 mTokenCollector.deletePendingClient(computer);
00128
00129 delete computer;
00130 }
00131
00132 static void sendCharacterData(AccountClient &computer, int slot,
00133 const Character &ch)
00134 {
00135 MessageOut charInfo(APMSG_CHAR_INFO);
00136 charInfo.writeByte(slot);
00137 charInfo.writeString(ch.getName());
00138 charInfo.writeByte(ch.getGender());
00139 charInfo.writeByte(ch.getHairStyle());
00140 charInfo.writeByte(ch.getHairColor());
00141 charInfo.writeShort(ch.getLevel());
00142 charInfo.writeShort(ch.getCharacterPoints());
00143 charInfo.writeShort(ch.getCorrectionPoints());
00144 charInfo.writeLong(ch.getPossessions().money);
00145
00146 for (int j = CHAR_ATTR_BEGIN; j < CHAR_ATTR_END; ++j)
00147 {
00148 charInfo.writeShort(ch.getAttribute(j));
00149 }
00150
00151 computer.send(charInfo);
00152 }
00153
00154 static void handleLoginMessage(AccountClient &computer, MessageIn &msg)
00155 {
00156 MessageOut reply(APMSG_LOGIN_RESPONSE);
00157
00158 if (computer.status != CLIENT_LOGIN)
00159 {
00160 reply.writeByte(ERRMSG_FAILURE);
00161 computer.send(reply);
00162 return;
00163 }
00164
00165 int clientVersion = msg.readLong();
00166
00167 if (clientVersion < Configuration::getValue("clientVersion", 0))
00168 {
00169 reply.writeByte(LOGIN_INVALID_VERSION);
00170 computer.send(reply);
00171 return;
00172 }
00173
00174
00175
00176
00177
00178
00179 time_t lastAttempt = computer.getLastLoginAttempt();
00180 if ((time(NULL) - lastAttempt) < 1)
00181 {
00182 reply.writeByte(LOGIN_INVALID_TIME);
00183 computer.send(reply);
00184 return;
00185 }
00186
00187
00188 computer.updateLoginAttempt();
00189
00190 std::string username = msg.readString();
00191 std::string password = msg.readString();
00192
00193 if (stringFilter->findDoubleQuotes(username))
00194 {
00195 reply.writeByte(ERRMSG_INVALID_ARGUMENT);
00196 computer.send(reply);
00197 return;
00198 }
00199
00200 unsigned maxClients = (unsigned)Configuration::getValue("net_maxClients", 1000);
00201 if (accountHandler->getClientNumber() >= maxClients)
00202 {
00203 reply.writeByte(ERRMSG_SERVER_FULL);
00204 computer.send(reply);
00205 return;
00206 }
00207
00208
00209 Account *acc = storage->getAccount(username);
00210
00211 if (!acc || acc->getPassword() != password)
00212 {
00213 reply.writeByte(ERRMSG_INVALID_ARGUMENT);
00214 computer.send(reply);
00215 delete acc;
00216 return;
00217 }
00218
00219 if (acc->getLevel() == AL_BANNED)
00220 {
00221 reply.writeByte(LOGIN_BANNED);
00222 computer.send(reply);
00223 delete acc;
00224 return;
00225 }
00226
00227
00228 time_t login;
00229 time(&login);
00230 acc->setLastLogin(login);
00231 storage->updateLastLogin(acc);
00232
00233
00234
00235 computer.setAccount(acc);
00236 computer.status = CLIENT_CONNECTED;
00237
00238 reply.writeByte(ERRMSG_OK);
00239 computer.send(reply);
00240
00241
00242 Characters &chars = acc->getCharacters();
00243
00244
00245 for (unsigned int i = 0; i < chars.size(); i++)
00246 {
00247 sendCharacterData(computer, i, *chars[i]);
00248 }
00249 }
00250
00251 static void handleLogoutMessage(AccountClient &computer)
00252 {
00253 MessageOut reply(APMSG_LOGOUT_RESPONSE);
00254
00255 if (computer.status == CLIENT_LOGIN)
00256 {
00257 reply.writeByte(ERRMSG_NO_LOGIN);
00258 }
00259 else if (computer.status == CLIENT_CONNECTED)
00260 {
00261 computer.unsetAccount();
00262 computer.status = CLIENT_LOGIN;
00263 reply.writeByte(ERRMSG_OK);
00264 }
00265 else if (computer.status == CLIENT_QUEUED)
00266 {
00267
00268 accountHandler->mTokenCollector.deletePendingClient(&computer);
00269 computer.status = CLIENT_LOGIN;
00270 reply.writeByte(ERRMSG_OK);
00271 }
00272 computer.send(reply);
00273 }
00274
00275 static void handleReconnectMessage(AccountClient &computer, MessageIn &msg)
00276 {
00277 if (computer.status != CLIENT_LOGIN)
00278 {
00279 LOG_DEBUG("Account tried to reconnect, but was already logged in "
00280 "or queued.");
00281 return;
00282 }
00283
00284 std::string magic_token = msg.readString(MAGIC_TOKEN_LENGTH);
00285 computer.status = CLIENT_QUEUED;
00286 accountHandler->mTokenCollector.addPendingClient(magic_token, &computer);
00287 }
00288
00289 static void handleRegisterMessage(AccountClient &computer, MessageIn &msg)
00290 {
00291 int clientVersion = msg.readLong();
00292 std::string username = msg.readString();
00293 std::string password = msg.readString();
00294 std::string email = msg.readString();
00295 int minClientVersion = Configuration::getValue("clientVersion", 0);
00296 unsigned minNameLength = Configuration::getValue("account_minNameLength", 4);
00297 unsigned maxNameLength = Configuration::getValue("account_maxNameLength", 15);
00298 unsigned minPasswordLength = Configuration::getValue("account_minPasswordLength", 6);
00299 unsigned maxPasswordLength = Configuration::getValue("account_maxPasswordLength", 25);
00300
00301 MessageOut reply(APMSG_REGISTER_RESPONSE);
00302
00303 if (computer.status != CLIENT_LOGIN)
00304 {
00305 reply.writeByte(ERRMSG_FAILURE);
00306 }
00307 else if (clientVersion < minClientVersion)
00308 {
00309 reply.writeByte(REGISTER_INVALID_VERSION);
00310 }
00311 else if (stringFilter->findDoubleQuotes(username))
00312 {
00313 reply.writeByte(ERRMSG_INVALID_ARGUMENT);
00314 }
00315 else if (stringFilter->findDoubleQuotes(email))
00316 {
00317 reply.writeByte(ERRMSG_INVALID_ARGUMENT);
00318 }
00319 else if (username.length() < minNameLength ||
00320 username.length() > maxNameLength)
00321 {
00322 reply.writeByte(ERRMSG_INVALID_ARGUMENT);
00323 }
00324 else if (password.length() < minPasswordLength ||
00325 password.length() > maxPasswordLength)
00326 {
00327 reply.writeByte(ERRMSG_INVALID_ARGUMENT);
00328 }
00329 else if (stringFilter->findDoubleQuotes(password))
00330 {
00331 reply.writeByte(ERRMSG_INVALID_ARGUMENT);
00332 }
00333 else if (!stringFilter->isEmailValid(email))
00334 {
00335 reply.writeByte(ERRMSG_INVALID_ARGUMENT);
00336 }
00337
00338 else if (!stringFilter->filterContent(username))
00339 {
00340 reply.writeByte(ERRMSG_INVALID_ARGUMENT);
00341 }
00342
00343 else if (storage->doesUserNameExist(username))
00344 {
00345 reply.writeByte(REGISTER_EXISTS_USERNAME);
00346 }
00347
00348 else if (storage->doesEmailAddressExist(sha256(email)))
00349 {
00350 reply.writeByte(REGISTER_EXISTS_EMAIL);
00351 }
00352 else
00353 {
00354 Account *acc = new Account;
00355 acc->setName(username);
00356
00357 acc->setPassword(sha256(username + password));
00358
00359 acc->setEmail(sha256(email));
00360 acc->setLevel(AL_PLAYER);
00361
00362
00363 time_t regdate;
00364 time(®date);
00365 acc->setRegistrationDate(regdate);
00366 acc->setLastLogin(regdate);
00367
00368 storage->addAccount(acc);
00369 reply.writeByte(ERRMSG_OK);
00370
00371
00372 computer.setAccount(acc);
00373 computer.status = CLIENT_CONNECTED;
00374 }
00375
00376 computer.send(reply);
00377 }
00378
00379 static void handleUnregisterMessage(AccountClient &computer, MessageIn &msg)
00380 {
00381 LOG_DEBUG("AccountHandler::handleUnregisterMessage");
00382 std::string username = msg.readString();
00383 std::string password = msg.readString();
00384
00385 MessageOut reply(APMSG_UNREGISTER_RESPONSE);
00386
00387 if (computer.status != CLIENT_CONNECTED)
00388 {
00389 reply.writeByte(ERRMSG_FAILURE);
00390 computer.send(reply);
00391 return;
00392 }
00393
00394 if (stringFilter->findDoubleQuotes(username))
00395 {
00396 reply.writeByte(ERRMSG_INVALID_ARGUMENT);
00397 computer.send(reply);
00398 return;
00399 }
00400
00401
00402 Account *acc = storage->getAccount(username);
00403
00404 if (!acc || acc->getPassword() != password)
00405 {
00406 reply.writeByte(ERRMSG_INVALID_ARGUMENT);
00407 computer.send(reply);
00408 delete acc;
00409 return;
00410 }
00411
00412
00413 LOG_INFO("Unregistered \"" << username
00414 << "\", AccountID: " << acc->getID());
00415 storage->delAccount(acc);
00416 reply.writeByte(ERRMSG_OK);
00417
00418 computer.send(reply);
00419 }
00420
00421 static void handleEmailChangeMessage(AccountClient &computer, MessageIn &msg)
00422 {
00423 MessageOut reply(APMSG_EMAIL_CHANGE_RESPONSE);
00424
00425 Account *acc = computer.getAccount();
00426 if (!acc)
00427 {
00428 reply.writeByte(ERRMSG_NO_LOGIN);
00429 computer.send(reply);
00430 return;
00431 }
00432
00433 const std::string email = msg.readString();
00434 const std::string emailHash = sha256(email);
00435
00436 if (!stringFilter->isEmailValid(email))
00437 {
00438 reply.writeByte(ERRMSG_INVALID_ARGUMENT);
00439 }
00440 else if (stringFilter->findDoubleQuotes(email))
00441 {
00442 reply.writeByte(ERRMSG_INVALID_ARGUMENT);
00443 }
00444 else if (storage->doesEmailAddressExist(emailHash))
00445 {
00446 reply.writeByte(ERRMSG_EMAIL_ALREADY_EXISTS);
00447 }
00448 else
00449 {
00450 acc->setEmail(emailHash);
00451
00452 storage->flush(acc);
00453 reply.writeByte(ERRMSG_OK);
00454 }
00455 computer.send(reply);
00456 }
00457
00458 static void handlePasswordChangeMessage(AccountClient &computer, MessageIn &msg)
00459 {
00460 std::string oldPassword = msg.readString();
00461 std::string newPassword = msg.readString();
00462
00463 MessageOut reply(APMSG_PASSWORD_CHANGE_RESPONSE);
00464
00465 Account *acc = computer.getAccount();
00466 if (!acc)
00467 {
00468 reply.writeByte(ERRMSG_NO_LOGIN);
00469 }
00470 else if (newPassword.length() != SHA256_HASH_LENGTH)
00471 {
00472 reply.writeByte(ERRMSG_INVALID_ARGUMENT);
00473 }
00474 else if (stringFilter->findDoubleQuotes(newPassword))
00475 {
00476 reply.writeByte(ERRMSG_INVALID_ARGUMENT);
00477 }
00478 else if (oldPassword != acc->getPassword())
00479 {
00480 reply.writeByte(ERRMSG_FAILURE);
00481 }
00482 else
00483 {
00484 acc->setPassword(newPassword);
00485
00486 storage->flush(acc);
00487 reply.writeByte(ERRMSG_OK);
00488 }
00489
00490 computer.send(reply);
00491 }
00492
00493 static void handleCharacterCreateMessage(AccountClient &computer, MessageIn &msg)
00494 {
00495 std::string name = msg.readString();
00496 int hairStyle = msg.readByte();
00497 int hairColor = msg.readByte();
00498 int gender = msg.readByte();
00499 int numHairStyles = Configuration::getValue("char_numHairStyles", 17);
00500 int numHairColors = Configuration::getValue("char_numHairColors", 11);
00501 int numGenders = Configuration::getValue("char_numGenders", 2);
00502 unsigned minNameLength = Configuration::getValue("char_minNameLength", 4);
00503 unsigned maxNameLength = Configuration::getValue("char_maxNameLength", 25);
00504 unsigned maxCharacters = Configuration::getValue("char_maxCharacters", 3);
00505 unsigned startingPoints = Configuration::getValue("char_startingPoints", 60);
00506
00507
00508 MessageOut reply(APMSG_CHAR_CREATE_RESPONSE);
00509
00510 Account *acc = computer.getAccount();
00511 if (!acc)
00512 {
00513 reply.writeByte(ERRMSG_NO_LOGIN);
00514 }
00515 else if (!stringFilter->filterContent(name))
00516 {
00517 reply.writeByte(ERRMSG_INVALID_ARGUMENT);
00518 }
00519 else if (stringFilter->findDoubleQuotes(name))
00520 {
00521 reply.writeByte(ERRMSG_INVALID_ARGUMENT);
00522 }
00523 else if (hairStyle > numHairStyles)
00524 {
00525 reply.writeByte(CREATE_INVALID_HAIRSTYLE);
00526 }
00527 else if (hairColor > numHairColors)
00528 {
00529 reply.writeByte(CREATE_INVALID_HAIRCOLOR);
00530 }
00531 else if (gender > numGenders)
00532 {
00533 reply.writeByte(CREATE_INVALID_GENDER);
00534 }
00535 else if ((name.length() < minNameLength) ||
00536 (name.length() > maxNameLength))
00537 {
00538 reply.writeByte(ERRMSG_INVALID_ARGUMENT);
00539 }
00540 else
00541 {
00542 if (storage->doesCharacterNameExist(name))
00543 {
00544 reply.writeByte(CREATE_EXISTS_NAME);
00545 computer.send(reply);
00546 return;
00547 }
00548
00549
00550 Characters &chars = acc->getCharacters();
00551 if (chars.size() >= maxCharacters)
00552 {
00553 reply.writeByte(CREATE_TOO_MUCH_CHARACTERS);
00554 computer.send(reply);
00555 return;
00556 }
00557
00558
00559
00560
00561 int attributes[CHAR_ATTR_NB];
00562 for (int i = 0; i < CHAR_ATTR_NB; ++i)
00563 attributes[i] = msg.readShort();
00564
00565 unsigned int totalAttributes = 0;
00566 bool validNonZeroAttributes = true;
00567 for (int i = 0; i < CHAR_ATTR_NB; ++i)
00568 {
00569
00570 totalAttributes += attributes[i];
00571
00572
00573 if (attributes[i] <= 0) validNonZeroAttributes = false;
00574 }
00575
00576 if (totalAttributes > startingPoints)
00577 {
00578 reply.writeByte(CREATE_ATTRIBUTES_TOO_HIGH);
00579 }
00580 else if (totalAttributes < startingPoints)
00581 {
00582 reply.writeByte(CREATE_ATTRIBUTES_TOO_LOW);
00583 }
00584 else if (!validNonZeroAttributes)
00585 {
00586 reply.writeByte(CREATE_ATTRIBUTES_EQUAL_TO_ZERO);
00587 }
00588 else
00589 {
00590 Character *newCharacter = new Character(name);
00591 for (int i = CHAR_ATTR_BEGIN; i < CHAR_ATTR_END; ++i)
00592 newCharacter->setAttribute(i, attributes[i - CHAR_ATTR_BEGIN]);
00593 newCharacter->setAccount(acc);
00594 newCharacter->setLevel(1);
00595 newCharacter->setCharacterPoints(0);
00596 newCharacter->setCorrectionPoints(0);
00597 newCharacter->setGender(gender);
00598 newCharacter->setHairStyle(hairStyle);
00599 newCharacter->setHairColor(hairColor);
00600 newCharacter->setMapId(Configuration::getValue("char_startMap", 1));
00601 Point startingPos(Configuration::getValue("char_startX", 1024),
00602 Configuration::getValue("char_startY", 1024));
00603 newCharacter->setPosition(startingPos);
00604 acc->addCharacter(newCharacter);
00605
00606 LOG_INFO("Character " << name << " was created for "
00607 << acc->getName() << "'s account.");
00608
00609
00610 Transaction trans;
00611 trans.mCharacterId = newCharacter->getDatabaseID();
00612 trans.mAction = TRANS_CHAR_CREATE;
00613 trans.mMessage = acc->getName() + " created character ";
00614 trans.mMessage.append(" called " + name);
00615 storage->addTransaction(trans);
00616
00617 storage->flush(acc);
00618 reply.writeByte(ERRMSG_OK);
00619 computer.send(reply);
00620
00621
00622 int slot = chars.size() - 1;
00623 sendCharacterData(computer, slot, *chars[slot]);
00624 return;
00625 }
00626 }
00627
00628 computer.send(reply);
00629 }
00630
00631 static void handleCharacterSelectMessage(AccountClient &computer, MessageIn &msg)
00632 {
00633 MessageOut reply(APMSG_CHAR_SELECT_RESPONSE);
00634
00635 Account *acc = computer.getAccount();
00636 if (!acc)
00637 {
00638 reply.writeByte(ERRMSG_NO_LOGIN);
00639 computer.send(reply);
00640 return;
00641 }
00642
00643 unsigned charNum = msg.readByte();
00644 Characters &chars = acc->getCharacters();
00645
00646
00647 if (charNum >= chars.size())
00648 {
00649
00650 reply.writeByte(ERRMSG_INVALID_ARGUMENT);
00651 computer.send(reply);
00652 return;
00653 }
00654
00655 Character *selectedChar = chars[charNum];
00656
00657 std::string address;
00658 int port;
00659 if (!GameServerHandler::getGameServerFromMap
00660 (selectedChar->getMapId(), address, port))
00661 {
00662 LOG_ERROR("Character Selection: No game server for the map.");
00663 reply.writeByte(ERRMSG_FAILURE);
00664 computer.send(reply);
00665 return;
00666 }
00667
00668 reply.writeByte(ERRMSG_OK);
00669
00670 LOG_DEBUG(selectedChar->getName() << " is trying to enter the servers.");
00671
00672 std::string magic_token(utils::getMagicToken());
00673 reply.writeString(magic_token, MAGIC_TOKEN_LENGTH);
00674 reply.writeString(address);
00675 reply.writeShort(port);
00676
00677
00678 reply.writeString(Configuration::getValue("net_accountServerAddress",
00679 "localhost"));
00680 reply.writeShort(Configuration::getValue("net_accountServerPort",
00681 DEFAULT_SERVER_PORT) + 2);
00682
00683 GameServerHandler::registerClient(magic_token, selectedChar);
00684 registerChatClient(magic_token, selectedChar->getName(), acc->getLevel());
00685
00686 computer.send(reply);
00687
00688
00689 Transaction trans;
00690 trans.mCharacterId = selectedChar->getDatabaseID();
00691 trans.mAction = TRANS_CHAR_SELECTED;
00692 trans.mMessage = "";
00693 storage->addTransaction(trans);
00694 }
00695
00696 static void handleCharacterDeleteMessage(AccountClient &computer, MessageIn &msg)
00697 {
00698 MessageOut reply(APMSG_CHAR_DELETE_RESPONSE);
00699
00700 Account *acc = computer.getAccount();
00701 if (!acc)
00702 {
00703 reply.writeByte(ERRMSG_NO_LOGIN);
00704 computer.send(reply);
00705 return;
00706 }
00707
00708 unsigned charNum = msg.readByte();
00709 Characters &chars = acc->getCharacters();
00710
00711
00712 if (charNum >= chars.size())
00713 {
00714
00715 reply.writeByte(ERRMSG_INVALID_ARGUMENT);
00716 computer.send(reply);
00717 return;
00718 }
00719
00720 LOG_INFO("Character deleted:" << chars[charNum]->getName());
00721
00722 acc->delCharacter(charNum);
00723 storage->flush(acc);
00724
00725 reply.writeByte(ERRMSG_OK);
00726 computer.send(reply);
00727
00728
00729 Transaction trans;
00730 trans.mCharacterId = chars[charNum]->getDatabaseID();
00731 trans.mAction = TRANS_CHAR_DELETED;
00732 trans.mMessage = chars[charNum]->getName() + " deleted by ";
00733 trans.mMessage.append(acc->getName());
00734 storage->addTransaction(trans);
00735 }
00736
00737 void
00738 AccountHandler::tokenMatched(AccountClient *computer, int accountID)
00739 {
00740 MessageOut reply(APMSG_RECONNECT_RESPONSE);
00741
00742
00743 Account *acc = storage->getAccount(accountID);
00744 computer->setAccount(acc);
00745 computer->status = CLIENT_CONNECTED;
00746
00747 reply.writeByte(ERRMSG_OK);
00748 computer->send(reply);
00749
00750
00751 Characters &chars = acc->getCharacters();
00752
00753
00754 for (unsigned int i = 0; i < chars.size(); i++)
00755 {
00756 sendCharacterData(*computer, i, *chars[i]);
00757 }
00758 }
00759
00760 void
00761 AccountHandler::deletePendingClient(AccountClient* computer)
00762 {
00763 MessageOut msg(APMSG_RECONNECT_RESPONSE);
00764 msg.writeByte(ERRMSG_TIME_OUT);
00765 computer->disconnect(msg);
00766
00767 }
00768
00769 void AccountHandler::processMessage(NetComputer *comp, MessageIn &message)
00770 {
00771 AccountClient &computer = *static_cast< AccountClient * >(comp);
00772
00773 switch (message.getId())
00774 {
00775 case PAMSG_LOGIN:
00776 LOG_DEBUG("Received msg ... PAMSG_LOGIN");
00777 handleLoginMessage(computer, message);
00778 break;
00779
00780 case PAMSG_LOGOUT:
00781 LOG_DEBUG("Received msg ... PAMSG_LOGOUT");
00782 handleLogoutMessage(computer);
00783 break;
00784
00785 case PAMSG_RECONNECT:
00786 LOG_DEBUG("Received msg ... PAMSG_RECONNECT");
00787 handleReconnectMessage(computer, message);
00788 break;
00789
00790 case PAMSG_REGISTER:
00791 LOG_DEBUG("Received msg ... PAMSG_REGISTER");
00792 handleRegisterMessage(computer, message);
00793 break;
00794
00795 case PAMSG_UNREGISTER:
00796 LOG_DEBUG("Received msg ... PAMSG_UNREGISTER");
00797 handleUnregisterMessage(computer, message);
00798 break;
00799
00800 case PAMSG_EMAIL_CHANGE:
00801 LOG_DEBUG("Received msg ... PAMSG_EMAIL_CHANGE");
00802 handleEmailChangeMessage(computer, message);
00803 break;
00804
00805 case PAMSG_PASSWORD_CHANGE:
00806 LOG_DEBUG("Received msg ... PAMSG_PASSWORD_CHANGE");
00807 handlePasswordChangeMessage(computer, message);
00808 break;
00809
00810 case PAMSG_CHAR_CREATE:
00811 LOG_DEBUG("Received msg ... PAMSG_CHAR_CREATE");
00812 handleCharacterCreateMessage(computer, message);
00813 break;
00814
00815 case PAMSG_CHAR_SELECT:
00816 LOG_DEBUG("Received msg ... PAMSG_CHAR_SELECT");
00817 handleCharacterSelectMessage(computer, message);
00818 break;
00819
00820 case PAMSG_CHAR_DELETE:
00821 LOG_DEBUG("Received msg ... PAMSG_CHAR_DELETE");
00822 handleCharacterDeleteMessage(computer, message);
00823 break;
00824
00825 default:
00826 LOG_WARN("AccountHandler::processMessage, Invalid message type "
00827 << message.getId());
00828 MessageOut result(XXMSG_INVALID);
00829 computer.send(result);
00830 break;
00831 }
00832 }