GCC Code Coverage Report
Directory: src/ Exec Total Coverage
File: src/net/loginhandler.h Lines: 0 12 0.0 %
Date: 2021-03-17 Branches: 0 0 0.0 %

Line Branch Exec Source
1
/*
2
 *  The ManaPlus Client
3
 *  Copyright (C) 2009  The Mana World Development Team
4
 *  Copyright (C) 2009-2010  The Mana Developers
5
 *  Copyright (C) 2011-2019  The ManaPlus Developers
6
 *  Copyright (C) 2019-2021  Andrei Karas
7
 *
8
 *  This file is part of The ManaPlus Client.
9
 *
10
 *  This program is free software; you can redistribute it and/or modify
11
 *  it under the terms of the GNU General Public License as published by
12
 *  the Free Software Foundation; either version 2 of the License, or
13
 *  any later version.
14
 *
15
 *  This program is distributed in the hope that it will be useful,
16
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 *  GNU General Public License for more details.
19
 *
20
 *  You should have received a copy of the GNU General Public License
21
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
22
 */
23
24
#ifndef NET_LOGINHANDLER_H
25
#define NET_LOGINHANDLER_H
26
27
#include "net/serverinfo.h"
28
29
#include "enums/simpletypes/beingid.h"
30
31
#include "net/worldinfo.h"
32
33
class LoginData;
34
35
namespace Net
36
{
37
38
class LoginHandler notfinal
39
{
40
    public:
41
        A_DELETE_COPY(LoginHandler)
42
43
        void setServer(const ServerInfo &server)
44
        { mServer = server; }
45
46
        const ServerInfo &getServer() const A_WARN_UNUSED
47
        { return mServer; }
48
49
        virtual void connect() const = 0;
50
51
        virtual bool isConnected() const A_WARN_UNUSED = 0;
52
53
        virtual void disconnect() const = 0;
54
55
        virtual bool isRegistrationEnabled() const A_WARN_UNUSED = 0;
56
57
        virtual void getRegistrationDetails() const = 0;
58
59
        virtual unsigned int getMinUserNameLength() const A_WARN_UNUSED
60
        { return 4; }
61
62
        virtual unsigned int getMaxUserNameLength() const A_WARN_UNUSED
63
        { return 25; }
64
65
        virtual unsigned int getMinPasswordLength() const A_WARN_UNUSED
66
        { return 4; }
67
68
        virtual unsigned int getMaxPasswordLength() const A_WARN_UNUSED
69
        { return 255; }
70
71
        virtual void loginAccount(LoginData *const loginData) const = 0;
72
73
        virtual void logout() const = 0;
74
75
        virtual void changeEmail(const std::string &email) const = 0;
76
77
        virtual void changePassword(const std::string &restrict oldPassword,
78
                                    const std::string &restrict newPassword)
79
                                    const = 0;
80
81
        virtual void chooseServer(unsigned int server,
82
                                  const bool persistentIp) const = 0;
83
84
        virtual void registerAccount(const LoginData *const loginData)
85
                                     const = 0;
86
87
        virtual void unregisterAccount(const std::string &username,
88
                                       const std::string &password) const = 0;
89
90
        virtual const Worlds &getWorlds() const A_WARN_UNUSED = 0;
91
92
        virtual void clearWorlds() const = 0;
93
94
        virtual void loginOrRegister(LoginData *const data) const = 0;
95
96
        virtual void sendVersion() const = 0;
97
98
        virtual void ping() const = 0;
99
100
        virtual void updatePacketVersion() const = 0;
101
102
        virtual void sendMobileCode(const BeingId accountId,
103
                                    const std::string &code) const = 0;
104
105
        virtual void sendOtpCode(const std::string &code) const = 0;
106
107
        virtual ~LoginHandler()
108
        { }
109
110
    protected:
111
        LoginHandler() :
112
            mServer()
113
        {
114
        }
115
116
        ServerInfo mServer;
117
};
118
119
}  // namespace Net
120
121
extern Net::LoginHandler *loginHandler;
122
123
#endif  // NET_LOGINHANDLER_H