From ed8f4de7d05024cf21f332bafae17cd9d13e5f61 Mon Sep 17 00:00:00 2001 From: Sergey Bolhovskoy Date: Fri, 20 Feb 2015 05:59:02 +0000 Subject: VKontakte: fix for notification filters move account.setOnline from SetServerStatus to RetrieveUsersInfo git-svn-id: http://svn.miranda-ng.org/main/trunk@12212 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/VKontakte/src/vk_proto.cpp | 5 +++-- protocols/VKontakte/src/vk_proto.h | 1 + protocols/VKontakte/src/vk_thread.cpp | 9 +++++++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp index ad34752ad3..01d7f7844c 100644 --- a/protocols/VKontakte/src/vk_proto.cpp +++ b/protocols/VKontakte/src/vk_proto.cpp @@ -104,14 +104,15 @@ CVkProto::CVkProto(const char *szModuleName, const TCHAR *ptszUserName) : m_bNewsSourceNoReposts = getBool("NewsSourceNoReposts", false); m_bNotificationFilterComments = getBool("NotificationFilterComments", true); - m_bNotificationFilterLikes = getBool("NotificationFilterComments", true); - m_bNotificationFilterReposts = getBool("NotificationFilterComments", true); + m_bNotificationFilterLikes = getBool("NotificationFilterLikes", true); + m_bNotificationFilterReposts = getBool("NotificationFilterReposts", true); m_bNotificationFilterMentions = getBool("NotificationFilterMentions", true); m_bUseNonStandardUrlEncode = getBool("UseNonStandardUrlEncode", true); m_iInvisibleInterval = getDword("InvisibleInterval", 10); m_bSetBroadcast = false; + m_bNeedSendOnline = 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 5ce2dc5571..3fe57eb15c 100644 --- a/protocols/VKontakte/src/vk_proto.h +++ b/protocols/VKontakte/src/vk_proto.h @@ -559,6 +559,7 @@ private: bool m_prevError, m_bOnline, + m_bNeedSendOnline, m_bHideChats, m_bMesAsUnread, m_bUseLocalTime, diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp index cc032a8d57..43e5416ca2 100644 --- a/protocols/VKontakte/src/vk_thread.cpp +++ b/protocols/VKontakte/src/vk_thread.cpp @@ -114,6 +114,7 @@ void CVkProto::SetServerStatus(int iNewStatus) ptrT ptszListeningToMsg(db_get_tsa(NULL, m_szModuleName, "ListeningTo")); if (iNewStatus == ID_STATUS_OFFLINE) { + m_bNeedSendOnline = false; if (!IsEmpty(ptszListeningToMsg) && m_bSetBroadcast) { RetrieveStatusMsg(oldStatusMsg); m_bSetBroadcast = false; @@ -124,11 +125,15 @@ void CVkProto::SetServerStatus(int iNewStatus) << VER_API); } else if (iNewStatus != ID_STATUS_INVISIBLE) { + m_bNeedSendOnline = true; + if (iOldStatus == ID_STATUS_ONLINE) + return; m_iStatus = ID_STATUS_ONLINE; Push(new AsyncHttpRequest(this, REQUEST_GET, "/method/account.setOnline.json", true, &CVkProto::OnReceiveSmth) << VER_API); } else { + m_bNeedSendOnline = false; if (!IsEmpty(ptszListeningToMsg) && m_bSetBroadcast) { RetrieveStatusMsg(oldStatusMsg); m_bSetBroadcast = false; @@ -424,6 +429,10 @@ void CVkProto::RetrieveUsersInfo(bool flag) } CMString codeformat("var userIDs=\"%s\";"); + + if (m_bNeedSendOnline) + codeformat += _T("API.account.setOnline();"); + if (flag) codeformat += CMString("var US=API.users.get({\"user_ids\":userIDs,\"fields\":\"%s\",\"name_case\":\"nom\"});" "var res=[];var index=US.length;while(index >0){index=index-1;if(US[index].online==1){res.unshift(US[index]);};};" -- cgit v1.2.3