summaryrefslogtreecommitdiff
path: root/protocols/YAMN/src
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/YAMN/src')
-rw-r--r--protocols/YAMN/src/account.cpp6
-rw-r--r--protocols/YAMN/src/browser/mailbrowser.cpp26
-rw-r--r--protocols/YAMN/src/main.cpp12
-rw-r--r--protocols/YAMN/src/proto/pop3/pop3opt.cpp10
-rw-r--r--protocols/YAMN/src/services.cpp2
-rw-r--r--protocols/YAMN/src/stdafx.h7
-rw-r--r--protocols/YAMN/src/yamn.cpp2
-rw-r--r--protocols/YAMN/src/yamn.h53
8 files changed, 87 insertions, 31 deletions
diff --git a/protocols/YAMN/src/account.cpp b/protocols/YAMN/src/account.cpp
index 3c834b28cc..4e2fad5824 100644
--- a/protocols/YAMN/src/account.cpp
+++ b/protocols/YAMN/src/account.cpp
@@ -895,7 +895,7 @@ int DeleteAccount(YAMN_PROTOPLUGIN *Plugin, CAccount *Which)
{
// 1. set stop signal
StopSignalFcn(Which);
- WindowList_BroadcastAsync(YAMNVar.MessageWnds, WM_YAMN_STOPACCOUNT, (WPARAM)Which, 0);
+ WindowList_BroadcastAsync(MessageWnds, WM_YAMN_STOPACCOUNT, (WPARAM)Which, 0);
if (Plugin->Fcn->StopAccountFcnPtr != nullptr)
Plugin->Fcn->StopAccountFcnPtr(Which);
@@ -948,7 +948,7 @@ int StopAccounts(YAMN_PROTOPLUGIN *Plugin)
for (Finder = Plugin->FirstAccount; Finder != nullptr; Finder = Finder->Next) {
// 2. set stop signal
StopSignalFcn(Finder);
- WindowList_BroadcastAsync(YAMNVar.MessageWnds, WM_YAMN_STOPACCOUNT, (WPARAM)Finder, 0);
+ WindowList_BroadcastAsync(MessageWnds, WM_YAMN_STOPACCOUNT, (WPARAM)Finder, 0);
if (Plugin->Fcn->StopAccountFcnPtr != nullptr)
Plugin->Fcn->StopAccountFcnPtr(Finder);
}
@@ -1006,5 +1006,5 @@ void SetStatusFcn(CAccount *Which, wchar_t *Value)
mir_wstrcpy(Which->Status, Value);
}
- WindowList_BroadcastAsync(YAMNVar.MessageWnds, WM_YAMN_CHANGESTATUS, (WPARAM)Which, 0);
+ WindowList_BroadcastAsync(MessageWnds, WM_YAMN_CHANGESTATUS, (WPARAM)Which, 0);
}
diff --git a/protocols/YAMN/src/browser/mailbrowser.cpp b/protocols/YAMN/src/browser/mailbrowser.cpp
index 15c3310589..83e6edbbcf 100644
--- a/protocols/YAMN/src/browser/mailbrowser.cpp
+++ b/protocols/YAMN/src/browser/mailbrowser.cpp
@@ -732,11 +732,11 @@ LRESULT CALLBACK NewMailPopupProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa
case UM_INITPOPUP:
// This is the equivalent to WM_INITDIALOG you'd get if you were the maker of dialog popups.
- WindowList_Add(YAMNVar.MessageWnds, hWnd);
+ WindowList_Add(MessageWnds, hWnd);
break;
case UM_DESTROYPOPUP:
- WindowList_Remove(YAMNVar.MessageWnds, hWnd);
+ WindowList_Remove(MessageWnds, hWnd);
break;
case WM_YAMN_STOPACCOUNT:
@@ -781,11 +781,11 @@ LRESULT CALLBACK NoNewMailPopupProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM l
case UM_INITPOPUP:
// This is the equivalent to WM_INITDIALOG you'd get if you were the maker of dialog popups.
- WindowList_Add(YAMNVar.MessageWnds, hWnd);
+ WindowList_Add(MessageWnds, hWnd);
break;
case UM_DESTROYPOPUP:
- WindowList_Remove(YAMNVar.MessageWnds, hWnd);
+ WindowList_Remove(MessageWnds, hWnd);
break;
case WM_YAMN_STOPACCOUNT:
@@ -1217,7 +1217,7 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg, UINT msg, WPARAM wParam, LPAR
else {
if (MailParam->mail->Flags & YAMN_MSG_UNSEEN) {
MailParam->mail->Flags &= ~YAMN_MSG_UNSEEN; // mark the message as seen
- HWND hMailBrowser = WindowList_Find(YAMNVar.NewMailAccountWnd, (UINT_PTR)MailParam->account);
+ HWND hMailBrowser = WindowList_Find(NewMailAccountWnd, (UINT_PTR)MailParam->account);
if (hMailBrowser) {
struct CChangeContent Params = { MailParam->account->NewMailN.Flags | YAMN_ACC_MSGP, MailParam->account->NoNewMailN.Flags | YAMN_ACC_MSGP };
SendMessage(hMailBrowser, WM_YAMN_CHANGECONTENT, (WPARAM)MailParam->account, (LPARAM)&Params);
@@ -1404,7 +1404,7 @@ void __cdecl ShowEmailThread(void *Param)
else {
CREADTEVIEWMESSAGEWINDOW:
MyParam->mail->MsgWindow = CreateDialogParamW(g_plugin.getInst(), MAKEINTRESOURCEW(IDD_DLGSHOWMESSAGE), nullptr, DlgProcYAMNShowMessage, (LPARAM)MyParam);
- WindowList_Add(YAMNVar.MessageWnds, MyParam->mail->MsgWindow);
+ WindowList_Add(MessageWnds, MyParam->mail->MsgWindow);
MSG msg;
while (GetMessage(&msg, nullptr, 0, 0)) {
if (MyParam->mail->MsgWindow == nullptr || !IsDialogMessage(MyParam->mail->MsgWindow, &msg)) { /* Wine fix. */
@@ -1412,7 +1412,7 @@ CREADTEVIEWMESSAGEWINDOW:
DispatchMessage(&msg);
}
}
- WindowList_Remove(YAMNVar.MessageWnds, MyParam->mail->MsgWindow);
+ WindowList_Remove(MessageWnds, MyParam->mail->MsgWindow);
MyParam->mail->MsgWindow = nullptr;
}
@@ -1521,8 +1521,8 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR
sra.Uninit();
- WindowList_Add(YAMNVar.MessageWnds, hDlg);
- WindowList_Add(YAMNVar.NewMailAccountWnd, hDlg, (UINT_PTR)ActualAccount);
+ WindowList_Add(MessageWnds, hDlg);
+ WindowList_Add(NewMailAccountWnd, hDlg, (UINT_PTR)ActualAccount);
wchar_t accstatus[512];
GetStatusFcn(ActualAccount, accstatus);
@@ -1556,7 +1556,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR
SizeDate = ColInfo.cx;
RECT coord;
- if (!YAMNVar.Shutdown && GetWindowRect(hDlg, &coord)) // the YAMNVar.Shutdown testing is because M<iranda strange functionality at shutdown phase, when call to DBWriteContactSetting freezes calling thread
+ if (!g_bShutdown && GetWindowRect(hDlg, &coord)) // the Shutdown testing is because M<iranda strange functionality at shutdown phase, when call to DBWriteContactSetting freezes calling thread
{
PosX = coord.left;
SizeX = coord.right - coord.left;
@@ -1569,8 +1569,8 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR
}
KillTimer(hDlg, TIMER_FLASHING);
- WindowList_Remove(YAMNVar.NewMailAccountWnd, hDlg);
- WindowList_Remove(YAMNVar.MessageWnds, hDlg);
+ WindowList_Remove(NewMailAccountWnd, hDlg);
+ WindowList_Remove(MessageWnds, hDlg);
{
SWriteGuard swm(ActualAccount->MessagesAccessSO);
if (!swm.Succeeded())
@@ -2058,7 +2058,7 @@ static void __cdecl MailBrowser(void *Param)
MyParam->nflags = MyParam->nflags & ~YAMN_ACC_POP;
}
- if (nullptr != (hMailBrowser = WindowList_Find(YAMNVar.NewMailAccountWnd, (UINT_PTR)ActualAccount)))
+ if (nullptr != (hMailBrowser = WindowList_Find(NewMailAccountWnd, (UINT_PTR)ActualAccount)))
WndFound = TRUE;
if ((hMailBrowser == nullptr) && ((MyParam->nflags & YAMN_ACC_MSG) || (MyParam->nflags & YAMN_ACC_ICO) || (MyParam->nnflags & YAMN_ACC_MSG))) {
diff --git a/protocols/YAMN/src/main.cpp b/protocols/YAMN/src/main.cpp
index ab7214294a..7522c4c0e8 100644
--- a/protocols/YAMN/src/main.cpp
+++ b/protocols/YAMN/src/main.cpp
@@ -22,7 +22,8 @@ BOOL UninstallPlugins;
HANDLE hAccountFolder;
-YAMN_VARIABLES YAMNVar;
+MWindowList MessageWnds, NewMailAccountWnd;
+bool g_bShutdown = false;
CMPlugin g_plugin;
@@ -171,9 +172,8 @@ int CMPlugin::Load()
optDateTime = g_plugin.getByte(YAMN_DBTIMEOPTIONS, optDateTime);
// Create new window queues for broadcast messages
- YAMNVar.MessageWnds = WindowList_Create();
- YAMNVar.NewMailAccountWnd = WindowList_Create();
- YAMNVar.Shutdown = FALSE;
+ MessageWnds = WindowList_Create();
+ NewMailAccountWnd = WindowList_Create();
hCurSplitNS = LoadCursor(nullptr, IDC_SIZENS);
hCurSplitWE = LoadCursor(nullptr, IDC_SIZEWE);
@@ -214,8 +214,8 @@ int CMPlugin::Unload()
UnInitDebug();
#endif
- WindowList_Destroy(YAMNVar.MessageWnds);
- WindowList_Destroy(YAMNVar.NewMailAccountWnd);
+ WindowList_Destroy(MessageWnds);
+ WindowList_Destroy(NewMailAccountWnd);
DestroyCursor(hCurSplitNS);
DestroyCursor(hCurSplitWE);
diff --git a/protocols/YAMN/src/proto/pop3/pop3opt.cpp b/protocols/YAMN/src/proto/pop3/pop3opt.cpp
index f557f6daa7..c50a89cd2a 100644
--- a/protocols/YAMN/src/proto/pop3/pop3opt.cpp
+++ b/protocols/YAMN/src/proto/pop3/pop3opt.cpp
@@ -232,7 +232,7 @@ static INT_PTR CALLBACK DlgProcPOP3AccStatusOpt(HWND hDlg, UINT msg, WPARAM wPar
iShift <<= 1;
}
- WindowList_BroadcastAsync(YAMNVar.MessageWnds, WM_YAMN_CHANGESTATUSOPTION, 0, 0);
+ WindowList_BroadcastAsync(MessageWnds, WM_YAMN_CHANGESTATUSOPTION, 0, 0);
EndDialog(hDlg, 0);
DestroyWindow(hDlg);
break;
@@ -355,7 +355,7 @@ public:
ActualAccount = nullptr;
SendMessage(GetParent(m_hwnd), PSM_UNCHANGED, (WPARAM)m_hwnd, 0);
- WindowList_Add(YAMNVar.MessageWnds, m_hwnd);
+ WindowList_Add(MessageWnds, m_hwnd);
return true;
}
@@ -539,7 +539,7 @@ public:
void OnDestroy() override
{
- WindowList_Remove(YAMNVar.MessageWnds, m_hwnd);
+ WindowList_Remove(MessageWnds, m_hwnd);
}
INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override
@@ -829,7 +829,7 @@ public:
bool OnInitDialog() override
{
- WindowList_Add(YAMNVar.MessageWnds, m_hwnd);
+ WindowList_Add(MessageWnds, m_hwnd);
DlgEnableAccountPopup(false);
DlgShowAccountPopup();
@@ -848,7 +848,7 @@ public:
void OnDestroy() override
{
- WindowList_Remove(YAMNVar.MessageWnds, m_hwnd);
+ WindowList_Remove(MessageWnds, m_hwnd);
}
void onSelChange_Account(CCtrlCombo *)
diff --git a/protocols/YAMN/src/services.cpp b/protocols/YAMN/src/services.cpp
index ee4476bf41..c7f1ea5f1c 100644
--- a/protocols/YAMN/src/services.cpp
+++ b/protocols/YAMN/src/services.cpp
@@ -168,7 +168,7 @@ int Shutdown(WPARAM, LPARAM)
g_plugin.setDword(YAMN_DBMSGSIZEX, HeadSizeX);
g_plugin.setDword(YAMN_DBMSGSIZEY, HeadSizeY);
g_plugin.setWord(YAMN_DBMSGPOSSPLIT, HeadSplitPos);
- YAMNVar.Shutdown = TRUE;
+ g_bShutdown = true;
KillTimer(nullptr, SecTimer);
UnregisterProtoPlugins();
diff --git a/protocols/YAMN/src/stdafx.h b/protocols/YAMN/src/stdafx.h
index aa88d18df9..05be77a7dc 100644
--- a/protocols/YAMN/src/stdafx.h
+++ b/protocols/YAMN/src/stdafx.h
@@ -25,7 +25,6 @@
#include <m_toptoolbar.h>
#include <m_kbdnotify.h>
-#include <m_yamn.h>
#include <m_folders.h>
#include "mails/decode.h"
@@ -35,6 +34,7 @@
#include "protoplugin.h"
#include "main.h"
+#include "yamn.h"
#include "debug.h"
#include "resource.h"
@@ -159,7 +159,10 @@ int Shutdown(WPARAM, LPARAM); // Executed before Miranda is going to shutdown
extern wchar_t UserDirectory[]; // e.g. "F:\WINNT\Profiles\UserXYZ"
extern wchar_t ProfileName[]; // e.g. "majvan"
extern SWMRG *AccountBrowserSO;
-extern YAMN_VARIABLES YAMNVar;
+extern MWindowList MessageWnds;
+extern MWindowList NewMailAccountWnd;
+extern bool g_bShutdown;
+
extern HANDLE hNewMailHook;
extern HCURSOR hCurSplitNS, hCurSplitWE;
extern UINT SecTimer;
diff --git a/protocols/YAMN/src/yamn.cpp b/protocols/YAMN/src/yamn.cpp
index d95721e6fb..b30cc4411d 100644
--- a/protocols/YAMN/src/yamn.cpp
+++ b/protocols/YAMN/src/yamn.cpp
@@ -73,7 +73,7 @@ void CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD)
isAccountCounting = TRUE;
}
- WindowList_BroadcastAsync(YAMNVar.MessageWnds, WM_YAMN_CHANGETIME, (WPARAM)ActualAccount, (LPARAM)ActualAccount->TimeLeft);
+ WindowList_BroadcastAsync(MessageWnds, WM_YAMN_CHANGETIME, (WPARAM)ActualAccount, (LPARAM)ActualAccount->TimeLeft);
if (!ActualAccount->TimeLeft) {
ActualAccount->TimeLeft = ActualAccount->Interval;
mir_forkthread((pThreadFunc)ActualAccount->Plugin->Fcn->TimeoutFcnPtr, new CheckParam(ActualAccount, YAMN_NORMALCHECK));
diff --git a/protocols/YAMN/src/yamn.h b/protocols/YAMN/src/yamn.h
new file mode 100644
index 0000000000..8d47fb1606
--- /dev/null
+++ b/protocols/YAMN/src/yamn.h
@@ -0,0 +1,53 @@
+#ifndef __M_YAMN_H
+#define __M_YAMN_H
+
+#include <windows.h>
+
+//
+//================================== YAMN SERVICES ==================================
+//
+
+//ForceCheck Service
+//Check mail on accounts
+//WPARAM- not used
+//LPARAM- not used
+#define MS_YAMN_FORCECHECK "YAMN/Service/ForceCheck"
+
+//Contact List Context Menu Click
+//wParam=(WPARAM)hContact
+//lParam=0
+//
+//Event is fired when there is a double click on a CList contact,
+//it is upto the caller to check for the protocol & status
+//of the MCONTACT, it's not done for you anymore since it didn't make
+//sense to store all this information in memory, etc.
+#define MS_YAMN_CLISTCONTEXT "YAMN/Service/ClistContactContextMenu"
+
+//Contact List Context Menu Click for application
+//wParam=(WPARAM)hContact
+//lParam=0
+//
+//Event is fired when there is a double click on a CList contact,
+//it is upto the caller to check for the protocol & status
+//of the MCONTACT, it's not done for you anymore since it didn't make
+//sense to store all this information in memory, etc.
+#define MS_YAMN_CLISTCONTEXTAPP "YAMN/Service/ClistContactContextMenuApp"
+
+//Contact List Double Click
+//wParam=(WPARAM)hContact
+//lParam=0
+//
+//Event is fired when there is a double click on a CList contact,
+//it is upto the caller to check for the protocol & status
+//of the MCONTACT, it's not done for you anymore since it didn't make
+//sense to store all this information in memory, etc.
+#define MS_YAMN_CLISTDBLCLICK "YAMN/Service/ClistContactDoubleclicked"
+
+//NoNewMail Service
+//runs no new mail procedure (shows popups e.g.)
+//WPARAM- pointer to YAMN_NONEWMAILPARAM structure, data to no new mail procedure. You do not need to fill ThreadRunningEV event member.
+//LPARAM- YAMN_NONEWMAILPARAM structure version param. Use YAMN_NONEWMAILVERSION definition.
+//returns zero if failed, nonzero if succeed
+#define MS_YAMN_NONEWMAILPROC "YAMN/Service/NoNewMailProc"
+
+#endif