summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorSergey Bolhovskoy <elzorfox@ya.ru>2015-02-16 03:59:39 +0000
committerSergey Bolhovskoy <elzorfox@ya.ru>2015-02-16 03:59:39 +0000
commitcbcc473a73ebb6f4fc1ed9077932b729e368ff5f (patch)
treedaddd51a6afe5abeabdbbff8e2dfb0b14e7b7432 /protocols
parent55c95bafef7e11d24931da4141c3c6d172edfcab (diff)
VKontakte: fix for clear status message on proto invisible
git-svn-id: http://svn.miranda-ng.org/main/trunk@12137 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r--protocols/VKontakte/src/vk_proto.cpp2
-rw-r--r--protocols/VKontakte/src/vk_proto.h3
-rw-r--r--protocols/VKontakte/src/vk_thread.cpp16
3 files changed, 13 insertions, 8 deletions
diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp
index 49a3736e81..633056f5b0 100644
--- a/protocols/VKontakte/src/vk_proto.cpp
+++ b/protocols/VKontakte/src/vk_proto.cpp
@@ -108,6 +108,8 @@ CVkProto::CVkProto(const char *szModuleName, const TCHAR *ptszUserName) :
m_bNotificationFilterMentions = getBool("NotificationFilterMentions", true);
m_bUseNonStandardUrlEncode = getBool("UseNonStandardUrlEncode", true);
+
+ m_bSetBroadcast = false;
// Set all contacts offline -- in case we crashed
SetAllContactStatuses(ID_STATUS_OFFLINE);
vk_Instances.insert(this);
diff --git a/protocols/VKontakte/src/vk_proto.h b/protocols/VKontakte/src/vk_proto.h
index 1d7a898f7c..e70d399565 100644
--- a/protocols/VKontakte/src/vk_proto.h
+++ b/protocols/VKontakte/src/vk_proto.h
@@ -586,7 +586,8 @@ private:
m_bNotificationFilterReposts,
m_bNotificationFilterMentions,
m_bUseBBCOnAttacmentsAsNews,
- m_bUseNonStandardUrlEncode;
+ m_bUseNonStandardUrlEncode,
+ m_bSetBroadcast;
int m_iNewsInterval,
m_iNotificationsInterval,
diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp
index a326002929..034cecd7e3 100644
--- a/protocols/VKontakte/src/vk_thread.cpp
+++ b/protocols/VKontakte/src/vk_thread.cpp
@@ -114,9 +114,9 @@ void CVkProto::SetServerStatus(int iNewStatus)
ptrT ptszListeningToMsg(db_get_tsa(NULL, m_szModuleName, "ListeningTo"));
if (iNewStatus == ID_STATUS_OFFLINE) {
- m_iStatus = ID_STATUS_OFFLINE;
- if (!IsEmpty(ptszListeningToMsg))
+ if (!IsEmpty(ptszListeningToMsg) && m_bSetBroadcast)
RetrieveStatusMsg(oldStatusMsg);
+ m_iStatus = ID_STATUS_OFFLINE;
if (iOldStatus != ID_STATUS_OFFLINE && iOldStatus != ID_STATUS_INVISIBLE)
Push(new AsyncHttpRequest(this, REQUEST_GET, "/method/account.setOffline.json", true, &CVkProto::OnReceiveSmth)
<< VER_API);
@@ -126,10 +126,10 @@ void CVkProto::SetServerStatus(int iNewStatus)
Push(new AsyncHttpRequest(this, REQUEST_GET, "/method/account.setOnline.json", true, &CVkProto::OnReceiveSmth)
<< VER_API);
}
- else {
- m_iStatus = ID_STATUS_INVISIBLE;
- if (!IsEmpty(ptszListeningToMsg))
+ else {
+ if (!IsEmpty(ptszListeningToMsg) && m_bSetBroadcast)
RetrieveStatusMsg(oldStatusMsg);
+ m_iStatus = ID_STATUS_INVISIBLE;
if (iOldStatus == ID_STATUS_ONLINE)
Push(new AsyncHttpRequest(this, REQUEST_GET, "/method/account.setOffline.json", true, &CVkProto::OnReceiveSmth)
<< VER_API);
@@ -1041,6 +1041,7 @@ void CVkProto::RetrieveStatusMusic(const CMString &StatusMsg)
CMString codeformat("API.status.set({text:\"%s\"});return null;");
code.AppendFormat(codeformat, ptszOldStatusMsg);
}
+ m_bSetBroadcast = false;
}
else {
if (m_iMusicSendMetod == sendBroadcastOnly) {
@@ -1072,6 +1073,7 @@ void CVkProto::RetrieveStatusMusic(const CMString &StatusMsg)
"};return OldMsg;");
code.AppendFormat(codeformat, StatusMsg);
}
+ m_bSetBroadcast = true;
}
Push(new AsyncHttpRequest(this, REQUEST_GET, "/method/execute.json", true, &CVkProto::OnReceiveStatus)
<< TCHAR_PARAM("code", code)
@@ -1093,8 +1095,8 @@ INT_PTR __cdecl CVkProto::SvcSetListeningTo(WPARAM, LPARAM lParam)
tszListeningTo = ptrT((LPWSTR)CallService(MS_LISTENINGTO_GETPARSEDTEXT, (WPARAM)_T("%artist% - %title%"), (LPARAM)pliInfo));
else
tszListeningTo.Format(_T("%s - %s"),
- pliInfo->ptszArtist ? pliInfo->ptszArtist : _T(""),
- pliInfo->ptszTitle ? pliInfo->ptszTitle : _T(""));
+ pliInfo->ptszArtist ? pliInfo->ptszArtist : _T(""),
+ pliInfo->ptszTitle ? pliInfo->ptszTitle : _T(""));
setTString("ListeningTo", tszListeningTo);
}
RetrieveStatusMusic(tszListeningTo);