From cc18d9391b12c7746083de3e93f6348d866efec7 Mon Sep 17 00:00:00 2001 From: Sergey Bolhovskoy Date: Tue, 29 Dec 2015 03:01:27 +0000 Subject: VKontakte: update VK_API version to 5.42 add [code] bbc for forwarding messages load unread message for muc on connect version bump git-svn-id: http://svn.miranda-ng.org/main/trunk@15961 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/VKontakte/res/resource.rc | 4 ++-- protocols/VKontakte/src/misc.cpp | 5 ++++- protocols/VKontakte/src/version.h | 2 +- protocols/VKontakte/src/vk.h | 2 +- protocols/VKontakte/src/vk_chats.cpp | 13 +++++++------ protocols/VKontakte/src/vk_struct.h | 2 +- 6 files changed, 16 insertions(+), 12 deletions(-) (limited to 'protocols') diff --git a/protocols/VKontakte/res/resource.rc b/protocols/VKontakte/res/resource.rc index 3d9193c0ac..861be3ab3c 100644 --- a/protocols/VKontakte/res/resource.rc +++ b/protocols/VKontakte/res/resource.rc @@ -135,7 +135,7 @@ BEGIN GROUPBOX "BBCode support on news and event notifications",IDC_STATIC,4,50,294,48,WS_GROUP CONTROL "off",IDC_NEWSBBC_OFF,"Button",BS_AUTORADIOBUTTON,12,61,129,10 CONTROL "basic ([b], [i], [u], [s])",IDC_NEWSBBC_BASIC,"Button",BS_AUTORADIOBUTTON,12,72,129,10 - CONTROL "advanced (+[url], [size], [color])",IDC_NEWSBBC_ADV, + CONTROL "advanced (+[url], [size], [color], [code])",IDC_NEWSBBC_ADV, "Button",BS_AUTORADIOBUTTON,154,61,129,10 CONTROL "Use this setting also for attachments on news and notifications",IDC_BBC_ATT_NEWS, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,83,278,10 @@ -143,7 +143,7 @@ BEGIN GROUPBOX "BBCode support on attachments",IDC_STATIC,4,99,294,38,WS_GROUP CONTROL "off",IDC_ATTBBC_OFF,"Button",BS_AUTORADIOBUTTON,12,110,129,10 CONTROL "basic ([b], [i], [u], [s])",IDC_ATTBBC_BASIC,"Button",BS_AUTORADIOBUTTON,12,121,129,10 - CONTROL "advanced (+[url], [size], [color])",IDC_ATTBBC_ADV, + CONTROL "advanced (+[url], [size], [color], [code])",IDC_ATTBBC_ADV, "Button",BS_AUTORADIOBUTTON,154,110,129,10 CONTROL "Process stickers as smileys",IDC_STICKERS_AS_SMYLES, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,149,278,10 diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp index c02477735e..aab000491f 100644 --- a/protocols/VKontakte/src/misc.cpp +++ b/protocols/VKontakte/src/misc.cpp @@ -847,6 +847,9 @@ CMString CVkProto::SetBBCString(LPCTSTR ptszString, BBCSupport iBBC, VKBBCType b { vkbbcU, bbcNo, _T("%s") }, { vkbbcU, bbcBasic, _T("[u]%s[/u]") }, { vkbbcU, bbcAdvanced, _T("[u]%s[/u]") }, + { vkbbcCode, bbcNo, _T("%s") }, + { vkbbcCode, bbcBasic, _T("%s") }, + { vkbbcCode, bbcAdvanced, _T("[code]%s[/code]") }, { vkbbcImg, bbcNo, _T("%s") }, { vkbbcImg, bbcBasic, _T("[img]%s[/img]") }, { vkbbcImg, bbcAdvanced, _T("[img]%s[/img]") }, @@ -1139,7 +1142,7 @@ CMString CVkProto::GetFwdMessages(const JSONNode &jnMessages, const JSONNode &jn tcSplit, SetBBCString(TranslateT("at"), iBBC, vkbbcB), ttime, - tszBody); + SetBBCString(tszBody, iBBC, vkbbcCode)); if (!res.IsEmpty()) res.AppendChar(_T('\n')); diff --git a/protocols/VKontakte/src/version.h b/protocols/VKontakte/src/version.h index 39d0d3708a..4ed7ce80b4 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 1 -#define __BUILD_NUM 19 +#define __BUILD_NUM 20 #include diff --git a/protocols/VKontakte/src/vk.h b/protocols/VKontakte/src/vk.h index 3ccc5f89b1..1d3ee166e1 100644 --- a/protocols/VKontakte/src/vk.h +++ b/protocols/VKontakte/src/vk.h @@ -80,7 +80,7 @@ along with this program. If not, see . #define VKERR_INVALID_URL 10106 // Upload server returned empty URL #define VKERR_INVALID_USER 10107 // Invalid or unknown recipient user ID -#define VK_API_VER "5.40" +#define VK_API_VER "5.42" #define VER_API CHAR_PARAM("v", VK_API_VER) #define VK_FEED_USER 2147483647L diff --git a/protocols/VKontakte/src/vk_chats.cpp b/protocols/VKontakte/src/vk_chats.cpp index 0287809189..b6adda8b87 100644 --- a/protocols/VKontakte/src/vk_chats.cpp +++ b/protocols/VKontakte/src/vk_chats.cpp @@ -104,16 +104,17 @@ void CVkProto::RetrieveChatInfo(CVkChatInfo *cc) { CMStringA tszQuery(FORMAT, "var ChatId=%d;", cc->m_chatid); - tszQuery += "var Info=API.messages.getChat({\"chat_id\":ChatId});"; - tszQuery += "var ChatUsers=API.messages.getChatUsers({\"chat_id\":ChatId,\"fields\":\"id,first_name,last_name\"});"; + tszQuery += "var Info=API.messages.getChat({\"chat_id\":ChatId});" + "var ChatUsers=API.messages.getChatUsers({\"chat_id\":ChatId,\"fields\":\"id,first_name,last_name\"});"; if (!cc->m_bHistoryRead) { - tszQuery += "var ChatMsg=API.messages.getHistory({\"chat_id\":ChatId,\"count\":20,\"rev\":0});"; - tszQuery += "var FMsgs = ChatMsg.items@.fwd_messages;var Idx = 0;var Uids =[];while (Idx < FMsgs.length){" + tszQuery += "var ChatMsg=API.messages.getHistory({\"chat_id\":ChatId,\"count\":20,\"rev\":0});var UR=parseInt(ChatMsg.unread);" + "if(UR>20){if(UR>200)UR=200;ChatMsg=API.messages.getHistory({\"chat_id\":ChatId,\"count\":UR,\"rev\":0});};" + "var FMsgs = ChatMsg.items@.fwd_messages;var Idx = 0;var Uids =[];while (Idx < FMsgs.length){" "var Jdx = 0;var CFMsgs = parseInt(FMsgs[Idx].length);while (Jdx < CFMsgs){" "Uids.unshift(FMsgs[Idx][Jdx].user_id);Jdx = Jdx + 1;};Idx = Idx + 1;};" - "var FUsers = API.users.get({\"user_ids\": Uids, \"name_case\":\"gen\"});"; - tszQuery += "var MsgUsers=API.users.get({\"user_ids\":ChatMsg.items@.user_id,\"fields\":\"id,first_name,last_name\"});"; + "var FUsers = API.users.get({\"user_ids\": Uids, \"name_case\":\"gen\"});" + "var MsgUsers=API.users.get({\"user_ids\":ChatMsg.items@.user_id,\"fields\":\"id,first_name,last_name\"});"; } tszQuery += "return {\"info\":Info,\"users\":ChatUsers"; diff --git a/protocols/VKontakte/src/vk_struct.h b/protocols/VKontakte/src/vk_struct.h index 1a55218a55..6207d52f9a 100644 --- a/protocols/VKontakte/src/vk_struct.h +++ b/protocols/VKontakte/src/vk_struct.h @@ -220,7 +220,7 @@ struct CVKNewsItem : public MZeroedObject { bool bIsRepost; }; -enum VKBBCType { vkbbcB, vkbbcI, vkbbcS, vkbbcU, vkbbcImg, vkbbcUrl, vkbbcSize, vkbbcColor }; +enum VKBBCType { vkbbcB, vkbbcI, vkbbcS, vkbbcU, vkbbcCode, vkbbcImg, vkbbcUrl, vkbbcSize, vkbbcColor }; enum BBCSupport { bbcNo, bbcBasic, bbcAdvanced }; struct CVKBBCItem { -- cgit v1.2.3