1 /*
2  *  The ManaPlus Client
3  *  Copyright (C) 2004-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_LOGINDATA_H
25 #define NET_LOGINDATA_H
26 
27 #include "enums/being/gender.h"
28 
29 #include "enums/net/updatetype.h"
30 
31 #include "utils/stringvector.h"
32 
33 #include "localconsts.h"
34 
35 class LoginData final
36 {
37     public:
LoginData()38         LoginData() :
39             username(),
40             password(),
41             newPassword(),
42             updateHost(),
43             updateHosts(),
44             lastLogin(),
45             updateType(UpdateType::Normal),
46             email(),
47             captchaResponse(),
48             registerUrl(),
49             gender(Gender::UNSPECIFIED),
50             packetVersion(0),
51             remember(false),
52             registerLogin(false),
53             characterSlots(9)
54         {
55         }
56 
57         A_DELETE_COPY(LoginData)
58 
59         std::string username;
60         std::string password;
61         std::string newPassword;
62         std::string updateHost;
63         StringVect updateHosts;
64         std::string lastLogin;
65         UpdateTypeT updateType;
66 
67         std::string email;
68         std::string captchaResponse;
69         std::string registerUrl;
70 
71         GenderT gender;
72 
73         int packetVersion;
74         bool remember;       // Whether to store the username.
75         bool registerLogin;  // Whether an account is being registered.
76 
77         uint16_t characterSlots;  // The number of character slots
78 
clear()79         void clear()
80         {
81             username.clear();
82             password.clear();
83             newPassword.clear();
84             updateHost.clear();
85             updateHosts.clear();
86             updateType = UpdateType::Normal;
87             email.clear();
88             captchaResponse.clear();
89             registerUrl.clear();
90             gender = Gender::UNSPECIFIED;
91             packetVersion = 0;
92             lastLogin.clear();
93             resetCharacterSlots();
94         }
95 
clearUpdateHost()96         void clearUpdateHost()
97         {
98             updateHost.clear();
99             updateHosts.clear();
100         }
101 
102         /**
103          * Initialize character slots to 3 for TmwAthena compatibility
104          */
resetCharacterSlots()105         void resetCharacterSlots()
106         {
107             characterSlots = 9;  // Default value, used for TmwAthena.
108         }
109 };
110 
111 #endif  // NET_LOGINDATA_H
112