From bc55bf103dc79145ddd24e93a8f96fc6e8cf46d7 Mon Sep 17 00:00:00 2001 From: MikalaiR Date: Sat, 25 Jul 2015 12:30:11 +0000 Subject: SkypeWeb: Closing dialogs on logout git-svn-id: http://svn.miranda-ng.org/main/trunk@14682 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/SkypeWeb/src/skype_chatrooms.cpp | 17 ++++++++++++----- protocols/SkypeWeb/src/skype_dialogs.cpp | 19 ++++++++++++++++--- protocols/SkypeWeb/src/skype_proto.cpp | 4 ++-- protocols/SkypeWeb/src/skype_proto.h | 7 ++++++- 4 files changed, 36 insertions(+), 11 deletions(-) (limited to 'protocols/SkypeWeb/src') diff --git a/protocols/SkypeWeb/src/skype_chatrooms.cpp b/protocols/SkypeWeb/src/skype_chatrooms.cpp index 353b6064ee..839a1191d0 100644 --- a/protocols/SkypeWeb/src/skype_chatrooms.cpp +++ b/protocols/SkypeWeb/src/skype_chatrooms.cpp @@ -179,16 +179,19 @@ int CSkypeProto::OnGroupChatEventHook(WPARAM, LPARAM lParam) { case 10: { CSkypeInviteDlg dlg(this); - if(!dlg.DoModal()) - { - break; - } + + { mir_cslock lck(m_InviteDialogsLock); m_InviteDialogs.insert(&dlg); } + + if(!dlg.DoModal()) break; MCONTACT hContact = dlg.m_hContact; if (hContact != NULL) { ptrA username(db_get_sa(hContact, m_szModuleName, SKYPE_SETTINGS_ID)); SendRequest(new InviteUserToChatRequest(m_szRegToken, chat_id, username, "User", m_szServer)); } + + { mir_cslock lck(m_InviteDialogsLock); m_InviteDialogs.remove(&dlg); } + break; } case 20: @@ -562,10 +565,14 @@ INT_PTR CSkypeProto::SvcCreateChat(WPARAM, LPARAM) if (IsOnline()) { CSkypeGCCreateDlg dlg(this); + + { mir_cslock lck(m_GCCreateDialogsLock); m_GCCreateDialogs.insert(&dlg); } + if (!dlg.DoModal()) { return 1; } SendRequest(new CreateChatroomRequest(m_szRegToken, dlg.m_ContactsList, ptrA(getStringA(SKYPE_SETTINGS_ID)), m_szServer)); - + + { mir_cslock lck(m_GCCreateDialogsLock); m_GCCreateDialogs.remove(&dlg); } return 0; } return 1; diff --git a/protocols/SkypeWeb/src/skype_dialogs.cpp b/protocols/SkypeWeb/src/skype_dialogs.cpp index 64a5aae03a..9cf2c4f2ec 100644 --- a/protocols/SkypeWeb/src/skype_dialogs.cpp +++ b/protocols/SkypeWeb/src/skype_dialogs.cpp @@ -17,8 +17,22 @@ along with this program. If not, see . #include "stdafx.h" -//CSkypeInvideDlg +void CSkypeProto::CloseDialogs() +{ + { + mir_cslock lck(m_GCCreateDialogsLock); + for (int i = 0; i < m_GCCreateDialogs.getCount(); i++) + m_GCCreateDialogs[i]->Close(); + } + + { + mir_cslock lck(m_InviteDialogsLock); + for (int i = 0; i < m_InviteDialogs.getCount(); i++) + m_InviteDialogs[i]->Close(); + } +} +//CSkypeInvideDlg CSkypeInviteDlg::CSkypeInviteDlg(CSkypeProto *proto) : CSkypeDlgBase(proto, IDD_GC_INVITE, false), m_ok(this, IDOK), m_cancel(this, IDCANCEL), m_combo(this, IDC_CONTACT) { @@ -43,9 +57,8 @@ void CSkypeInviteDlg::btnOk_OnOk(CCtrlButton*) } //CSkypeGCCreateDlg - CSkypeGCCreateDlg::CSkypeGCCreateDlg(CSkypeProto *proto) : -CSkypeDlgBase(proto, IDD_GC_CREATE, false), m_ok(this, IDOK), m_cancel(this, IDCANCEL), m_clc(this, IDC_CLIST), m_ContactsList(1) + CSkypeDlgBase(proto, IDD_GC_CREATE, false), m_ok(this, IDOK), m_cancel(this, IDCANCEL), m_clc(this, IDC_CLIST), m_ContactsList(1) { m_ok.OnClick = Callback(this, &CSkypeGCCreateDlg::btnOk_OnOk); } diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp index fc2cbfecd4..78b44fe2e2 100644 --- a/protocols/SkypeWeb/src/skype_proto.cpp +++ b/protocols/SkypeWeb/src/skype_proto.cpp @@ -18,7 +18,7 @@ along with this program. If not, see . #include "stdafx.h" CSkypeProto::CSkypeProto(const char* protoName, const TCHAR* userName) : -PROTO(protoName, userName), m_PopupClasses(1) + PROTO(protoName, userName), m_PopupClasses(1), m_InviteDialogs(1), m_GCCreateDialogs(1) { m_hProtoIcon = Icons[0].Handle; @@ -243,7 +243,7 @@ int CSkypeProto::SetStatus(int iNewStatus) delSetting("expires"); } requestQueue->Stop(); - + CloseDialogs(); ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)m_iStatus, ID_STATUS_OFFLINE); m_iStatus = m_iDesiredStatus = ID_STATUS_OFFLINE; diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h index 3a565b9df4..876b51e655 100644 --- a/protocols/SkypeWeb/src/skype_proto.h +++ b/protocols/SkypeWeb/src/skype_proto.h @@ -100,8 +100,12 @@ private: TRInfo TRouter; - LIST m_PopupClasses; + LIST m_PopupClasses; + LIST m_InviteDialogs; + LIST m_GCCreateDialogs; + mir_cs m_InviteDialogsLock; + mir_cs m_GCCreateDialogsLock; // accounts ptrA m_szServer, @@ -314,6 +318,7 @@ private: time_t GetLastMessageTime(MCONTACT hContact); CMString RunConfirmationCode(); CMString ChangeTopicForm(); + void CloseDialogs(); //events void InitDBEvents(); int __cdecl ProcessSrmmEvent(WPARAM, LPARAM); -- cgit v1.2.3