-
-
Notifications
You must be signed in to change notification settings - Fork 406
/
CCommunity.h
78 lines (61 loc) · 2.79 KB
/
CCommunity.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*****************************************************************************
*
* PROJECT: Multi Theft Auto v1.0
* LICENSE: See LICENSE in the top level directory
* FILE: core/CCommunity.h
* PURPOSE: Header file for community connector class
* DEVELOPERS: Cecill Etheredge <ijsf@gmx.net>
* Sebas Lamers <sebasdevelopment@gmx.com>
*
* Multi Theft Auto is available from http://www.multitheftauto.com/
*
*****************************************************************************/
#ifndef __CCOMMUNITY_H
#define __CCOMMUNITY_H
#include <core/CCommunityInterface.h>
#include "tracking/CHTTPClient.h"
typedef void (*VERIFICATIONCALLBACK) ( bool, char*, void* obj );
#define VERIFICATION_DELAY 9000
#define VERIFICATION_URL "http://community.mtasa.com/core/1.1/client.php"
enum eVerificationResult
{
VERIFY_ERROR_UNEXPECTED = 0,
VERIFY_ERROR_SUCCESS,
VERIFY_ERROR_VERIFICATION_FAILED,
VERIFY_ERROR_COMPUTER_USED,
VERIFY_ERROR_SERIALS_MAX,
VERIFY_ERROR_INVALID_ACCOUNT,
VERIFY_ERROR_ACCOUNT_USED,
VERIFY_ERROR_INVALID,
VERIFY_ERROR_ACCOUNT_BANNED,
VERIFY_ERROR_SERIAL_BANNED,
VERIFY_ERROR_CURL,
};
class CCommunity : public CCommunityInterface, public CSingleton < CCommunity >
{
friend class CSettings;
friend class CCommunityLogin;
public:
CCommunity ( void );
~CCommunity ( void );
void Initialize ( void );
void GetUsername ( std::string & strUsername ) { strUsername = m_strUsername; };
void GetPassword ( std::string & strPassword ) { strPassword = m_strPassword; };
bool IsLoggedIn ( void ) { return m_bLoggedIn; };
void DoPulse ( void );
protected:
void SetUsername ( const std::string& strUsername ) { m_strUsername = strUsername; };
void SetPassword ( const std::string& strPassword ) { m_strPassword = strPassword; };
void Login ( VERIFICATIONCALLBACK pCallBack = NULL, void* pObject = NULL );
void Logout ( void );
private:
CHTTPClient m_HTTP;
std::string m_strUsername;
std::string m_strPassword;
bool m_bLoggedIn;
unsigned long m_ulStartTime;
// Callback variables
VERIFICATIONCALLBACK m_pCallback;
void * m_pVerificationObject;
};
#endif