GCC Code Coverage Report
Directory: src/ Exec Total Coverage
File: src/net/loginhandler.h Lines: 0 12 0.0 %
Date: 2017-11-29 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-2017  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
#include "net/worldinfo.h"
28
29
class LoginData;
30
31
namespace Net
32
{
33
34
class LoginHandler notfinal
35
{
36
    public:
37
        A_DELETE_COPY(LoginHandler)
38
39
        void setServer(const ServerInfo &server)
40
        { mServer = server; }
41
42
        const ServerInfo &getServer() const A_WARN_UNUSED
43
        { return mServer; }
44
45
        virtual void connect() const = 0;
46
47
        virtual bool isConnected() const A_WARN_UNUSED = 0;
48
49
        virtual void disconnect() const = 0;
50
51
        virtual bool isRegistrationEnabled() const A_WARN_UNUSED = 0;
52
53
        virtual void getRegistrationDetails() const = 0;
54
55
        virtual unsigned int getMinUserNameLength() const A_WARN_UNUSED
56
        { return 4; }
57
58
        virtual unsigned int getMaxUserNameLength() const A_WARN_UNUSED
59
        { return 25; }
60
61
        virtual unsigned int getMinPasswordLength() const A_WARN_UNUSED
62
        { return 4; }
63
64
        virtual unsigned int getMaxPasswordLength() const A_WARN_UNUSED
65
        { return 255; }
66
67
        virtual void loginAccount(LoginData *const loginData) const = 0;
68
69
        virtual void logout() const = 0;
70
71
        virtual void changeEmail(const std::string &email) const = 0;
72
73
        virtual void changePassword(const std::string &restrict oldPassword,
74
                                    const std::string &restrict newPassword)
75
                                    const = 0;
76
77
        virtual void chooseServer(unsigned int server,
78
                                  const bool persistentIp) const = 0;
79
80
        virtual void registerAccount(const LoginData *const loginData)
81
                                     const = 0;
82
83
        virtual void unregisterAccount(const std::string &username,
84
                                       const std::string &password) const = 0;
85
86
        virtual const Worlds &getWorlds() const A_WARN_UNUSED = 0;
87
88
        virtual void clearWorlds() const = 0;
89
90
        virtual void loginOrRegister(LoginData *const data) const = 0;
91
92
        virtual void sendVersion() const = 0;
93
94
        virtual void ping() const = 0;
95
96
        virtual void updatePacketVersion() const = 0;
97
98
        virtual ~LoginHandler()
99
        { }
100
101
    protected:
102
        LoginHandler() :
103
            mServer()
104
        {
105
        }
106
107
        ServerInfo mServer;
108
};
109
110
}  // namespace Net
111
112
extern Net::LoginHandler *loginHandler;
113
114
#endif  // NET_LOGINHANDLER_H