diff options
Diffstat (limited to 'protocols/WhatsApp/src')
-rw-r--r-- | protocols/WhatsApp/src/WASocketConnection.cpp | 23 | ||||
-rw-r--r-- | protocols/WhatsApp/src/WASocketConnection.h | 1 | ||||
-rw-r--r-- | protocols/WhatsApp/src/WhatsAPI++/ISocketConnection.h | 1 | ||||
-rw-r--r-- | protocols/WhatsApp/src/WhatsAPI++/WAConnection.cpp | 117 | ||||
-rw-r--r-- | protocols/WhatsApp/src/WhatsAPI++/WAConnection.h | 26 | ||||
-rw-r--r-- | protocols/WhatsApp/src/WhatsAPI++/WALogin.cpp | 4 | ||||
-rw-r--r-- | protocols/WhatsApp/src/avatars.cpp | 2 | ||||
-rw-r--r-- | protocols/WhatsApp/src/chat.cpp | 12 | ||||
-rw-r--r-- | protocols/WhatsApp/src/contacts.cpp | 4 | ||||
-rw-r--r-- | protocols/WhatsApp/src/dialogs.cpp | 2 | ||||
-rw-r--r-- | protocols/WhatsApp/src/entities.h | 2 | ||||
-rw-r--r-- | protocols/WhatsApp/src/main.cpp | 2 | ||||
-rw-r--r-- | protocols/WhatsApp/src/proto.cpp | 7 | ||||
-rw-r--r-- | protocols/WhatsApp/src/proto.h | 28 | ||||
-rw-r--r-- | protocols/WhatsApp/src/theme.cpp | 2 |
15 files changed, 103 insertions, 130 deletions
diff --git a/protocols/WhatsApp/src/WASocketConnection.cpp b/protocols/WhatsApp/src/WASocketConnection.cpp index 0de6be5884..e6b53aa419 100644 --- a/protocols/WhatsApp/src/WASocketConnection.cpp +++ b/protocols/WhatsApp/src/WASocketConnection.cpp @@ -47,29 +47,6 @@ void WASocketConnection::makeNonBlock() throw WAException("Error setting socket nonblocking!", WAException::SOCKET_EX, WAException::SOCKET_EX_OPEN);
}
-int WASocketConnection::waitForRead()
-{
- // #TODO Is this called at all?
- return 0;
-
- fd_set rfds;
- struct timeval tv;
- struct timeval* tvp;
- int fd = 0;
-
- FD_ZERO(&rfds);
- FD_SET(fd, &rfds);
- tv.tv_sec = 600; //ApplicationData::SELECT_TIMEOUT;
- tv.tv_usec = 0; // 5000000;
- tvp = &tv;
-
- int retval = select(/*fd + 1*/ 0, &rfds, NULL, NULL, tvp);
- if (!FD_ISSET(fd, &rfds))
- retval = 0;
-
- return retval;
-}
-
void WASocketConnection::flush() {}
void WASocketConnection::write(const std::vector<unsigned char> &bytes, int length)
diff --git a/protocols/WhatsApp/src/WASocketConnection.h b/protocols/WhatsApp/src/WASocketConnection.h index 6f9d5f2426..802ba911b3 100644 --- a/protocols/WhatsApp/src/WASocketConnection.h +++ b/protocols/WhatsApp/src/WASocketConnection.h @@ -28,7 +28,6 @@ public: virtual void write(const std::vector<unsigned char>& b, int length);
// virtual void write(const std::vector<unsigned char>& bytes, int offset, int length);
virtual void makeNonBlock();
- virtual int waitForRead();
virtual void forceShutdown();
virtual void log(const char *prefix, const char *str);
diff --git a/protocols/WhatsApp/src/WhatsAPI++/ISocketConnection.h b/protocols/WhatsApp/src/WhatsAPI++/ISocketConnection.h index 3ae7932e95..b017df8cdc 100644 --- a/protocols/WhatsApp/src/WhatsAPI++/ISocketConnection.h +++ b/protocols/WhatsApp/src/WhatsAPI++/ISocketConnection.h @@ -16,7 +16,6 @@ public: virtual int read(unsigned char*, int length) = 0;
virtual int read(std::vector<unsigned char>& b, int off, int length) = 0;
virtual void makeNonBlock() = 0;
- virtual int waitForRead() = 0;
virtual void forceShutdown() = 0;
virtual void log(const char *prefix, const char *str) = 0;
diff --git a/protocols/WhatsApp/src/WhatsAPI++/WAConnection.cpp b/protocols/WhatsApp/src/WhatsAPI++/WAConnection.cpp index 6b1336e6d7..b760c58da4 100644 --- a/protocols/WhatsApp/src/WhatsAPI++/WAConnection.cpp +++ b/protocols/WhatsApp/src/WhatsAPI++/WAConnection.cpp @@ -249,7 +249,7 @@ void WAConnection::parseAck(ProtocolTreeNode *node) throw(WAException) const string &from = node->getAttributeValue("from");
const string &cls = node->getAttributeValue("class");
const string &id = node->getAttributeValue("id");
- const string &ts = node->getAttributeValue("t");
+ // const string &ts = node->getAttributeValue("t");
if (cls == "message" && m_pEventHandler != NULL) {
FMessage msg(from, true, id);
@@ -365,9 +365,9 @@ void WAConnection::parseIq(ProtocolTreeNode *node) throw(WAException) if (xmlns == "jabber:iq:roster") {
std::vector<ProtocolTreeNode*> itemNodes(childNode->getAllChildren("item"));
for (size_t i = 0; i < itemNodes.size(); i++) {
- ProtocolTreeNode *itemNode = itemNodes[i];
- const string &jid = itemNode->getAttributeValue("jid");
- const string &subscription = itemNode->getAttributeValue("subscription");
+ // ProtocolTreeNode *itemNode = itemNodes[i];
+ // const string &jid = itemNode->getAttributeValue("jid");
+ // const string &subscription = itemNode->getAttributeValue("subscription");
// ask = itemNode->getAttributeValue("ask");
}
}
@@ -609,7 +609,6 @@ void WAConnection::parseReceipt(ProtocolTreeNode *node) throw(WAException) {
const string &from = node->getAttributeValue("from");
const string &id = node->getAttributeValue("id");
- const string &ts = node->getAttributeValue("t");
if (m_pEventHandler != NULL) {
FMessage msg(from, false, id);
@@ -640,26 +639,26 @@ std::vector<ProtocolTreeNode*>* WAConnection::processGroupSettings(const std::ve void WAConnection::sendActive() throw(WAException)
{
- out.write(ProtocolTreeNode("presence") << XATTR("type", "active"));
+ ProtocolTreeNode n("presence");
+ out.write(n << XATTR("type", "active"));
}
void WAConnection::sendAvailableForChat() throw(WAException)
{
- out.write(ProtocolTreeNode("presence") << XATTR("name", this->nick));
+ ProtocolTreeNode n("presence");
+ out.write(n << XATTR("name", this->nick));
}
void WAConnection::sendClientConfig(const std::string &sound, const std::string &pushID, bool preview, const std::string &platform) throw(WAException)
{
- ProtocolTreeNode *configNode = new ProtocolTreeNode("config")
- << XATTR("xmlns", "urn:xmpp:whatsapp:push") << XATTR("sound", sound) << XATTR("id", pushID) << XATTR("preview", preview ? "1" : "0") << XATTR("platform", platform);
-
m_pMutex->lock();
std::string id = makeId("config_");
this->pending_server_requests[id] = new IqSendClientConfigHandler(this);
m_pMutex->unlock();
- out.write(ProtocolTreeNode("iq", configNode)
- << XATTR("id", id) << XATTR("type", "set") << XATTR("to", this->domain));
+ ProtocolTreeNode iq("iq", new ProtocolTreeNode("config")
+ << XATTR("xmlns", "urn:xmpp:whatsapp:push") << XATTR("sound", sound) << XATTR("id", pushID) << XATTR("preview", preview ? "1" : "0") << XATTR("platform", platform));
+ out.write(iq << XATTR("id", id) << XATTR("type", "set") << XATTR("to", this->domain));
}
void WAConnection::sendClientConfig(const std::string &pushID, bool preview, const std::string &platform, bool defaultSettings, bool groupSettings, const std::vector<GroupSetting>& groups) throw(WAException)
@@ -670,18 +669,21 @@ void WAConnection::sendClientConfig(const std::string &pushID, bool preview, con << XATTR("default", defaultSettings ? "1" : "0") << XATTR("groups", groupSettings ? "1" : "0");
std::string id = makeId("config_");
- out.write(ProtocolTreeNode("iq", configNode) << XATTR("id", id) << XATTR("type", "set") << XATTR("to", this->domain));
+ ProtocolTreeNode iq("iq", configNode);
+ out.write(iq << XATTR("id", id) << XATTR("type", "set") << XATTR("to", this->domain));
}
void WAConnection::sendClose() throw(WAException)
{
- out.write(ProtocolTreeNode("presence") << XATTR("type", "unavailable"));
+ ProtocolTreeNode n("presence");
+ out.write(n << XATTR("type", "unavailable"));
out.streamEnd();
}
void WAConnection::sendComposing(const std::string &to) throw(WAException)
{
- out.write(ProtocolTreeNode("chatstate", new ProtocolTreeNode("composing")) << XATTR("to", to));
+ ProtocolTreeNode n("chatstate", new ProtocolTreeNode("composing"));
+ out.write(n << XATTR("to", to));
}
void WAConnection::sendDeleteAccount() throw (WAException)
@@ -691,8 +693,8 @@ void WAConnection::sendDeleteAccount() throw (WAException) this->pending_server_requests[id] = new IqResultSendDeleteAccount(this);
m_pMutex->unlock();
- out.write(ProtocolTreeNode("iq", new ProtocolTreeNode("remove") << XATTR("xmlns", "urn:xmpp:whatsapp:account"))
- << XATTR("id", id) << XATTR("type", "get") << XATTR("to", "s.whatsapp.net"));
+ ProtocolTreeNode iq("iq", new ProtocolTreeNode("remove") << XATTR("xmlns", "urn:xmpp:whatsapp:account"));
+ out.write(iq << XATTR("id", id) << XATTR("type", "get") << XATTR("to", "s.whatsapp.net"));
}
void WAConnection::sendGetGroups() throw (WAException)
@@ -702,8 +704,8 @@ void WAConnection::sendGetGroups() throw (WAException) this->pending_server_requests[id] = new IqResultGetGroupsHandler(this, "participating");
m_pMutex->unlock();
- out.write(ProtocolTreeNode("iq", new ProtocolTreeNode("list") << XATTR("type", "participating"))
- << XATTR("xmlns", "w:g") << XATTR("id", id) << XATTR("type", "get") << XATTR("to", "g.us"));
+ ProtocolTreeNode iq("iq", new ProtocolTreeNode("list") << XATTR("type", "participating"));
+ out.write(iq << XATTR("xmlns", "w:g") << XATTR("id", id) << XATTR("type", "get") << XATTR("to", "g.us"));
}
void WAConnection::sendGetPicture(const char *jid, const char *type) throw (WAException)
@@ -713,8 +715,8 @@ void WAConnection::sendGetPicture(const char *jid, const char *type) throw (WAEx this->pending_server_requests[id] = new IqResultGetPhotoHandler(this, jid);
m_pMutex->unlock();
- out.write(ProtocolTreeNode("iq", new ProtocolTreeNode("picture") << XATTR("type", type))
- << XATTR("id", id) << XATTR("to", jid) << XATTR("xmlns", "w:profile:picture") << XATTR("type", "get"));
+ ProtocolTreeNode iq("iq", new ProtocolTreeNode("picture") << XATTR("type", type));
+ out.write(iq << XATTR("id", id) << XATTR("to", jid) << XATTR("xmlns", "w:profile:picture") << XATTR("type", "get"));
}
void WAConnection::sendGetPrivacyList() throw (WAException)
@@ -724,9 +726,9 @@ void WAConnection::sendGetPrivacyList() throw (WAException) this->pending_server_requests[id] = new IqResultPrivayListHandler(this);
m_pMutex->unlock();
- ProtocolTreeNode *queryNode = new ProtocolTreeNode("query", new ProtocolTreeNode("list") << XATTR("name", "default"))
- << XATTR("xmlns", "jabber:iq:privacy");
- out.write(ProtocolTreeNode("iq", queryNode) << XATTR("id", id) << XATTR("type", "get"));
+ ProtocolTreeNode iq("iq", new ProtocolTreeNode("query",
+ new ProtocolTreeNode("list") << XATTR("name", "default")) << XATTR("xmlns", "jabber:iq:privacy"));
+ out.write(iq << XATTR("id", id) << XATTR("type", "get"));
}
void WAConnection::sendGetServerProperties() throw (WAException)
@@ -736,13 +738,14 @@ void WAConnection::sendGetServerProperties() throw (WAException) this->pending_server_requests[id] = new IqResultServerPropertiesHandler(this);
m_pMutex->unlock();
- out.write(ProtocolTreeNode("iq", new ProtocolTreeNode("list") << XATTR("type", "props"))
- << XATTR("xmlns", "w:g2") << XATTR("id", id) << XATTR("type", "get") << XATTR("to", "g.us"));
+ ProtocolTreeNode iq("iq", new ProtocolTreeNode("list") << XATTR("type", "props"));
+ out.write(iq << XATTR("xmlns", "w:g2") << XATTR("id", id) << XATTR("type", "get") << XATTR("to", "g.us"));
}
void WAConnection::sendInactive() throw(WAException)
{
- out.write(ProtocolTreeNode("presence") << XATTR("type", "inactive"));
+ ProtocolTreeNode n("presence");
+ out.write(n << XATTR("type", "inactive"));
}
void WAConnection::sendAck(ProtocolTreeNode *node, const char *classType)
@@ -957,15 +960,16 @@ void WAConnection::sendMessageWithBody(FMessage* message) throw (WAException) void WAConnection::sendMessageReceived(const FMessage &message) throw(WAException)
{
- out.write(ProtocolTreeNode("receipt") << XATTR("type", "read")
- << XATTR("to", message.key.remote_jid) << XATTR("id", message.key.id));
+ ProtocolTreeNode n("receipt");
+ out.write(n << XATTR("type", "read") << XATTR("to", message.key.remote_jid) << XATTR("id", message.key.id));
}
/////////////////////////////////////////////////////////////////////////////////////////
void WAConnection::sendPaused(const std::string &to) throw(WAException)
{
- out.write(ProtocolTreeNode("chatstate", new ProtocolTreeNode("paused")) << XATTR("to", to));
+ ProtocolTreeNode n("chatstate", new ProtocolTreeNode("paused"));
+ out.write(n << XATTR("to", to));
}
void WAConnection::sendPing() throw(WAException)
@@ -975,20 +979,20 @@ void WAConnection::sendPing() throw(WAException) this->pending_server_requests[id] = new IqResultPingHandler(this);
m_pMutex->unlock();
- ProtocolTreeNode *pingNode = new ProtocolTreeNode("ping");
- out.write(ProtocolTreeNode("iq", pingNode)
- << XATTR("id", id) << XATTR("xmlns", "w:p") << XATTR("type", "get") << XATTR("to", "s.whatsapp.net"));
+ ProtocolTreeNode iq("iq", new ProtocolTreeNode("ping"));
+ out.write(iq << XATTR("id", id) << XATTR("xmlns", "w:p") << XATTR("type", "get") << XATTR("to", "s.whatsapp.net"));
}
void WAConnection::sendPong(const std::string &id) throw(WAException)
{
- out.write(ProtocolTreeNode("iq")
- << XATTR("type", "result") << XATTR("to", this->domain) << XATTR("id", id));
+ ProtocolTreeNode iq("iq");
+ out.write(iq << XATTR("type", "result") << XATTR("to", this->domain) << XATTR("id", id));
}
void WAConnection::sendPresenceSubscriptionRequest(const std::string &to) throw(WAException)
{
- out.write(ProtocolTreeNode("presence") << XATTR("type", "subscribe") << XATTR("to", to));
+ ProtocolTreeNode n("presence");
+ out.write(n << XATTR("type", "subscribe") << XATTR("to", to));
}
void WAConnection::sendSetPicture(const char *jid, std::vector<unsigned char>* data, std::vector<unsigned char>* preview) throw (WAException)
@@ -1003,8 +1007,9 @@ void WAConnection::sendSetPicture(const char *jid, std::vector<unsigned char>* d messageChildren->push_back(new ProtocolTreeNode("picture", preview, NULL) << XATTR("type", "preview"));
if (data)
messageChildren->push_back(new ProtocolTreeNode("picture", data, NULL) << XATTR("type", "image"));
- out.write(ProtocolTreeNode("iq", NULL, messageChildren)
- << XATTR("id", id) << XATTR("type", "set") << XATTR("to", jid) << XATTR("xmlns", "w:profile:picture"));
+
+ ProtocolTreeNode iq("iq", NULL, messageChildren);
+ out.write(iq << XATTR("id", id) << XATTR("type", "set") << XATTR("to", jid) << XATTR("xmlns", "w:profile:picture"));
}
void WAConnection::sendStatusUpdate(std::string& status) throw (WAException)
@@ -1027,9 +1032,8 @@ void WAConnection::sendGetGroupInfo(const std::string &gjid) throw (WAException) this->pending_server_requests[id] = new IqResultGetGroupInfoHandler(this);
m_pMutex->unlock();
- ProtocolTreeNode *queryNode = new ProtocolTreeNode("query") << XATTR("request", "interactive");
- out.write(ProtocolTreeNode("iq", queryNode) << XATTR("xmlns", "w:g2")
- << XATTR("id", id) << XATTR("type", "get") << XATTR("to", gjid));
+ ProtocolTreeNode iq("iq", new ProtocolTreeNode("query") << XATTR("request", "interactive"));
+ out.write(iq << XATTR("xmlns", "w:g2") << XATTR("id", id) << XATTR("type", "get") << XATTR("to", gjid));
}
void WAConnection::sendGetParticipants(const std::string &gjid) throw (WAException)
@@ -1039,9 +1043,8 @@ void WAConnection::sendGetParticipants(const std::string &gjid) throw (WAExcepti this->pending_server_requests[id] = new IqResultGetGroupParticipantsHandler(this);
m_pMutex->unlock();
- ProtocolTreeNode *listNode = new ProtocolTreeNode("list");
- out.write(ProtocolTreeNode("iq", listNode) << XATTR("xmlns", "w:g")
- << XATTR("id", id) << XATTR("type", "get") << XATTR("to", gjid));
+ ProtocolTreeNode iq("iq", new ProtocolTreeNode("list"));
+ out.write(iq << XATTR("xmlns", "w:g") << XATTR("id", id) << XATTR("type", "get") << XATTR("to", gjid));
}
void WAConnection::readAttributeList(ProtocolTreeNode *node, std::vector<std::string>& vector, const std::string &tag, const std::string &attribute) throw (WAException)
@@ -1062,10 +1065,8 @@ void WAConnection::sendCreateGroupChat(const std::string &subject) throw (WAExce this->pending_server_requests[id] = new IqResultCreateGroupChatHandler(this, subject);
m_pMutex->unlock();
- ProtocolTreeNode *groupNode = new ProtocolTreeNode("group") << XATTR("action", "create") << XATTR("subject", subject);
-
- out.write(ProtocolTreeNode("iq", groupNode) << XATTR("xmlns", "w:g")
- << XATTR("id", id) << XATTR("type", "set") << XATTR("to", "g.us"));
+ ProtocolTreeNode iq("iq", new ProtocolTreeNode("group") << XATTR("action", "create") << XATTR("subject", subject));
+ out.write(iq << XATTR("xmlns", "w:g") << XATTR("id", id) << XATTR("type", "set") << XATTR("to", "g.us"));
}
void WAConnection::sendClearDirty(const std::string &category) throw (WAException)
@@ -1077,8 +1078,8 @@ void WAConnection::sendClearDirty(const std::string &category) throw (WAExceptio ProtocolTreeNode *categoryNode = new ProtocolTreeNode("category") << XATTR("name", category);
ProtocolTreeNode *cleanNode = new ProtocolTreeNode("clean", categoryNode) << XATTR("xmlns", "urn:xmpp:whatsapp:dirty");
- out.write(ProtocolTreeNode("iq", cleanNode)
- << XATTR("id", id) << XATTR("type", "set") << XATTR("to", "s.whatsapp.net"));
+ ProtocolTreeNode iq("iq", cleanNode);
+ out.write(iq << XATTR("id", id) << XATTR("type", "set") << XATTR("to", "s.whatsapp.net"));
}
void WAConnection::sendJoinLeaveGroup(const char *gjid, bool bJoin) throw (WAException)
@@ -1087,8 +1088,8 @@ void WAConnection::sendJoinLeaveGroup(const char *gjid, bool bJoin) throw (WAExc ProtocolTreeNode *groupNode = new ProtocolTreeNode("group") << XATTR("id", gjid);
ProtocolTreeNode *leaveNode = new ProtocolTreeNode((bJoin) ? "join" : "leave", groupNode);
- out.write(ProtocolTreeNode("iq", leaveNode) << XATTR("xmlns", "w:g2")
- << XATTR("id", id) << XATTR("type", "set") << XATTR("to", "g.us"));
+ ProtocolTreeNode iq("iq", leaveNode);
+ out.write(iq << XATTR("xmlns", "w:g2") << XATTR("id", id) << XATTR("type", "set") << XATTR("to", "g.us"));
}
void WAConnection::sendAddParticipants(const std::string &gjid, const std::vector<std::string> &participants) throw (WAException)
@@ -1110,10 +1111,8 @@ void WAConnection::sendVerbParticipants(const std::string &gjid, const std::vect for (size_t i = 0; i < size; i++)
(*children)[i] = new ProtocolTreeNode("participant") << XATTR("jid", participants[i]);
- ProtocolTreeNode *innerNode = new ProtocolTreeNode(inner_tag, NULL, children);
-
- out.write(ProtocolTreeNode("iq", innerNode) << XATTR("xmlns", "w:g")
- << XATTR("id", id) << XATTR("type", "set") << XATTR("to", gjid));
+ ProtocolTreeNode iq("iq", new ProtocolTreeNode(inner_tag, NULL, children));
+ out.write(iq << XATTR("xmlns", "w:g") << XATTR("id", id) << XATTR("type", "set") << XATTR("to", gjid));
}
void WAConnection::sendSetNewSubject(const std::string &gjid, const std::string &subject) throw (WAException)
@@ -1121,8 +1120,6 @@ void WAConnection::sendSetNewSubject(const std::string &gjid, const std::string std::string id = this->makeId("iq_");
std::vector<unsigned char> *data = new std::vector<unsigned char>(subject.begin(), subject.end());
- ProtocolTreeNode *subjectNode = new ProtocolTreeNode("subject", data);
-
- out.write(ProtocolTreeNode("iq", subjectNode) << XATTR("xmlns", "w:g2")
- << XATTR("id", id) << XATTR("type", "set") << XATTR("to", gjid));
+ ProtocolTreeNode iq("iq", new ProtocolTreeNode("subject", data));
+ out.write(iq << XATTR("xmlns", "w:g2") << XATTR("id", id) << XATTR("type", "set") << XATTR("to", gjid));
}
diff --git a/protocols/WhatsApp/src/WhatsAPI++/WAConnection.h b/protocols/WhatsApp/src/WhatsAPI++/WAConnection.h index e85ebbe5db..0756a77abe 100644 --- a/protocols/WhatsApp/src/WhatsAPI++/WAConnection.h +++ b/protocols/WhatsApp/src/WhatsAPI++/WAConnection.h @@ -111,12 +111,12 @@ class WAConnection class IqResultPingHandler: public IqResultHandler {
public:
IqResultPingHandler(WAConnection* con):IqResultHandler(con) {}
- virtual void parse(ProtocolTreeNode* node, const std::string &from) throw (WAException) {
+ virtual void parse(ProtocolTreeNode*, const std::string&) throw (WAException) {
if (this->con->m_pEventHandler != NULL)
this->con->m_pEventHandler->onPingResponseReceived();
}
- void error(ProtocolTreeNode* node) throw (WAException) {
+ void error(ProtocolTreeNode*) throw (WAException) {
if (this->con->m_pEventHandler != NULL)
this->con->m_pEventHandler->onPingResponseReceived();
}
@@ -127,7 +127,7 @@ class WAConnection std::string type;
public:
IqResultGetGroupsHandler(WAConnection* con, const std::string &type ):IqResultHandler(con) {this->type = type;}
- virtual void parse(ProtocolTreeNode* node, const std::string &from) throw (WAException) {
+ virtual void parse(ProtocolTreeNode* node, const std::string&) throw (WAException) {
std::vector<std::string> groups;
this->con->readGroupList(node, groups);
}
@@ -136,7 +136,7 @@ class WAConnection class IqResultServerPropertiesHandler: public IqResultHandler {
public:
IqResultServerPropertiesHandler(WAConnection* con):IqResultHandler(con) {}
- virtual void parse(ProtocolTreeNode* node, const std::string &from) throw (WAException) {
+ virtual void parse(ProtocolTreeNode* node, const std::string&) throw (WAException) {
std::vector<ProtocolTreeNode*> nodes(node->getAllChildren("prop"));
std::map<std::string,std::string> nameValueMap;
for (size_t i = 0; i < nodes.size();i++) {
@@ -154,7 +154,7 @@ class WAConnection class IqResultPrivayListHandler: public IqResultHandler {
public:
IqResultPrivayListHandler(WAConnection* con):IqResultHandler(con) {}
- virtual void parse(ProtocolTreeNode* node, const std::string &from) throw (WAException) {
+ virtual void parse(ProtocolTreeNode* node, const std::string&) throw (WAException) {
ProtocolTreeNode* queryNode = node->getChild(0);
ProtocolTreeNode::require(queryNode, "query");
ProtocolTreeNode* listNode = queryNode->getChild(0);
@@ -227,7 +227,7 @@ class WAConnection IqResultGetPhotoHandler(WAConnection* con, const std::string &jid):IqResultHandler(con) {
this->jid = jid;
}
- virtual void parse(ProtocolTreeNode* node, const std::string &from) throw (WAException) {
+ virtual void parse(ProtocolTreeNode* node, const std::string&) throw (WAException) {
const string &attributeValue = node->getAttributeValue("type");
if (!attributeValue.empty() && attributeValue == "result" && this->con->m_pEventHandler != NULL) {
@@ -243,7 +243,7 @@ class WAConnection }
}
}
- void error(ProtocolTreeNode* node) throw (WAException) {
+ void error(ProtocolTreeNode*) throw (WAException) {
if (this->con->m_pEventHandler != NULL) {
std::vector<unsigned char> v;
this->con->m_pEventHandler->onSendGetPicture("error", v, "");
@@ -256,7 +256,7 @@ class WAConnection std::string jid;
public:
IqResultSetPhotoHandler(WAConnection* con, const std::string &jid):IqResultHandler(con) {this->jid = jid;}
- virtual void parse(ProtocolTreeNode* node, const std::string &from) throw (WAException) {
+ virtual void parse(ProtocolTreeNode* node, const std::string&) throw (WAException) {
if (this->con->m_pEventHandler != NULL) {
ProtocolTreeNode* child = node->getChild("picture");
if (child != NULL)
@@ -270,12 +270,12 @@ class WAConnection class IqResultSendDeleteAccount: public IqResultHandler {
public:
IqResultSendDeleteAccount(WAConnection* con):IqResultHandler(con) {}
- virtual void parse(ProtocolTreeNode* node, const std::string &from) throw (WAException) {
+ virtual void parse(ProtocolTreeNode*, const std::string&) throw (WAException) {
if (this->con->m_pEventHandler != NULL)
this->con->m_pEventHandler->onDeleteAccount(true);
}
- void error(ProtocolTreeNode* node) throw (WAException) {
+ void error(ProtocolTreeNode*) throw (WAException) {
if (this->con->m_pEventHandler != NULL)
this->con->m_pEventHandler->onDeleteAccount(false);
}
@@ -284,14 +284,14 @@ class WAConnection class IqResultClearDirtyHandler: public IqResultHandler {
public:
IqResultClearDirtyHandler(WAConnection* con):IqResultHandler(con) {}
- virtual void parse(ProtocolTreeNode* node, const std::string &from) throw (WAException) {
+ virtual void parse(ProtocolTreeNode*, const std::string&) throw (WAException) {
}
};
class IqSendClientConfigHandler: public IqResultHandler {
public:
IqSendClientConfigHandler(WAConnection* con):IqResultHandler(con) {}
- virtual void parse(ProtocolTreeNode* node, const std::string &from) throw (WAException) {
+ virtual void parse(ProtocolTreeNode* node, const std::string&) throw (WAException) {
con->logData("Clientconfig response %s", node->toString().c_str());
}
@@ -305,7 +305,7 @@ class WAConnection FMessage message;
public:
MediaUploadResponseHandler(WAConnection* con, const FMessage &message) :IqResultHandler(con) { this->message = message; }
- virtual void parse(ProtocolTreeNode* node, const std::string &from) throw (WAException) {
+ virtual void parse(ProtocolTreeNode* node, const std::string&) throw (WAException) {
this->con->processUploadResponse(node, &message);
}
void error(ProtocolTreeNode* node) throw (WAException) {
diff --git a/protocols/WhatsApp/src/WhatsAPI++/WALogin.cpp b/protocols/WhatsApp/src/WhatsAPI++/WALogin.cpp index 957716e2b0..12f7c7a863 100644 --- a/protocols/WhatsApp/src/WhatsAPI++/WALogin.cpp +++ b/protocols/WhatsApp/src/WhatsAPI++/WALogin.cpp @@ -76,8 +76,8 @@ void WALogin::sendAuth(const std::vector<unsigned char>& existingChallenge) if (!existingChallenge.empty())
data = getAuthBlob(existingChallenge);
- m_pConnection->out.write(ProtocolTreeNode("auth", data) <<
- XATTR("mechanism", "WAUTH-2") << XATTR("user", m_pConnection->user));
+ ProtocolTreeNode n("auth", data);
+ m_pConnection->out.write(n << XATTR("mechanism", "WAUTH-2") << XATTR("user", m_pConnection->user));
}
std::vector<unsigned char>* WALogin::getAuthBlob(const std::vector<unsigned char>& nonce)
diff --git a/protocols/WhatsApp/src/avatars.cpp b/protocols/WhatsApp/src/avatars.cpp index 9e6c24a6ac..36d14bce77 100644 --- a/protocols/WhatsApp/src/avatars.cpp +++ b/protocols/WhatsApp/src/avatars.cpp @@ -128,7 +128,7 @@ int WhatsAppProto::InternalSetAvatar(MCONTACT hContact, const char *szJid, const return 0;
}
-INT_PTR WhatsAppProto::SetMyAvatar(WPARAM wParam, LPARAM lParam)
+INT_PTR WhatsAppProto::SetMyAvatar(WPARAM, LPARAM lParam)
{
return InternalSetAvatar(NULL, m_szJid.c_str(), (const TCHAR*)lParam);
}
diff --git a/protocols/WhatsApp/src/chat.cpp b/protocols/WhatsApp/src/chat.cpp index f816e40f1d..ab84dfb4be 100644 --- a/protocols/WhatsApp/src/chat.cpp +++ b/protocols/WhatsApp/src/chat.cpp @@ -16,7 +16,7 @@ enum /////////////////////////////////////////////////////////////////////////////////////////
// protocol menu handler - create a new group
-INT_PTR __cdecl WhatsAppProto::OnCreateGroup(WPARAM wParam, LPARAM lParam)
+INT_PTR __cdecl WhatsAppProto::OnCreateGroup(WPARAM, LPARAM)
{
ENTER_STRING es = { 0 };
es.cbSize = sizeof(es);
@@ -37,7 +37,7 @@ INT_PTR __cdecl WhatsAppProto::OnCreateGroup(WPARAM wParam, LPARAM lParam) /////////////////////////////////////////////////////////////////////////////////////////
// handler to pass events from SRMM to WAConnection
-int WhatsAppProto::onGroupChatEvent(WPARAM wParam, LPARAM lParam)
+int WhatsAppProto::onGroupChatEvent(WPARAM, LPARAM lParam)
{
GCHOOK *gch = (GCHOOK*)lParam;
if (mir_strcmp(gch->pDest->pszModule, m_szModuleName))
@@ -216,7 +216,7 @@ void WhatsAppProto::NickListMenuHook(WAChatInfo *pInfo, struct GCHOOK *gch) }
}
-void WhatsAppProto::AddChatUser(WAChatInfo *pInfo, const TCHAR *ptszJid)
+void WhatsAppProto::AddChatUser(WAChatInfo*, const TCHAR *ptszJid)
{
std::string jid((char*)_T2A(ptszJid));
MCONTACT hContact = ContactIDToHContact(jid);
@@ -250,7 +250,7 @@ void WhatsAppProto::KickChatUser(WAChatInfo *pInfo, const TCHAR *ptszJid) /////////////////////////////////////////////////////////////////////////////////////////
// Leave groupchat emulator for contact's deletion
-int WhatsAppProto::OnDeleteChat(WPARAM hContact, LPARAM lParam)
+int WhatsAppProto::OnDeleteChat(WPARAM hContact, LPARAM)
{
if (isChatRoom(hContact) && isOnline()) {
ptrT tszID(getTStringA(hContact, WHATSAPP_KEY_ID));
@@ -264,7 +264,7 @@ int WhatsAppProto::OnDeleteChat(WPARAM hContact, LPARAM lParam) /////////////////////////////////////////////////////////////////////////////////////////
// handler to customize chat menus
-int WhatsAppProto::OnChatMenu(WPARAM wParam, LPARAM lParam)
+int WhatsAppProto::OnChatMenu(WPARAM, LPARAM lParam)
{
GCMENUITEMS *gcmi = (GCMENUITEMS*)lParam;
if (gcmi == NULL)
@@ -351,7 +351,7 @@ WAChatInfo* WhatsAppProto::SafeGetChat(const std::string &jid) ///////////////////////////////////////////////////////////////////////////////
// WAGroupListener members
-void WhatsAppProto::onGroupInfo(const std::string &jid, const std::string &owner, const std::string &subject, const std::string &subject_owner, int time_subject, int time_created)
+void WhatsAppProto::onGroupInfo(const std::string &jid, const std::string &owner, const std::string &subject, const std::string &subject_owner, int time_subject, int)
{
WAChatInfo *pInfo = SafeGetChat(jid);
if (pInfo == NULL) {
diff --git a/protocols/WhatsApp/src/contacts.cpp b/protocols/WhatsApp/src/contacts.cpp index baea533421..413d3b80f1 100644 --- a/protocols/WhatsApp/src/contacts.cpp +++ b/protocols/WhatsApp/src/contacts.cpp @@ -145,11 +145,11 @@ void WhatsAppProto::UpdateStatusMsg(MCONTACT hContact) db_set_ws(hContact, "CList", "StatusMsg", ss.str().c_str());
}
-void WhatsAppProto::onContactChanged(const std::string &jid, bool added)
+void WhatsAppProto::onContactChanged(const std::string&, bool)
{
}
-void WhatsAppProto::onPictureChanged(const std::string &jid, const std::string &id, bool set)
+void WhatsAppProto::onPictureChanged(const std::string &jid, const std::string&, bool)
{
if (isOnline())
m_pConnection->sendGetPicture(jid.c_str(), "image");
diff --git a/protocols/WhatsApp/src/dialogs.cpp b/protocols/WhatsApp/src/dialogs.cpp index 9d95acc5da..069603bb2b 100644 --- a/protocols/WhatsApp/src/dialogs.cpp +++ b/protocols/WhatsApp/src/dialogs.cpp @@ -122,7 +122,7 @@ public: }
};
-INT_PTR WhatsAppProto::SvcCreateAccMgrUI(WPARAM wParam, LPARAM lParam)
+INT_PTR WhatsAppProto::SvcCreateAccMgrUI(WPARAM, LPARAM lParam)
{
COptionsDlg *pDlg = new COptionsDlg(this, IDD_ACCMGRUI);
pDlg->SetParent((HWND)lParam);
diff --git a/protocols/WhatsApp/src/entities.h b/protocols/WhatsApp/src/entities.h index c55e3dfd8a..657cc82f90 100644 --- a/protocols/WhatsApp/src/entities.h +++ b/protocols/WhatsApp/src/entities.h @@ -3,7 +3,7 @@ struct send_direct
{
- send_direct(MCONTACT hContact, const std::string &msg, HANDLE msgid, bool isChat = false) :
+ send_direct(MCONTACT hContact, const std::string &msg, HANDLE msgid) :
hContact(hContact), msg(msg), msgid(msgid)
{}
diff --git a/protocols/WhatsApp/src/main.cpp b/protocols/WhatsApp/src/main.cpp index 20480c0332..26eea6b01e 100644 --- a/protocols/WhatsApp/src/main.cpp +++ b/protocols/WhatsApp/src/main.cpp @@ -37,7 +37,7 @@ DWORD WINAPI DllMain(HINSTANCE hInstance, DWORD, LPVOID) return TRUE;
}
-extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
+extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfo;
}
diff --git a/protocols/WhatsApp/src/proto.cpp b/protocols/WhatsApp/src/proto.cpp index 9cfa22ac8e..3d63355f19 100644 --- a/protocols/WhatsApp/src/proto.cpp +++ b/protocols/WhatsApp/src/proto.cpp @@ -65,7 +65,7 @@ WhatsAppProto::~WhatsAppProto() CloseHandle(update_loop_lock_);
}
-int WhatsAppProto::OnEvent(PROTOEVENTTYPE evType, WPARAM wParam, LPARAM lParam)
+int WhatsAppProto::OnEvent(PROTOEVENTTYPE evType, WPARAM, LPARAM)
{
switch (evType) {
case EV_PROTO_ONMENU:
@@ -88,7 +88,7 @@ int WhatsAppProto::OnEvent(PROTOEVENTTYPE evType, WPARAM wParam, LPARAM lParam) return TRUE;
}
-DWORD_PTR WhatsAppProto::GetCaps(int type, MCONTACT hContact)
+DWORD_PTR WhatsAppProto::GetCaps(int type, MCONTACT)
{
switch (type) {
case PFLAGNUM_1:
@@ -377,7 +377,8 @@ void WhatsAppProto::NotifyEvent(const string& title, const string& info, MCONTAC void WhatsAppProto::NotifyEvent(const TCHAR *title, const TCHAR *info, MCONTACT contact, DWORD flags, TCHAR* szUrl)
{
- int ret; int timeout; COLORREF colorBack = 0; COLORREF colorText = 0;
+ int ret, timeout = 0;
+ COLORREF colorBack = 0, colorText = 0;
switch (flags) {
case WHATSAPP_EVENT_CLIENT:
diff --git a/protocols/WhatsApp/src/proto.h b/protocols/WhatsApp/src/proto.h index 8abf895347..2822dd85d0 100644 --- a/protocols/WhatsApp/src/proto.h +++ b/protocols/WhatsApp/src/proto.h @@ -163,34 +163,34 @@ protected: // WAListener methods ////////////////////////////////////////////////////////////////
virtual void onMessageForMe(const FMessage ¶mFMessage);
virtual void onMessageStatusUpdate(const FMessage ¶mFMessage);
- virtual void onMessageError(const FMessage &message, int paramInt) { ; }
+ virtual void onMessageError(const FMessage&, int) { }
virtual void onPing(const std::string &id) throw (WAException);
- virtual void onPingResponseReceived() { }
+ virtual void onPingResponseReceived() { }
virtual void onAvailable(const std::string ¶mString, bool paramBoolean, DWORD lastSeenTime);
- virtual void onClientConfigReceived(const std::string ¶mString) { }
+ virtual void onClientConfigReceived(const std::string&) { }
virtual void onIsTyping(const std::string ¶mString, bool paramBoolean);
- virtual void onAccountChange(int paramInt, time_t expire_date) { }
- virtual void onPrivacyBlockListAdd(const std::string ¶mString) { }
- virtual void onPrivacyBlockListClear() { }
- virtual void onDirty(const std::map<string, string>& paramHashtable) { }
- virtual void onDirtyResponse(int paramHashtable) { }
- virtual void onRelayRequest(const std::string ¶mString1, int paramInt, const std::string ¶mString2) { }
+ virtual void onAccountChange(int, time_t) { }
+ virtual void onPrivacyBlockListAdd(const std::string&) { }
+ virtual void onPrivacyBlockListClear() { }
+ virtual void onDirty(const std::map<string, string>&) { }
+ virtual void onDirtyResponse(int) { }
+ virtual void onRelayRequest(const std::string&, int, const std::string&) { }
virtual void onSendGetPicture(const std::string &jid, const std::vector<unsigned char>& data, const std::string &id);
virtual void onPictureChanged(const std::string &jid, const std::string &id, bool set);
virtual void onContactChanged(const std::string &jid, bool added);
- virtual void onDeleteAccount(bool result) {}
+ virtual void onDeleteAccount(bool) {}
// WAGroupListener methods ///////////////////////////////////////////////////////////
virtual void onGroupAddUser(const std::string &gjid, const std::string &ujid, int ts);
virtual void onGroupRemoveUser(const std::string &gjid, const std::string &ujid, int ts);
virtual void onGroupNewSubject(const std::string &from, const std::string &author, const std::string &newSubject, int ts);
virtual void onGroupMessage(const FMessage ¶mFMessage);
- virtual void onServerProperties(std::map<std::string, std::string>* nameValueMap) {}
+ virtual void onServerProperties(std::map<std::string, std::string>*) { }
virtual void onGroupCreated(const std::string &gjid, const std::string &nick);
virtual void onGroupInfo(const std::string &jid, const std::string &owner, const std::string &subject, const std::string &subject_owner, int time_subject, int time_created);
- virtual void onSetSubject(const std::string ¶mString) { }
- virtual void onAddGroupParticipants(const std::string ¶mString, const std::vector<string> ¶mVector, int paramHashtable) { }
- virtual void onRemoveGroupParticipants(const std::string ¶mString, const std::vector<string> ¶mVector, int paramHashtable) { }
+ virtual void onSetSubject(const std::string&) { }
+ virtual void onAddGroupParticipants(const std::string&, const std::vector<string>&, int) { }
+ virtual void onRemoveGroupParticipants(const std::string&, const std::vector<string>&, int) { }
virtual void onGetParticipants(const std::string &gjid, const std::vector<string> &participants);
virtual void onLeaveGroup(const std::string ¶mString);
diff --git a/protocols/WhatsApp/src/theme.cpp b/protocols/WhatsApp/src/theme.cpp index 939def3d81..70ba827608 100644 --- a/protocols/WhatsApp/src/theme.cpp +++ b/protocols/WhatsApp/src/theme.cpp @@ -59,7 +59,7 @@ void WhatsAppProto::InitMenu() m_hMenuCreateGroup = Menu_AddProtoMenuItem(&mi, m_szModuleName);
}
-int WhatsAppProto::OnBuildStatusMenu(WPARAM wParam, LPARAM lParam)
+int WhatsAppProto::OnBuildStatusMenu(WPARAM, LPARAM)
{
ToggleStatusMenuItems(isOnline());
return 0;
|