diff options
author | Robert Pösel <robyer@seznam.cz> | 2014-07-06 09:00:21 +0000 |
---|---|---|
committer | Robert Pösel <robyer@seznam.cz> | 2014-07-06 09:00:21 +0000 |
commit | 1e11f5fc920b54759b2ec16854d8f9e65662cdec (patch) | |
tree | 51dd2419a0278a57d1d0dfab6697624c8dc2ced8 | |
parent | ea1f790f193039c1091d6c091825fe924a30fcb0 (diff) |
Facebook: Fix invisible status (now it's not true-invisible again)
It's not fully tested, should be fixed better later.
git-svn-id: http://svn.miranda-ng.org/main/trunk@9702 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | protocols/FacebookRM/docs/facebook - readme.txt | 2 | ||||
-rw-r--r-- | protocols/FacebookRM/src/communication.cpp | 8 | ||||
-rw-r--r-- | protocols/FacebookRM/src/connection.cpp | 16 | ||||
-rw-r--r-- | protocols/FacebookRM/src/proto.cpp | 4 | ||||
-rw-r--r-- | protocols/FacebookRM/src/proto.h | 5 |
5 files changed, 28 insertions, 7 deletions
diff --git a/protocols/FacebookRM/docs/facebook - readme.txt b/protocols/FacebookRM/docs/facebook - readme.txt index 49b79368ac..d991b3071e 100644 --- a/protocols/FacebookRM/docs/facebook - readme.txt +++ b/protocols/FacebookRM/docs/facebook - readme.txt @@ -18,7 +18,7 @@ Info: Information about statuses
--------------------------------
- Online = connected to fb, chat is online
- - Invisible = connected to fb, chat is offline, but you can still see other people online, receive messages, newsfeeds and notifications
+ - Invisible = connected to fb, but only for getting feeds and notifications - CHAT is OFFLINE
- Offline = disconnected
--------------------------------
diff --git a/protocols/FacebookRM/src/communication.cpp b/protocols/FacebookRM/src/communication.cpp index 6f14407941..3faf8da535 100644 --- a/protocols/FacebookRM/src/communication.cpp +++ b/protocols/FacebookRM/src/communication.cpp @@ -516,7 +516,13 @@ std::string facebook_client::choose_action(RequestType request_type, std::string action += "&partition=" + (this->chat_channel_partition_.empty() ? "0" : this->chat_channel_partition_); action += "&clientid=" + this->chat_clientid_; action += "&cb=" + utils::text::rand_string(4, "0123456789abcdefghijklmnopqrstuvwxyz"); - action += "&idle=0&state=active"; + + // FIXME: fix this as I don't know how it works yet (because of quick stable release) + if (!parent->isInvisible()) + action += "&idle=-1&state=active"; + else + action += "&idle=1"; + if (!this->chat_sticky_num_.empty()) action += "&sticky_token=" + this->chat_sticky_num_; diff --git a/protocols/FacebookRM/src/connection.cpp b/protocols/FacebookRM/src/connection.cpp index 02699bc1e0..7ecc553f20 100644 --- a/protocols/FacebookRM/src/connection.cpp +++ b/protocols/FacebookRM/src/connection.cpp @@ -125,11 +125,18 @@ void FacebookProto::ChangeStatus(void*) debugLogA("***** SignOn complete"); } - facy.chat_state(m_iDesiredStatus != ID_STATUS_INVISIBLE); + m_invisible = (new_status == ID_STATUS_INVISIBLE); - ForkThread(&FacebookProto::ProcessBuddyList, NULL); + facy.chat_state(!m_invisible); - m_iStatus = facy.self_.status_id = m_iDesiredStatus; + if (m_invisible) { + facy.buddies.clear(); + SetAllContactStatuses(ID_STATUS_OFFLINE); + } else { + ForkThread(&FacebookProto::ProcessBuddyList, NULL); + } + + m_iStatus = facy.self_.status_id = new_status; ProtoBroadcastAck(0, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, m_iStatus); debugLogA("***** ChangeStatus complete"); @@ -181,7 +188,8 @@ void FacebookProto::UpdateLoop(void *) for (int i = -1; !isOffline(); i = ++i % 50) { if (i != -1) { - ProcessBuddyList(NULL); + if (!isInvisible()) + ProcessBuddyList(NULL); if (getByte(FACEBOOK_KEY_EVENT_FEEDS_ENABLE, DEFAULT_EVENT_FEEDS_ENABLE)) ProcessFeeds(NULL); diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp index 4a36cc96d4..54cd7f0b10 100644 --- a/protocols/FacebookRM/src/proto.cpp +++ b/protocols/FacebookRM/src/proto.cpp @@ -35,6 +35,8 @@ FacebookProto::FacebookProto(const char* proto_name,const TCHAR* username) : facy.send_message_lock_ = CreateMutex(NULL, FALSE, NULL); facy.fcb_conn_lock_ = CreateMutex(NULL, FALSE, NULL); + m_invisible = false; + CreateProtoService(PS_CREATEACCMGRUI, &FacebookProto::SvcCreateAccMgrUI); CreateProtoService(PS_GETMYAWAYMSG, &FacebookProto::GetMyAwayMsg); CreateProtoService(PS_GETMYAVATART, &FacebookProto::GetMyAvatar); @@ -175,6 +177,8 @@ int FacebookProto::SetStatus(int new_status) return 0; } + m_invisible = (new_status == ID_STATUS_INVISIBLE); + ForkThread(&FacebookProto::ChangeStatus, this); return 0; } diff --git a/protocols/FacebookRM/src/proto.h b/protocols/FacebookRM/src/proto.h index 0887d402a7..7a1b208707 100644 --- a/protocols/FacebookRM/src/proto.h +++ b/protocols/FacebookRM/src/proto.h @@ -47,9 +47,12 @@ public: inline bool isInvisible() { - return (m_iStatus == ID_STATUS_INVISIBLE); + return m_invisible; + //return (m_iStatus == ID_STATUS_INVISIBLE); } + bool m_invisible; + // DB utils missing in proto_interface __forceinline INT_PTR getStringUtf(const char *name, DBVARIANT *result) { |