diff options
author | Robert Pösel <robyer@seznam.cz> | 2014-09-07 11:42:55 +0000 |
---|---|---|
committer | Robert Pösel <robyer@seznam.cz> | 2014-09-07 11:42:55 +0000 |
commit | 36fda94bceb22984f08944e1a89d420a90cd6299 (patch) | |
tree | 953fe688c9aaf87b17c72b6dc66b3c33bb927688 /protocols/FacebookRM/src/connection.cpp | |
parent | 064b323a22f939a04f54eb3cdcd165cdcca431c9 (diff) |
Facebook: Various fixes
- Fix getting own name and avatar
- Improve login error messages
- Fix turning off chat on logout and improve logout procedure
- Improve some options text
- Remove "DisableLogout" hidden option
- Some code cleanup
git-svn-id: http://svn.miranda-ng.org/main/trunk@10387 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/FacebookRM/src/connection.cpp')
-rw-r--r-- | protocols/FacebookRM/src/connection.cpp | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/protocols/FacebookRM/src/connection.cpp b/protocols/FacebookRM/src/connection.cpp index fbc4819308..3372d671d2 100644 --- a/protocols/FacebookRM/src/connection.cpp +++ b/protocols/FacebookRM/src/connection.cpp @@ -33,23 +33,27 @@ void FacebookProto::ChangeStatus(void*) if (new_status == ID_STATUS_OFFLINE) { // Logout debugLogA("##### Beginning SignOff process"); + m_signingOut = true; - m_iStatus = facy.self_.status_id = ID_STATUS_OFFLINE; SetEvent(update_loop_lock_); - Netlib_Shutdown(facy.hMsgCon); - - OnLeaveChat(NULL, NULL); - SetAllContactStatuses(ID_STATUS_OFFLINE); - ToggleStatusMenuItems(false); - delSetting("LogonTS"); - ProtoBroadcastAck(0, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, m_iStatus); + // Shutdown and close channel handle + Netlib_Shutdown(facy.hMsgCon); + if (facy.hMsgCon) + Netlib_CloseHandle(facy.hMsgCon); + facy.hMsgCon = NULL; + // Turn off chat on Facebook if (getByte(FACEBOOK_KEY_DISCONNECT_CHAT, DEFAULT_DISCONNECT_CHAT)) facy.chat_state(false); facy.logout(); + OnLeaveChat(NULL, NULL); + SetAllContactStatuses(ID_STATUS_OFFLINE); + ToggleStatusMenuItems(false); + delSetting("LogonTS"); + facy.clear_cookies(); facy.clear_notifications(); facy.clear_chatrooms(); @@ -59,10 +63,15 @@ void FacebookProto::ChangeStatus(void*) facy.pages.clear(); facy.typers.clear(); - if (facy.hMsgCon) - Netlib_CloseHandle(facy.hMsgCon); - facy.hMsgCon = NULL; + // Close connection handle + if (facy.hFcbCon) + Netlib_CloseHandle(facy.hFcbCon); + facy.hFcbCon = NULL; + + m_iStatus = facy.self_.status_id = ID_STATUS_OFFLINE; + ProtoBroadcastAck(0, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, m_iStatus); + m_signingOut = false; debugLogA("##### SignOff complete"); return; @@ -208,7 +217,7 @@ void FacebookProto::MessageLoop(void *) while (facy.channel()) { - if (isOffline()) + if (isOffline() || m_signingOut) break; debugLogA("***** FacebookProto::MessageLoop[%d] refreshing...", tim); } |