summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--protocols/VKontakte/src/vk_proto.cpp5
-rw-r--r--protocols/VKontakte/src/vk_proto.h1
-rw-r--r--protocols/VKontakte/src/vk_thread.cpp9
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]);};};"