diff options
Diffstat (limited to 'protocols/Facebook/src')
| -rw-r--r-- | protocols/Facebook/src/proto.h | 4 | ||||
| -rw-r--r-- | protocols/Facebook/src/server.cpp | 10 | 
2 files changed, 10 insertions, 4 deletions
diff --git a/protocols/Facebook/src/proto.h b/protocols/Facebook/src/proto.h index 2f6df655b3..bd3eca0938 100644 --- a/protocols/Facebook/src/proto.h +++ b/protocols/Facebook/src/proto.h @@ -249,8 +249,8 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.   * The query hash for the `ThreadListQuery`.   *   * Key mapping: - *   0: folder_tag - *   1: thread_count + *   0: folder_tag (INBOX, PENDING, ARCHIVED, OTHER, UNREAD) + *   1: thread_count (result is sorted from newest to oldest when parameter is sent)   *   2: include_thread_info   *   3: verification_type   *   4: hash_key diff --git a/protocols/Facebook/src/server.cpp b/protocols/Facebook/src/server.cpp index fbff76af40..faa8032d7b 100644 --- a/protocols/Facebook/src/server.cpp +++ b/protocols/Facebook/src/server.cpp @@ -267,8 +267,10 @@ FacebookUser* FacebookProto::RefreshThread(CMStringW& wszId) {  void FacebookProto::RefreshThreads()  { +	int threadsLimit = 40; +  	auto * pReq = CreateRequestGQL(FB_API_QUERY_THREADS); -	JSONNode json; json << CHAR_PARAM("2", "true") << CHAR_PARAM("12", "false") << CHAR_PARAM("13", "false"); +	JSONNode json; json << INT_PARAM("1", threadsLimit) << CHAR_PARAM("2", "true") << CHAR_PARAM("12", "false") << CHAR_PARAM("13", "false");  	pReq << CHAR_PARAM("query_params", json.write().c_str());  	pReq->CalcSig(); @@ -277,8 +279,12 @@ void FacebookProto::RefreshThreads()  		auto &root = reply.data()["viewer"]["message_threads"];  		for (auto &n : root["nodes"]) { -			RefreshThread(n); +			if (n["is_group_thread"].as_bool() && n["is_viewer_subscribed"].as_bool() && !n["has_viewer_archived"].as_bool()) +				RefreshThread(n);  		} + +		// TODO: save timestamp of last message/action/... into DB +		// TODO: lower threadsLimit to 10, load next pages if timestamp of last message is higher than timestamp in DB  	}  }  | 
