From 8736afe83f8c5aadf130542b2bbf14b2bcf57105 Mon Sep 17 00:00:00 2001 From: ElzorFox Date: Tue, 28 Feb 2017 13:24:28 +0500 Subject: =?UTF-8?q?VKontakte:=20add=20option=20=E2=80=98Add=20message=20li?= =?UTF-8?q?nk=20to=20messages=20with=20attachments=E2=80=99=20version=20bu?= =?UTF-8?q?mp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- protocols/VKontakte/res/resource.rc | 8 +++++--- protocols/VKontakte/src/misc.cpp | 1 + protocols/VKontakte/src/resource.h | 3 ++- protocols/VKontakte/src/version.h | 2 +- protocols/VKontakte/src/vk_chats.cpp | 4 ++++ protocols/VKontakte/src/vk_history.cpp | 4 ++++ protocols/VKontakte/src/vk_messages.cpp | 4 ++++ protocols/VKontakte/src/vk_options.cpp | 2 ++ protocols/VKontakte/src/vk_options.h | 1 + protocols/VKontakte/src/vk_struct.cpp | 1 + protocols/VKontakte/src/vk_struct.h | 1 + 11 files changed, 26 insertions(+), 5 deletions(-) (limited to 'protocols') diff --git a/protocols/VKontakte/res/resource.rc b/protocols/VKontakte/res/resource.rc index 6e4a3ef943..38e40080a5 100644 --- a/protocols/VKontakte/res/resource.rc +++ b/protocols/VKontakte/res/resource.rc @@ -73,7 +73,7 @@ BEGIN LEFTMARGIN, 4 RIGHTMARGIN, 298 TOPMARGIN, 7 - BOTTOMMARGIN, 190 + BOTTOMMARGIN, 202 END IDD_OPT_FEEDS, DIALOG @@ -163,7 +163,7 @@ BEGIN CONTROL "Visit profile",IDC_SHOW_MENU6,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,85,280,10 END -IDD_OPT_VIEW DIALOGEX 0, 0, 304, 197 +IDD_OPT_VIEW DIALOGEX 0, 0, 304, 209 STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD EXSTYLE WS_EX_CONTROLPARENT FONT 8, "MS Shell Dlg", 0, 0, 0x1 @@ -185,13 +185,15 @@ BEGIN CONTROL "basic ([b], [i], [u], [s])",IDC_ATTBBC_BASIC,"Button",BS_AUTORADIOBUTTON,12,121,129,10 CONTROL "advanced (+[url], [size], [color], [code])",IDC_ATTBBC_ADV, "Button",BS_AUTORADIOBUTTON,154,110,129,10 - GROUPBOX "Other",IDC_STATIC,4,138,294,46 + GROUPBOX "Other",IDC_STATIC,4,138,294,57 CONTROL "Process stickers as smileys",IDC_STICKERS_AS_SMYLES, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,149,278,10 CONTROL "Shorten links for audio attachments",IDC_SHOTEN_LINKS_FOR_AUDIO, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,160,278,10 CONTROL "Use non-standard popups for news and event notifications",IDC_USENOSTDPOPUPS, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,171,278,10 + CONTROL "Add message link to messages with attachments",IDC_ADD_MES_LINK_MES_ATT, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,182,278,10 END IDD_OPT_FEEDS DIALOGEX 0, 0, 304, 232 diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp index 789d5659d4..6938f7fdb2 100644 --- a/protocols/VKontakte/src/misc.cpp +++ b/protocols/VKontakte/src/misc.cpp @@ -1343,6 +1343,7 @@ CMStringW CVkProto::GetFwdMessages(const JSONNode &jnMessages, const JSONNode &j res.AppendChar('\n'); res += wszMes; } + res.AppendChar('\n'); vkUsers.destroy(); return res; diff --git a/protocols/VKontakte/src/resource.h b/protocols/VKontakte/src/resource.h index 15ac29bc9c..ec7626e033 100644 --- a/protocols/VKontakte/src/resource.h +++ b/protocols/VKontakte/src/resource.h @@ -127,6 +127,7 @@ #define IDC_N_FRIENDACCEPTED 1110 #define IDC_SENDVKURLSASATTACH 1111 #define IDC_LOADSENTATTACH 1112 +#define IDC_ADD_MES_LINK_MES_ATT 1113 // Next default values for new objects // @@ -135,7 +136,7 @@ #define _APS_NO_MFC 1 #define _APS_NEXT_RESOURCE_VALUE 123 #define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1112 +#define _APS_NEXT_CONTROL_VALUE 1114 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff --git a/protocols/VKontakte/src/version.h b/protocols/VKontakte/src/version.h index 7b75abe875..c5db730bcd 100644 --- a/protocols/VKontakte/src/version.h +++ b/protocols/VKontakte/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0 #define __MINOR_VERSION 1 #define __RELEASE_NUM 2 -#define __BUILD_NUM 12 +#define __BUILD_NUM 13 #include diff --git a/protocols/VKontakte/src/vk_chats.cpp b/protocols/VKontakte/src/vk_chats.cpp index 39cd7f2704..f26d6f061f 100644 --- a/protocols/VKontakte/src/vk_chats.cpp +++ b/protocols/VKontakte/src/vk_chats.cpp @@ -308,6 +308,10 @@ void CVkProto::AppendChatMessage(int id, const JSONNode &jnMsg, const JSONNode & wszBody += wszAttachmentDescr; } + if (m_vkOptions.bAddMessageLinkToMesWAtt && (jnAttachments || jnFwdMessages)) + wszBody += SetBBCString(TranslateT("Message link"), bbcNo, vkbbcUrl, + CMStringW(FORMAT, L"https://vk.com/im?sel=c%d&msgid=%d", cc->m_chatid, mid)); + if (jnMsg["action"]) { bIsAction = true; CMStringW wszAction = jnMsg["action"].as_mstring(); diff --git a/protocols/VKontakte/src/vk_history.cpp b/protocols/VKontakte/src/vk_history.cpp index 794ac8e465..fd27cc8104 100644 --- a/protocols/VKontakte/src/vk_history.cpp +++ b/protocols/VKontakte/src/vk_history.cpp @@ -246,6 +246,10 @@ void CVkProto::OnReceiveHistoryMessages(NETLIBHTTPREQUEST *reply, AsyncHttpReque 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)); + T2Utf pszBody(wszBody); MCONTACT hContact = FindUser(uid, true); PROTORECVEVENT recv = { 0 }; diff --git a/protocols/VKontakte/src/vk_messages.cpp b/protocols/VKontakte/src/vk_messages.cpp index 50bf218266..98b1a1076a 100644 --- a/protocols/VKontakte/src/vk_messages.cpp +++ b/protocols/VKontakte/src/vk_messages.cpp @@ -278,6 +278,10 @@ void CVkProto::OnReceiveMessages(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe 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 = NULL; int chat_id = jnMsg["chat_id"].as_int(); if (chat_id == 0) diff --git a/protocols/VKontakte/src/vk_options.cpp b/protocols/VKontakte/src/vk_options.cpp index a3033d3ed3..3f04ec8d6f 100644 --- a/protocols/VKontakte/src/vk_options.cpp +++ b/protocols/VKontakte/src/vk_options.cpp @@ -428,11 +428,13 @@ CVkOptionViewForm::CVkOptionViewForm(CVkProto *proto) : m_cbBBCForAttachmentsAdvanced(this, IDC_ATTBBC_ADV), m_cbStikersAsSmyles(this, IDC_STICKERS_AS_SMYLES), m_cbShortenLinksForAudio(this, IDC_SHOTEN_LINKS_FOR_AUDIO), + m_cbAddMessageLinkToMesWAtt(this, IDC_ADD_MES_LINK_MES_ATT), m_cbUseNonStandardNotifications(this, IDC_USENOSTDPOPUPS) { CreateLink(m_cbUseBBCOnAttacmentsAsNews, m_proto->m_vkOptions.bUseBBCOnAttacmentsAsNews); CreateLink(m_cbStikersAsSmyles, m_proto->m_vkOptions.bStikersAsSmyles); CreateLink(m_cbShortenLinksForAudio, m_proto->m_vkOptions.bShortenLinksForAudio); + CreateLink(m_cbAddMessageLinkToMesWAtt, m_proto->m_vkOptions.bAddMessageLinkToMesWAtt); CreateLink(m_cbUseNonStandardNotifications, m_proto->m_vkOptions.bUseNonStandardNotifications); } diff --git a/protocols/VKontakte/src/vk_options.h b/protocols/VKontakte/src/vk_options.h index f58dcff171..59a6ec2980 100644 --- a/protocols/VKontakte/src/vk_options.h +++ b/protocols/VKontakte/src/vk_options.h @@ -167,6 +167,7 @@ class CVkOptionViewForm : public CVkDlgBase CCtrlCheck m_cbStikersAsSmyles; CCtrlCheck m_cbShortenLinksForAudio; + CCtrlCheck m_cbAddMessageLinkToMesWAtt; CCtrlCheck m_cbUseNonStandardNotifications; public: diff --git a/protocols/VKontakte/src/vk_struct.cpp b/protocols/VKontakte/src/vk_struct.cpp index d931f2d911..da8010e26c 100644 --- a/protocols/VKontakte/src/vk_struct.cpp +++ b/protocols/VKontakte/src/vk_struct.cpp @@ -210,6 +210,7 @@ CVKOptions::CVKOptions(PROTO_INTERFACE *proto) : bUseNonStandardNotifications(proto, "UseNonStandardNotifications", false), bUseNonStandardUrlEncode(proto, "UseNonStandardUrlEncode", true), bShortenLinksForAudio(proto, "ShortenLinksForAudio", true), + bAddMessageLinkToMesWAtt(proto, "AddMessageLinkToMesWAtt", 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 88642cccd4..9b2e05766a 100644 --- a/protocols/VKontakte/src/vk_struct.h +++ b/protocols/VKontakte/src/vk_struct.h @@ -332,6 +332,7 @@ struct CVKOptions { CMOption bUseNonStandardNotifications; CMOption bUseNonStandardUrlEncode; CMOption bShortenLinksForAudio; + CMOption bAddMessageLinkToMesWAtt; CMOption bSplitFormatFwdMsg; CMOption bSyncReadMessageStatusFromServer; CMOption bLoadFullCList; -- cgit v1.2.3