From 6f562987395cad37f8aa55a8950ca86b64f987ad Mon Sep 17 00:00:00 2001 From: MikalaiR Date: Fri, 24 Jul 2015 14:35:02 +0000 Subject: SkypeWeb: ChatCreateDialog refactoring git-svn-id: http://svn.miranda-ng.org/main/trunk@14678 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/SkypeWeb/src/skype_chatrooms.cpp | 16 ++-------------- protocols/SkypeWeb/src/skype_dialogs.cpp | 15 ++++++++++++--- protocols/SkypeWeb/src/skype_dialogs.h | 4 +++- protocols/SkypeWeb/src/skype_proto.h | 2 ++ 4 files changed, 19 insertions(+), 18 deletions(-) diff --git a/protocols/SkypeWeb/src/skype_chatrooms.cpp b/protocols/SkypeWeb/src/skype_chatrooms.cpp index 2c52918dce..353b6064ee 100644 --- a/protocols/SkypeWeb/src/skype_chatrooms.cpp +++ b/protocols/SkypeWeb/src/skype_chatrooms.cpp @@ -562,22 +562,10 @@ INT_PTR CSkypeProto::SvcCreateChat(WPARAM, LPARAM) if (IsOnline()) { CSkypeGCCreateDlg dlg(this); - if (!dlg.DoModal()) - { - return 1; - } - LISTuids(1); - for (std::vector::size_type i = 0; i < dlg.m_hContacts.size(); i++) - { - uids.insert(db_get_sa(dlg.m_hContacts[i], m_szModuleName, SKYPE_SETTINGS_ID)); - } - uids.insert(getStringA(SKYPE_SETTINGS_ID)); + if (!dlg.DoModal()) { return 1; } - SendRequest(new CreateChatroomRequest(m_szRegToken, uids, ptrA(getStringA(SKYPE_SETTINGS_ID)), m_szServer)); + SendRequest(new CreateChatroomRequest(m_szRegToken, dlg.m_ContactsList, ptrA(getStringA(SKYPE_SETTINGS_ID)), m_szServer)); - for (int i = 0; i < uids.getCount(); i++) - mir_free(uids[i]); - uids.destroy(); return 0; } return 1; diff --git a/protocols/SkypeWeb/src/skype_dialogs.cpp b/protocols/SkypeWeb/src/skype_dialogs.cpp index 43834306c8..64a5aae03a 100644 --- a/protocols/SkypeWeb/src/skype_dialogs.cpp +++ b/protocols/SkypeWeb/src/skype_dialogs.cpp @@ -45,10 +45,16 @@ 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) +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); } +CSkypeGCCreateDlg::~CSkypeGCCreateDlg() +{ + for (int i = 0; i < m_ContactsList.getCount(); i++) + mir_free(m_ContactsList[i]); + m_ContactsList.destroy(); +} void CSkypeGCCreateDlg::OnInitDialog() { @@ -70,12 +76,15 @@ void CSkypeGCCreateDlg::btnOk_OnOk(CCtrlButton*) { if (m_clc.GetCheck(hItem)) { - m_hContacts.push_back(hContact); + char *szName = db_get_sa(hContact, m_proto->m_szModuleName, SKYPE_SETTINGS_ID); + if (szName != NULL) + m_ContactsList.insert(szName); } } } } - EndDialog(m_hwnd, 1); + m_ContactsList.insert(m_proto->m_szSelfSkypeName); + EndDialog(m_hwnd, m_ContactsList.getCount()); } void CSkypeGCCreateDlg::FilterList(CCtrlClc *) diff --git a/protocols/SkypeWeb/src/skype_dialogs.h b/protocols/SkypeWeb/src/skype_dialogs.h index b07265ef1b..ab9c33f71c 100644 --- a/protocols/SkypeWeb/src/skype_dialogs.h +++ b/protocols/SkypeWeb/src/skype_dialogs.h @@ -57,8 +57,10 @@ protected: public: - std::vector m_hContacts; + LIST m_ContactsList; + CSkypeGCCreateDlg(CSkypeProto *proto); + ~CSkypeGCCreateDlg(); }; diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h index 1540ac4c8c..3a565b9df4 100644 --- a/protocols/SkypeWeb/src/skype_proto.h +++ b/protocols/SkypeWeb/src/skype_proto.h @@ -23,6 +23,8 @@ typedef void(CSkypeProto::*SkypeResponseWithArgCallback)(const NETLIBHTTPREQUEST struct CSkypeProto : public PROTO < CSkypeProto > { + friend CSkypeGCCreateDlg; + public: ////////////////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3