summaryrefslogtreecommitdiff
path: root/protocols/VKontakte
diff options
context:
space:
mode:
authorSergey Bolhovskoy <elzorfox@ya.ru>2015-05-09 15:35:12 +0000
committerSergey Bolhovskoy <elzorfox@ya.ru>2015-05-09 15:35:12 +0000
commit807628ee7e48fe0be9a65b851ff11af6bdc6b47b (patch)
tree2f9c8cbe67df7c5fa445d39595bca58aca9af1cb /protocols/VKontakte
parent1221bbbf2b71573423b0e4ef505d3969ea3a5a62 (diff)
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
Diffstat (limited to 'protocols/VKontakte')
-rw-r--r--protocols/VKontakte/src/misc.cpp23
-rw-r--r--protocols/VKontakte/src/version.h2
-rw-r--r--protocols/VKontakte/src/vk.h2
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 <http://www.gnu.org/licenses/>.
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 <stdver.h>
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 <http://www.gnu.org/licenses/>.
#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