From b13d3e39e161dd4804b1d6f1b92f39aed7886160 Mon Sep 17 00:00:00 2001 From: Sergey Bolhovskoy Date: Wed, 17 Jun 2015 07:53:54 +0000 Subject: VKontakte: change [img] processing git-svn-id: http://svn.miranda-ng.org/main/trunk@14228 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/VKontakte/src/misc.cpp | 21 ++++++++++----------- protocols/VKontakte/src/vk_proto.h | 2 +- 2 files changed, 11 insertions(+), 12 deletions(-) (limited to 'protocols/VKontakte/src') diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp index 79ab9356e8..0c6d23000a 100644 --- a/protocols/VKontakte/src/misc.cpp +++ b/protocols/VKontakte/src/misc.cpp @@ -877,8 +877,8 @@ CMString CVkProto::GetVkPhotoItem(const JSONNode &jnPhoto, BBCSupport iBBC) int iHeight = jnPhoto["height"].as_int(); tszRes.AppendFormat(_T("%s (%dx%d)"), SetBBCString(TranslateT("Photo"), iBBC, vkbbcUrl, tszLink), iWidth, iHeight); - if (m_iIMGBBCSupport) - tszRes.AppendFormat(_T("\n\t[img]%s[/img]"), !tszPreviewLink.IsEmpty() ? tszPreviewLink : (!tszLink.IsEmpty() ? tszLink : _T(""))); + if (m_iIMGBBCSupport && iBBC != bbcNo) + tszRes.AppendFormat(_T("\n\t%s"), SetBBCString(!tszPreviewLink.IsEmpty() ? tszPreviewLink : (!tszLink.IsEmpty() ? tszLink : _T("")), bbcBasic, vkbbcImg)); CMString tszText(jnPhoto["text"].as_mstring()); if (!tszText.IsEmpty()) tszRes += _T("\n") + tszText; @@ -901,6 +901,9 @@ CMString CVkProto::SetBBCString(LPCTSTR ptszString, BBCSupport iBBC, VKBBCType b { vkbbcU, bbcNo, _T("%s") }, { vkbbcU, bbcBasic, _T("[u]%s[/u]") }, { vkbbcU, bbcAdvanced, _T("[u]%s[/u]") }, + { vkbbcImg, bbcNo, _T("%s") }, + { vkbbcImg, bbcBasic, _T("[img]%s[/img]") }, + { vkbbcImg, bbcAdvanced, _T("[img]%s[/img]") }, { vkbbcUrl, bbcNo, _T("%s (%s)") }, { vkbbcUrl, bbcBasic, _T("[i]%s[/i] (%s)") }, { vkbbcUrl, bbcAdvanced, _T("[url=%s]%s[/url]") }, @@ -1065,8 +1068,8 @@ CMString CVkProto::GetAttachmentDescr(const JSONNode &jnAttachments, BBCSupport } res.AppendFormat(_T("%s"), tszLink); - if (m_iIMGBBCSupport) - res.AppendFormat(_T("[img]%s[/img]"), tszLink); + if (m_iIMGBBCSupport && iBBC != bbcNo) + res += SetBBCString(tszLink, iBBC, vkbbcImg); } } else if (tszType == _T("link")) { @@ -1083,10 +1086,7 @@ CMString CVkProto::GetAttachmentDescr(const JSONNode &jnAttachments, BBCSupport SetBBCString(TranslateT("Link"), iBBC, vkbbcB), SetBBCString(tszTitle, iBBC, vkbbcUrl, tszUrl)); if (!tszImage.IsEmpty()) - if (m_iIMGBBCSupport) - res.AppendFormat(_T("\n\t%s: [img]%s[/img]"), TranslateT("Image"), tszImage); - else - res.AppendFormat(_T("\n\t%s: %s"), TranslateT("Image"), tszImage); + res.AppendFormat(_T("\n\t%s: %s"), TranslateT("Image"), SetBBCString(tszImage, m_iIMGBBCSupport ? iBBC : bbcNo, vkbbcImg)); if (!tszDescription.IsEmpty()) res.AppendFormat(_T("\n\t%s"), tszDescription); @@ -1108,9 +1108,8 @@ CMString CVkProto::GetAttachmentDescr(const JSONNode &jnAttachments, BBCSupport continue; res += SetBBCString(TranslateT("Gift"), iBBC, vkbbcUrl, tszLink); - if (m_iIMGBBCSupport) - res.AppendFormat(_T("\n\t[img]%s[/img]"), tszLink); - + if (m_iIMGBBCSupport && iBBC != bbcNo) + res.AppendFormat(_T("\n\t%s"), SetBBCString(tszLink, iBBC, vkbbcImg)); } else res.AppendFormat(TranslateT("Unsupported or unknown attachment type: %s"), SetBBCString(tszType, iBBC, vkbbcB)); diff --git a/protocols/VKontakte/src/vk_proto.h b/protocols/VKontakte/src/vk_proto.h index 57b78f4d2a..db970b9998 100644 --- a/protocols/VKontakte/src/vk_proto.h +++ b/protocols/VKontakte/src/vk_proto.h @@ -227,7 +227,7 @@ struct CVKNewsItem : public MZeroedObject { bool bIsRepost; }; -enum VKBBCType { vkbbcB, vkbbcI, vkbbcS, vkbbcU, vkbbcUrl, vkbbcSize, vkbbcColor }; +enum VKBBCType { vkbbcB, vkbbcI, vkbbcS, vkbbcU, vkbbcImg, vkbbcUrl, vkbbcSize, vkbbcColor }; enum BBCSupport { bbcNo, bbcBasic, bbcAdvanced }; struct CVKBBCItem { -- cgit v1.2.3