summaryrefslogtreecommitdiff
path: root/protocols/WhatsApp/src/messages.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-01-29 16:24:44 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-01-29 16:24:44 +0000
commit518e9a70f554179f344510f594d7d759b56cea58 (patch)
treec1e952b455e38e5ab2ee92a8868afc34f51364ed /protocols/WhatsApp/src/messages.cpp
parent25a7a059a20f51e6df201ba606e38c4aef45e8f0 (diff)
fix for the automatic nick name extraction
git-svn-id: http://svn.miranda-ng.org/main/trunk@11951 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/WhatsApp/src/messages.cpp')
-rw-r--r--protocols/WhatsApp/src/messages.cpp32
1 files changed, 19 insertions, 13 deletions
diff --git a/protocols/WhatsApp/src/messages.cpp b/protocols/WhatsApp/src/messages.cpp
index d2f170a020..37b2ebad65 100644
--- a/protocols/WhatsApp/src/messages.cpp
+++ b/protocols/WhatsApp/src/messages.cpp
@@ -121,18 +121,24 @@ void WhatsAppProto::onMessageStatusUpdate(FMessage* fmsg)
if (hContact == 0)
return;
- if (fmsg->status == FMessage::STATUS_RECEIVED_BY_SERVER) {
- size_t delim = fmsg->key.id.find('-');
- if (delim == string::npos)
- return;
-
- int msgId = atoi(fmsg->key.id.substr(delim+1).c_str());
- ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE)msgId, 0);
-
- time_t timestamp = atol(fmsg->key.id.substr(0, delim).c_str());
-
- TCHAR ttime[64];
- _tcsftime(ttime, SIZEOF(ttime), _T("%X"), localtime(&timestamp));
- utils::setStatusMessage(hContact, CMString(FORMAT, TranslateT("Message received: %s by %s"), ttime, pcli->pfnGetContactDisplayName(hContact, 0)));
+ const TCHAR *ptszBy;
+ switch (fmsg->status) {
+ case FMessage::STATUS_RECEIVED_BY_SERVER: ptszBy = TranslateT("server"); break;
+ case FMessage::STATUS_RECEIVED_BY_TARGET: ptszBy = pcli->pfnGetContactDisplayName(hContact, 0); break;
+ default:
+ return;
}
+
+ size_t delim = fmsg->key.id.find('-');
+ if (delim == string::npos)
+ return;
+
+ int msgId = atoi(fmsg->key.id.substr(delim+1).c_str());
+ ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE)msgId, 0);
+
+ time_t timestamp = atol(fmsg->key.id.substr(0, delim).c_str());
+
+ TCHAR ttime[64];
+ _tcsftime(ttime, SIZEOF(ttime), _T("%X"), localtime(&timestamp));
+ utils::setStatusMessage(hContact, CMString(FORMAT, TranslateT("Message received: %s by %s"), ttime, ptszBy));
}