summaryrefslogtreecommitdiff
path: root/protocols/VKontakte/src/vk_thread.cpp
diff options
context:
space:
mode:
authorSergey Bolhovskoy <elzorfox@ya.ru>2014-10-27 10:29:01 +0000
committerSergey Bolhovskoy <elzorfox@ya.ru>2014-10-27 10:29:01 +0000
commit9cc7d99f174805bc965f5bc6d0ba09e592515b80 (patch)
treef47e17ea2d751d193d3b6901cd3e5b09630f8c89 /protocols/VKontakte/src/vk_thread.cpp
parent908f1787312f52e30020163ba29d1326b76b4ca6 (diff)
VKontakte:
remove unneeded code add “Open broadcast” contacts menuitem when ListeningTo \<VK>Enabled is change, MusicSendMetod is also change some cleanup version bump git-svn-id: http://svn.miranda-ng.org/main/trunk@10877 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/VKontakte/src/vk_thread.cpp')
-rw-r--r--protocols/VKontakte/src/vk_thread.cpp30
1 files changed, 22 insertions, 8 deletions
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)
{