diff options
author | Sergey Bolhovskoy <elzorfox@ya.ru> | 2015-07-15 15:49:49 +0000 |
---|---|---|
committer | Sergey Bolhovskoy <elzorfox@ya.ru> | 2015-07-15 15:49:49 +0000 |
commit | f08c773ae32838a6669664349d85580c910abf60 (patch) | |
tree | cb3deaaa18e0237e1bc7d5999698a5745338713e /protocols/VKontakte/src | |
parent | 5604a6276fe755bcc0731d6a2ff944271aa07e75 (diff) |
VKontakte: fix audiostatus processing
git-svn-id: http://svn.miranda-ng.org/main/trunk@14569 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/VKontakte/src')
-rw-r--r-- | protocols/VKontakte/src/vk_thread.cpp | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp index 0261f4ad6a..0be2273a07 100644 --- a/protocols/VKontakte/src/vk_thread.cpp +++ b/protocols/VKontakte/src/vk_thread.cpp @@ -337,23 +337,29 @@ MCONTACT CVkProto::SetContactInfo(const JSONNode &jnItem, bool flag, bool self) tszValue = jnItem["status"].as_mstring();
CMString tszOldStatus(ptrT(db_get_tsa(hContact, hContact ? "CList" : m_szModuleName, "StatusMsg")));
- if (tszValue != tszOldStatus) {
+ if (tszValue != tszOldStatus)
db_set_ts(hContact, hContact ? "CList" : m_szModuleName, "StatusMsg", tszValue);
- db_unset(hContact, m_szModuleName, "AudioUrl");
- const JSONNode &jnAudio = jnItem["status_audio"];
- if (!jnAudio.isnull()) {
- db_set_ts(hContact, m_szModuleName, "ListeningTo", tszValue);
- tszValue = jnAudio["url"].as_mstring();
- db_set_ts(hContact, m_szModuleName, "AudioUrl", tszValue);
+
+ CMString tszOldListeningTo(ptrT(db_get_tsa(hContact, m_szModuleName, "ListeningTo")));
+ const JSONNode &jnAudio = jnItem["status_audio"];
+ if (!jnAudio.isnull()) {
+ CMString tszListeningTo(FORMAT, _T("%s - %s"), jnAudio["artist"].as_mstring(), jnAudio["title"].as_mstring());
+ if (tszListeningTo != tszOldListeningTo) {
+ setTString(hContact, "ListeningTo", tszListeningTo);
+ setTString(hContact, "AudioUrl", jnAudio["url"].as_mstring());
}
- else if (tszValue[0] == TCHAR(9835) && tszValue.GetLength() > 2)
- db_set_ts(hContact, m_szModuleName, "ListeningTo", &(tszValue.GetBuffer())[2]);
- else
- db_unset(hContact, m_szModuleName, "ListeningTo");
+ }
+ else if (tszValue[0] == TCHAR(9835) && tszValue.GetLength() > 2) {
+ setTString(hContact, "ListeningTo", &(tszValue.GetBuffer())[2]);
+ db_unset(hContact, m_szModuleName, "AudioUrl");
+ }
+ else {
+ db_unset(hContact, m_szModuleName, "ListeningTo");
+ db_unset(hContact, m_szModuleName, "AudioUrl");
}
- tszValue = jnItem["about"].as_mstring();
+ tszValue = jnItem["about"].as_mstring();
if (!tszValue.IsEmpty())
setTString(hContact, "About", tszValue);
|