OregonCore  revision fb2a440-git
Your Favourite TBC server
AccountMgr.h
Go to the documentation of this file.
1 /*
2  * This file is part of the OregonCore Project. See AUTHORS file for Copyright information
3  *
4  * This program is free software; you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License as published by the
6  * Free Software Foundation; either version 2 of the License, or (at your
7  * option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12  * more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef _ACCMGR_H
19 #define _ACCMGR_H
20 
21 #include <string>
22 
23 #include "Common.h"
24 #include "ace/Singleton.h"
25 
27 {
34 };
35 
36 #define MAX_ACCOUNT_STR 16
37 
39 {
40  public:
41  AccountMgr();
42  ~AccountMgr();
43 
44  AccountOpResult CreateAccount(std::string username, std::string password);
46  AccountOpResult ChangeUsername(uint32 accid, std::string new_uname, std::string new_passwd);
47  AccountOpResult ChangePassword(uint32 accid, std::string new_passwd);
48  bool CheckPassword(uint32 accid, std::string passwd);
49 
50  uint32 GetId(std::string username);
51  uint32 GetSecurity(uint32 acc_id);
52  uint32 GetSecurity(uint32 acc_id, int32 realm_id);
53  bool GetName(uint32 acc_id, std::string& name);
55  static std::string CalculateShaPassHash(std::string& name, std::string& password);
56 
57  static bool normalizeString(std::string& utf8str);
58 };
59 
60 #define sAccountMgr ACE_Singleton<AccountMgr, ACE_Null_Mutex>::instance()
61 #endif
62 
AccountOpResult DeleteAccount(uint32 accid)
Definition: AccountMgr.cpp:56
static std::string CalculateShaPassHash(std::string &name, std::string &password)
Definition: AccountMgr.cpp:236
ACE_INT32 int32
Definition: Define.h:67
AccountOpResult ChangeUsername(uint32 accid, std::string new_uname, std::string new_passwd)
Definition: AccountMgr.cpp:103
uint32 GetId(std::string username)
Definition: AccountMgr.cpp:146
bool CheckPassword(uint32 accid, std::string passwd)
Definition: AccountMgr.cpp:211
bool GetName(uint32 acc_id, std::string &name)
Definition: AccountMgr.cpp:185
AccountOpResult
Definition: AccountMgr.h:26
static bool normalizeString(std::string &utf8str)
Definition: AccountMgr.cpp:223
uint32 GetCharactersCount(uint32 acc_id)
Definition: AccountMgr.cpp:197
uint32 GetSecurity(uint32 acc_id)
Definition: AccountMgr.cpp:159
AccountOpResult ChangePassword(uint32 accid, std::string new_passwd)
Definition: AccountMgr.cpp:127
AccountOpResult CreateAccount(std::string username, std::string password)
Definition: AccountMgr.cpp:34
ACE_UINT32 uint32
Definition: Define.h:71