diff options
author | Sergey Bolhovskoy <elzorfox@ya.ru> | 2014-12-25 11:22:02 +0000 |
---|---|---|
committer | Sergey Bolhovskoy <elzorfox@ya.ru> | 2014-12-25 11:22:02 +0000 |
commit | 60074fa377aeaed72a7cb1bb8d3ed7781a68eeb1 (patch) | |
tree | c9eb2a7a979d1af16e66bac18c99b496364cbda8 /protocols/VKontakte/src/vk_thread.cpp | |
parent | 5da4cd56a1a5ea4f2e745bde855f604c52ef36da (diff) |
VKontakte:
move GetAttachmentDescr to misc.cpp
add ‘View settings’ option page and more options for view attachments, news and notification in message log
code cleanup and reorganization
version bump
git-svn-id: http://svn.miranda-ng.org/main/trunk@11624 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/VKontakte/src/vk_thread.cpp')
-rw-r--r-- | protocols/VKontakte/src/vk_thread.cpp | 125 |
1 files changed, 0 insertions, 125 deletions
diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp index e92e85914d..4d1aa375f3 100644 --- a/protocols/VKontakte/src/vk_thread.cpp +++ b/protocols/VKontakte/src/vk_thread.cpp @@ -20,7 +20,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. UINT_PTR CVkProto::m_timer;
char szBlankUrl[] = "http://api.vk.com/blank.html";
-static char* szImageTypes[] = { "photo_2560", "photo_1280", "photo_807", "photo_604", "photo_256", "photo_130", "photo_128", "photo_75", "photo_64" };
static char VK_TOKEN_BEG[] = "access_token=";
static char fieldsName[] = "id, first_name, last_name, photo_100, bdate, sex, timezone, contacts, online, status, about, domain";
@@ -1249,128 +1248,4 @@ INT_PTR __cdecl CVkProto::SvcVisitProfile(WPARAM hContact, LPARAM) return 0;
}
-/////////////////////////////////////////////////////////////////////////////////////////
-
-CMString CVkProto::GetAttachmentDescr(JSONNODE *pAttachments)
-{
- debugLogA("CVkProto::GetAttachmentDescr");
- CMString res;
- res.AppendChar('\n');
- res += TranslateT("Attachments:");
- res.AppendChar('\n');
- JSONNODE *pAttach;
- for (int k = 0; (pAttach = json_at(pAttachments, k)) != NULL; k++) {
- res.AppendChar('\t');
- ptrT ptszType(json_as_string(json_get(pAttach, "type")));
- if (!mir_tstrcmp(ptszType, _T("photo"))) {
- JSONNODE *pPhoto = json_get(pAttach, "photo");
- if (pPhoto == NULL)
- continue;
-
- ptrT ptszLink;
- for (int i = 0; i < SIZEOF(szImageTypes); i++) {
- JSONNODE *n = json_get(pPhoto, szImageTypes[i]);
- if (n != NULL) {
- ptszLink = json_as_string(n);
- break;
- }
- }
-
- int iWidth = json_as_int(json_get(pPhoto, "width"));
- int iHeight = json_as_int(json_get(pPhoto, "height"));
- res.AppendFormat(_T("%s: %s (%dx%d)"), TranslateT("Photo"), ptszLink ? ptszLink : _T(""), iWidth, iHeight);
- if (m_bAddImgBbc)
- res.AppendFormat(_T("\n\t[img]%s[/img]"), ptszLink);
- }
- else if (!mir_tstrcmp(ptszType, _T("audio"))) {
- JSONNODE *pAudio = json_get(pAttach, "audio");
- if (pAudio == NULL)
- continue;
-
- ptrT ptszArtist(json_as_string(json_get(pAudio, "artist")));
- ptrT ptszTitle(json_as_string(json_get(pAudio, "title")));
- ptrT ptszUrl(json_as_string(json_get(pAudio, "url")));
- res.AppendFormat(_T("%s: (%s - %s) - %s"),
- TranslateT("Audio"), ptszArtist, ptszTitle, ptszUrl);
- }
- else if (!mir_tstrcmp(ptszType, _T("video"))) {
- JSONNODE *pVideo = json_get(pAttach, "video");
- if (pVideo == NULL)
- continue;
-
- ptrT ptszTitle(json_as_string(json_get(pVideo, "title")));
- int vid = json_as_int(json_get(pVideo, "id"));
- int ownerID = json_as_int(json_get(pVideo, "owner_id"));
- res.AppendFormat(_T("%s: %s - http://vk.com/video%d_%d"), TranslateT("Video"), ptszTitle, ownerID, vid);
- }
- else if (!mir_tstrcmp(ptszType, _T("doc"))) {
- JSONNODE *pDoc = json_get(pAttach, "doc");
- if (pDoc == NULL)
- continue;
- ptrT ptszTitle(json_as_string(json_get(pDoc, "title")));
- ptrT ptszUrl(json_as_string(json_get(pDoc, "url")));
- res.AppendFormat(_T("%s: (%s) - %s"), TranslateT("Document"), ptszTitle, ptszUrl);
- }
- else if (!mir_tstrcmp(ptszType, _T("wall"))) {
- JSONNODE *pWall = json_get(pAttach, "wall");
- if (pWall == NULL)
- continue;
-
- ptrT ptszText(json_as_string(json_get(pWall, "text")));
- int id = json_as_int(json_get(pWall, "id"));
- int fromID = json_as_int(json_get(pWall, "from_id"));
- res.AppendFormat(_T("%s: %s - http://vk.com/wall%d_%d"), TranslateT("Wall post"), ptszText ? ptszText : _T(" "), fromID, id);
- }
- else if (!mir_tstrcmp(ptszType, _T("sticker"))) {
- JSONNODE *pSticker = json_get(pAttach, "sticker");
- if (pSticker == NULL)
- continue;
- res.Empty(); // sticker is not really an attachment, so we don't want all that heading info
-
- if (m_bStikersAsSmyles) {
- int id = json_as_int(json_get(pSticker, "id"));
- res.AppendFormat(_T("[sticker:%d]"), id);
- }
- else {
- ptrT ptszLink;
- for (int i = 0; i < SIZEOF(szImageTypes); i++) {
- JSONNODE *n = json_get(pSticker, szImageTypes[i]);
- if (n != NULL) {
- ptszLink = json_as_string(n);
- break;
- }
- }
- res.AppendFormat(_T("%s"), ptszLink);
-
- if (m_bAddImgBbc)
- 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\t%s: [img]%s[/img]"), TranslateT("Image"), tszImage.GetBuffer());
- else
- res.AppendFormat(_T("\n\t%s: %s"), TranslateT("Image"), 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');
- }
-
- return res;
-}
|