summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
Diffstat (limited to 'protocols')
-rw-r--r--protocols/Steam/res/Resource.rc18
-rw-r--r--protocols/Steam/src/common.h1
-rw-r--r--protocols/Steam/src/resource.h7
-rw-r--r--protocols/Steam/src/steam_dialogs.cpp242
-rw-r--r--protocols/Steam/src/steam_events.cpp5
-rw-r--r--protocols/Steam/src/steam_menus.cpp2
-rw-r--r--protocols/Steam/src/steam_proto.h6
7 files changed, 276 insertions, 5 deletions
diff --git a/protocols/Steam/res/Resource.rc b/protocols/Steam/res/Resource.rc
index 512af64348..d604849222 100644
--- a/protocols/Steam/res/Resource.rc
+++ b/protocols/Steam/res/Resource.rc
@@ -128,6 +128,16 @@ BEGIN
CONTROL "Go to email domain",IDC_GETDOMAIN,"Hyperlink",WS_GROUP | WS_TABSTOP,7,36,179,8
END
+IDD_OPT_BLOCK_LIST DIALOGEX 0, 0, 305, 230
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+EXSTYLE WS_EX_CONTROLPARENT
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ CONTROL "",IDC_LIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,7,291,194
+ COMBOBOX IDC_CONTACTS,7,206,217,30,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
+ PUSHBUTTON "Block",IDC_BLOCK,230,206,68,13,WS_DISABLED
+END
+
/////////////////////////////////////////////////////////////////////////////
//
@@ -174,6 +184,14 @@ BEGIN
TOPMARGIN, 7
BOTTOMMARGIN, 86
END
+
+ IDD_OPT_BLOCK_LIST, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ VERTGUIDE, 298
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 223
+ END
END
#endif // APSTUDIO_INVOKED
diff --git a/protocols/Steam/src/common.h b/protocols/Steam/src/common.h
index 1597bd002d..2811c9a861 100644
--- a/protocols/Steam/src/common.h
+++ b/protocols/Steam/src/common.h
@@ -2,6 +2,7 @@
#define _COMMON_H_
#include <windows.h>
+#include <commctrl.h>
#include <time.h>
#include <newpluginapi.h>
diff --git a/protocols/Steam/src/resource.h b/protocols/Steam/src/resource.h
index f2817e7d20..e0df660de8 100644
--- a/protocols/Steam/src/resource.h
+++ b/protocols/Steam/src/resource.h
@@ -4,6 +4,8 @@
//
#define IDD_ACCMGR 9
#define IDD_OPT_MAIN 10
+#define IDD_OPT_BLOCKED 20
+#define IDD_OPT_BLOCK_LIST 20
#define IDD_IGNORE_LIST 21
#define IDD_CAPTCHA 118
#define IDI_ICON1 119
@@ -21,10 +23,11 @@
#define IDC_REGISTER 1018
#define IDC_DEFAULT_GROUP 1020
#define IDC_GROUP 1021
+#define IDC_CONTACTS 1050
+#define IDC_BLOCK 1059
#define IDC_BM_LIST 1064
+#define IDC_LIST 1065
#define IDC_TEXT 1082
-#define IDC_CUSTOM1 1083
-#define IDC_BUTTON1 1084
#define IDC_OPENDOMAIN 1200
#define IDC_GETDOMAIN 1200
diff --git a/protocols/Steam/src/steam_dialogs.cpp b/protocols/Steam/src/steam_dialogs.cpp
index 882a30b70a..af0cea11b7 100644
--- a/protocols/Steam/src/steam_dialogs.cpp
+++ b/protocols/Steam/src/steam_dialogs.cpp
@@ -233,4 +233,246 @@ INT_PTR CALLBACK CSteamProto::MainOptionsProc(HWND hwnd, UINT message, WPARAM wP
}
return FALSE;
+}
+
+static WNDPROC oldWndProc = NULL;
+
+LRESULT CALLBACK CSteamProto::BlockListOptionsSubProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ if (msg == WM_LBUTTONDOWN)
+ {
+ LVHITTESTINFO hi;
+ hi.pt.x = LOWORD(lParam); hi.pt.y = HIWORD(lParam);
+ ListView_SubItemHitTest(hwnd, &hi);
+ if (hi.iSubItem == 1)
+ {
+ LVITEM lvi = { 0 };
+ lvi.mask = LVIF_IMAGE | LVIF_PARAM;
+ lvi.stateMask = -1;
+ lvi.iItem = hi.iItem;
+ if (ListView_GetItem(hwnd, &lvi))
+ {
+ /*ContactParam *param = (ContactParam *)lvi.lParam;
+
+ if (param->contact->SetBlocked(false))
+ {
+ SEString data;
+ param->contact->GetIdentity(data);
+ ptrW sid(mir_utf8decodeW(data));
+
+ MCONTACT hContact = param->ppro->GetContactBySid(sid);
+ if (db_get_b(hContact, param->ppro->m_szModuleName, "IsSkypeOut", 0) > 0)
+ db_set_w(hContact, param->ppro->m_szModuleName, "Status", ID_STATUS_ONTHEPHONE);
+
+ ListView_DeleteItem(hwnd, lvi.iItem);
+
+ int nItem = SendMessage(::GetDlgItem(GetParent(hwnd), IDC_CONTACTS), CB_ADDSTRING, 0, (LPARAM)sid);
+ SendMessage(GetDlgItem(GetParent(hwnd), IDC_CONTACTS), CB_SETITEMDATA, nItem, hContact);
+ }*/
+ }
+ }
+ }
+
+ return CallWindowProc(oldWndProc, hwnd, msg, wParam, lParam);
+}
+
+INT_PTR CALLBACK CSteamProto::BlockListOptionsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ CSteamProto *ppro = (CSteamProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+
+ switch (msg)
+ {
+ case WM_INITDIALOG:
+ if (lParam)
+ {
+ ppro = (CSteamProto*)lParam;
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
+
+ TranslateDialogDefault(hwndDlg);
+
+ HWND hwndList = ::GetDlgItem(hwndDlg, IDC_LIST);
+ { // IDC_BM_LIST setup
+ oldWndProc = (WNDPROC)SetWindowLongPtr(hwndList, GWLP_WNDPROC, (LONG_PTR)BlockListOptionsSubProc);
+
+ HIMAGELIST hIml = ImageList_Create(16, 16, ILC_MASK | ILC_COLOR32, 4, 0);
+ //ImageList_AddIconFromIconLib(hIml, "Skype_contact");
+ //ImageList_AddIconFromIconLib(hIml, "Skype_delete");
+ ListView_SetImageList(hwndList, hIml, LVSIL_SMALL);
+
+ LVCOLUMN lvc = { 0 };
+ lvc.mask = LVCF_WIDTH | LVCF_TEXT;
+ //lvc.fmt = LVCFMT_JUSTIFYMASK;
+ lvc.pszText = TranslateT("Name");
+ lvc.cx = 220; // width of column in pixels
+ ListView_InsertColumn(hwndList, 0, &lvc);
+ //lvc.fmt = LVCFMT_RIGHT;
+ lvc.pszText = L"";
+ lvc.cx = 32 - GetSystemMetrics(SM_CXVSCROLL); // width of column in pixels
+ ListView_InsertColumn(hwndList, 1, &lvc);
+
+ SendMessage(hwndList, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_SUBITEMIMAGES | LVS_EX_FULLROWSELECT | LVS_EX_LABELTIP);
+
+ if (!ppro->IsOnline())
+ {
+ EnableWindow(hwndList, FALSE);
+ EnableWindow(::GetDlgItem(hwndDlg, IDC_CONTACTS), FALSE);
+ }
+ }
+
+ if (ppro->IsOnline())
+ {
+ /*SEString data;
+ ContactGroupRef blockedList;
+ ppro->GetHardwiredContactGroup(ContactGroup::CONTACTS_BLOCKED_BY_ME, blockedList);
+
+ CContact::Refs contacts;
+ blockedList->GetContacts(contacts);
+ for (size_t i = 0; i < contacts.size(); i++)
+ {
+ auto contact = contacts[i];
+
+ ptrW sid(::mir_utf8decodeW(contact->GetSid()));
+
+ LVITEM lvi = { 0 };
+ lvi.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM;
+ lvi.iItem = (int)i;
+ lvi.iImage = 0;
+ lvi.lParam = (LPARAM)new ContactParam(contact, ppro);
+ lvi.pszText = sid;
+ int iRow = ListView_InsertItem(hwndList, &lvi);
+
+ if (iRow != -1)
+ {
+ lvi.iItem = iRow;
+ lvi.mask = LVIF_IMAGE;
+ lvi.iSubItem = 1;
+ lvi.iImage = 1;
+ ListView_SetItem(hwndList, &lvi);
+ }
+ }*/
+
+ /*int nItem = 0;
+ MCONTACT hContact = NULL;
+
+ EnterCriticalSection(&ppro->contact_search_lock);
+
+ for (hContact = ::db_find_first(ppro->m_szModuleName); hContact && !ppro->isChatRoom(hContact); hContact = ::db_find_next(hContact, ppro->m_szModuleName))
+ {
+ ptrW sid(::db_get_wsa(hContact, ppro->m_szModuleName, SKYPE_SETTINGS_SID));
+
+ ContactRef contact;
+ ppro->GetContact((char *)_T2A(sid), contact);
+ if (!contacts.contains(contact))
+ {
+ nItem = ::SendMessage(::GetDlgItem(hwndDlg, IDC_CONTACTS), CB_ADDSTRING, 0, (LPARAM)sid);
+ ::SendMessage(::GetDlgItem(hwndDlg, IDC_CONTACTS), CB_SETITEMDATA, nItem, hContact);
+ }
+ }
+
+ LeaveCriticalSection(&ppro->contact_search_lock);*/
+ }
+
+ }
+ break;
+
+ case WM_COMMAND:
+ {
+ switch (LOWORD(wParam))
+ {
+ case IDC_CONTACTS:
+ EnableWindow(GetDlgItem(hwndDlg, IDC_BLOCK), TRUE);
+ break;
+
+ case IDC_BLOCK:
+ {
+ int i = ::SendMessage(::GetDlgItem(hwndDlg, IDC_CONTACTS), CB_GETCURSEL, 0, 0);
+
+ MCONTACT hContact = (MCONTACT)::SendMessage(GetDlgItem(hwndDlg, IDC_CONTACTS), CB_GETITEMDATA, i, 0);
+ if (!hContact)
+ break;
+
+ ptrA steamId(ppro->getStringA(hContact, "SteamID"));
+
+ /*SEString data;
+ ContactRef contact;
+ if (!ppro->GetContact((char *)_T2A(sid), contact) || !contact)
+ break;
+
+ BlockParam param(hContact, ppro);
+ if (::DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_BLOCK), NULL, CSkypeProto::SkypeBlockProc, (LPARAM)&param) != IDOK)
+ break;
+
+ contact->SetBlocked(true, param.abuse);
+ if (::db_get_b(hContact, ppro->m_szModuleName, "IsSkypeOut", 0) > 0)
+ ::db_set_w(hContact, ppro->m_szModuleName, "Status", ID_STATUS_OFFLINE);
+
+ if (param.remove)
+ {
+ contact->SetBuddyStatus(false);
+ ppro->contactList.remove_val(contact);
+ ::CallService(MS_DB_CONTACT_DELETE, wParam, 0);
+ }
+
+ if (contact->SetBlocked(true))
+ {
+ LVITEM lvi = { 0 };
+ lvi.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM;
+ lvi.iItem = (int)i;
+ lvi.iImage = 0;
+ lvi.lParam = (LPARAM)new ContactParam(contact, ppro);
+ lvi.pszText = sid;
+ int iRow = ListView_InsertItem(::GetDlgItem(hwndDlg, IDC_LIST), &lvi);
+
+ if (iRow != -1)
+ {
+ lvi.iItem = iRow;
+ lvi.mask = LVIF_IMAGE;
+ lvi.iSubItem = 1;
+ lvi.iImage = 1;
+ ListView_SetItem(::GetDlgItem(hwndDlg, IDC_LIST), &lvi);
+ }
+ ::SendMessage(::GetDlgItem(hwndDlg, IDC_CONTACTS), CB_DELETESTRING, i, 0);
+ }*/
+ }
+ break;
+ }
+ }
+ break;
+
+ case WM_NOTIFY:
+ if (reinterpret_cast<NMHDR*>(lParam)->code == PSN_APPLY && !ppro->IsOnline())
+ {
+ return TRUE;
+ }
+ break;
+
+ switch (LOWORD(wParam))
+ {
+ case IDC_LIST:
+ if (((LPNMHDR)lParam)->code == NM_DBLCLK)
+ {
+ HWND hwndList = ::GetDlgItem(hwndDlg, IDC_BM_LIST);
+ int iItem = ListView_GetNextItem(hwndList, -1, LVNI_ALL | LVNI_SELECTED);
+ if (iItem < 0) break;
+ LVITEM lvi = { 0 };
+ lvi.mask = LVIF_PARAM | LVIF_GROUPID;
+ lvi.stateMask = -1;
+ lvi.iItem = iItem;
+ if (ListView_GetItem(hwndList, &lvi))
+ {
+ /*SEString data;
+ if (lvi.iGroupId == 1)
+ {
+ ContactParam *param = (ContactParam *)lvi.lParam;
+
+ param->contact->GetIdentity(data);
+ ptrW sid(::mir_utf8decodeW(data));
+ ::CallService(MS_MSG_SENDMESSAGE, (WPARAM)ppro->GetContactBySid(sid), 0);
+ }*/
+ }
+ }
+ }
+ break;
+ }
+ return FALSE;
} \ No newline at end of file
diff --git a/protocols/Steam/src/steam_events.cpp b/protocols/Steam/src/steam_events.cpp
index 2d6daf07d3..4a61c913ef 100644
--- a/protocols/Steam/src/steam_events.cpp
+++ b/protocols/Steam/src/steam_events.cpp
@@ -56,6 +56,11 @@ int CSteamProto::OnOptionsInit(void *obj, WPARAM wParam, LPARAM lParam)
odp.pfnDlgProc = MainOptionsProc;
Options_AddPage(wParam, &odp);
+ odp.pszTab = LPGEN("Blocked contacts");
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_BLOCK_LIST);
+ odp.pfnDlgProc = BlockListOptionsProc;
+ Options_AddPage(wParam, &odp);
+
mir_free(title);
return 0;
diff --git a/protocols/Steam/src/steam_menus.cpp b/protocols/Steam/src/steam_menus.cpp
index 2f5e114cca..3fc7779e98 100644
--- a/protocols/Steam/src/steam_menus.cpp
+++ b/protocols/Steam/src/steam_menus.cpp
@@ -50,7 +50,7 @@ int CSteamProto::JoinToGameCommand(WPARAM hContact, LPARAM)
return 0;
}
-int CSteamProto::OpenBlockListCommand(WPARAM, LPARAM)
+INT_PTR CSteamProto::OpenBlockListCommand(WPARAM, LPARAM)
{
ptrA token(getStringA("TokenSecret"));
ptrA steamId(getStringA("SteamID"));
diff --git a/protocols/Steam/src/steam_proto.h b/protocols/Steam/src/steam_proto.h
index 5e307965e8..192254fb46 100644
--- a/protocols/Steam/src/steam_proto.h
+++ b/protocols/Steam/src/steam_proto.h
@@ -230,7 +230,7 @@ protected:
int __cdecl BlockCommand(WPARAM, LPARAM);
int __cdecl JoinToGameCommand(WPARAM, LPARAM);
- int __cdecl OpenBlockListCommand(WPARAM, LPARAM);
+ INT_PTR __cdecl OpenBlockListCommand(WPARAM, LPARAM);
static INT_PTR MenuChooseService(WPARAM wParam, LPARAM lParam);
@@ -263,10 +263,12 @@ protected:
static void CSteamProto::ShowNotification(const wchar_t *message, int flags = 0, MCONTACT hContact = NULL);
static void CSteamProto::ShowNotification(const wchar_t *caption, const wchar_t *message, int flags = 0, MCONTACT hContact = NULL);
- // options
+ // dialog procs
static INT_PTR CALLBACK GuardProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
static INT_PTR CALLBACK CaptchaProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
static INT_PTR CALLBACK MainOptionsProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
+ static LRESULT CALLBACK BlockListOptionsSubProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
+ static INT_PTR CALLBACK BlockListOptionsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
};
#endif //_STEAM_PROTO_H_ \ No newline at end of file