summaryrefslogtreecommitdiff
path: root/protocols/WhatsApp/src/WhatsAPI++
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-01-30 22:02:53 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-01-30 22:02:53 +0000
commit347246b38a50d6570f3c15c09fc3c78ce4ad2d9c (patch)
tree378534277afdeaa9e52f99677cdbd8a4565c3c8a /protocols/WhatsApp/src/WhatsAPI++
parent96808cb66bd6e006e25367bc69815b6fe6d3cb28 (diff)
more fixes for parsing messages
git-svn-id: http://svn.miranda-ng.org/main/trunk@11961 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/WhatsApp/src/WhatsAPI++')
-rw-r--r--protocols/WhatsApp/src/WhatsAPI++/WAConnection.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/protocols/WhatsApp/src/WhatsAPI++/WAConnection.cpp b/protocols/WhatsApp/src/WhatsAPI++/WAConnection.cpp
index c5ae37bb6b..34b0f2a899 100644
--- a/protocols/WhatsApp/src/WhatsAPI++/WAConnection.cpp
+++ b/protocols/WhatsApp/src/WhatsAPI++/WAConnection.cpp
@@ -368,7 +368,7 @@ void WAConnection::parseMessage(ProtocolTreeNode *messageNode) throw (WAExceptio
FMessage fmessage(from, false, id);
fmessage.wants_receipt = false;
fmessage.timestamp = atoi(attribute_t.c_str());
- fmessage.data = messageNode->getAttributeValue("caption");
+ fmessage.notifyname = messageNode->getAttributeValue("notify");
fmessage.remote_resource = author;
fmessage.media_wa_type = FMessage::getMessage_WA_Type(media->getAttributeValue("type"));
fmessage.media_url = media->getAttributeValue("url");
@@ -377,6 +377,7 @@ void WAConnection::parseMessage(ProtocolTreeNode *messageNode) throw (WAExceptio
fmessage.media_duration_seconds = atoi(media->getAttributeValue("seconds").c_str());
if (fmessage.media_wa_type == FMessage::WA_TYPE_LOCATION) {
+ const string &name = media->getAttributeValue("name");
const string &latitudeString = media->getAttributeValue("latitude");
const string &longitudeString = media->getAttributeValue("longitude");
if (latitudeString.empty() || longitudeString.empty())
@@ -384,6 +385,8 @@ void WAConnection::parseMessage(ProtocolTreeNode *messageNode) throw (WAExceptio
fmessage.latitude = atof(latitudeString.c_str());
fmessage.longitude = atof(longitudeString.c_str());
+ if (!name.empty())
+ fmessage.data = name;
}
else if (fmessage.media_wa_type == FMessage::WA_TYPE_CONTACT) {
ProtocolTreeNode *contactChildNode = media->getChild(0);
@@ -416,9 +419,12 @@ void WAConnection::parseMessage(ProtocolTreeNode *messageNode) throw (WAExceptio
const string &encoding = media->getAttributeValue("encoding");
if (encoding.empty() || encoding == "text")
fmessage.data = media->getDataAsString();
- else if (media->data->size() > 0) {
- fmessage.bindata = (unsigned char*)malloc(fmessage.bindata_len = media->data->size());
- memcpy(fmessage.bindata, media->data->data(), fmessage.bindata_len);
+ else {
+ fmessage.data = media->getAttributeValue("caption");
+ if (media->data->size() > 0) {
+ fmessage.bindata = (unsigned char*)malloc(fmessage.bindata_len = media->data->size());
+ memcpy(fmessage.bindata, media->data->data(), fmessage.bindata_len);
+ }
}
}