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