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 | |
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')
-rw-r--r-- | protocols/SkypeWeb/src/skype_chatrooms.cpp | 108 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_dialogs.cpp | 59 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_dialogs.h | 22 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_messages.cpp | 14 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_proto.h | 4 |
5 files changed, 104 insertions, 103 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"));
diff --git a/protocols/SkypeWeb/src/skype_dialogs.cpp b/protocols/SkypeWeb/src/skype_dialogs.cpp index 78f612419d..43834306c8 100644 --- a/protocols/SkypeWeb/src/skype_dialogs.cpp +++ b/protocols/SkypeWeb/src/skype_dialogs.cpp @@ -41,3 +41,62 @@ void CSkypeInviteDlg::btnOk_OnOk(CCtrlButton*) m_hContact = m_combo.GetItemData(m_combo.GetCurSel());
EndDialog(m_hwnd, 1);
}
+
+//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_ok.OnClick = Callback(this, &CSkypeGCCreateDlg::btnOk_OnOk);
+}
+
+void CSkypeGCCreateDlg::OnInitDialog()
+{
+ SetWindowLongPtr(m_clc.GetHwnd(), GWL_STYLE,
+ GetWindowLongPtr(m_clc.GetHwnd(), GWL_STYLE) | CLS_CHECKBOXES | CLS_HIDEEMPTYGROUPS | CLS_USEGROUPS | CLS_GREYALTERNATE);
+ m_clc.SendMsg(CLM_SETEXSTYLE, CLS_EX_DISABLEDRAGDROP | CLS_EX_TRACKSELECT, 0);
+
+ ResetListOptions(&m_clc);
+ FilterList(&m_clc);
+}
+
+void CSkypeGCCreateDlg::btnOk_OnOk(CCtrlButton*)
+{
+ for (MCONTACT hContact = db_find_first(m_proto->m_szModuleName); hContact; hContact = db_find_next(hContact, m_proto->m_szModuleName))
+ {
+ if (!m_proto->isChatRoom(hContact))
+ {
+ if (HANDLE hItem = m_clc.FindContact(hContact))
+ {
+ if (m_clc.GetCheck(hItem))
+ {
+ m_hContacts.push_back(hContact);
+ }
+ }
+ }
+ }
+ EndDialog(m_hwnd, 1);
+}
+
+void CSkypeGCCreateDlg::FilterList(CCtrlClc *)
+{
+ for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
+ char *proto = GetContactProto(hContact);
+ if (mir_strcmp(proto, m_proto->m_szModuleName) || m_proto->isChatRoom(hContact))
+ if (HANDLE hItem = m_clc.FindContact(hContact))
+ m_clc.DeleteItem(hItem);
+ }
+}
+
+void CSkypeGCCreateDlg::ResetListOptions(CCtrlClc *)
+{
+ m_clc.SetBkBitmap(0, NULL);
+ m_clc.SetBkColor(GetSysColor(COLOR_WINDOW));
+ m_clc.SetGreyoutFlags(0);
+ m_clc.SetLeftMargin(4);
+ m_clc.SetIndent(10);
+ m_clc.SetHideEmptyGroups(true);
+ m_clc.SetHideOfflineRoot(true);
+ for (int i = 0; i <= FONTID_MAX; i++)
+ m_clc.SetTextColor(i, GetSysColor(COLOR_WINDOWTEXT));
+}
\ No newline at end of file diff --git a/protocols/SkypeWeb/src/skype_dialogs.h b/protocols/SkypeWeb/src/skype_dialogs.h index cf6f5df671..d7be605e94 100644 --- a/protocols/SkypeWeb/src/skype_dialogs.h +++ b/protocols/SkypeWeb/src/skype_dialogs.h @@ -74,5 +74,27 @@ public: CSkypeInviteDlg(CSkypeProto *proto);
};
+class CSkypeGCCreateDlg : public CSkypeDlgBase
+{
+private:
+ typedef CSkypeDlgBase CSuper;
+ CCtrlButton m_ok;
+ CCtrlButton m_cancel;
+ CCtrlClc m_clc;
+
+protected:
+
+ void OnInitDialog();
+ void btnOk_OnOk(CCtrlButton*);
+ void FilterList(CCtrlClc*);
+ void ResetListOptions(CCtrlClc*);
+
+
+public:
+
+ std::vector<MCONTACT> m_hContacts;
+ CSkypeGCCreateDlg(CSkypeProto *proto);
+};
+
#endif //_SKYPE_DIALOGS_H_
\ No newline at end of file diff --git a/protocols/SkypeWeb/src/skype_messages.cpp b/protocols/SkypeWeb/src/skype_messages.cpp index 8f74578b4f..af30b55f1a 100644 --- a/protocols/SkypeWeb/src/skype_messages.cpp +++ b/protocols/SkypeWeb/src/skype_messages.cpp @@ -205,30 +205,18 @@ void CSkypeProto::OnPrivateMessageEvent(const JSONNode &node) else if (!mir_strcmpi(messageType.c_str(), "Event/SkypeVideoMessage")) {}
else if (!mir_strcmpi(messageType.c_str(), "Event/Call"))
{
- //content=<partlist type="ended" alt=""><part identity="username"><name>user name</name><duration>6</duration></part>
- //<part identity="echo123"><name>Echo / Sound Test Service</name><duration>6</duration></part></partlist>
- //content=<partlist type="started" alt=""><part identity="username"><name>user name</name></part></partlist>
AddDbEvent(SKYPE_DB_EVENT_TYPE_CALL_INFO, hContact, timestamp, DBEF_UTF, content.c_str(), clientMsgId.c_str());
}
else if (!mir_strcmpi(messageType.c_str(), "RichText/Files"))
- {
-
- //content=<files alt="отправил (-а) файл "run.bat""><file size="97" index="0" tid="4197760077">run.bat</file></files>
-
+ {
AddDbEvent(SKYPE_DB_EVENT_TYPE_FILETRANSFER_INFO, hContact, timestamp, DBEF_UTF, content.c_str(), clientMsgId.c_str());
}
else if (!mir_strcmpi(messageType.c_str(), "RichText/Location")) {}
else if (!mir_strcmpi(messageType.c_str(), "RichText/UriObject"))
{
- //content=<URIObject type="Picture.1" uri="https://api.asm.skype.com/v1//objects/0-weu-d1-262f0a1ee256d03b8e4b8360d9208834" url_thumbnail="https://api.asm.skype.com/v1//objects/0-weu-d1-262f0a1ee256d03b8e4b8360d9208834/views/imgt1"><Title></Title><Description></Description>Для просмотра этого общего фото перейдите по ссылке: https://api.asm.skype.com/s/i?0-weu-d1-262f0a1ee256d03b8e4b8360d9208834<meta type="photo" originalName="ysd7ZE4BqOg.jpg"/><OriginalName v="ysd7ZE4BqOg.jpg"/></URIObject>
AddDbEvent(SKYPE_DB_EVENT_TYPE_URIOBJ, hContact, timestamp, DBEF_UTF, content.c_str(), clientMsgId.c_str());
}
else if (!mir_strcmpi(messageType.c_str(), "RichText/Contacts")) {}
-
- //if (clientMsgId && (!mir_strcmpi(messageType, "Text") || !mir_strcmpi(messageType, "RichText")))
- //{
- // PushRequest(new MarkMessageReadRequest(skypename, m_szRegToken, _ttoi(json_as_string(json_get(node, "id"))), timestamp, false, m_szServer));
- //}
}
int CSkypeProto::OnDbEventRead(WPARAM hContact, LPARAM hDbEvent)
diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h index e52021a1e9..b8b85fb62e 100644 --- a/protocols/SkypeWeb/src/skype_proto.h +++ b/protocols/SkypeWeb/src/skype_proto.h @@ -285,10 +285,6 @@ private: void RenameChat(const char *chat_id, const char *name);
void ChangeChatTopic(const char * chat_id, const char *topic, const char *initiator);
- static INT_PTR CALLBACK GcCreateDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-
- static void ResetOptions(HWND hwndDlg);
- static void FilterContacts(HWND hwndDlg, CSkypeProto *ppro);
void SetChatStatus(MCONTACT hContact, int iStatus);
//polling
|