summaryrefslogtreecommitdiff
path: root/protocols/VKontakte/src/misc.cpp
diff options
context:
space:
mode:
authorSergey Bolhovskoy <elzorfox@ya.ru>2016-06-23 10:12:19 +0000
committerSergey Bolhovskoy <elzorfox@ya.ru>2016-06-23 10:12:19 +0000
commita9a3ec00ede7662aa9a88fe35539547b0645c349 (patch)
treea3e3281dc9dffe7b13b98802b0201a7234bfa1b3 /protocols/VKontakte/src/misc.cpp
parenta324903b08b04759a0dfb0c08d917d70ca246c9b (diff)
VKontakte:
change http to https in urls fix for link captions in attachment market items support in attachment update VK_API_VER to 5.52 version bump git-svn-id: http://svn.miranda-ng.org/main/trunk@17020 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/VKontakte/src/misc.cpp')
-rw-r--r--protocols/VKontakte/src/misc.cpp41
1 files changed, 36 insertions, 5 deletions
diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp
index 3012278540..a075efef8f 100644
--- a/protocols/VKontakte/src/misc.cpp
+++ b/protocols/VKontakte/src/misc.cpp
@@ -971,7 +971,7 @@ CMString CVkProto::GetAttachmentDescr(const JSONNode &jnAttachments, BBCSupport
CMString tszTitle(jnVideo["title"].as_mstring());
int vid = jnVideo["id"].as_int();
int ownerID = jnVideo["owner_id"].as_int();
- CMString tszUrl(FORMAT, _T("http://vk.com/video%d_%d"), ownerID, vid);
+ CMString tszUrl(FORMAT, _T("https://vk.com/video%d_%d"), ownerID, vid);
res.AppendFormat(_T("%s: %s"),
SetBBCString(TranslateT("Video"), iBBC, vkbbcB),
SetBBCString(tszTitle, iBBC, vkbbcUrl, tszUrl));
@@ -995,7 +995,7 @@ CMString CVkProto::GetAttachmentDescr(const JSONNode &jnAttachments, BBCSupport
CMString tszText(jnWall["text"].as_mstring());
int id = jnWall["id"].as_int();
int fromID = jnWall["from_id"].as_int();
- CMString tszUrl(FORMAT, _T("http://vk.com/wall%d_%d"), fromID, id);
+ CMString tszUrl(FORMAT, _T("https://vk.com/wall%d_%d"), fromID, id);
res.AppendFormat(_T("%s: %s"),
SetBBCString(TranslateT("Wall post"), iBBC, vkbbcUrl, tszUrl),
tszText.IsEmpty() ? _T(" ") : tszText);
@@ -1007,7 +1007,7 @@ CMString CVkProto::GetAttachmentDescr(const JSONNode &jnAttachments, BBCSupport
CMString tszCHText(jnCopyHystoryItem["text"].as_mstring());
int iCHid = jnCopyHystoryItem["id"].as_int();
int iCHfromID = jnCopyHystoryItem["from_id"].as_int();
- CMString tszCHUrl(FORMAT, _T("http://vk.com/wall%d_%d"), iCHfromID, iCHid);
+ CMString tszCHUrl(FORMAT, _T("https://vk.com/wall%d_%d"), iCHfromID, iCHid);
tszCHText.Replace(_T("\n"), _T("\n\t\t"));
res.AppendFormat(_T("\n\t\t%s: %s"),
SetBBCString(TranslateT("Wall post"), iBBC, vkbbcUrl, tszCHUrl),
@@ -1069,15 +1069,46 @@ CMString CVkProto::GetAttachmentDescr(const JSONNode &jnAttachments, BBCSupport
SetBBCString(TranslateT("Link"), iBBC, vkbbcB),
SetBBCString(tszTitle, iBBC, vkbbcUrl, tszUrl));
- if (!tszDescription.IsEmpty())
+ if (!tszCaption.IsEmpty())
res.AppendFormat(_T("\n\t%s"), SetBBCString(tszCaption, iBBC, vkbbcI));
- if (jnLink["photo"])
+ if (jnLink["photo"])
res.AppendFormat(_T("\n\t%s"), GetVkPhotoItem(jnLink["photo"], iBBC));
if (!tszDescription.IsEmpty())
res.AppendFormat(_T("\n\t%s"), tszDescription);
}
+ else if (tszType == _T("market")) {
+ const JSONNode &jnMarket = jnAttach["market"];
+
+ int id = jnMarket["id"].as_int();
+ int ownerID = jnMarket["owner_id"].as_int();
+ CMString tszTitle(jnMarket["title"].as_mstring());
+ CMString tszDescription(jnMarket["description"].as_mstring());
+ CMString tszPhoto(jnMarket["thumb_photo"].as_mstring());
+ CMString tszUrl(FORMAT, _T("https://vk.com/%s%d?w=product%d_%d"),
+ ownerID > 0 ? _T("id") : _T("club"),
+ ownerID > 0 ? ownerID : (-1)*ownerID,
+ ownerID,
+ id);
+
+ res.AppendFormat(_T("%s: %s"),
+ SetBBCString(TranslateT("Product"), iBBC, vkbbcB),
+ SetBBCString(tszTitle, iBBC, vkbbcUrl, tszUrl));
+
+ if (!tszPhoto.IsEmpty())
+ res.AppendFormat(_T("\n\t%s: %s"),
+ SetBBCString(TranslateT("Photo"), iBBC, vkbbcB),
+ SetBBCString(tszPhoto, iBBC, vkbbcImg));
+
+ if (jnMarket["price"] && jnMarket["price"]["text"])
+ res.AppendFormat(_T("\n\t%s: %s"),
+ SetBBCString(TranslateT("Price"), iBBC, vkbbcB),
+ jnMarket["price"]["text"].as_mstring());
+
+ if (!tszDescription.IsEmpty())
+ res.AppendFormat(_T("\n\t%s"), tszDescription);
+ }
else if (tszType == _T("gift")) {
const JSONNode &jnGift = jnAttach["gift"];
if (!jnGift)