diff options
author | MikalaiR <nikolay.romanovich@narod.ru> | 2015-04-20 19:40:35 +0000 |
---|---|---|
committer | MikalaiR <nikolay.romanovich@narod.ru> | 2015-04-20 19:40:35 +0000 |
commit | 0ab99d5195c16d19aecf0e6d6867cc0a6ddfd66d (patch) | |
tree | 3b40d7449034a6fbf8b1c1b9af99e880295a32a7 /protocols/SkypeWeb/src/skype_chatrooms.cpp | |
parent | 4cbbc64544a96d365e0e1862b122b9dec8faf601 (diff) |
SkypeWeb: Chat creating part 1.
git-svn-id: http://svn.miranda-ng.org/main/trunk@12986 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/SkypeWeb/src/skype_chatrooms.cpp')
-rw-r--r-- | protocols/SkypeWeb/src/skype_chatrooms.cpp | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/protocols/SkypeWeb/src/skype_chatrooms.cpp b/protocols/SkypeWeb/src/skype_chatrooms.cpp index 237954214e..f2dbe7b229 100644 --- a/protocols/SkypeWeb/src/skype_chatrooms.cpp +++ b/protocols/SkypeWeb/src/skype_chatrooms.cpp @@ -561,4 +561,98 @@ INT_PTR CSkypeProto::InviteDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM }
return 0;
+}
+
+INT_PTR CSkypeProto::SvcCreateChat(WPARAM, LPARAM)
+{
+ if (!IsOnline())
+ return 1;
+ DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_GC_CREATE), NULL, GcCreateDlgProc, (LPARAM)this);
+ return 0;
+}
+
+static void 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);
+ }
+}
+
+static void ResetOptions(HWND hwndDlg)
+{
+ HWND hwndClist = GetDlgItem(hwndDlg, IDC_CLIST);
+ SendMessage(hwndClist, CLM_SETHIDEEMPTYGROUPS, 1, 0);
+ SendMessage(hwndClist, CLM_GETHIDEOFFLINEROOT, 1, 0);
+}
+
+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)) {
+ ptrA uid(db_get_sa(hContact, ppro->m_szModuleName, SKYPE_SETTINGS_ID));
+ uids.insert(uid);
+ }
+ }
+ }
+
+ TCHAR tszTitle[1024];
+ GetDlgItemText(hwndDlg, IDC_TITLE, tszTitle, SIZEOF(tszTitle));
+ ppro->CreateNewChat(uids, tszTitle);
+ for (int i = 0; i < uids.getCount(); i++)
+ mir_free(uids[i]);
+ uids.destroy();
+ EndDialog(hwndDlg, 0);
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+void CSkypeProto::CreateNewChat(LIST<char> &uids, LPCTSTR ptszTitle)
+{
+ if (!IsOnline())
+ return;
+ SendRequest(new CreateChatroomRequest(RegToken, uids, m_szModuleName, Server));
}
\ No newline at end of file |