summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorElzorFox <elzorfox@ya.ru>2024-09-28 15:17:03 +0500
committerElzorFox <elzorfox@ya.ru>2024-09-28 15:17:03 +0500
commit55793991ad8b130f5146c1b72bfa0d126ce13456 (patch)
tree83fafc896e505111594e4000a69f22725bb3b3c3 /protocols
parentb2f4da66f2affc8a53f79eef2a74cf447c8b0db8 (diff)
VKontakte:
fix video image preview filename fix link to private video version bump
Diffstat (limited to 'protocols')
-rw-r--r--protocols/VKontakte/src/misc.cpp9
-rw-r--r--protocols/VKontakte/src/version.h2
-rw-r--r--protocols/VKontakte/src/vk_files.cpp19
3 files changed, 25 insertions, 5 deletions
diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp
index 6669fb7adf..2794cbee54 100644
--- a/protocols/VKontakte/src/misc.cpp
+++ b/protocols/VKontakte/src/misc.cpp
@@ -1351,10 +1351,15 @@ CMStringW CVkProto::GetAttachmentDescr(const JSONNode &jnAttachments, BBCSupport
if (!jnVideo)
continue;
- CMStringW wszTitle(jnVideo["title"].as_mstring());
+ CMStringW wszTitle(jnVideo["title"].as_mstring()), wszUrl;
int iVideoId = jnVideo["id"].as_int();
VKUserID_t iOwnerId = jnVideo["owner_id"].as_int();
- CMStringW wszUrl(FORMAT, L"https://vk.com/video%d_%d", iOwnerId, iVideoId);
+ CMStringW wszAccessKey(jnVideo["access_key"].as_mstring());
+
+ if (iMessageId == -1)
+ wszUrl.Format(L"https://vk.com/video%d_%d", iOwnerId, iVideoId);
+ else
+ wszUrl.Format(L"https://vk.com/im?z=video%d_%d/%s", iOwnerId, iVideoId, wszAccessKey.IsEmpty() ? L"" : wszAccessKey.c_str());
if (jnVideo["image"]) {
CMStringW wszPreviewImage = GetVkPhotoForVideoItem(jnVideo["image"], hContact, iMessageId);
diff --git a/protocols/VKontakte/src/version.h b/protocols/VKontakte/src/version.h
index 6da093fa56..d3f8e85b2e 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 16
-#define __BUILD_NUM 12
+#define __BUILD_NUM 13
#include <stdver.h>
diff --git a/protocols/VKontakte/src/vk_files.cpp b/protocols/VKontakte/src/vk_files.cpp
index d5d13b5ba8..7a29c0d3d8 100644
--- a/protocols/VKontakte/src/vk_files.cpp
+++ b/protocols/VKontakte/src/vk_files.cpp
@@ -32,17 +32,32 @@ CMStringW CVkProto::GetVkFileItem(CMStringW& _wszUrl, MCONTACT hContact, VKMessa
CreateDirectoryTreeW(buf);
- CMStringW wszUrl = _wszUrl;
+ CMStringW wszUrl = _wszUrl, wszAltFileName;
wszUrl.Replace(L"\\", L"/");
int i = wszUrl.Find('?');
- if (i > -1)
+ if (i > -1) {
+ wszAltFileName = wszUrl.Mid(i + 1);
wszUrl.Truncate(i);
+ }
i = wszUrl.ReverseFind('/');
if (i > -1)
wszUrl = wszUrl.Mid(i + 1);
+ i = wszUrl.ReverseFind('.');
+ if (i < 0) {
+ i = wszAltFileName.Find('&');
+ if (i > -1)
+ wszAltFileName.Truncate(i);
+
+ i = wszAltFileName.ReverseFind('=');
+ if (i > -1)
+ wszAltFileName = wszAltFileName.Mid(i + 1);
+
+ wszUrl = wszAltFileName + L".jpg";
+ }
+
wszUrl.Insert(0, buf);
if (::_waccess(wszUrl.c_str(), 0) && IsOnline())