forked from davidgfnet/whatsapp-purple
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwhatsapp_api.h
More file actions
84 lines (66 loc) · 2.6 KB
/
whatsapp_api.h
File metadata and controls
84 lines (66 loc) · 2.6 KB
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
#ifndef __WHATSAPP_API__H__
#define __WHATSAPP_API__H__
#include <string>
#include <vector>
#include <map>
class WhatsappConnection;
class Group;
class Message;
class WhatsappConnectionAPI {
private:
WhatsappConnection * connection;
public:
WhatsappConnectionAPI(std::string phone, std::string password, std::string nick);
~WhatsappConnectionAPI();
// Login/Auth functions
void doLogin(std::string);
int loginStatus() const;
int getErrors(std::string & reason);
// Data transfer
void receiveCallback(const char *data, int len);
int sendCallback(char *data, int len);
void sentCallback(int len);
bool hasDataToSend();
// Receiving stuff
bool queryReceivedMessage(std::string &msgid, int & type, std::string & who);
Message * getReceivedMessage();
// Sending stuff
std::string getMessageId();
void sendChat(std::string msgid, std::string to, std::string message);
void sendGroupChat(std::string msgid, std::string to, std::string message);
int sendImage(std::string id, std::string to, int w, int h, unsigned int size, const char *fp);
// Privacy
void updatePrivacy(const std::string &, const std::string &, const std::string &);
void queryPrivacy(std::string &, std::string &, std::string &);
void addContacts(std::vector < std::string > clist);
void contactsUpdate();
bool query_status(std::string & from, int &status);
bool query_icon(std::string & from, std::string & icon, std::string & hash);
bool query_avatar(std::string user, std::string & icon);
bool query_typing(std::string & from, int &status);
void account_info(unsigned long long &creation, unsigned long long &freeexp, std::string & status);
void send_avatar(const std::string & avatar, const std::string & avatarp);
int getuserstatus(const std::string & who);
std::string getuserstatusstring(const std::string & who);
unsigned long long getlastseen(const std::string & who);
// Group functionality
void addGroup(std::string subject);
void leaveGroup(std::string group);
void manageParticipant(std::string group, std::string participant, std::string command);
std::map < std::string, Group > getGroups();
bool groupsUpdated();
// User
void notifyTyping(std::string who, int status);
void setMyPresence(std::string s, std::string msg);
// HTTP/SSL interface for file upload and so...
int sendSSLCallback(char *buffer, int maxbytes);
int sentSSLCallback(int bytessent);
void receiveSSLCallback(char *buffer, int bytesrecv);
bool hasSSLDataToSend();
bool closeSSLConnection();
void SSLCloseCallback();
bool hasSSLConnection(std::string & host, int *port);
int uploadProgress(int &rid, int &bs);
int uploadComplete(int);
};
#endif