From 9cc7d99f174805bc965f5bc6d0ba09e592515b80 Mon Sep 17 00:00:00 2001 From: Sergey Bolhovskoy Date: Mon, 27 Oct 2014 10:29:01 +0000 Subject: =?UTF-8?q?VKontakte:=20remove=20unneeded=20code=20add=20=E2=80=9C?= =?UTF-8?q?Open=20broadcast=E2=80=9D=20contacts=20menuitem=20when=20Listen?= =?UTF-8?q?ingTo=20\Enabled=20is=20change,=20MusicSendMetod=20is=20als?= =?UTF-8?q?o=20change=20some=20cleanup=20version=20bump?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://svn.miranda-ng.org/main/trunk@10877 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/VKontakte/src/vk_thread.cpp | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) (limited to 'protocols/VKontakte/src/vk_thread.cpp') diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp index d72fcecc1a..191be83f70 100644 --- a/protocols/VKontakte/src/vk_thread.cpp +++ b/protocols/VKontakte/src/vk_thread.cpp @@ -105,7 +105,8 @@ void CVkProto::SetServerStatus(int iNewStatus) if (iNewStatus == ID_STATUS_OFFLINE) { m_iStatus = ID_STATUS_OFFLINE; - if (!ListeningToMsg.IsEmpty()) RetrieveStatusMsg(oldStatusMsg); + if (!ListeningToMsg.IsEmpty()) + RetrieveStatusMsg(oldStatusMsg); Push(new AsyncHttpRequest(this, REQUEST_GET, "/method/account.setOffline.json", true, &CVkProto::OnReceiveSmth) << VER_API); } @@ -116,7 +117,8 @@ void CVkProto::SetServerStatus(int iNewStatus) } else { m_iStatus = ID_STATUS_INVISIBLE; - if (!ListeningToMsg.IsEmpty()) RetrieveStatusMsg(oldStatusMsg); + if (!ListeningToMsg.IsEmpty()) + RetrieveStatusMsg(oldStatusMsg); } ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)iOldStatus, m_iStatus); @@ -339,17 +341,19 @@ MCONTACT CVkProto::SetContactInfo(JSONNODE* pItem, bool flag, bool self) CMString tszOldStatus(db_get_tsa(hContact, hContact ? "CList" : m_szModuleName, "StatusMsg")); if (tszValue != tszOldStatus){ db_set_ts(hContact, hContact ? "CList" : m_szModuleName, "StatusMsg", tszValue.GetBuffer()); - if ((json_get(pItem, "status_audio") != NULL) || (tszValue.GetBuffer()[0] == TCHAR(9835))) + db_unset(hContact, m_szModuleName, "AudioUrl"); + JSONNODE* pAudio = json_get(pItem, "status_audio"); + if (pAudio != NULL) { db_set_ts(hContact, m_szModuleName, "ListeningTo", tszValue.GetBuffer()); + tszValue = json_as_string(json_get(pAudio, "url")); + db_set_ts(hContact, m_szModuleName, "AudioUrl", tszValue.GetBuffer()); + } + else if ((tszValue.GetBuffer()[0] == TCHAR(9835)) && (tszValue.GetLength() > 2)) + db_set_ts(hContact, m_szModuleName, "ListeningTo", &(tszValue.GetBuffer())[2]); else db_unset(hContact, m_szModuleName, "ListeningTo"); } - if ((hContact == NULL) && m_bOne){ - setTString("OldStatusMsg", db_get_tsa(0, m_szModuleName, "StatusMsg")); - m_bOne = false; - } - tszValue = json_as_string(json_get(pItem, "about")); if (!tszValue.IsEmpty()) @@ -1097,6 +1101,16 @@ INT_PTR __cdecl CVkProto::SvcReportAbuse(WPARAM hContact, LPARAM) return 0; } +INT_PTR __cdecl CVkProto::SvcOpenBroadcast(WPARAM hContact, LPARAM) +{ + debugLogA("CVkProto::SvcOpenBroadcast"); + CMString tszAudio(db_get_tsa(hContact, m_szModuleName, "AudioUrl")); + + if (!tszAudio.IsEmpty()) + CallService(MS_UTILS_OPENURL, (WPARAM)OUF_TCHAR, (LPARAM)tszAudio.GetBuffer()); + + return 0; +} INT_PTR __cdecl CVkProto::SvcVisitProfile(WPARAM hContact, LPARAM) { -- cgit v1.2.3