blob: 296abb20454a6db0aa32bd6b3ed4659099adc5ba (
plain)
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
|
class CIcqProto;
enum IcqConnection
{
CONN_NONE = -1, CONN_MAIN = 0, CONN_FETCH = 1, CONN_RAPI = 2, CONN_LAST = 3
};
struct AsyncHttpRequest : public MTHttpRequest<CIcqProto>
{
IcqConnection m_conn;
MCONTACT hContact;
char m_reqId[50];
AsyncHttpRequest(IcqConnection, int type, const char *szUrl, MTHttpRequestHandler pFunc = nullptr);
void ReplaceJsonParam(const JSONNode&);
};
/////////////////////////////////////////////////////////////////////////////////////////
class JsonReply
{
JSONNode *m_root = nullptr;
int m_errorCode = 0, m_detailCode = 0;
JSONNode* m_data = nullptr;
CMStringA m_requestId;
public:
JsonReply(NETLIBHTTPREQUEST*);
~JsonReply();
__forceinline const CMStringA& requestId() const { return m_requestId; }
__forceinline JSONNode& data() const { return *m_data; }
__forceinline int error() const { return m_errorCode; }
__forceinline int detail() const { return m_detailCode; }
};
class FileReply
{
JSONNode *m_root = nullptr;
int m_errorCode = 0;
JSONNode* m_data = nullptr;
public:
FileReply(NETLIBHTTPREQUEST*);
~FileReply();
__forceinline JSONNode& data() const { return *m_data; }
__forceinline int error() const { return m_errorCode; }
};
class RobustReply
{
JSONNode *m_root = nullptr;
int m_errorCode = 0;
JSONNode* m_results = nullptr;
public:
RobustReply(NETLIBHTTPREQUEST*);
~RobustReply();
__forceinline JSONNode& results() const { return *m_results; }
__forceinline int error() const { return m_errorCode; }
};
|