From 807628ee7e48fe0be9a65b851ff11af6bdc6b47b Mon Sep 17 00:00:00 2001 From: Sergey Bolhovskoy Date: Sat, 9 May 2015 15:35:12 +0000 Subject: VKontakte: gift support update VK API version to 5.31 version bump git-svn-id: http://svn.miranda-ng.org/main/trunk@13494 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/VKontakte/src/misc.cpp | 23 +++++++++++++++++++++++ protocols/VKontakte/src/version.h | 2 +- protocols/VKontakte/src/vk.h | 2 +- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp index db0be8587d..956cde2be4 100644 --- a/protocols/VKontakte/src/misc.cpp +++ b/protocols/VKontakte/src/misc.cpp @@ -19,6 +19,8 @@ along with this program. If not, see . static char* szImageTypes[] = { "photo_2560", "photo_1280", "photo_807", "photo_604", "photo_256", "photo_130", "photo_128", "photo_75", "photo_64" }; +static char* szGiftTypes[] = { "thumb_256", "thumb_96", "thumb_48" }; + bool IsEmpty(TCHAR *str) { if (str == NULL) @@ -1084,6 +1086,27 @@ CMString CVkProto::GetAttachmentDescr(JSONNODE *pAttachments, BBCSupport iBBC) if (ptszDescription) res.AppendFormat(_T("\n\t%s"), ptszDescription); } + else if (!mir_tstrcmp(ptszType, _T("gift"))) { + JSONNODE *pGift = json_get(pAttach, "gift"); + if (pGift == NULL) + continue; + + ptrT ptszLink; + for (int i = 0; i < SIZEOF(szImageTypes); i++) { + JSONNODE *n = json_get(pGift, szGiftTypes[i]); + if (n != NULL) { + ptszLink = json_as_string(n); + break; + } + } + if (IsEmpty(ptszLink)) + continue; + res += SetBBCString(TranslateT("Gift"), iBBC, vkbbcUrl, ptszLink); + + if (m_iIMGBBCSupport) + res.AppendFormat(_T("\n\t[img]%s[/img]"), ptszLink); + + } else res.AppendFormat(TranslateT("Unsupported or unknown attachment type: %s"), SetBBCString(ptszType, iBBC, vkbbcB).GetBuffer()); diff --git a/protocols/VKontakte/src/version.h b/protocols/VKontakte/src/version.h index 52445c2ef4..beb50fbf72 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 1 +#define __BUILD_NUM 2 #include diff --git a/protocols/VKontakte/src/vk.h b/protocols/VKontakte/src/vk.h index e618973eef..4f38eb6716 100644 --- a/protocols/VKontakte/src/vk.h +++ b/protocols/VKontakte/src/vk.h @@ -67,7 +67,7 @@ along with this program. If not, see . #define VKERR_INVALID_FILENAME 301 // Invalid filename #define VKERR_INVALID_FILESIZE 302 // Invalid filesize -#define VK_API_VER "5.30" +#define VK_API_VER "5.31" #define VER_API CHAR_PARAM("v", VK_API_VER) #define VK_FEED_USER 2147483647L -- cgit v1.2.3