diff options
author | ElzorFox <elzorfox@ya.ru> | 2019-06-10 19:02:55 +0500 |
---|---|---|
committer | ElzorFox <elzorfox@ya.ru> | 2019-06-10 19:03:26 +0500 |
commit | 8e2515105956ffde5915379348d7df94d4e3f06b (patch) | |
tree | ae1846fc48469f4511728116ccca6528bc6a8dfe /protocols/VKontakte | |
parent | a4cc4fb8da7396eaae8252cd42564b34fae2c774 (diff) |
VKontakte: more logical order of processing parts of messages
Diffstat (limited to 'protocols/VKontakte')
-rw-r--r-- | protocols/VKontakte/src/vk_messages.cpp | 58 |
1 files changed, 31 insertions, 27 deletions
diff --git a/protocols/VKontakte/src/vk_messages.cpp b/protocols/VKontakte/src/vk_messages.cpp index a83c5661c7..dbf4104d81 100644 --- a/protocols/VKontakte/src/vk_messages.cpp +++ b/protocols/VKontakte/src/vk_messages.cpp @@ -244,33 +244,6 @@ void CVkProto::OnReceiveMessages(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe int isRead = jnMsg["read_state"].as_int();
int uid = jnMsg["user_id"].as_int();
- const JSONNode &jnFwdMessages = jnMsg["fwd_messages"];
- if (jnFwdMessages) {
- CMStringW wszFwdMessages = GetFwdMessages(jnFwdMessages, jnFUsers, m_vkOptions.BBCForAttachments());
- if (!wszBody.IsEmpty())
- wszFwdMessages = L"\n" + wszFwdMessages;
- wszBody += wszFwdMessages;
- }
-
- CMStringW wszBodyNoAttachments = wszBody;
-
- CMStringW wszAttachmentDescr;
- const JSONNode &jnAttachments = jnMsg["attachments"];
- if (jnAttachments) {
- wszAttachmentDescr = GetAttachmentDescr(jnAttachments, m_vkOptions.BBCForAttachments());
-
- if (wszAttachmentDescr == L"== FilterAudioMessages ==")
- continue;
-
- if (!wszBody.IsEmpty())
- wszBody += L"\n";
- wszBody += wszAttachmentDescr;
- }
-
- if (m_vkOptions.bAddMessageLinkToMesWAtt && (jnAttachments || jnFwdMessages))
- wszBody += SetBBCString(TranslateT("Message link"), m_vkOptions.BBCForAttachments(), vkbbcUrl,
- CMStringW(FORMAT, L"https://vk.com/im?sel=%d&msgid=%d", uid, mid));
-
MCONTACT hContact = 0;
int chat_id = jnMsg["chat_id"].as_int();
if (chat_id == 0)
@@ -301,6 +274,37 @@ void CVkProto::OnReceiveMessages(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe continue;
}
+ const JSONNode& jnFwdMessages = jnMsg["fwd_messages"];
+ if (jnFwdMessages) {
+ CMStringW wszFwdMessages = GetFwdMessages(jnFwdMessages, jnFUsers, m_vkOptions.BBCForAttachments());
+ if (!wszBody.IsEmpty())
+ wszFwdMessages = L"\n" + wszFwdMessages;
+ wszBody += wszFwdMessages;
+ }
+
+ CMStringW wszBodyNoAttachments = wszBody;
+
+
+ CMStringW wszAttachmentDescr;
+ const JSONNode &jnAttachments = jnMsg["attachments"];
+ if (jnAttachments) {
+ wszAttachmentDescr = GetAttachmentDescr(jnAttachments, m_vkOptions.BBCForAttachments());
+
+ if (wszAttachmentDescr == L"== FilterAudioMessages ==") {
+ if (hContact && (mid > getDword(hContact, "lastmsgid", -1)))
+ setDword(hContact, "lastmsgid", mid);
+ continue;
+ }
+
+ if (!wszBody.IsEmpty())
+ wszBody += L"\n";
+ wszBody += wszAttachmentDescr;
+ }
+
+ if (m_vkOptions.bAddMessageLinkToMesWAtt && (jnAttachments || jnFwdMessages))
+ wszBody += SetBBCString(TranslateT("Message link"), m_vkOptions.BBCForAttachments(), vkbbcUrl,
+ CMStringW(FORMAT, L"https://vk.com/im?sel=%d&msgid=%d", uid, mid));
+
time_t update_time = (time_t)jnMsg["update_time"].as_int();
bool bEdited = (update_time != 0);
|