From 73b4dd7987338cbb605e98505f21a16062663aae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20P=C3=B6sel?= Date: Thu, 1 Sep 2016 21:44:49 +0000 Subject: Facebook: Set users that were active more than 15 minutes ago as offline; version bump git-svn-id: http://svn.miranda-ng.org/main/trunk@17241 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/FacebookRM/src/json.cpp | 35 ++++++++++++++++++++++++----------- protocols/FacebookRM/src/version.h | 2 +- 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/protocols/FacebookRM/src/json.cpp b/protocols/FacebookRM/src/json.cpp index 493569346f..71d706a4e1 100644 --- a/protocols/FacebookRM/src/json.cpp +++ b/protocols/FacebookRM/src/json.cpp @@ -754,6 +754,8 @@ int facebook_json_parser::parse_messages(std::string *pData, std::vectordelSetting(hContact, "LastActiveTS"); } + + // Set users inactive for too long as offline + if (last_active > 0 && last_active < offlineThreshold) { + if (proto->getWord(hContact, "Status", 0) != ID_STATUS_OFFLINE) + proto->setWord(hContact, "Status", ID_STATUS_OFFLINE); + } } // Probably means client: guess 0 = web, 8 = messenger, 10 = something else? @@ -829,6 +837,8 @@ int facebook_json_parser::parse_messages(std::string *pData, std::vectorgetWord(hContact, "Status", 0) != status) - proto->setWord(hContact, "Status", status); - - - if (la_ && status != ID_STATUS_ONLINE) { + if (la_ /*&& status != ID_STATUS_ONLINE*/) { time_t last_active = utils::time::from_string(la_.as_string()); // we should set IdleTS only when contact is IDLE, or OFFLINE - if (proto->getDword(hContact, "IdleTS", 0) != last_active) { - if (/*(fbu->idle || status == ID_STATUS_OFFLINE) &&*/ last_active > 0) - proto->setDword(hContact, "IdleTS", last_active); - else - proto->delSetting(hContact, "IdleTS"); - } + //if (proto->getDword(hContact, "IdleTS", 0) != last_active) { + // if (/*(fbu->idle || status == ID_STATUS_OFFLINE) &&*/ last_active > 0) + // proto->setDword(hContact, "IdleTS", last_active); + // else + // proto->delSetting(hContact, "IdleTS"); + //} /*if (proto->getDword(hContact, "LastActiveTS", 0) != last_active) { if (last_active > 0) @@ -908,11 +914,18 @@ int facebook_json_parser::parse_messages(std::string *pData, std::vectordelSetting(hContact, "LastActiveTS"); }*/ + + // Set users inactive for too long as offline + if (last_active > 0 && last_active < offlineThreshold) + status = ID_STATUS_OFFLINE; } else { proto->delSetting(hContact, "IdleTS"); } + if (proto->getWord(hContact, "Status", 0) != status) + proto->setWord(hContact, "Status", status); + if (s_) { // what to do with this? } diff --git a/protocols/FacebookRM/src/version.h b/protocols/FacebookRM/src/version.h index 5f9b67272b..d5bae5255f 100644 --- a/protocols/FacebookRM/src/version.h +++ b/protocols/FacebookRM/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0 #define __MINOR_VERSION 2 #define __RELEASE_NUM 16 -#define __BUILD_NUM 0 +#define __BUILD_NUM 1 #include -- cgit v1.2.3