summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2019-04-12 23:28:07 +0300
committerGeorge Hazan <ghazan@miranda.im>2019-04-12 23:28:07 +0300
commitd25596f202a26ebc98a41340f9454c173a7e797f (patch)
tree85013f220799cbb2a01fa3011c5bbf56ffe25609 /protocols
parent1962493ef2d0111b548d89149ad3bf8424704cf1 (diff)
YAMN: another burst of insight
Diffstat (limited to 'protocols')
-rw-r--r--protocols/YAMN/src/browser/badconnect.cpp6
-rw-r--r--protocols/YAMN/src/browser/mailbrowser.cpp18
-rw-r--r--protocols/YAMN/src/main.cpp18
-rw-r--r--protocols/YAMN/src/proto/pop3/pop3opt.cpp57
-rw-r--r--protocols/YAMN/src/services.cpp4
-rw-r--r--protocols/YAMN/src/stdafx.h3
6 files changed, 41 insertions, 65 deletions
diff --git a/protocols/YAMN/src/browser/badconnect.cpp b/protocols/YAMN/src/browser/badconnect.cpp
index 678eb1f337..86e202d2e6 100644
--- a/protocols/YAMN/src/browser/badconnect.cpp
+++ b/protocols/YAMN/src/browser/badconnect.cpp
@@ -109,7 +109,7 @@ INT_PTR CALLBACK DlgProcYAMNBadConnection(HWND hDlg, UINT msg, WPARAM wParam, LP
ShowIco = ActualAccount->BadConnectN.Flags & YAMN_ACC_ICO;
if (ShowPopup) {
- BadConnectPopup.lchIcon = g_LoadIconEx(3);
+ BadConnectPopup.lchIcon = g_plugin.getIcon(IDI_BADCONNECT);
BadConnectPopup.colorBack = ActualAccount->BadConnectN.Flags & YAMN_ACC_POPC ? ActualAccount->BadConnectN.PopupB : GetSysColor(COLOR_BTNFACE);
BadConnectPopup.colorText = ActualAccount->BadConnectN.Flags & YAMN_ACC_POPC ? ActualAccount->BadConnectN.PopupT : GetSysColor(COLOR_WINDOWTEXT);
BadConnectPopup.iSeconds = ActualAccount->BadConnectN.PopupTime;
@@ -220,7 +220,7 @@ void __cdecl BadConnection(void *Param)
__try {
hBadConnect = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_DLGBADCONNECT), nullptr, DlgProcYAMNBadConnection, (LPARAM)&MyParam);
- Window_SetIcon_IcoLib(hBadConnect, g_GetIconHandle(3));
+ Window_SetIcon_IcoLib(hBadConnect, g_plugin.getIconHandle(IDI_BADCONNECT));
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile, "BadConnect:ActualAccountSO-read wait\n");
@@ -244,7 +244,7 @@ void __cdecl BadConnection(void *Param)
NOTIFYICONDATA nid = {};
nid.cbSize = sizeof(nid);
nid.hWnd = hBadConnect;
- nid.hIcon = g_LoadIconEx(3);
+ nid.hIcon = g_plugin.getIcon(IDI_BADCONNECT);
nid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
nid.uCallbackMessage = WM_YAMN_NOTIFYICON;
mir_snwprintf(nid.szTip, L"%S%s", ActualAccount->Name, TranslateT(" - connection error"));
diff --git a/protocols/YAMN/src/browser/mailbrowser.cpp b/protocols/YAMN/src/browser/mailbrowser.cpp
index 6321141135..b225516021 100644
--- a/protocols/YAMN/src/browser/mailbrowser.cpp
+++ b/protocols/YAMN/src/browser/mailbrowser.cpp
@@ -497,7 +497,7 @@ int AddNewMailsToListView(HWND hListView, CAccount *ActualAccount, DWORD nflags)
POPUPDATAW NewMailPopup = {};
NewMailPopup.lchContact = (ActualAccount->hContact != NULL) ? ActualAccount->hContact : (UINT_PTR)ActualAccount;
- NewMailPopup.lchIcon = g_LoadIconEx(2);
+ NewMailPopup.lchIcon = g_plugin.getIcon(IDI_NEWMAIL);
if (nflags & YAMN_ACC_POPC) {
NewMailPopup.colorBack = ActualAccount->NewMailN.PopupB;
NewMailPopup.colorText = ActualAccount->NewMailN.PopupT;
@@ -640,7 +640,7 @@ void DoMailActions(HWND hDlg, CAccount *ActualAccount, struct CMailNumbers *MN,
CLISTEVENT evt = {};
evt.flags = CLEF_UNICODE;
evt.hContact = ActualAccount->hContact;
- evt.hIcon = g_LoadIconEx(2);
+ evt.hIcon = g_plugin.getIcon(IDI_NEWMAIL);
evt.hDbEvent = ActualAccount->hContact;
evt.lParam = ActualAccount->hContact;
evt.pszService = MS_YAMN_CLISTDBLCLICK;
@@ -659,7 +659,7 @@ void DoMailActions(HWND hDlg, CAccount *ActualAccount, struct CMailNumbers *MN,
POPUPDATAW NewMailPopup;
NewMailPopup.lchContact = (ActualAccount->hContact != NULL) ? ActualAccount->hContact : (UINT_PTR)ActualAccount;
- NewMailPopup.lchIcon = g_LoadIconEx(2);
+ NewMailPopup.lchIcon = g_plugin.getIcon(IDI_NEWMAIL);
if (nflags & YAMN_ACC_POPC) {
NewMailPopup.colorBack = ActualAccount->NewMailN.PopupB;
NewMailPopup.colorText = ActualAccount->NewMailN.PopupT;
@@ -701,7 +701,7 @@ void DoMailActions(HWND hDlg, CAccount *ActualAccount, struct CMailNumbers *MN,
SendDlgItemMessageW(hDlg, IDC_LISTMAILS, LVM_SCROLL, 0, (LPARAM)0x7ffffff);
if ((nflags & YAMN_ACC_ICO) && (MN->Real.SysTrayUC + MN->Virtual.SysTrayUC)) {
- nid.hIcon = g_LoadIconEx(2);
+ nid.hIcon = g_plugin.getIcon(IDI_NEWMAIL);
nid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
nid.uCallbackMessage = WM_YAMN_NOTIFYICON;
mir_snwprintf(nid.szTip, L"%S %s", ActualAccount->Name, TranslateT("- new mail message(s)"));
@@ -747,7 +747,7 @@ void DoMailActions(HWND hDlg, CAccount *ActualAccount, struct CMailNumbers *MN,
POPUPDATAW NoNewMailPopup = {};
NoNewMailPopup.lchContact = (ActualAccount->hContact != NULL) ? ActualAccount->hContact : (UINT_PTR)ActualAccount;
- NoNewMailPopup.lchIcon = g_LoadIconEx(1);
+ NoNewMailPopup.lchIcon = g_plugin.getIcon(IDI_LAUNCHAPP);
if (nflags & YAMN_ACC_POPC) {
NoNewMailPopup.colorBack = ActualAccount->NoNewMailN.PopupB;
NoNewMailPopup.colorText = ActualAccount->NoNewMailN.PopupT;
@@ -1261,7 +1261,7 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg, UINT msg, WPARAM wParam, LPAR
HWND hListView = GetDlgItem(hDlg, IDC_LISTHEADERS);
mir_subclassWindow(GetDlgItem(hDlg, IDC_SPLITTER), SplitterSubclassProc);
SetWindowLongPtr(hDlg, DWLP_USER, (LONG_PTR)MailParam);
- Window_SetIcon_IcoLib(hDlg, g_GetIconHandle(2));
+ Window_SetIcon_IcoLib(hDlg, g_plugin.getIconHandle(IDI_NEWMAIL));
ListView_SetUnicodeFormat(hListView, TRUE);
ListView_SetExtendedListViewStyle(hListView, LVS_EX_FULLROWSELECT);
@@ -2083,9 +2083,9 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR
nid.uID = 0;
nid.uFlags = NIF_ICON;
if (mwui->TrayIconState == 0)
- nid.hIcon = g_LoadIconEx(0);
+ nid.hIcon = g_plugin.getIcon(IDI_CHECKMAIL);
else
- nid.hIcon = g_LoadIconEx(2);
+ nid.hIcon = g_plugin.getIcon(IDI_NEWMAIL);
Shell_NotifyIcon(NIM_MODIFY, &nid);
mwui->TrayIconState = !mwui->TrayIconState;
// UpdateWindow(hDlg);
@@ -2320,7 +2320,7 @@ void __cdecl MailBrowser(void *Param)
if ((hMailBrowser == nullptr) && ((MyParam.nflags & YAMN_ACC_MSG) || (MyParam.nflags & YAMN_ACC_ICO) || (MyParam.nnflags & YAMN_ACC_MSG))) {
hMailBrowser = CreateDialogParamW(g_plugin.getInst(), MAKEINTRESOURCEW(IDD_DLGVIEWMESSAGES), nullptr, DlgProcYAMNMailBrowser, (LPARAM)&MyParam);
- Window_SetIcon_IcoLib(hMailBrowser, g_GetIconHandle(2));
+ Window_SetIcon_IcoLib(hMailBrowser, g_plugin.getIconHandle(IDI_NEWMAIL));
MoveWindow(hMailBrowser, PosX, PosY, SizeX, SizeY, TRUE);
}
diff --git a/protocols/YAMN/src/main.cpp b/protocols/YAMN/src/main.cpp
index 9bdbf83504..d214f5e982 100644
--- a/protocols/YAMN/src/main.cpp
+++ b/protocols/YAMN/src/main.cpp
@@ -126,7 +126,7 @@ int SystemModulesLoaded(WPARAM, LPARAM)
SET_UID(mi, 0xa01ff3d9, 0x53cb, 0x4406, 0x85, 0xd9, 0xf1, 0x90, 0x3a, 0x94, 0xed, 0xf4);
mi.position = 0xb0000000;
- mi.hIcolibItem = g_GetIconHandle(0);
+ mi.hIcolibItem = g_plugin.getIconHandle(IDI_CHECKMAIL);
mi.name.a = LPGEN("Check &mail (All Account)");
mi.pszService = MS_YAMN_FORCECHECK;
hMenuItemMain = Menu_AddMainMenuItem(&mi);
@@ -137,7 +137,7 @@ int SystemModulesLoaded(WPARAM, LPARAM)
hMenuItemCont = Menu_AddContactMenuItem(&mi, YAMN_DBMODULE);
SET_UID(mi, 0x147c7800, 0x12d0, 0x4209, 0xab, 0xcc, 0xfa, 0x64, 0xc6, 0xb0, 0xa6, 0xeb);
- mi.hIcolibItem = g_GetIconHandle(1);
+ mi.hIcolibItem = g_plugin.getIconHandle(IDI_LAUNCHAPP);
mi.name.a = LPGEN("Launch application");
mi.pszService = MS_YAMN_CLISTCONTEXTAPP;
hMenuItemContApp = Menu_AddContactMenuItem(&mi, YAMN_DBMODULE);
@@ -166,20 +166,6 @@ void LoadIcons()
g_plugin.registerIcon("YAMN", iconList);
}
-HANDLE WINAPI g_GetIconHandle(int idx)
-{
- if (idx >= _countof(iconList))
- return nullptr;
- return iconList[idx].hIcolib;
-}
-
-HICON WINAPI g_LoadIconEx(int idx, bool big)
-{
- if (idx >= _countof(iconList))
- return nullptr;
- return IcoLib_GetIcon(iconList[idx].szName, big);
-}
-
static void LoadPlugins()
{
wchar_t szSearchPath[MAX_PATH];
diff --git a/protocols/YAMN/src/proto/pop3/pop3opt.cpp b/protocols/YAMN/src/proto/pop3/pop3opt.cpp
index 83551a631c..4d4993de70 100644
--- a/protocols/YAMN/src/proto/pop3/pop3opt.cpp
+++ b/protocols/YAMN/src/proto/pop3/pop3opt.cpp
@@ -1248,6 +1248,7 @@ INT_PTR CALLBACK DlgProcPOP3AccPopup(HWND hDlg, UINT msg, WPARAM wParam, LPARAM
case IDC_RADIOPOP1:
Changed = TRUE;
break;
+
case IDC_CPB:
case IDC_CPT:
case IDC_CPFB:
@@ -1256,6 +1257,7 @@ INT_PTR CALLBACK DlgProcPOP3AccPopup(HWND hDlg, UINT msg, WPARAM wParam, LPARAM
case IDC_CPNT:
if (HIWORD(wParam) != CPN_COLOURCHANGED)
break;
+
case IDC_CHECKCOL:
case IDC_CHECKFCOL:
case IDC_CHECKNCOL:
@@ -1269,25 +1271,12 @@ INT_PTR CALLBACK DlgProcPOP3AccPopup(HWND hDlg, UINT msg, WPARAM wParam, LPARAM
break;
case IDC_PREVIEW:
- {
+ if (IsDlgButtonChecked(hDlg, IDC_CHECKPOP) == BST_CHECKED) {
POPUPDATAW Tester = {};
- POPUPDATAW TesterF = {};
- POPUPDATAW TesterN = {};
- BOOL TesterC = (IsDlgButtonChecked(hDlg, IDC_CHECKCOL) == BST_CHECKED);
- BOOL TesterFC = (IsDlgButtonChecked(hDlg, IDC_CHECKFCOL) == BST_CHECKED);
- BOOL TesterNC = (IsDlgButtonChecked(hDlg, IDC_CHECKNCOL) == BST_CHECKED);
-
- Tester.lchIcon = g_LoadIconEx(2);
- TesterF.lchIcon = g_LoadIconEx(3);
- TesterN.lchIcon = g_LoadIconEx(1);
-
+ Tester.lchIcon = g_plugin.getIcon(IDI_NEWMAIL);
mir_wstrncpy(Tester.lpwzContactName, TranslateT("Account Test"), MAX_CONTACTNAME);
- mir_wstrncpy(TesterF.lpwzContactName, TranslateT("Account Test (failed)"), MAX_CONTACTNAME);
- mir_wstrncpy(TesterN.lpwzContactName, TranslateT("Account Test"), MAX_CONTACTNAME);
mir_wstrncpy(Tester.lpwzText, TranslateT("You have N new mail messages"), MAX_SECONDLINE);
- mir_wstrncpy(TesterF.lpwzText, TranslateT("Connection failed message"), MAX_SECONDLINE);
- mir_wstrncpy(TesterN.lpwzText, TranslateT("No new mail message"), MAX_SECONDLINE);
- if (TesterC) {
+ if (IsDlgButtonChecked(hDlg, IDC_CHECKCOL) == BST_CHECKED) {
Tester.colorBack = SendDlgItemMessage(hDlg, IDC_CPB, CPM_GETCOLOUR, 0, 0);
Tester.colorText = SendDlgItemMessage(hDlg, IDC_CPT, CPM_GETCOLOUR, 0, 0);
}
@@ -1295,7 +1284,14 @@ INT_PTR CALLBACK DlgProcPOP3AccPopup(HWND hDlg, UINT msg, WPARAM wParam, LPARAM
Tester.colorBack = GetSysColor(COLOR_BTNFACE);
Tester.colorText = GetSysColor(COLOR_WINDOWTEXT);
}
- if (TesterFC) {
+ PUAddPopupW(&Tester);
+ }
+ if (IsDlgButtonChecked(hDlg, IDC_CHECKFPOP) == BST_CHECKED) {
+ POPUPDATAW TesterF = {};
+ TesterF.lchIcon = g_plugin.getIcon(IDI_BADCONNECT);
+ mir_wstrncpy(TesterF.lpwzContactName, TranslateT("Account Test (failed)"), MAX_CONTACTNAME);
+ mir_wstrncpy(TesterF.lpwzText, TranslateT("Connection failed message"), MAX_SECONDLINE);
+ if (IsDlgButtonChecked(hDlg, IDC_CHECKFCOL) == BST_CHECKED) {
TesterF.colorBack = SendDlgItemMessage(hDlg, IDC_CPFB, CPM_GETCOLOUR, 0, 0);
TesterF.colorText = SendDlgItemMessage(hDlg, IDC_CPFT, CPM_GETCOLOUR, 0, 0);
}
@@ -1303,7 +1299,14 @@ INT_PTR CALLBACK DlgProcPOP3AccPopup(HWND hDlg, UINT msg, WPARAM wParam, LPARAM
TesterF.colorBack = GetSysColor(COLOR_BTNFACE);
TesterF.colorText = GetSysColor(COLOR_WINDOWTEXT);
}
- if (TesterNC) {
+ PUAddPopupW(&TesterF);
+ }
+ if (IsDlgButtonChecked(hDlg, IDC_CHECKNPOP) == BST_CHECKED) {
+ POPUPDATAW TesterN = {};
+ TesterN.lchIcon = g_plugin.getIcon(IDI_LAUNCHAPP);
+ mir_wstrncpy(TesterN.lpwzContactName, TranslateT("Account Test"), MAX_CONTACTNAME);
+ mir_wstrncpy(TesterN.lpwzText, TranslateT("No new mail message"), MAX_SECONDLINE);
+ if (IsDlgButtonChecked(hDlg, IDC_CHECKNCOL) == BST_CHECKED) {
TesterN.colorBack = SendDlgItemMessage(hDlg, IDC_CPNB, CPM_GETCOLOUR, 0, 0);
TesterN.colorText = SendDlgItemMessage(hDlg, IDC_CPNT, CPM_GETCOLOUR, 0, 0);
}
@@ -1311,25 +1314,15 @@ INT_PTR CALLBACK DlgProcPOP3AccPopup(HWND hDlg, UINT msg, WPARAM wParam, LPARAM
TesterN.colorBack = GetSysColor(COLOR_BTNFACE);
TesterN.colorText = GetSysColor(COLOR_WINDOWTEXT);
}
- Tester.PluginWindowProc = nullptr;
- TesterF.PluginWindowProc = nullptr;
- TesterN.PluginWindowProc = nullptr;
- Tester.PluginData = nullptr;
- TesterF.PluginData = nullptr;
- TesterN.PluginData = nullptr;
-
- if (IsDlgButtonChecked(hDlg, IDC_CHECKPOP) == BST_CHECKED)
- PUAddPopupW(&Tester);
- if (IsDlgButtonChecked(hDlg, IDC_CHECKFPOP) == BST_CHECKED)
- PUAddPopupW(&TesterF);
- if (IsDlgButtonChecked(hDlg, IDC_CHECKNPOP) == BST_CHECKED)
- PUAddPopupW(&TesterN);
- Changed = TRUE;
+ PUAddPopupW(&TesterN);
}
+ Changed = TRUE;
break;
+
case IDC_CHECKKBN:
Changed = TRUE;
break;
+
case IDC_CHECKPOP:
Changed = TRUE;
EnableWindow(GetDlgItem(hDlg, IDC_CHECKCOL), IsDlgButtonChecked(hDlg, IDC_CHECKPOP) == BST_CHECKED);
diff --git a/protocols/YAMN/src/services.cpp b/protocols/YAMN/src/services.cpp
index 3ddae133c6..771367d479 100644
--- a/protocols/YAMN/src/services.cpp
+++ b/protocols/YAMN/src/services.cpp
@@ -44,7 +44,7 @@ static INT_PTR Service_GetName(WPARAM wParam, LPARAM lParam)
static INT_PTR Service_LoadIcon(WPARAM wParam, LPARAM)
{
if (LOWORD(wParam) == PLI_PROTOCOL)
- return (INT_PTR)CopyIcon(g_LoadIconEx(0)); // noone cares about other than PLI_PROTOCOL
+ return (INT_PTR)CopyIcon(g_plugin.getIcon(IDI_CHECKMAIL)); // noone cares about other than PLI_PROTOCOL
return (INT_PTR)(HICON)NULL;
}
@@ -297,7 +297,7 @@ int AddTopToolbarIcon(WPARAM, LPARAM)
TTBButton btn = {};
btn.pszService = MS_YAMN_FORCECHECK;
btn.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP;
- btn.hIconHandleUp = btn.hIconHandleDn = g_GetIconHandle(0);
+ btn.hIconHandleUp = btn.hIconHandleDn = g_plugin.getIconHandle(IDI_CHECKMAIL);
btn.name = btn.pszTooltipUp = LPGEN("Check mail");
hTTButton = g_plugin.addTTB(&btn);
}
diff --git a/protocols/YAMN/src/stdafx.h b/protocols/YAMN/src/stdafx.h
index f0919e24b8..44bb1037dd 100644
--- a/protocols/YAMN/src/stdafx.h
+++ b/protocols/YAMN/src/stdafx.h
@@ -178,9 +178,6 @@ extern HANDLE hTTButton;
extern HCURSOR hCurSplitNS, hCurSplitWE;
extern UINT SecTimer;
-HANDLE WINAPI g_GetIconHandle(int idx);
-HICON WINAPI g_LoadIconEx(int idx, bool big = false);
-
//From synchro.cpp
void WINAPI DeleteMessagesToEndFcn(CAccount *Account, HYAMNMAIL From);
DWORD WINAPI WaitToWriteFcn(PSWMRG SObject, PSCOUNTER SCounter = nullptr);