diff options
author | MikalaiR <nikolay.romanovich@narod.ru> | 2015-07-15 14:46:10 +0000 |
---|---|---|
committer | MikalaiR <nikolay.romanovich@narod.ru> | 2015-07-15 14:46:10 +0000 |
commit | 5604a6276fe755bcc0731d6a2ff944271aa07e75 (patch) | |
tree | ba3038dd652e8737339d1909107d7fad69efe4c7 /protocols/SkypeWeb/src/skype_chatrooms.cpp | |
parent | 6ffdb6d86ef448bd95ec9065bd624cf15593a044 (diff) |
SkypeWeb: Chat create dialog -> core ui
git-svn-id: http://svn.miranda-ng.org/main/trunk@14568 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/SkypeWeb/src/skype_chatrooms.cpp')
-rw-r--r-- | protocols/SkypeWeb/src/skype_chatrooms.cpp | 108 |
1 files changed, 22 insertions, 86 deletions
diff --git a/protocols/SkypeWeb/src/skype_chatrooms.cpp b/protocols/SkypeWeb/src/skype_chatrooms.cpp index 275f86437f..2c52918dce 100644 --- a/protocols/SkypeWeb/src/skype_chatrooms.cpp +++ b/protocols/SkypeWeb/src/skype_chatrooms.cpp @@ -559,10 +559,28 @@ void CSkypeProto::RemoveChatContact(const TCHAR *tchat_id, const char *id, const INT_PTR CSkypeProto::SvcCreateChat(WPARAM, LPARAM)
{
- if (!IsOnline())
- return 1;
- DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_GC_CREATE), NULL, GcCreateDlgProc, (LPARAM)this);
- return 0;
+ if (IsOnline())
+ {
+ CSkypeGCCreateDlg dlg(this);
+ if (!dlg.DoModal())
+ {
+ return 1;
+ }
+ LIST<char>uids(1);
+ for (std::vector<MCONTACT>::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));
+
+ SendRequest(new CreateChatroomRequest(m_szRegToken, uids, 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;
}
/* Menus */
@@ -609,88 +627,6 @@ int CSkypeProto::OnGroupChatMenuHook(WPARAM, LPARAM lParam) return 0;
}
-/* Dialogs */
-
-INT_PTR CSkypeProto::GcCreateDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- CSkypeProto *ppro = (CSkypeProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- NMCLISTCONTROL* nmc;
-
- switch (msg)
- {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwndDlg);
-
- ppro = (CSkypeProto*)lParam;
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
- {
- HWND hwndClist = GetDlgItem(hwndDlg, IDC_CLIST);
- SetWindowLongPtr(hwndClist, GWL_STYLE,
- GetWindowLongPtr(hwndClist, GWL_STYLE) | CLS_CHECKBOXES | CLS_HIDEEMPTYGROUPS | CLS_USEGROUPS | CLS_GREYALTERNATE | CLS_GROUPCHECKBOXES);
- SendMessage(hwndClist, CLM_SETEXSTYLE, CLS_EX_DISABLEDRAGDROP | CLS_EX_TRACKSELECT, 0);
-
- ResetOptions(hwndDlg);
- }
- return TRUE;
-
- case WM_NOTIFY:
- nmc = (NMCLISTCONTROL*)lParam;
- if (nmc->hdr.idFrom == IDC_CLIST && nmc->hdr.code == CLN_LISTREBUILT)
- FilterContacts(hwndDlg, ppro);
- break;
-
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDCANCEL:
- EndDialog(hwndDlg, 0);
- return TRUE;
-
- case IDOK:
- HWND hwndClist = GetDlgItem(hwndDlg, IDC_CLIST);
- LIST<char>uids(1);
- for (MCONTACT hContact = db_find_first(ppro->m_szModuleName); hContact; hContact = db_find_next(hContact, ppro->m_szModuleName)) {
- if (ppro->isChatRoom(hContact))
- continue;
-
- if (int hItem = SendMessage(hwndClist, CLM_FINDCONTACT, hContact, 0)) {
- if (SendMessage(hwndClist, CLM_GETCHECKMARK, (WPARAM)hItem, 0)) {
- uids.insert(db_get_sa(hContact, ppro->m_szModuleName, SKYPE_SETTINGS_ID));
- }
- }
- }
- uids.insert(ppro->getStringA(SKYPE_SETTINGS_ID));
-
- TCHAR tszTitle[1024];
- GetDlgItemText(hwndDlg, IDC_TITLE, tszTitle, _countof(tszTitle));
- ppro->SendRequest(new CreateChatroomRequest(ppro->m_szRegToken, uids, ptrA(ppro->getStringA(SKYPE_SETTINGS_ID)), ppro->m_szServer));
- for (int i = 0; i < uids.getCount(); i++)
- mir_free(uids[i]);
- uids.destroy();
- EndDialog(hwndDlg, 0);
- return TRUE;
- }
- }
- return FALSE;
-}
-
-void CSkypeProto::FilterContacts(HWND hwndDlg, CSkypeProto *ppro)
-{
- HWND hwndClist = GetDlgItem(hwndDlg, IDC_CLIST);
- for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
- char *proto = GetContactProto(hContact);
- if (mir_strcmp(proto, ppro->m_szModuleName) || ppro->isChatRoom(hContact))
- if (HANDLE hItem = (HANDLE)SendMessage(hwndClist, CLM_FINDCONTACT, hContact, 0))
- SendMessage(hwndClist, CLM_DELETEITEM, (WPARAM)hItem, 0);
- }
-}
-
-void CSkypeProto::ResetOptions(HWND hwndDlg)
-{
- HWND hwndClist = GetDlgItem(hwndDlg, IDC_CLIST);
- SendMessage(hwndClist, CLM_SETHIDEEMPTYGROUPS, 1, 0);
- SendMessage(hwndClist, CLM_GETHIDEOFFLINEROOT, 1, 0);
-}
-
CMString CSkypeProto::ChangeTopicForm()
{
CMString caption(FORMAT, _T("[%s] %s"), _A2T(m_szModuleName), TranslateT("Enter new chatroom topic"));
|