Mana
Loading...
Searching...
No Matches
loginhandler.h
Go to the documentation of this file.
1/*
2 * The Mana Client
3 * Copyright (C) 2004-2009 The Mana World Development Team
4 * Copyright (C) 2009-2012 The Mana Developers
5 *
6 * This file is part of The Mana Client.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22#pragma once
23
24#include "net/loginhandler.h"
25
27#include "net/tmwa/token.h"
28
29#include <string>
30
31class LoginData;
32
33namespace TmwAthena {
34
35class LoginHandler final : public MessageHandler, public Net::LoginHandler
36{
37 public:
39
40 ~LoginHandler() override;
41
42 void handleMessage(MessageIn &msg) override;
43
44 void connect() override;
45
46 bool isConnected() override;
47
48 void disconnect() override;
49
50 int supportedOptionalActions() const override
51 { return SetGenderOnRegister; }
52
53 bool isRegistrationEnabled() override;
54
55 void getRegistrationDetails() override;
56
57 unsigned int getMaxPasswordLength() const override { return 25; }
58
59 void loginAccount(LoginData *loginData) override;
60
61 void logout() override;
62
63 void changeEmail(const std::string &email) override;
64
65 void changePassword(const std::string &username,
66 const std::string &oldPassword,
67 const std::string &newPassword) override;
68
69 void chooseServer(unsigned int server) override;
70
71 void registerAccount(LoginData *loginData) override;
72
73 void unregisterAccount(const std::string &username,
74 const std::string &password) override;
75
76 Worlds getWorlds() const override;
77 void clearWorlds();
78
79 const Token &getToken() const { return mToken; }
80
81 unsigned getServerVersion() const { return mServerVersion; }
82
83 private:
84 void sendLoginRegister(const std::string &username,
85 const std::string &password);
86
87 unsigned mServerVersion = 0;
88 bool mVersionResponse = false;
90 std::string mUpdateHost;
93};
94
95} // namespace TmwAthena
Worlds getWorlds() const override
void sendLoginRegister(const std::string &username, const std::string &password)
unsigned int getMaxPasswordLength() const override
const Token & getToken() const
void changePassword(const std::string &username, const std::string &oldPassword, const std::string &newPassword) override
void getRegistrationDetails() override
void unregisterAccount(const std::string &username, const std::string &password) override
void loginAccount(LoginData *loginData) override
void changeEmail(const std::string &email) override
bool isRegistrationEnabled() override
void handleMessage(MessageIn &msg) override
void disconnect() override
int supportedOptionalActions() const override
void registerAccount(LoginData *loginData) override
unsigned getServerVersion() const
bool isConnected() override
void chooseServer(unsigned int server) override
Used for parsing an incoming message from eAthena.
Definition messagein.h:35
LoginData loginData
Definition client.cpp:95
Warning: buffers and other variables are shared, so there can be only one connection active at a time...
std::vector< WorldInfo * > Worlds
Definition worldinfo.h:35