From e63ffcd3b3c8598d28ee899bd2537b02c02d8d39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20P=C3=B6sel?= Date: Sun, 18 May 2014 09:47:19 +0000 Subject: Facebook: Refactor various working threads and updating contacts procedure; Version bump This should eliminate creation of duplicite contacts, maybe made little slower or faster logging in... git-svn-id: http://svn.miranda-ng.org/main/trunk@9217 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/FacebookRM/src/connection.cpp | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'protocols/FacebookRM/src/connection.cpp') diff --git a/protocols/FacebookRM/src/connection.cpp b/protocols/FacebookRM/src/connection.cpp index 4ff500a31b..48c290dfba 100644 --- a/protocols/FacebookRM/src/connection.cpp +++ b/protocols/FacebookRM/src/connection.cpp @@ -77,13 +77,12 @@ void FacebookProto::ChangeStatus(void*) ResetEvent(update_loop_lock_); - if (NegotiateConnection() && facy.home()) + if (NegotiateConnection() && facy.home() && facy.reconnect()) { - facy.reconnect(); - facy.load_friends(); - facy.load_pages(); + // Load all friends + ProcessFriendList(NULL); - // Process Friends requests + // Process friendship requests ForkThread(&FacebookProto::ProcessFriendRequests, NULL); // Get unread messages @@ -92,6 +91,9 @@ void FacebookProto::ChangeStatus(void*) // Get notifications ForkThread(&FacebookProto::ProcessNotifications, NULL); + // Load pages for post status dialog + ForkThread(&FacebookProto::ProcessPages, NULL); + setDword("LogonTS", (DWORD)time(NULL)); ForkThread(&FacebookProto::UpdateLoop, NULL); ForkThread(&FacebookProto::MessageLoop, NULL); @@ -122,7 +124,8 @@ void FacebookProto::ChangeStatus(void*) } facy.chat_state(m_iDesiredStatus != ID_STATUS_INVISIBLE); - facy.buddy_list(); + + ForkThread(&FacebookProto::ProcessBuddyList, NULL); m_iStatus = facy.self_.status_id = m_iDesiredStatus; ProtoBroadcastAck(0, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, m_iStatus); @@ -175,16 +178,14 @@ void FacebookProto::UpdateLoop(void *) for (int i = -1; !isOffline(); i = ++i % 50) { - if (i != -1) { - if (!facy.buddy_list()) - break; - } + if (i != -1) + ProcessBuddyList(NULL); + if (i == 2 && getByte(FACEBOOK_KEY_EVENT_FEEDS_ENABLE, DEFAULT_EVENT_FEEDS_ENABLE)) - if (!facy.feeds()) - break; + ProcessFeeds(NULL); if (i == 49) - ForkThread(&FacebookProto::ProcessFriendRequests, NULL); + ProcessFriendRequests(NULL); debugLogA("***** FacebookProto::UpdateLoop[%d] going to sleep...", tim); if (WaitForSingleObjectEx(update_loop_lock_, GetPollRate() * 1000, true) != WAIT_TIMEOUT) -- cgit v1.2.3