diff options
author | ElzorFox <elzorfox@ya.ru> | 2017-12-18 15:35:14 +0500 |
---|---|---|
committer | ElzorFox <elzorfox@ya.ru> | 2017-12-18 15:35:29 +0500 |
commit | a1e85579f746d778c874cf083d154caa09965eea (patch) | |
tree | c5ac919e8f58b1255142a0788091cf191a97b82f /protocols/VKontakte/src/vk_messages.cpp | |
parent | e41d801d1c41d51c6f220ab457eaa78bbcbb51ac (diff) |
VKontakte:
add edited message support (only from vk to miranda)
update VK_API to 5.68
version bump
Diffstat (limited to 'protocols/VKontakte/src/vk_messages.cpp')
-rw-r--r-- | protocols/VKontakte/src/vk_messages.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/protocols/VKontakte/src/vk_messages.cpp b/protocols/VKontakte/src/vk_messages.cpp index 56d3b4edda..2c0bead07c 100644 --- a/protocols/VKontakte/src/vk_messages.cpp +++ b/protocols/VKontakte/src/vk_messages.cpp @@ -250,7 +250,7 @@ void CVkProto::OnReceiveMessages(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe UINT mid = jnMsg["id"].as_int();
CMStringW wszBody(jnMsg["body"].as_mstring());
- int datetime = jnMsg["date"].as_int();
+ UINT datetime = jnMsg["date"].as_int();
int isOut = jnMsg["out"].as_int();
int isRead = jnMsg["read_state"].as_int();
int uid = jnMsg["user_id"].as_int();
@@ -313,8 +313,21 @@ void CVkProto::OnReceiveMessages(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe else if (m_vkOptions.bUserForceInvisibleOnActivity && time(nullptr) - datetime < 60 * m_vkOptions.iInvisibleInterval)
SetInvisible(hContact);
+ bool bEdited = CheckMid(m_editedIds, mid);
+ if (bEdited) {
+ CMStringW wszOldMsg;
+ MEVENT hDbEvent = GetMessageFromDb(hContact, szMid, datetime, wszOldMsg);
+ if (hDbEvent) {
+ wszBody = SetBBCString(TranslateT("Edited message:\n"), m_vkOptions.BBCForAttachments(), vkbbcB) +
+ wszBody +
+ SetBBCString(TranslateT("\nOriginal message:\n"), m_vkOptions.BBCForAttachments(), vkbbcB) +
+ wszOldMsg;
+ db_event_delete(hContact, hDbEvent);
+ }
+ }
+
T2Utf pszBody(wszBody);
- recv.timestamp = m_vkOptions.bUseLocalTime ? time(nullptr) : datetime;
+ recv.timestamp = bEdited ? datetime : (m_vkOptions.bUseLocalTime ? time(nullptr) : datetime);
recv.szMessage = pszBody;
recv.lParam = isOut;
recv.pCustomData = szMid;
|