summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
Diffstat (limited to 'protocols')
-rw-r--r--protocols/VKontakte/src/vk_history.cpp20
-rw-r--r--protocols/VKontakte/src/vk_messages.cpp23
-rw-r--r--protocols/VKontakte/src/vk_struct.cpp1
-rw-r--r--protocols/VKontakte/src/vk_struct.h1
4 files changed, 30 insertions, 15 deletions
diff --git a/protocols/VKontakte/src/vk_history.cpp b/protocols/VKontakte/src/vk_history.cpp
index 25275f915d..4604a99231 100644
--- a/protocols/VKontakte/src/vk_history.cpp
+++ b/protocols/VKontakte/src/vk_history.cpp
@@ -225,7 +225,7 @@ void CVkProto::OnReceiveHistoryMessages(NETLIBHTTPREQUEST *reply, AsyncHttpReque
if (iLastMsgId < iMessageId)
iLastMsgId = iMessageId;
- char szMid[40];
+ char szMid[40], szReplyId[40] = "";;
_ltoa(iMessageId, szMid, 10);
CMStringW wszBody(jnMsg["text"].as_mstring());
@@ -245,12 +245,14 @@ void CVkProto::OnReceiveHistoryMessages(NETLIBHTTPREQUEST *reply, AsyncHttpReque
}
const JSONNode& jnReplyMessages = jnMsg["reply_message"];
- if (jnReplyMessages && !jnReplyMessages.empty()) {
- CMStringW wszReplyMessages = GetFwdMessages(jnReplyMessages, jnFUsers, m_vkOptions.BBCForAttachments());
- if (!wszBody.IsEmpty())
- wszReplyMessages = L"\n" + wszReplyMessages;
- wszBody += wszReplyMessages;
- }
+ if (jnReplyMessages && !jnReplyMessages.empty())
+ if (m_vkOptions.bShowReplyInMessage) {
+ CMStringW wszReplyMessages = GetFwdMessages(jnReplyMessages, jnFUsers, m_vkOptions.BBCForAttachments());
+ if (!wszBody.IsEmpty())
+ wszReplyMessages = L"\n" + wszReplyMessages;
+ wszBody += wszReplyMessages;
+ } else if (jnReplyMessages["id"])
+ _ltoa(jnReplyMessages["id"].as_int(), szReplyId, 10);
const JSONNode &jnAttachments = jnMsg["attachments"];
if (jnAttachments && !jnAttachments.empty()) {
@@ -298,6 +300,10 @@ void CVkProto::OnReceiveHistoryMessages(NETLIBHTTPREQUEST *reply, AsyncHttpReque
recv.timestamp = tDateTime;
recv.szMessage = pszBody;
recv.szMsgId = szMid;
+
+ if (!m_vkOptions.bShowReplyInMessage && szReplyId)
+ recv.szReplyId = szReplyId;
+
ProtoChainRecvMsg(hContact, &recv);
MEVENT hDbEvent = db_event_getById(m_szModuleName, strcat(szMid, "_"));
diff --git a/protocols/VKontakte/src/vk_messages.cpp b/protocols/VKontakte/src/vk_messages.cpp
index 46a30b070c..9cdf21f0f8 100644
--- a/protocols/VKontakte/src/vk_messages.cpp
+++ b/protocols/VKontakte/src/vk_messages.cpp
@@ -241,7 +241,7 @@ void CVkProto::OnReceiveMessages(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe
if (iChatId == 0)
hContact = FindUser(iUserId, true);
- char szMid[40];
+ char szMid[40], szReplyId[40] = "";
_ltoa(iMessageId, szMid, 10);
bool bUseServerReadFlag = m_vkOptions.bSyncReadMessageStatusFromServer ? true : !m_vkOptions.bMesAsUnread;
@@ -270,13 +270,16 @@ void CVkProto::OnReceiveMessages(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe
}
const JSONNode& jnReplyMessages = jnMsg["reply_message"];
- if (jnReplyMessages && !jnReplyMessages.empty()) {
- CMStringW wszReplyMessages = GetFwdMessages(jnReplyMessages, jnFUsers, m_vkOptions.BBCForAttachments());
- if (!wszBody.IsEmpty())
- wszReplyMessages = L"\n" + wszReplyMessages;
- wszBody += wszReplyMessages;
- }
-
+ if (jnReplyMessages && !jnReplyMessages.empty())
+ if (m_vkOptions.bShowReplyInMessage) {
+ CMStringW wszReplyMessages = GetFwdMessages(jnReplyMessages, jnFUsers, m_vkOptions.BBCForAttachments());
+ if (!wszBody.IsEmpty())
+ wszReplyMessages = L"\n" + wszReplyMessages;
+ wszBody += wszReplyMessages;
+ }
+ else if (jnReplyMessages["id"])
+ _ltoa(jnReplyMessages["id"].as_int(), szReplyId, 10);
+
CMStringW wszBodyNoAttachments = wszBody;
CMStringW wszAttachmentDescr;
@@ -335,8 +338,12 @@ void CVkProto::OnReceiveMessages(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe
T2Utf pszBody(wszBody);
recv.timestamp = bEdited ? tDateTime : (m_vkOptions.bUseLocalTime ? time(0) : tDateTime);
recv.szMessage = pszBody;
+
+ if (!m_vkOptions.bShowReplyInMessage && szReplyId)
+ recv.szReplyId = szReplyId;
debugLogA("CVkProto::OnReceiveMessages mid = %d, datetime = %d, isOut = %d, isRead = %d, iUserId = %d, Edited = %d", iMessageId, tDateTime, isOut, isRead, iUserId, (int)bEdited);
+
if (!IsMessageExist(iMessageId, vkALL) || bEdited) {
debugLogA("CVkProto::OnReceiveMessages new or edited message");
diff --git a/protocols/VKontakte/src/vk_struct.cpp b/protocols/VKontakte/src/vk_struct.cpp
index 25e8fa9057..2b5eb9e121 100644
--- a/protocols/VKontakte/src/vk_struct.cpp
+++ b/protocols/VKontakte/src/vk_struct.cpp
@@ -194,6 +194,7 @@ CVKOptions::CVKOptions(PROTO_INTERFACE* proto) :
bUseNonStandardNotifications(proto, "UseNonStandardNotifications", false),
bShortenLinksForAudio(proto, "ShortenLinksForAudio", true),
bAddMessageLinkToMesWAtt(proto, "AddMessageLinkToMesWAtt", true),
+ bShowReplyInMessage(proto, "ShowReplyInMessage", true),
bSplitFormatFwdMsg(proto, "SplitFormatFwdMsg", true),
bSyncReadMessageStatusFromServer(proto, "SyncReadMessageStatusFromServer", false),
bLoadFullCList(proto, "LoadFullCList", false),
diff --git a/protocols/VKontakte/src/vk_struct.h b/protocols/VKontakte/src/vk_struct.h
index 4537397358..1415c0a609 100644
--- a/protocols/VKontakte/src/vk_struct.h
+++ b/protocols/VKontakte/src/vk_struct.h
@@ -281,6 +281,7 @@ struct CVKOptions {
CMOption<uint8_t> bUseNonStandardNotifications;
CMOption<uint8_t> bShortenLinksForAudio;
CMOption<uint8_t> bAddMessageLinkToMesWAtt;
+ CMOption<uint8_t> bShowReplyInMessage;
CMOption<uint8_t> bSplitFormatFwdMsg;
CMOption<uint8_t> bSyncReadMessageStatusFromServer;
CMOption<uint8_t> bLoadFullCList;