From 640137e05fa985829eabfecfe156d5b7fa376bef Mon Sep 17 00:00:00 2001 From: Sergey Bolhovskoy Date: Tue, 16 Dec 2014 09:41:48 +0000 Subject: VKontakte: add link attachments type support git-svn-id: http://svn.miranda-ng.org/main/trunk@11446 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/VKontakte/src/vk_thread.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'protocols') diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp index f4e5866713..139d16e6fc 100644 --- a/protocols/VKontakte/src/vk_thread.cpp +++ b/protocols/VKontakte/src/vk_thread.cpp @@ -1347,6 +1347,27 @@ CMString CVkProto::GetAttachmentDescr(JSONNODE *pAttachments) res.AppendFormat(_T("[img]%s[/img]"), ptszLink); } } + else if (!mir_tstrcmp(ptszType, _T("link"))){ + JSONNODE *pLink = json_get(pAttach, "link"); + if (pLink == NULL) + continue; + + ptrT ptszUrl(json_as_string(json_get(pLink, "url"))); + ptrT ptszTitle(json_as_string(json_get(pLink, "title"))); + ptrT ptszDescription(json_as_string(json_get(pLink, "description"))); + CMString tszImage(json_as_string(json_get(pLink, "image_src"))); + + res.AppendFormat(_T("%s: %s (%s)"), TranslateT("Link"), ptszTitle ? ptszTitle : _T(""), ptszUrl ? ptszUrl : _T("")); + if (!tszImage.IsEmpty()) + if (m_bAddImgBbc) + res.AppendFormat(_T("\n\tImage: [img]%s[/img]"), tszImage.GetBuffer()); + else + res.AppendFormat(_T("\n\tImage: %s"), tszImage.GetBuffer()); + + if (ptszDescription) + res.AppendFormat(_T("\n\t%s"), ptszDescription); + + } else res.AppendFormat(TranslateT("Unsupported or unknown attachment type: %s"), ptszType); res.AppendChar('\n'); -- cgit v1.2.3