summaryrefslogtreecommitdiff
path: root/protocols/ICQ-WIM
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2019-08-22 21:41:01 +0300
committerGeorge Hazan <ghazan@miranda.im>2019-08-22 21:41:01 +0300
commitbd1aa37996b30d2140e134ebba328c84c92da40c (patch)
tree7a7fd3b57893df799c8c5a59e751fa399f763e4c /protocols/ICQ-WIM
parent6c4788805f2df5b0953010d54c59a3ed71ea5031 (diff)
ICQ-WIM: experimental server group editor
Diffstat (limited to 'protocols/ICQ-WIM')
-rw-r--r--protocols/ICQ-WIM/res/resources.rc57
-rw-r--r--protocols/ICQ-WIM/src/groupchats.cpp6
-rw-r--r--protocols/ICQ-WIM/src/options.cpp16
-rw-r--r--protocols/ICQ-WIM/src/proto.cpp77
-rw-r--r--protocols/ICQ-WIM/src/proto.h6
-rw-r--r--protocols/ICQ-WIM/src/resource.h7
6 files changed, 153 insertions, 16 deletions
diff --git a/protocols/ICQ-WIM/res/resources.rc b/protocols/ICQ-WIM/res/resources.rc
index 03271bb855..fb02a5186a 100644
--- a/protocols/ICQ-WIM/res/resources.rc
+++ b/protocols/ICQ-WIM/res/resources.rc
@@ -12,6 +12,63 @@
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
+// Russian (Russia) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS)
+LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
+#pragma code_page(1251)
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_EDITGROUPS DIALOGEX 0, 0, 262, 255
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Edit server groups"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ DEFPUSHBUTTON "OK",IDOK,205,234,50,14
+ CONTROL "",IDC_GROUPS,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | LVS_AUTOARRANGE | LVS_ALIGNLEFT | WS_BORDER | WS_TABSTOP,7,7,248,222
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO
+BEGIN
+ IDD_EDITGROUPS, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 255
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 248
+ END
+END
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// AFX_DIALOG_LAYOUT
+//
+
+IDD_EDITGROUPS AFX_DIALOG_LAYOUT
+BEGIN
+ 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 100
+END
+
+#endif // Russian (Russia) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
// English (United States) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
diff --git a/protocols/ICQ-WIM/src/groupchats.cpp b/protocols/ICQ-WIM/src/groupchats.cpp
index 84a293684c..dc5747e0c8 100644
--- a/protocols/ICQ-WIM/src/groupchats.cpp
+++ b/protocols/ICQ-WIM/src/groupchats.cpp
@@ -83,10 +83,8 @@ void CIcqProto::OnGetChatInfo(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest *pReq)
/////////////////////////////////////////////////////////////////////////////////////////
// Invitation dialog
-class CGroupchatInviteDlg : public CProtoDlgBase<CIcqProto>
+class CGroupchatInviteDlg : public CIcqDlgBase
{
- typedef CProtoDlgBase<CIcqProto> CSuper;
-
CCtrlClc m_clc;
SESSION_INFO *m_si;
@@ -115,7 +113,7 @@ class CGroupchatInviteDlg : public CProtoDlgBase<CIcqProto>
public:
CGroupchatInviteDlg(CIcqProto *ppro, SESSION_INFO *si) :
- CSuper(ppro, IDD_GROUPCHAT_INVITE),
+ CIcqDlgBase(ppro, IDD_GROUPCHAT_INVITE),
m_si(si),
m_clc(this, IDC_CLIST)
{
diff --git a/protocols/ICQ-WIM/src/options.cpp b/protocols/ICQ-WIM/src/options.cpp
index 09b9866f68..8469b3eaef 100644
--- a/protocols/ICQ-WIM/src/options.cpp
+++ b/protocols/ICQ-WIM/src/options.cpp
@@ -20,14 +20,14 @@
#include "stdafx.h"
-class CIcqEnterLoginDlg : public CProtoDlgBase<CIcqProto>
+class CIcqEnterLoginDlg : public CIcqDlgBase
{
CCtrlEdit edtPass;
CCtrlCheck chkSave;
public:
CIcqEnterLoginDlg(CIcqProto *ppro) :
- CProtoDlgBase<CIcqProto>(ppro, IDD_LOGINPW),
+ CIcqDlgBase(ppro, IDD_LOGINPW),
edtPass(this, IDC_PASSWORD),
chkSave(this, IDC_SAVEPASS)
{
@@ -75,7 +75,7 @@ bool CIcqProto::RetrievePassword()
/////////////////////////////////////////////////////////////////////////////////////////
-struct CIcqRegistrationDlg : public CProtoDlgBase<CIcqProto>
+struct CIcqRegistrationDlg : public CIcqDlgBase
{
CMStringA szTrans, szMsisdn;
int iErrorCode = 0;
@@ -84,7 +84,7 @@ struct CIcqRegistrationDlg : public CProtoDlgBase<CIcqProto>
CCtrlButton btnSendSms;
CIcqRegistrationDlg(CIcqProto *ppro) :
- CProtoDlgBase<CIcqProto>(ppro, IDD_REGISTER),
+ CIcqDlgBase(ppro, IDD_REGISTER),
edtPhone(this, IDC_PHONE),
edtCode(this, IDC_CODE),
btnSendSms(this, IDC_SENDSMS)
@@ -210,7 +210,7 @@ void CIcqProto::OnLoginViaPhone(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest *pRe
/////////////////////////////////////////////////////////////////////////////////////////
-class CIcqOptionsDlg : public CProtoDlgBase<CIcqProto>
+class CIcqOptionsDlg : public CIcqDlgBase
{
CCtrlEdit edtUin, edtPassword;
CCtrlCheck chkHideChats, chkTrayIcon, chkLaunchMailbox, chkShowErrorPopups;
@@ -219,7 +219,7 @@ class CIcqOptionsDlg : public CProtoDlgBase<CIcqProto>
public:
CIcqOptionsDlg(CIcqProto *ppro, int iDlgID, bool bFullDlg) :
- CProtoDlgBase<CIcqProto>(ppro, iDlgID),
+ CIcqDlgBase(ppro, iDlgID),
edtUin(this, IDC_UIN),
btnCreate(this, IDC_REGISTER),
edtPassword(this, IDC_PASSWORD),
@@ -290,7 +290,7 @@ public:
/////////////////////////////////////////////////////////////////////////////////////////
// Advanced options
-class CIcqOptionsAdv : public CProtoDlgBase<CIcqProto>
+class CIcqOptionsAdv : public CIcqDlgBase
{
CCtrlEdit edtDiff1, edtDiff2;
CCtrlSpin spin1, spin2;
@@ -298,7 +298,7 @@ class CIcqOptionsAdv : public CProtoDlgBase<CIcqProto>
public:
CIcqOptionsAdv(CIcqProto *ppro) :
- CProtoDlgBase<CIcqProto>(ppro, IDD_OPTIONS_ADV),
+ CIcqDlgBase(ppro, IDD_OPTIONS_ADV),
spin1(this, IDC_SPIN1, 32000),
spin2(this, IDC_SPIN2, 32000),
edtDiff1(this, IDC_DIFF1),
diff --git a/protocols/ICQ-WIM/src/proto.cpp b/protocols/ICQ-WIM/src/proto.cpp
index abfab56f45..819637f707 100644
--- a/protocols/ICQ-WIM/src/proto.cpp
+++ b/protocols/ICQ-WIM/src/proto.cpp
@@ -160,6 +160,13 @@ void CIcqProto::OnBuildProtoMenu()
mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_GROUP);
m_hUploadGroups = Menu_AddProtoMenuItem(&mi, m_szModuleName);
+ mi.pszService = "/EditGroups";
+ CreateProtoService(mi.pszService, &CIcqProto::EditGroups);
+ mi.name.a = LPGEN("Edit server groups");
+ mi.position = 200002;
+ mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_GROUP);
+ Menu_AddProtoMenuItem(&mi, m_szModuleName);
+
Menu_ShowItem(m_hUploadGroups, false);
}
@@ -181,6 +188,76 @@ INT_PTR CIcqProto::UploadGroups(WPARAM, LPARAM)
/////////////////////////////////////////////////////////////////////////////////////////
+class CGroupEditDlg : public CIcqDlgBase
+{
+ CCtrlListView groups;
+
+ void RefreshGroups()
+ {
+ for (auto &it : m_proto->m_arGroups.rev_iter())
+ groups.AddItem(it->wszName, 0, (LPARAM)it);
+ }
+
+public:
+ CGroupEditDlg(CIcqProto *ppro) :
+ CIcqDlgBase(ppro, IDD_EDITGROUPS),
+ groups(this, IDC_GROUPS)
+ {
+ groups.OnBuildMenu = Callback(this, &CGroupEditDlg::onMenu);
+ }
+
+ bool OnInitDialog() override
+ {
+ groups.AddColumn(0, TranslateT("Name"), 300);
+ RefreshGroups();
+ return true;
+ }
+
+ void onMenu(void *)
+ {
+ int cur = groups.GetSelectionMark();
+ if (cur == -1)
+ return;
+
+ IcqGroup *pGroup = (IcqGroup *)groups.GetItemData(cur);
+
+ HMENU hMenu = CreatePopupMenu();
+ AppendMenu(hMenu, MF_STRING, 1, TranslateT("Rename"));
+ AppendMenu(hMenu, MF_STRING, 2, TranslateT("Delete"));
+
+ POINT pt;
+ GetCursorPos(&pt);
+ int cmd = TrackPopupMenu(hMenu, TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, m_hwnd, nullptr);
+ DestroyMenu(hMenu);
+
+ CLISTGROUPCHANGE param = { pGroup->wszName, nullptr };
+
+ if (cmd == 1) { // rename
+ ENTER_STRING es = {};
+ es.cbSize = sizeof(es);
+ es.type = ES_MULTILINE;
+ es.caption = TranslateT("Enter new group name");
+ if (!EnterString(&es))
+ return;
+
+ param.pszNewName = es.ptszResult;
+ m_proto->OnGroupChange(0, (LPARAM)&param);
+ mir_free(es.ptszResult);
+ }
+ else if (cmd == 2) { // delete
+ m_proto->OnGroupChange(0, (LPARAM)&param);
+ }
+ }
+};
+
+INT_PTR CIcqProto::EditGroups(WPARAM, LPARAM)
+{
+ (new CGroupEditDlg(this))->Show();
+ return 0;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
INT_PTR CIcqProto::GetEmailCount(WPARAM, LPARAM)
{
if (!m_bOnline)
diff --git a/protocols/ICQ-WIM/src/proto.h b/protocols/ICQ-WIM/src/proto.h
index 60375bab77..7aca4717bc 100644
--- a/protocols/ICQ-WIM/src/proto.h
+++ b/protocols/ICQ-WIM/src/proto.h
@@ -34,9 +34,9 @@
#include "m_protoint.h"
#define ICQ_APP_ID "ic1nmMjqg7Yu-0hL"
-#define ICQ_API_SERVER "https://api.icq.net"
+#define ICQ_API_SERVER "https://u.icq.net/wim"
#define ICQ_FAKE_EVENT_ID 0xBABAEB
-#define ICQ_ROBUST_SERVER "https://rapi.icq.net"
+#define ICQ_ROBUST_SERVER "https://u.icq.net/rapi"
#define PS_DUMMY "/DoNothing"
#define PS_GOTO_INBOX "/GotoInbox"
@@ -176,6 +176,7 @@ class CIcqProto : public PROTO<CIcqProto>
friend class CEditIgnoreListDlg;
friend class CIcqEnterLoginDlg;
friend class CIcqOptionsDlg;
+ friend class CGroupEditDlg;
friend AsyncHttpRequest* operator <<(AsyncHttpRequest*, const AIMSID&);
@@ -328,6 +329,7 @@ class CIcqProto : public PROTO<CIcqProto>
INT_PTR __cdecl SetAvatar(WPARAM, LPARAM);
INT_PTR __cdecl CreateAccMgrUI(WPARAM, LPARAM);
+ INT_PTR __cdecl EditGroups(WPARAM, LPARAM);
INT_PTR __cdecl GetEmailCount(WPARAM, LPARAM);
INT_PTR __cdecl GotoInbox(WPARAM, LPARAM);
INT_PTR __cdecl UploadGroups(WPARAM, LPARAM);
diff --git a/protocols/ICQ-WIM/src/resource.h b/protocols/ICQ-WIM/src/resource.h
index 9bdf21e844..01bf0841b2 100644
--- a/protocols/ICQ-WIM/src/resource.h
+++ b/protocols/ICQ-WIM/src/resource.h
@@ -12,6 +12,7 @@
#define IDI_MAIL_NOTIFY 108
#define IDD_OPTIONS_ADV 109
#define IDD_LOGINPW 110
+#define IDD_EDITGROUPS 111
#define IDC_PASSWORD 1001
#define IDC_UIN 1002
#define IDC_UIN2 1003
@@ -36,15 +37,17 @@
#define IDC_SHOWERRORPOPUPS 1022
#define IDC_DIFF2 1023
#define IDC_SPIN2 1024
+#define IDC_LIST1 1024
#define IDC_STATUS2 1025
+#define IDC_GROUPS 1025
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 110
+#define _APS_NEXT_RESOURCE_VALUE 113
#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1023
+#define _APS_NEXT_CONTROL_VALUE 1026
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif