forked from davidgfnet/whatsapp-purple
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwhatsapp_api.cc
221 lines (175 loc) · 5.2 KB
/
whatsapp_api.cc
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
#include "whatsapp_api.h"
#include "wa_connection.h"
WhatsappConnectionAPI::WhatsappConnectionAPI(std::string phone, std::string password, std::string nick)
{
connection = new WhatsappConnection(phone, password, nick);
}
WhatsappConnectionAPI::~WhatsappConnectionAPI()
{
delete connection;
}
std::map < std::string, Group > WhatsappConnectionAPI::getGroups()
{
return connection->getGroups();
}
bool WhatsappConnectionAPI::groupsUpdated()
{
return connection->groupsUpdated();
}
int WhatsappConnectionAPI::getuserstatus(const std::string & who)
{
return connection->getuserstatus(who);
}
void WhatsappConnectionAPI::addGroup(std::string subject)
{
connection->addGroup(subject);
}
void WhatsappConnectionAPI::leaveGroup(std::string subject)
{
connection->leaveGroup(subject);
}
void WhatsappConnectionAPI::manageParticipant(std::string group, std::string participant, std::string command)
{
connection->manageParticipant(group, participant, command);
}
unsigned long long WhatsappConnectionAPI::getlastseen(const std::string & who)
{
return connection->getlastseen(who);
}
int WhatsappConnectionAPI::sendImage(std::string mid, std::string to, int w, int h, unsigned int size, const char *fp)
{
return connection->sendImage(mid, to, w, h, size, fp);
}
int WhatsappConnectionAPI::uploadProgress(int &rid, int &bs)
{
return connection->uploadProgress(rid, bs);
}
int WhatsappConnectionAPI::uploadComplete(int rid)
{
return connection->uploadComplete(rid);
}
void WhatsappConnectionAPI::send_avatar(const std::string & avatar, const std::string & avatarp)
{
connection->send_avatar(avatar, avatarp);
}
bool WhatsappConnectionAPI::query_icon(std::string & from, std::string & icon, std::string & hash)
{
return connection->query_icon(from, icon, hash);
}
bool WhatsappConnectionAPI::query_avatar(std::string user, std::string & icon)
{
return connection->query_avatar(user, icon);
}
bool WhatsappConnectionAPI::query_typing(std::string & from, int &status)
{
return connection->query_typing(from, status);
}
void WhatsappConnectionAPI::setMyPresence(std::string s, std::string msg)
{
connection->setMyPresence(s, msg);
}
void WhatsappConnectionAPI::notifyTyping(std::string who, int status)
{
connection->notifyTyping(who, status);
}
std::string WhatsappConnectionAPI::getuserstatusstring(const std::string & who)
{
return connection->getuserstatusstring(who);
}
bool WhatsappConnectionAPI::query_status(std::string & from, int &status)
{
return connection->query_status(from, status);
}
std::string WhatsappConnectionAPI::getMessageId()
{
return connection->getMessageId();
}
bool WhatsappConnectionAPI::queryReceivedMessage(std::string & msgid, int & type, std::string & who)
{
unsigned long long t;
return connection->queryReceivedMessage(msgid, type, t, who);
}
void WhatsappConnectionAPI::sendChat(std::string msgid, std::string to, std::string message)
{
connection->sendChat(msgid, to, message);
}
void WhatsappConnectionAPI::sendGroupChat(std::string msgid, std::string to, std::string message)
{
connection->sendGroupChat(msgid, to, message);
}
int WhatsappConnectionAPI::loginStatus() const
{
return connection->loginStatus();
}
void WhatsappConnectionAPI::doLogin(std::string resource)
{
connection->doLogin(resource);
}
void WhatsappConnectionAPI::receiveCallback(const char *data, int len)
{
connection->receiveCallback(data, len);
}
int WhatsappConnectionAPI::sendCallback(char *data, int len)
{
return connection->sendCallback(data, len);
}
void WhatsappConnectionAPI::sentCallback(int len)
{
connection->sentCallback(len);
}
void WhatsappConnectionAPI::addContacts(std::vector < std::string > clist)
{
connection->addContacts(clist);
}
void WhatsappConnectionAPI::contactsUpdate()
{
connection->contactsUpdate();
}
bool WhatsappConnectionAPI::hasDataToSend()
{
return connection->hasDataToSend();
}
void WhatsappConnectionAPI::account_info(unsigned long long &creation, unsigned long long &freeexp, std::string & status)
{
connection->account_info(creation, freeexp, status);
}
int WhatsappConnectionAPI::sendSSLCallback(char *buffer, int maxbytes)
{
return connection->sendSSLCallback(buffer, maxbytes);
}
int WhatsappConnectionAPI::sentSSLCallback(int bytessent)
{
return connection->sentSSLCallback(bytessent);
}
void WhatsappConnectionAPI::receiveSSLCallback(char *buffer, int bytesrecv)
{
connection->receiveSSLCallback(buffer, bytesrecv);
}
bool WhatsappConnectionAPI::hasSSLDataToSend()
{
return connection->hasSSLDataToSend();
}
bool WhatsappConnectionAPI::closeSSLConnection()
{
return connection->closeSSLConnection();
}
void WhatsappConnectionAPI::SSLCloseCallback()
{
connection->SSLCloseCallback();
}
bool WhatsappConnectionAPI::hasSSLConnection(std::string & host, int *port)
{
return connection->hasSSLConnection(host, port);
}
Message * WhatsappConnectionAPI::getReceivedMessage() {
return connection->getReceivedMessage();
}
void WhatsappConnectionAPI::updatePrivacy(const std::string & a, const std::string & b, const std::string & c) {
connection->updatePrivacy(a,b,c);
}
void WhatsappConnectionAPI::queryPrivacy(std::string & a, std::string & b, std::string & c) {
connection->queryPrivacy(a,b,c);
}
int WhatsappConnectionAPI::getErrors(std::string & reason) {
return (int)connection->getErrors(reason);
}