diff options
author | George Hazan <george.hazan@gmail.com> | 2015-02-10 21:31:29 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-02-10 21:31:29 +0000 |
commit | 85f31b137eb97138e81a185185882d445903f84d (patch) | |
tree | 695227cb1b51abef21ba41304193bd3dbf1af0e1 /protocols/WhatsApp | |
parent | e3506fe66886912cee16a91793d17010a87eecef (diff) |
sender's time ignored to prevent message reordering
git-svn-id: http://svn.miranda-ng.org/main/trunk@12086 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/WhatsApp')
-rw-r--r-- | protocols/WhatsApp/src/chat.cpp | 4 | ||||
-rw-r--r-- | protocols/WhatsApp/src/contacts.cpp | 4 | ||||
-rw-r--r-- | protocols/WhatsApp/src/messages.cpp | 6 |
3 files changed, 7 insertions, 7 deletions
diff --git a/protocols/WhatsApp/src/chat.cpp b/protocols/WhatsApp/src/chat.cpp index 020773f37a..c3c4fbb0f4 100644 --- a/protocols/WhatsApp/src/chat.cpp +++ b/protocols/WhatsApp/src/chat.cpp @@ -389,7 +389,7 @@ void WhatsAppProto::onGroupMessage(const FMessage &pMsg) gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszUID = tszUID;
gce.ptszNick = tszNick;
- gce.time = pMsg.timestamp;
+ gce.time = time(NULL);
gce.ptszText = tszText;
gce.bIsMe = m_szJid == pMsg.remote_resource;
CallServiceSync(MS_GC_EVENT, NULL, (LPARAM)&gce);
@@ -532,7 +532,7 @@ void WhatsAppProto::onGroupMessageReceived(const FMessage &msg) gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszUID = tszUID;
gce.ptszNick = tszNick;
- gce.time = msg.timestamp;
+ gce.time = time(NULL);
gce.ptszText = p->second.c_str();
gce.bIsMe = m_szJid == msg.remote_resource;
CallServiceSync(MS_GC_EVENT, NULL, (LPARAM)&gce);
diff --git a/protocols/WhatsApp/src/contacts.cpp b/protocols/WhatsApp/src/contacts.cpp index c6153e09e7..d68e3b42b5 100644 --- a/protocols/WhatsApp/src/contacts.cpp +++ b/protocols/WhatsApp/src/contacts.cpp @@ -134,9 +134,9 @@ void WhatsAppProto::UpdateStatusMsg(MCONTACT hContact) int lastSeen = getDword(hContact, WHATSAPP_KEY_LAST_SEEN, -1);
if (lastSeen != -1) {
- time_t timestamp = time(NULL) - lastSeen;
+ time_t ts = time(NULL) - lastSeen;
TCHAR stzLastSeen[MAX_PATH];
- _tcsftime(stzLastSeen, SIZEOF(stzLastSeen), TranslateT("Last seen on %x at %X"), localtime(×tamp));
+ _tcsftime(stzLastSeen, SIZEOF(stzLastSeen), TranslateT("Last seen on %x at %X"), localtime(&ts));
ss << stzLastSeen;
}
diff --git a/protocols/WhatsApp/src/messages.cpp b/protocols/WhatsApp/src/messages.cpp index 390ad9a5dc..4525e09b96 100644 --- a/protocols/WhatsApp/src/messages.cpp +++ b/protocols/WhatsApp/src/messages.cpp @@ -32,7 +32,7 @@ void WhatsAppProto::onMessageForMe(const FMessage &pMsg) PROTORECVEVENT recv = { 0 };
recv.flags = PREF_UTF;
recv.szMessage = const_cast<char*>(msg.c_str());
- recv.timestamp = pMsg.timestamp;
+ recv.timestamp = time(NULL);
ProtoChainRecvMsg(hContact, &recv);
}
@@ -124,9 +124,9 @@ void WhatsAppProto::onMessageStatusUpdate(const FMessage &fmsg) 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());
+ time_t ts = atol(fmsg.key.id.substr(0, delim).c_str());
TCHAR ttime[64];
- _tcsftime(ttime, SIZEOF(ttime), _T("%X"), localtime(×tamp));
+ _tcsftime(ttime, SIZEOF(ttime), _T("%X"), localtime(&ts));
utils::setStatusMessage(hContact, CMString(FORMAT, TranslateT("Message received: %s by %s"), ttime, ptszBy));
}
|