summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
Diffstat (limited to 'protocols')
-rw-r--r--protocols/YAMN/src/account.cpp20
-rw-r--r--protocols/YAMN/src/browser/mailbrowser.cpp282
-rw-r--r--protocols/YAMN/src/proto/pop3/pop3comm.cpp22
-rw-r--r--protocols/YAMN/src/proto/pop3/pop3opt.cpp493
-rw-r--r--protocols/YAMN/src/services.cpp19
-rw-r--r--protocols/YAMN/src/stdafx.h2
6 files changed, 409 insertions, 429 deletions
diff --git a/protocols/YAMN/src/account.cpp b/protocols/YAMN/src/account.cpp
index e65ac6417b..ef06bc78b9 100644
--- a/protocols/YAMN/src/account.cpp
+++ b/protocols/YAMN/src/account.cpp
@@ -18,6 +18,24 @@ static mir_cs csAccountStatusCS;
static mir_cs csFileWritingCS;
/////////////////////////////////////////////////////////////////////////////////////////
+// CAccount class
+
+void CAccount::RefreshContact()
+{
+ if (hContact != 0) {
+ Contact::Hide(hContact, !(Flags & YAMN_ACC_ENA) && (NewMailN.Flags & YAMN_ACC_CONT));
+ }
+ else if ((Flags & YAMN_ACC_ENA) && (NewMailN.Flags & YAMN_ACC_CONT)) {
+ hContact = db_add_contact();
+ Proto_AddToContact(hContact, YAMN_DBMODULE);
+ g_plugin.setString(hContact, "Id", Name);
+ g_plugin.setString(hContact, "Nick", Name);
+ g_plugin.setWord(hContact, "Status", ID_STATUS_ONLINE);
+ db_set_s(hContact, "CList", "StatusMsg", Translate("No new mail message"));
+ }
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
CAccount* CreatePluginAccount(YAMN_PROTOPLUGIN *Plugin)
{
@@ -890,7 +908,7 @@ int DeleteAccount(YAMN_PROTOPLUGIN *Plugin, CAccount *Which)
if ((Plugin->Fcn != nullptr) && (Plugin->Fcn->WriteAccountsFcnPtr != nullptr))
Plugin->Fcn->WriteAccountsFcnPtr();
- CloseHandle(mir_forkthread(DeleteAccountInBackground, (void *)Which));
+ mir_forkthread(DeleteAccountInBackground, Which);
// Now, plugin can consider account as deleted, but plugin really can achieve deleting this account from memory when using
// event UsingThreads.
diff --git a/protocols/YAMN/src/browser/mailbrowser.cpp b/protocols/YAMN/src/browser/mailbrowser.cpp
index faa60926e8..c6a2b8bbbd 100644
--- a/protocols/YAMN/src/browser/mailbrowser.cpp
+++ b/protocols/YAMN/src/browser/mailbrowser.cpp
@@ -13,14 +13,14 @@
#include "../stdafx.h"
#define TIMER_FLASHING 0x09061979
-#define MAILBROWSER_MINXSIZE 200 //min size of mail browser window
+#define MAILBROWSER_MINXSIZE 200 // min size of mail browser window
#define MAILBROWSER_MINYSIZE 130
#define MAILBROWSERTITLE LPGEN("%s - %d new mail messages, %d total")
void __cdecl ShowEmailThread(void *Param);
-//--------------------------------------------------------------------------------------------------
+// --------------------------------------------------------------------------------------------------
char *s_MonthNames[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
bool bDate = false, bSub = false, bSize = false, bFrom = false;
int PosX = 0, PosY = 0, SizeX = 460, SizeY = 100;
@@ -35,27 +35,27 @@ static CMOption<int> SizeDate(YAMN_DBMODULE, "ColSizeDate", 205);
struct CMailNumbersSub
{
- int Total; //any mail
- int New; //uses YAMN_MSG_NEW flag
- int UnSeen; //uses YAMN_MSG_UNSEEN flag
- // int Browser; //uses YAMN_MSG_BROWSER flag
- int BrowserUC; //uses YAMN_MSG_BROWSER flag and YAMN_MSG_UNSEEN flag
- int Display; //uses YAMN_MSG_DISPLAY flag
- int DisplayTC; //uses YAMN_MSG_DISPLAY flag and YAMN_MSG_DISPLAYC flag
- int DisplayUC; //uses YAMN_MSG_DISPLAY flag and YAMN_MSG_DISPLAYC flag and YAMN_MSG_UNSEEN flag
- int Popup; //uses YAMN_MSG_POPUP flag
- int PopupTC; //uses YAMN_MSG_POPUPC flag
- int PopupNC; //uses YAMN_MSG_POPUPC flag and YAMN_MSG_NEW flag
- int PopupRun; //uses YAMN_MSG_POPUP flag and YAMN_MSG_NEW flag
- int PopupSL2NC; //uses YAMN_MSG_SPAML2 flag and YAMN_MSG_NEW flag
- int PopupSL3NC; //uses YAMN_MSG_SPAML3 flag and YAMN_MSG_NEW flag
- // int SysTray; //uses YAMN_MSG_SYSTRAY flag
- int SysTrayUC; //uses YAMN_MSG_SYSTRAY flag and YAMN_MSG_UNSEEN flag
- // int Sound; //uses YAMN_MSG_SOUND flag
- int SoundNC; //uses YAMN_MSG_SOUND flag and YAMN_MSG_NEW flag
- // int App; //uses YAMN_MSG_APP flag
- int AppNC; //uses YAMN_MSG_APP flag and YAMN_MSG_NEW flag
- int EventNC; //uses YAMN_MSG_NEVENT flag and YAMN_MSG_NEW flag
+ int Total; // any mail
+ int New; // uses YAMN_MSG_NEW flag
+ int UnSeen; // uses YAMN_MSG_UNSEEN flag
+ // int Browser; // uses YAMN_MSG_BROWSER flag
+ int BrowserUC; // uses YAMN_MSG_BROWSER flag and YAMN_MSG_UNSEEN flag
+ int Display; // uses YAMN_MSG_DISPLAY flag
+ int DisplayTC; // uses YAMN_MSG_DISPLAY flag and YAMN_MSG_DISPLAYC flag
+ int DisplayUC; // uses YAMN_MSG_DISPLAY flag and YAMN_MSG_DISPLAYC flag and YAMN_MSG_UNSEEN flag
+ int Popup; // uses YAMN_MSG_POPUP flag
+ int PopupTC; // uses YAMN_MSG_POPUPC flag
+ int PopupNC; // uses YAMN_MSG_POPUPC flag and YAMN_MSG_NEW flag
+ int PopupRun; // uses YAMN_MSG_POPUP flag and YAMN_MSG_NEW flag
+ int PopupSL2NC; // uses YAMN_MSG_SPAML2 flag and YAMN_MSG_NEW flag
+ int PopupSL3NC; // uses YAMN_MSG_SPAML3 flag and YAMN_MSG_NEW flag
+ // int SysTray; // uses YAMN_MSG_SYSTRAY flag
+ int SysTrayUC; // uses YAMN_MSG_SYSTRAY flag and YAMN_MSG_UNSEEN flag
+ // int Sound; // uses YAMN_MSG_SOUND flag
+ int SoundNC; // uses YAMN_MSG_SOUND flag and YAMN_MSG_NEW flag
+ // int App; // uses YAMN_MSG_APP flag
+ int AppNC; // uses YAMN_MSG_APP flag and YAMN_MSG_NEW flag
+ int EventNC; // uses YAMN_MSG_NEVENT flag and YAMN_MSG_NEW flag
};
struct CMailNumbers
@@ -104,9 +104,9 @@ void IncrementMailCounters(HYAMNMAIL msgq, struct CMailNumbers *MN);
enum
{
- UPDATE_FAIL = 0, //function failed
- UPDATE_NONE, //none update has been performed
- UPDATE_OK, //some changes occured, update performed
+ UPDATE_FAIL = 0, // function failed
+ UPDATE_NONE, // none update has been performed
+ UPDATE_OK, // some changes occured, update performed
};
// Just looks for mail changes in account and update the mail browser window
@@ -153,38 +153,38 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR
#define YAMN_BROWSER_SHOWPOPUP 0x01
-// list view items' order criteria
+// list view items' order criteria
#define LVORDER_NOORDER -1
#define LVORDER_STRING 0
#define LVORDER_NUMERIC 1
#define LVORDER_DATETIME 2
-// list view order direction
+// list view order direction
#define LVORDER_ASCENDING 1
#define LVORDER_NONE 0
#define LVORDER_DESCENDING -1
-// list view sort type
+// list view sort type
#define LVSORTPRIORITY_NONE -1
-// List view column info.
+// List view column info.
typedef struct _SAMPLELISTVIEWCOLUMN
{
- UINT uCXCol; // index
- int nSortType; // sorting type (STRING = 0, NUMERIC, DATE, DATETIME)
- int nSortOrder; // sorting order (ASCENDING = -1, NONE, DESCENDING)
- int nPriority; // sort priority (-1 for none, 0, 1, ..., nColumns - 1 maximum)
- wchar_t lpszName[128]; // column name
+ UINT uCXCol; // index
+ int nSortType; // sorting type (STRING = 0, NUMERIC, DATE, DATETIME)
+ int nSortOrder; // sorting order (ASCENDING = -1, NONE, DESCENDING)
+ int nPriority; // sort priority (-1 for none, 0, 1, ..., nColumns - 1 maximum)
+ wchar_t lpszName[128]; // column name
} SAMPLELISTVIEWCOLUMN;
-// Compare priority
+// Compare priority
typedef struct _LVCOMPAREINFO
{
- int iIdx; // Index
- int iPriority; // Priority
+ int iIdx; // Index
+ int iPriority; // Priority
} LVCOMPAREINFO, *LPLVCOMPAREINFO;
-//--------------------------------------------------------------------------------------------------
+// --------------------------------------------------------------------------------------------------
LPARAM readItemLParam(HWND hwnd, uint32_t iItem)
{
@@ -270,41 +270,27 @@ void IncrementMailCounters(HYAMNMAIL msgq, struct CMailNumbers *MN)
MN->Virtual.PopupSL3NC++;
else
MN->Real.PopupSL3NC++;
- /* if (msgq->MailData->Flags & YAMN_MSG_SYSTRAY)
- if (msgq->Flags & YAMN_MSG_VIRTUAL)
- MN->Virtual.SysTray++;
- else
- MN->Real.SysTray++;
- */ if ((msgq->Flags & (YAMN_MSG_UNSEEN | YAMN_MSG_SYSTRAY)) == (YAMN_MSG_UNSEEN | YAMN_MSG_SYSTRAY))
- if (msgq->Flags & YAMN_MSG_VIRTUAL)
- MN->Virtual.SysTrayUC++;
- else
- MN->Real.SysTrayUC++;
- /* if (msgq->MailData->Flags & YAMN_MSG_SOUND)
- if (msgq->Flags & YAMN_MSG_VIRTUAL)
- MN->Virtual.Sound++;
- else
- MN->Real.Sound++;
- */ if ((msgq->Flags & (YAMN_MSG_NEW | YAMN_MSG_SOUND)) == (YAMN_MSG_NEW | YAMN_MSG_SOUND))
- if (msgq->Flags & YAMN_MSG_VIRTUAL)
- MN->Virtual.SoundNC++;
- else
- MN->Real.SoundNC++;
- /* if (msgq->MailData->Flags & YAMN_MSG_APP)
- if (msgq->Flags & YAMN_MSG_VIRTUAL)
- MN->Virtual.App++;
- else
- MN->Real.App++;
- */ if ((msgq->Flags & (YAMN_MSG_NEW | YAMN_MSG_APP)) == (YAMN_MSG_NEW | YAMN_MSG_APP))
- if (msgq->Flags & YAMN_MSG_VIRTUAL)
- MN->Virtual.AppNC++;
- else
- MN->Real.AppNC++;
- if ((msgq->Flags & (YAMN_MSG_NEW | YAMN_MSG_NEVENT)) == (YAMN_MSG_NEW | YAMN_MSG_NEVENT))
- if (msgq->Flags & YAMN_MSG_VIRTUAL)
- MN->Virtual.EventNC++;
- else
- MN->Real.EventNC++;
+
+ if ((msgq->Flags & (YAMN_MSG_UNSEEN | YAMN_MSG_SYSTRAY)) == (YAMN_MSG_UNSEEN | YAMN_MSG_SYSTRAY))
+ if (msgq->Flags & YAMN_MSG_VIRTUAL)
+ MN->Virtual.SysTrayUC++;
+ else
+ MN->Real.SysTrayUC++;
+ if ((msgq->Flags & (YAMN_MSG_NEW | YAMN_MSG_SOUND)) == (YAMN_MSG_NEW | YAMN_MSG_SOUND))
+ if (msgq->Flags & YAMN_MSG_VIRTUAL)
+ MN->Virtual.SoundNC++;
+ else
+ MN->Real.SoundNC++;
+ if ((msgq->Flags & (YAMN_MSG_NEW | YAMN_MSG_APP)) == (YAMN_MSG_NEW | YAMN_MSG_APP))
+ if (msgq->Flags & YAMN_MSG_VIRTUAL)
+ MN->Virtual.AppNC++;
+ else
+ MN->Real.AppNC++;
+ if ((msgq->Flags & (YAMN_MSG_NEW | YAMN_MSG_NEVENT)) == (YAMN_MSG_NEW | YAMN_MSG_NEVENT))
+ if (msgq->Flags & YAMN_MSG_VIRTUAL)
+ MN->Virtual.EventNC++;
+ else
+ MN->Real.EventNC++;
}
int UpdateMails(HWND hDlg, CAccount *ActualAccount, uint32_t nflags, uint32_t nnflags)
@@ -316,7 +302,7 @@ int UpdateMails(HWND hDlg, CAccount *ActualAccount, uint32_t nflags, uint32_t nn
struct CMailWinUserInfo *mwui = (struct CMailWinUserInfo *)GetWindowLongPtr(hDlg, DWLP_USER);
- //now we ensure read access for account and write access for its mails
+ // now we ensure read access for account and write access for its mails
{
SReadGuard sra(ActualAccount->AccountAccessSO);
if (!sra.Succeeded()) {
@@ -346,18 +332,18 @@ int UpdateMails(HWND hDlg, CAccount *ActualAccount, uint32_t nflags, uint32_t nn
if (mwui != nullptr)
mwui->UpdateMailsMessagesAccess = TRUE;
- //Now we are going to check if extracting data from mail headers are needed.
- //If popups will be displayed or mailbrowser window
+ // Now we are going to check if extracting data from mail headers are needed.
+ // If popups will be displayed or mailbrowser window
if ((((mwui != nullptr) && !(mwui->RunFirstTime)) &&
(
((nnflags & YAMN_ACC_MSGP) && !(MN.Real.BrowserUC + MN.Virtual.BrowserUC)) ||
((nflags & YAMN_ACC_MSGP) && (MN.Real.BrowserUC + MN.Virtual.BrowserUC))
)
- ) || //if mail window was displayed before and flag YAMN_ACC_MSGP is set
- ((nnflags & YAMN_ACC_MSG) && !(MN.Real.BrowserUC + MN.Virtual.BrowserUC)) || //if needed to run mailbrowser when no unseen and no unseen mail found
- ((nflags & YAMN_ACC_MSG) && (MN.Real.BrowserUC + MN.Virtual.BrowserUC)) || //if unseen mails found, we sure run mailbrowser
- ((nflags & YAMN_ACC_ICO) && (MN.Real.SysTrayUC + MN.Virtual.SysTrayUC))
- ) //if needed to run systray
+ ) || // if mail window was displayed before and flag YAMN_ACC_MSGP is set
+ ((nnflags & YAMN_ACC_MSG) && !(MN.Real.BrowserUC + MN.Virtual.BrowserUC)) || // if needed to run mailbrowser when no unseen and no unseen mail found
+ ((nflags & YAMN_ACC_MSG) && (MN.Real.BrowserUC + MN.Virtual.BrowserUC)) || // if unseen mails found, we sure run mailbrowser
+ ((nflags & YAMN_ACC_ICO) && (MN.Real.SysTrayUC + MN.Virtual.SysTrayUC)))
+ // if needed to run systray
RunMailBrowser = TRUE;
else
RunMailBrowser = FALSE;
@@ -373,7 +359,7 @@ int UpdateMails(HWND hDlg, CAccount *ActualAccount, uint32_t nflags, uint32_t nn
AddNewMailsToListView(hDlg == nullptr ? nullptr : GetDlgItem(hDlg, IDC_LISTMAILS), ActualAccount, nflags);
if (RunMailBrowser) {
- size_t len = mir_strlen(ActualAccount->Name) + mir_strlen(Translate(MAILBROWSERTITLE)) + 10; //+10 chars for numbers
+ size_t len = mir_strlen(ActualAccount->Name) + mir_strlen(Translate(MAILBROWSERTITLE)) + 10; // +10 chars for numbers
char *TitleStrA = new char[len];
wchar_t *TitleStrW = new wchar_t[len];
@@ -386,9 +372,9 @@ int UpdateMails(HWND hDlg, CAccount *ActualAccount, uint32_t nflags, uint32_t nn
DoMailActions(hDlg, ActualAccount, &MN, nflags, nnflags);
- SetRemoveFlagsInQueueFcn((HYAMNMAIL)ActualAccount->Mails, YAMN_MSG_NEW, 0, YAMN_MSG_NEW, YAMN_FLAG_REMOVE); //rempve the new flag
+ SetRemoveFlagsInQueueFcn((HYAMNMAIL)ActualAccount->Mails, YAMN_MSG_NEW, 0, YAMN_MSG_NEW, YAMN_FLAG_REMOVE); // rempve the new flag
if (!RunMailBrowser)
- SetRemoveFlagsInQueueFcn((HYAMNMAIL)ActualAccount->Mails, YAMN_MSG_UNSEEN, YAMN_MSG_STAYUNSEEN, YAMN_MSG_UNSEEN, YAMN_FLAG_REMOVE); //remove the unseen flag when it was not displayed and it has not "stay unseen" flag set
+ SetRemoveFlagsInQueueFcn((HYAMNMAIL)ActualAccount->Mails, YAMN_MSG_UNSEEN, YAMN_MSG_STAYUNSEEN, YAMN_MSG_UNSEEN, YAMN_FLAG_REMOVE); // remove the unseen flag when it was not displayed and it has not "stay unseen" flag set
if (mwui != nullptr) {
mwui->UpdateMailsMessagesAccess = FALSE;
@@ -419,8 +405,8 @@ int ChangeExistingMailStatus(HWND hListView, CAccount *ActualAccount)
mail = (HYAMNMAIL)item.lParam;
else
continue;
- for (msgq = (HYAMNMAIL)ActualAccount->Mails; (msgq != nullptr) && (msgq != mail); msgq = msgq->Next); //found the same mail in account queue
- if (msgq == nullptr) //if mail was not found
+ for (msgq = (HYAMNMAIL)ActualAccount->Mails; (msgq != nullptr) && (msgq != mail); msgq = msgq->Next); // found the same mail in account queue
+ if (msgq == nullptr) // if mail was not found
if (TRUE == ListView_DeleteItem(hListView, i)) {
in--; i--;
continue;
@@ -450,7 +436,7 @@ int AddNewMailsToListView(HWND hListView, CAccount *ActualAccount, uint32_t nfla
item.mask = LVIF_TEXT | LVIF_PARAM;
item.iItem = 0;
memset(&fi, 0, sizeof(fi));
- fi.flags = LVFI_PARAM; //let's go search item by lParam number
+ fi.flags = LVFI_PARAM; // let's go search item by lParam number
lfoundi = 0;
}
@@ -485,7 +471,7 @@ int AddNewMailsToListView(HWND hListView, CAccount *ActualAccount, uint32_t nfla
if (!LoadedMailData(msgq)) { // check if mail is already in memory
Loaded = false;
- if (nullptr == msgq->MailData) //if we could not load mail to memory, consider this mail deleted and do not display it
+ if (nullptr == msgq->MailData) // if we could not load mail to memory, consider this mail deleted and do not display it
continue;
}
else Loaded = true;
@@ -616,15 +602,15 @@ void DoMailActions(HWND hDlg, CAccount *ActualAccount, struct CMailNumbers *MN,
if ((MN->Real.BrowserUC + MN->Virtual.BrowserUC == 0) && (hDlg != nullptr)) {
if (!IsWindowVisible(hDlg) && !(nflags & YAMN_ACC_MSG))
- PostMessage(hDlg, WM_DESTROY, 0, 0); //destroy window if no new mail and window is not visible
- if (nnflags & YAMN_ACC_MSG) //if no new mail and msg should be executed
+ PostMessage(hDlg, WM_DESTROY, 0, 0); // destroy window if no new mail and window is not visible
+ if (nnflags & YAMN_ACC_MSG) // if no new mail and msg should be executed
{
SetForegroundWindow(hDlg);
ShowWindow(hDlg, SW_SHOWNORMAL);
}
}
else
- if (hDlg != nullptr) //else insert icon and set window if new mails
+ if (hDlg != nullptr) // else insert icon and set window if new mails
{
SendDlgItemMessageW(hDlg, IDC_LISTMAILS, LVM_SCROLL, 0, (LPARAM)0x7ffffff);
@@ -636,7 +622,7 @@ void DoMailActions(HWND hDlg, CAccount *ActualAccount, struct CMailNumbers *MN,
Shell_NotifyIcon(NIM_ADD, &nid);
SetTimer(hDlg, TIMER_FLASHING, 500, nullptr);
}
- if (nflags & YAMN_ACC_MSG) //if no new mail and msg should be executed
+ if (nflags & YAMN_ACC_MSG) // if no new mail and msg should be executed
ShowWindow(hDlg, SW_SHOWNORMAL);
}
@@ -686,7 +672,7 @@ void DoMailActions(HWND hDlg, CAccount *ActualAccount, struct CMailNumbers *MN,
NoNewMailPopup.iSeconds = ActualAccount->NoNewMailN.PopupTime;
NoNewMailPopup.PluginWindowProc = NoNewMailPopupProc;
- NoNewMailPopup.PluginData = nullptr; //it's not new mail popup
+ NoNewMailPopup.PluginData = nullptr; // it's not new mail popup
mir_wstrncpy(NoNewMailPopup.lpwzContactName, _A2T(ActualAccount->Name), _countof(NoNewMailPopup.lpwzContactName));
if (MN->Real.PopupSL2NC + MN->Virtual.PopupSL2NC)
@@ -776,10 +762,10 @@ LRESULT CALLBACK NoNewMailPopupProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM l
if (sra.Succeeded() && msg == WM_COMMAND) {
YAMN_MAILBROWSERPARAM Param = { ActualAccount, ActualAccount->NewMailN.Flags, ActualAccount->NoNewMailN.Flags, nullptr };
- Param.nnflags = Param.nnflags | YAMN_ACC_MSG; //show mails in account even no new mail in account
+ Param.nnflags = Param.nnflags | YAMN_ACC_MSG; // show mails in account even no new mail in account
Param.nnflags = Param.nnflags & ~YAMN_ACC_POP;
- Param.nflags = Param.nflags | YAMN_ACC_MSG; //show mails in account even no new mail in account
+ Param.nflags = Param.nflags | YAMN_ACC_MSG; // show mails in account even no new mail in account
Param.nflags = Param.nflags & ~YAMN_ACC_POP;
RunMailBrowser(&Param);
@@ -794,7 +780,7 @@ LRESULT CALLBACK NoNewMailPopupProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM l
break;
case UM_INITPOPUP:
- //This is the equivalent to WM_INITDIALOG you'd get if you were the maker of dialog popups.
+ // This is the equivalent to WM_INITDIALOG you'd get if you were the maker of dialog popups.
WindowList_Add(YAMNVar.MessageWnds, hWnd);
break;
@@ -816,9 +802,9 @@ LRESULT CALLBACK NoNewMailPopupProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM l
}
#ifdef __GNUC__
-//number of 100 ns periods between FILETIME 0 (1601/01/01 00:00:00.0000000) and TIMESTAMP 0 (1970/01/01 00:00:00)
+// number of 100 ns periods between FILETIME 0 (1601/01/01 00:00:00.0000000) and TIMESTAMP 0 (1970/01/01 00:00:00)
#define NUM100NANOSEC 116444736000000000ULL
-//The biggest time Get[Date|Time]Format can handle (Fri, 31 Dec 30827 23:59:59.9999999)
+// The biggest time Get[Date|Time]Format can handle (Fri, 31 Dec 30827 23:59:59.9999999)
#define MAXFILETIME 0x7FFF35F4F06C7FFFULL
#else
#define NUM100NANOSEC 116444736000000000
@@ -832,11 +818,11 @@ ULONGLONG MimeDateToFileTime(char *datein)
ULONGLONG res = 0;
int wShiftSeconds = TimeZone_ToLocal(0);
GetLocalTime(&st);
- //datein = "Xxx, 1 Jan 2060 5:29:1 +0530 XXX";
- //datein = "Xxx, 1 Jan 2060 05:29:10 ";
- //datein = " ManySpaces 1.5 Jan 2060 05::";
- //datein = "Xxx, 35 February 20 :29:10 ";
- //datein = "01.12.2007 (22:38:17)"; //
+ // datein = "Xxx, 1 Jan 2060 5:29:1 +0530 XXX";
+ // datein = "Xxx, 1 Jan 2060 05:29:10 ";
+ // datein = " ManySpaces 1.5 Jan 2060 05::";
+ // datein = "Xxx, 35 February 20 :29:10 ";
+ // datein = "01.12.2007 (22:38:17)"; //
if (datein) {
char tmp[64];
while (datein[0] == ' ') datein++; // eat leading spaces
@@ -875,7 +861,7 @@ ULONGLONG MimeDateToFileTime(char *datein)
if (shift) {
if (mir_strlen(shift) < 4) {
- //has only hour
+ // has only hour
wShiftSeconds = (atoi(shift)) * 3600;
}
else {
@@ -902,7 +888,7 @@ ULONGLONG MimeDateToFileTime(char *datein)
void FileTimeToLocalizedDateTime(LONGLONG filetime, wchar_t *dateout, int lendateout)
{
int localeID = Langpack_GetDefaultLocale();
- //int localeID = MAKELCID(LANG_URDU, SORT_DEFAULT);
+ // int localeID = MAKELCID(LANG_URDU, SORT_DEFAULT);
if (localeID == CALLSERVICE_NOTFOUND) localeID = LOCALE_USER_DEFAULT;
if (filetime > MAXFILETIME) filetime = MAXFILETIME;
else if (filetime <= 0) {
@@ -972,7 +958,7 @@ int CALLBACK ListViewCompareProc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSo
ExtractShortHeader(email2->MailData->TranslatedHeader, &Header2);
switch ((int)lParamSort) {
- case 0: //From
+ case 0: // From
if (Header1.FromNick == nullptr)
str1 = Header1.From;
else str1 = Header1.FromNick;
@@ -985,7 +971,7 @@ int CALLBACK ListViewCompareProc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSo
if (bFrom) nResult = -nResult;
break;
- case 1: //Subject
+ case 1: // Subject
if (Header1.Subject == nullptr)
str1 = " ";
else str1 = Header1.Subject;
@@ -998,7 +984,7 @@ int CALLBACK ListViewCompareProc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSo
if (bSub) nResult = -nResult;
break;
- case 2: //Size
+ case 2: // Size
if (email1->MailData->Size == email2->MailData->Size) nResult = 0;
if (email1->MailData->Size > email2->MailData->Size) nResult = 1;
if (email1->MailData->Size < email2->MailData->Size) nResult = -1;
@@ -1006,7 +992,7 @@ int CALLBACK ListViewCompareProc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSo
if (bSize) nResult = -nResult;
break;
- case 3: //Date
+ case 3: // Date
{
ULONGLONG ts1 = 0, ts2 = 0;
ts1 = MimeDateToFileTime(Header1.Date);
@@ -1028,12 +1014,12 @@ int CALLBACK ListViewCompareProc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSo
nResult = mir_strcmp(str1, str2);
break;
}
- //MessageBox(NULL,str1,str2,0);
+ // MessageBox(NULL,str1,str2,0);
}
catch (...) {
}
- //free mem
+ // free mem
DeleteShortHeaderContent(&Header1);
DeleteShortHeaderContent(&Header2);
return nResult;
@@ -1119,14 +1105,14 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg, UINT msg, WPARAM wParam, LPAR
auto *MailParam = (YAMN_MAILSHOWPARAM *)(lParam ? lParam : GetWindowLongPtr(hDlg, DWLP_USER));
HWND hListView = GetDlgItem(hDlg, IDC_LISTHEADERS);
HWND hEdit = GetDlgItem(hDlg, IDC_EDITBODY);
- //do not redraw
+ // do not redraw
SendMessage(hListView, WM_SETREDRAW, 0, 0);
ListView_DeleteAllItems(hListView);
struct CMimeItem *Header;
LVITEMW item;
item.mask = LVIF_TEXT | LVIF_PARAM;
wchar_t *From = nullptr, *Subj = nullptr;
- char *contentType = nullptr, *transEncoding = nullptr, *body = nullptr; //should not be delete[]-ed
+ char *contentType = nullptr, *transEncoding = nullptr, *body = nullptr; // should not be delete[]-ed
for (Header = MailParam->mail->MailData->TranslatedHeader; Header != nullptr; Header = Header->Next) {
wchar_t *str1 = nullptr;
@@ -1136,7 +1122,7 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg, UINT msg, WPARAM wParam, LPAR
{
int streamsize = MultiByteToWideChar(20127, 0, Header->name, -1, nullptr, 0);
str1 = (wchar_t *)malloc(sizeof(wchar_t) * (streamsize + 1));
- MultiByteToWideChar(20127, 0, Header->name, -1, str1, streamsize);//US-ASCII
+ MultiByteToWideChar(20127, 0, Header->name, -1, str1, streamsize);// US-ASCII
}
CMStringW wszTmp = ConvertCodedStringToUnicode(Header->value, MailParam->mail->MailData->CP, 1);
@@ -1230,7 +1216,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
+ MailParam->mail->Flags &= ~YAMN_MSG_UNSEEN; // mark the message as seen
HWND hMailBrowser = WindowList_Find(YAMNVar.NewMailAccountWnd, (UINT_PTR)MailParam->account);
if (hMailBrowser) {
struct CChangeContent Params = { MailParam->account->NewMailN.Flags | YAMN_ACC_MSGP, MailParam->account->NoNewMailN.Flags | YAMN_ACC_MSGP };
@@ -1305,8 +1291,8 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg, UINT msg, WPARAM wParam, LPAR
break;
case WM_MOVE:
- HeadPosX = LOWORD(lParam); //((LPRECT)lParam)->right-((LPRECT)lParam)->left;
- HeadPosY = HIWORD(lParam); //((LPRECT)lParam)->bottom-((LPRECT)lParam)->top;
+ HeadPosX = LOWORD(lParam); // ((LPRECT)lParam)->right-((LPRECT)lParam)->left;
+ HeadPosY = HIWORD(lParam); // ((LPRECT)lParam)->bottom-((LPRECT)lParam)->top;
return 0;
case DM_SPLITTERMOVED:
@@ -1315,7 +1301,7 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg, UINT msg, WPARAM wParam, LPAR
pt.x = 0;
pt.y = wParam;
ScreenToClient(hDlg, &pt);
- HeadSplitPos = (pt.y * 1000) / HeadSizeY;//+rc.bottom-rc.top;
+ HeadSplitPos = (pt.y * 1000) / HeadSizeY;// +rc.bottom-rc.top;
if (HeadSplitPos >= 1000) HeadSplitPos = 999;
else if (HeadSplitPos <= 0) HeadSplitPos = 1;
else SendMessage(hDlg, WM_SIZE, 0, HeadSizeY << 16 | HeadSizeX);
@@ -1327,28 +1313,28 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg, UINT msg, WPARAM wParam, LPAR
HWND hList = GetDlgItem(hDlg, IDC_LISTHEADERS);
HWND hEdit = GetDlgItem(hDlg, IDC_EDITBODY);
BOOL isBodyShown = ((YAMN_MAILSHOWPARAM *)(GetWindowLongPtr(hDlg, DWLP_USER)))->mail->Flags & YAMN_MSG_BODYRECEIVED;
- HeadSizeX = LOWORD(lParam); //((LPRECT)lParam)->right-((LPRECT)lParam)->left;
- HeadSizeY = HIWORD(lParam); //((LPRECT)lParam)->bottom-((LPRECT)lParam)->top;
+ HeadSizeX = LOWORD(lParam); // ((LPRECT)lParam)->right-((LPRECT)lParam)->left;
+ HeadSizeY = HIWORD(lParam); // ((LPRECT)lParam)->bottom-((LPRECT)lParam)->top;
int localSplitPos = (HeadSplitPos * HeadSizeY) / 1000;
int localSizeX;
RECT coord;
MoveWindow(GetDlgItem(hDlg, IDC_SPLITTER), 5, localSplitPos, HeadSizeX - 10, 2, TRUE);
- MoveWindow(hEdit, 5, localSplitPos + 6, HeadSizeX - 10, HeadSizeY - localSplitPos - 11, TRUE); //where to put text window while resizing
- MoveWindow(hList, 5, 5, HeadSizeX - 10, (isBodyShown ? localSplitPos : HeadSizeY) - 10, TRUE); //where to put headers list window while resizing
- //if (changeX) {
+ MoveWindow(hEdit, 5, localSplitPos + 6, HeadSizeX - 10, HeadSizeY - localSplitPos - 11, TRUE); // where to put text window while resizing
+ MoveWindow(hList, 5, 5, HeadSizeX - 10, (isBodyShown ? localSplitPos : HeadSizeY) - 10, TRUE); // where to put headers list window while resizing
+ // if (changeX) {
if (GetClientRect(hList, &coord)) {
localSizeX = coord.right - coord.left;
}
else localSizeX = HeadSizeX;
LONG iNameWidth = ListView_GetColumnWidth(hList, 0);
ListView_SetColumnWidth(hList, 1, (localSizeX <= iNameWidth) ? 0 : (localSizeX - iNameWidth));
- //}
+ // }
}
return 0;
case WM_CONTEXTMENU:
if (GetWindowLongPtr((HWND)wParam, GWLP_ID) == IDC_LISTHEADERS) {
- //MessageBox(0,"LISTHEADERS","Debug",0);
+ // MessageBox(0,"LISTHEADERS","Debug",0);
HWND hList = GetDlgItem(hDlg, IDC_LISTHEADERS);
POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
if (pt.x == -1) pt.x = 0;
@@ -1433,7 +1419,7 @@ CREADTEVIEWMESSAGEWINDOW:
delete MyParam;
}
-/////////////////////////////////////////////////////////////////////////////////////////
+// // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // /
// Mail browser window
static LRESULT CALLBACK ListViewSubclassProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -1570,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 (!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
{
PosX = coord.left;
SizeX = coord.right - coord.left;
@@ -1592,7 +1578,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR
// delete mails from queue, which are deleted from server (spam level 3 mails e.g.)
for (HYAMNMAIL Parser = (HYAMNMAIL)ActualAccount->Mails; Parser != nullptr; Parser = Parser->Next) {
- if ((Parser->Flags & YAMN_MSG_DELETED) && YAMN_MSG_SPAML(Parser->Flags, YAMN_MSG_SPAML3) && mwui->Seen) //if spaml3 was already deleted and user knows about it
+ if ((Parser->Flags & YAMN_MSG_DELETED) && YAMN_MSG_SPAML(Parser->Flags, YAMN_MSG_SPAML3) && mwui->Seen) // if spaml3 was already deleted and user knows about it
{
DeleteMessageFromQueueFcn((HYAMNMAIL *)&ActualAccount->Mails, Parser, 1);
DeleteAccountMail(ActualAccount->Plugin, Parser);
@@ -1652,7 +1638,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR
if (!UpdateMails(hDlg, (CAccount *)wParam, UpdateParams.Flags->nflags, UpdateParams.Flags->nnflags))
DestroyWindow(hDlg);
}
- else if (PostMessage(hDlg, WM_YAMN_UPDATEMAILS, wParam, (LPARAM)&UpdateParams)) //this ensures UpdateMails will execute the thread who created the browser window
+ else if (PostMessage(hDlg, WM_YAMN_UPDATEMAILS, wParam, (LPARAM)&UpdateParams)) // this ensures UpdateMails will execute the thread who created the browser window
{
if (!ThisThreadWindow)
WaitForSingleObject(UpdateParams.Copied, INFINITE);
@@ -1799,7 +1785,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR
HYAMNMAIL ActualMail;
uint32_t Total = 0;
- // we use event to signal, that running thread has all needed stack parameters copied
+ // we use event to signal, that running thread has all needed stack parameters copied
HANDLE ThreadRunningEV = CreateEvent(nullptr, FALSE, FALSE, nullptr);
if (ThreadRunningEV == nullptr)
break;
@@ -1821,7 +1807,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR
if (nullptr == ActualMail)
break;
if (item.state & LVIS_SELECTED) {
- ActualMail->Flags |= YAMN_MSG_USERDELETE; //set to mail we are going to delete it
+ ActualMail->Flags |= YAMN_MSG_USERDELETE; // set to mail we are going to delete it
Total++;
}
}
@@ -1839,10 +1825,10 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR
SWriteGuard swm(ActualAccount->MessagesAccessSO);
if (swm.Succeeded()) {
for (ActualMail = (HYAMNMAIL)ActualAccount->Mails; ActualMail != nullptr; ActualMail = ActualMail->Next) {
- if ((ActualMail->Flags & YAMN_MSG_DELETED) && ((ActualMail->Flags & YAMN_MSG_USERDELETE))) //if selected mail was already deleted
+ if ((ActualMail->Flags & YAMN_MSG_DELETED) && ((ActualMail->Flags & YAMN_MSG_USERDELETE))) // if selected mail was already deleted
{
DeleteMessageFromQueueFcn((HYAMNMAIL *)&ActualAccount->Mails, ActualMail, 1);
- DeleteAccountMail(ActualAccount->Plugin, ActualMail); //delete it from memory
+ DeleteAccountMail(ActualAccount->Plugin, ActualMail); // delete it from memory
continue;
}
}
@@ -1854,7 +1840,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR
WaitForSingleObject(ThreadRunningEV, INFINITE);
}
}
- else //else mark messages that they are not to be deleted
+ else // else mark messages that they are not to be deleted
SetRemoveFlagsInQueueFcn((HYAMNMAIL)ActualAccount->Mails, YAMN_MSG_DISPLAY | YAMN_MSG_USERDELETE, 0, YAMN_MSG_USERDELETE, 0);
}
@@ -1868,14 +1854,14 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR
case WM_SIZE:
if (wParam == SIZE_RESTORED) {
- LONG x = LOWORD(lParam); //((LPRECT)lParam)->right-((LPRECT)lParam)->left;
- LONG y = HIWORD(lParam); //((LPRECT)lParam)->bottom-((LPRECT)lParam)->top;
- MoveWindow(GetDlgItem(hDlg, IDC_BTNDEL), 5, y - 5 - 25, (x - 20) / 3, 25, TRUE); //where to put DELETE button while resizing
- MoveWindow(GetDlgItem(hDlg, IDC_BTNCHECKALL), 10 + (x - 20) / 3, y - 5 - 25, (x - 20) / 6, 25, TRUE); //where to put CHECK ALL button while resizing
- MoveWindow(GetDlgItem(hDlg, IDC_BTNAPP), 15 + (x - 20) / 3 + (x - 20) / 6, y - 5 - 25, (x - 20) / 3, 25, TRUE); //where to put RUN APP button while resizing
- MoveWindow(GetDlgItem(hDlg, IDC_BTNOK), 20 + 2 * (x - 20) / 3 + (x - 20) / 6, y - 5 - 25, (x - 20) / 6, 25, TRUE); //where to put OK button while resizing
- MoveWindow(GetDlgItem(hDlg, IDC_LISTMAILS), 5, 5, x - 10, y - 55, TRUE); //where to put list mail window while resizing
- MoveWindow(GetDlgItem(hDlg, IDC_STSTATUS), 5, y - 5 - 45, x - 10, 15, TRUE); //where to put account status text while resizing
+ LONG x = LOWORD(lParam);
+ LONG y = HIWORD(lParam);
+ MoveWindow(GetDlgItem(hDlg, IDC_BTNDEL), 5, y - 5 - 25, (x - 20) / 3, 25, TRUE);
+ MoveWindow(GetDlgItem(hDlg, IDC_BTNCHECKALL), 10 + (x - 20) / 3, y - 5 - 25, (x - 20) / 6, 25, TRUE);
+ MoveWindow(GetDlgItem(hDlg, IDC_BTNAPP), 15 + (x - 20) / 3 + (x - 20) / 6, y - 5 - 25, (x - 20) / 3, 25, TRUE);
+ MoveWindow(GetDlgItem(hDlg, IDC_BTNOK), 20 + 2 * (x - 20) / 3 + (x - 20) / 6, y - 5 - 25, (x - 20) / 6, 25, TRUE);
+ MoveWindow(GetDlgItem(hDlg, IDC_LISTMAILS), 5, 5, x - 10, y - 55, TRUE);
+ MoveWindow(GetDlgItem(hDlg, IDC_STSTATUS), 5, y - 5 - 45, x - 10, 15, TRUE);
}
return 0;
@@ -1898,7 +1884,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR
nid.hIcon = g_plugin.getIcon(IDI_NEWMAIL);
Shell_NotifyIcon(NIM_MODIFY, &nid);
mwui->TrayIconState = !mwui->TrayIconState;
- // UpdateWindow(hDlg);
+ // UpdateWindow(hDlg);
}
break;
@@ -1998,7 +1984,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR
case WM_CONTEXTMENU:
if (GetWindowLongPtr((HWND)wParam, GWLP_ID) == IDC_LISTMAILS) {
- //MessageBox(0,"LISTHEADERS","Debug",0);
+ // MessageBox(0,"LISTHEADERS","Debug",0);
HWND hList = GetDlgItem(hDlg, IDC_LISTMAILS);
POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
if (pt.x == -1) pt.x = 0;
@@ -2086,11 +2072,11 @@ static void __cdecl MailBrowser(void *Param)
if (hMailBrowser != nullptr) {
// if this thread created window, just post message to update mails
struct CChangeContent Params = { MyParam->nflags, MyParam->nnflags };
- SendMessage(hMailBrowser, WM_YAMN_CHANGECONTENT, (WPARAM)ActualAccount, (LPARAM)&Params); //we ensure this will do the thread who created the browser window
+ SendMessage(hMailBrowser, WM_YAMN_CHANGECONTENT, (WPARAM)ActualAccount, (LPARAM)&Params); // we ensure this will do the thread who created the browser window
}
- else UpdateMails(nullptr, ActualAccount, MyParam->nflags, MyParam->nnflags); //update mails without displaying or refreshing any window
+ else UpdateMails(nullptr, ActualAccount, MyParam->nflags, MyParam->nnflags); // update mails without displaying or refreshing any window
- if ((hMailBrowser != nullptr) && !WndFound) { //we process message loop only for thread that created window
+ if ((hMailBrowser != nullptr) && !WndFound) { // we process message loop only for thread that created window
while (GetMessage(&msg, nullptr, 0, 0)) {
if (hMailBrowser == nullptr || !IsDialogMessage(hMailBrowser, &msg)) { /* Wine fix. */
TranslateMessage(&msg);
diff --git a/protocols/YAMN/src/proto/pop3/pop3comm.cpp b/protocols/YAMN/src/proto/pop3/pop3comm.cpp
index c3ffa80e5b..3410d187e6 100644
--- a/protocols/YAMN/src/proto/pop3/pop3comm.cpp
+++ b/protocols/YAMN/src/proto/pop3/pop3comm.cpp
@@ -219,19 +219,15 @@ int RegisterPOP3Plugin(WPARAM, LPARAM)
for (CAccount *Finder = POP3Plugin->FirstAccount; Finder != nullptr; Finder = Finder->Next) {
Finder->hContact = NULL;
for (auto &hContact : Contacts(YAMN_DBMODULE)) {
- DBVARIANT dbv;
- if (!g_plugin.getString(hContact, "Id", &dbv)) {
- if (mir_strcmp(dbv.pszVal, Finder->Name) == 0) {
- Finder->hContact = hContact;
- g_plugin.setWord(Finder->hContact, "Status", ID_STATUS_ONLINE);
- db_set_s(Finder->hContact, "CList", "StatusMsg", Translate("No new mail message"));
- if ((Finder->Flags & YAMN_ACC_ENA) && (Finder->NewMailN.Flags & YAMN_ACC_CONT))
- Contact::Hide(Finder->hContact, false);
-
- if (!(Finder->Flags & YAMN_ACC_ENA) || !(Finder->NewMailN.Flags & YAMN_ACC_CONT))
- Contact::Hide(Finder->hContact);
- }
- db_free(&dbv);
+ if (g_plugin.getMStringA(hContact, "Id") == Finder->Name) {
+ Finder->hContact = hContact;
+ g_plugin.setWord(Finder->hContact, "Status", ID_STATUS_ONLINE);
+ db_set_s(Finder->hContact, "CList", "StatusMsg", Translate("No new mail message"));
+ if ((Finder->Flags & YAMN_ACC_ENA) && (Finder->NewMailN.Flags & YAMN_ACC_CONT))
+ Contact::Hide(Finder->hContact, false);
+
+ if (!(Finder->Flags & YAMN_ACC_ENA) || !(Finder->NewMailN.Flags & YAMN_ACC_CONT))
+ Contact::Hide(Finder->hContact);
}
}
diff --git a/protocols/YAMN/src/proto/pop3/pop3opt.cpp b/protocols/YAMN/src/proto/pop3/pop3opt.cpp
index 71b6b0642d..2372b6f6c2 100644
--- a/protocols/YAMN/src/proto/pop3/pop3opt.cpp
+++ b/protocols/YAMN/src/proto/pop3/pop3opt.cpp
@@ -6,33 +6,36 @@
#include "../../stdafx.h"
-//--------------------------------------------------------------------------------------------------
-
static char DlgInput[MAX_PATH];
-static BOOL DlgSetItemText(HWND hDlg, WPARAM wParam, const char *str)
+static void DlgSetItemText(HWND hDlg, WPARAM wParam, const char *str)
{
- if (str == nullptr)
- SetDlgItemTextA(hDlg, wParam, "");
- else
- SetDlgItemTextA(hDlg, wParam, str);
- return TRUE;
+ SetDlgItemTextA(hDlg, wParam, (str == nullptr) ? "" : str);
}
-static BOOL DlgSetItemTextW(HWND hDlg, WPARAM wParam, const wchar_t *str)
+static void DlgSetItemTextW(HWND hDlg, WPARAM wParam, const wchar_t *str)
{
- if (str == nullptr)
- SetDlgItemTextW(hDlg, wParam, L"");
- else
- SetDlgItemTextW(hDlg, wParam, str);
- return TRUE;
+ SetDlgItemTextW(hDlg, wParam, (str == nullptr) ? L"" : str);
}
+/////////////////////////////////////////////////////////////////////////////////////////
+// Base options class
+
struct CBaseOptionsDlg : public CDlgBase
{
CBaseOptionsDlg(int iDlgId) :
CDlgBase(g_plugin, iDlgId)
- {}
+ {
+ this->m_OnFinishWizard = Callback(this, &CBaseOptionsDlg::OnFinish);
+ }
+
+ void OnFinish(void *)
+ {
+ WritePOP3Accounts();
+
+ for (auto *pAcc = POP3Plugin->FirstAccount; pAcc != nullptr; pAcc = pAcc->Next)
+ pAcc->RefreshContact();
+ }
void DlgShowAccount(CPOP3Account* pAccount)
{
@@ -356,6 +359,184 @@ public:
return true;
}
+ bool OnApply() override
+ {
+ char Text[MAX_PATH];
+ wchar_t TextW[MAX_PATH];
+ BOOL Translated, NewAcc = FALSE;
+ size_t Length;
+ int index;
+
+ if (!GetDlgItemTextA(m_hwnd, IDC_COMBOACCOUNT, Text, _countof(Text)))
+ return false;
+
+ BOOL Check = (IsDlgButtonChecked(m_hwnd, IDC_CHECK) == BST_CHECKED);
+ BOOL CheckSSL = (IsDlgButtonChecked(m_hwnd, IDC_CHECKSSL) == BST_CHECKED);
+ BOOL CheckNoTLS = (IsDlgButtonChecked(m_hwnd, IDC_CHECKNOTLS) == BST_CHECKED);
+ BOOL CheckAPOP = (IsDlgButtonChecked(m_hwnd, IDC_CHECKAPOP) == BST_CHECKED);
+
+ BOOL CheckABody = (IsDlgButtonChecked(m_hwnd, IDC_AUTOBODY) == BST_CHECKED);
+ BOOL CheckMsg = (IsDlgButtonChecked(m_hwnd, IDC_CHECKMSG) == BST_CHECKED);
+ BOOL CheckIco = (IsDlgButtonChecked(m_hwnd, IDC_CHECKICO) == BST_CHECKED);
+
+ BOOL CheckApp = (IsDlgButtonChecked(m_hwnd, IDC_CHECKAPP) == BST_CHECKED);
+ BOOL CheckKBN = (IsDlgButtonChecked(m_hwnd, IDC_CHECKKBN) == BST_CHECKED);
+ BOOL CheckContact = (IsDlgButtonChecked(m_hwnd, IDC_CHECKCONTACT) == BST_CHECKED);
+ BOOL CheckContactNick = (IsDlgButtonChecked(m_hwnd, IDC_CHECKCONTACTNICK) == BST_CHECKED);
+ BOOL CheckContactNoEvent = (IsDlgButtonChecked(m_hwnd, IDC_CHECKCONTACTNOEVENT) == BST_CHECKED);
+
+ BOOL CheckFMsg = (IsDlgButtonChecked(m_hwnd, IDC_CHECKFMSG) == BST_CHECKED);
+ BOOL CheckFIco = (IsDlgButtonChecked(m_hwnd, IDC_CHECKFICO) == BST_CHECKED);
+
+ BOOL CheckNMsgP = (IsDlgButtonChecked(m_hwnd, IDC_CHECKNMSGP) == BST_CHECKED);
+
+ UINT Port = GetDlgItemInt(m_hwnd, IDC_EDITPORT, &Translated, FALSE);
+ if (!Translated) {
+ MessageBox(m_hwnd, TranslateT("This is not a valid number value"), TranslateT("Input error"), MB_OK);
+ SetFocus(GetDlgItem(m_hwnd, IDC_EDITPORT));
+ return false;
+ }
+
+ UINT Interval = GetDlgItemInt(m_hwnd, IDC_EDITINTERVAL, &Translated, FALSE);
+ if (!Translated) {
+ MessageBox(m_hwnd, TranslateT("This is not a valid number value"), TranslateT("Input error"), MB_OK);
+ SetFocus(GetDlgItem(m_hwnd, IDC_EDITINTERVAL));
+ return false;
+ }
+
+ GetDlgItemTextA(m_hwnd, IDC_EDITAPP, Text, _countof(Text));
+ if (CheckApp && !(Length = mir_strlen(Text))) {
+ MessageBox(m_hwnd, TranslateT("Please select application to run"), TranslateT("Input error"), MB_OK);
+ return false;
+ }
+
+ GetDlgItemTextA(m_hwnd, IDC_COMBOACCOUNT, Text, _countof(Text));
+ if (!(Length = mir_strlen(Text))) {
+ GetDlgItemTextA(m_hwnd, IDC_EDITNAME, Text, _countof(Text));
+ if (!(Length = mir_strlen(Text)))
+ return false;
+ }
+
+ DlgSetItemTextW(m_hwnd, IDC_STTIMELEFT, TranslateT("Please wait while no account is in use."));
+
+ if (nullptr == (ActualAccount = (CPOP3Account *)FindAccountByName(POP3Plugin, Text))) {
+ NewAcc = TRUE;
+ SWriteGuard swb(POP3Plugin->AccountBrowserSO);
+ if (nullptr == (ActualAccount = (CPOP3Account *)GetNextFreeAccount(POP3Plugin))) {
+ swb.Uninit();
+ MessageBox(m_hwnd, TranslateT("Cannot allocate memory space for new account"), TranslateT("Memory error"), MB_OK);
+ return false;
+ }
+ DlgEnableAccount(true);
+ }
+ {
+ SWriteGuard swa(ActualAccount->AccountAccessSO);
+ if (!swa.Succeeded())
+ return false;
+
+ GetDlgItemTextA(m_hwnd, IDC_EDITNAME, Text, _countof(Text));
+ if (!(Length = mir_strlen(Text)))
+ return false;
+ if (nullptr != ActualAccount->Name)
+ delete[] ActualAccount->Name;
+ ActualAccount->Name = new char[mir_strlen(Text) + 1];
+ mir_strcpy(ActualAccount->Name, Text);
+
+ GetDlgItemTextA(m_hwnd, IDC_EDITSERVER, Text, _countof(Text));
+ if (nullptr != ActualAccount->Server->Name)
+ delete[] ActualAccount->Server->Name;
+ ActualAccount->Server->Name = new char[mir_strlen(Text) + 1];
+ mir_strcpy(ActualAccount->Server->Name, Text);
+
+ GetDlgItemTextA(m_hwnd, IDC_EDITLOGIN, Text, _countof(Text));
+ if (nullptr != ActualAccount->Server->Login)
+ delete[] ActualAccount->Server->Login;
+ ActualAccount->Server->Login = new char[mir_strlen(Text) + 1];
+ mir_strcpy(ActualAccount->Server->Login, Text);
+
+ GetDlgItemTextA(m_hwnd, IDC_EDITPASS, Text, _countof(Text));
+ if (nullptr != ActualAccount->Server->Passwd)
+ delete[] ActualAccount->Server->Passwd;
+ ActualAccount->Server->Passwd = new char[mir_strlen(Text) + 1];
+ mir_strcpy(ActualAccount->Server->Passwd, Text);
+
+ GetDlgItemTextW(m_hwnd, IDC_EDITAPP, TextW, _countof(TextW));
+ if (nullptr != ActualAccount->NewMailN.App)
+ delete[] ActualAccount->NewMailN.App;
+ ActualAccount->NewMailN.App = new wchar_t[mir_wstrlen(TextW) + 1];
+ mir_wstrcpy(ActualAccount->NewMailN.App, TextW);
+
+ GetDlgItemTextW(m_hwnd, IDC_EDITAPPPARAM, TextW, _countof(TextW));
+ if (nullptr != ActualAccount->NewMailN.AppParam)
+ delete[] ActualAccount->NewMailN.AppParam;
+ ActualAccount->NewMailN.AppParam = new wchar_t[mir_wstrlen(TextW) + 1];
+ mir_wstrcpy(ActualAccount->NewMailN.AppParam, TextW);
+
+ ActualAccount->Server->Port = Port;
+ ActualAccount->Interval = Interval * 60;
+
+ if (CB_ERR == (index = SendDlgItemMessage(m_hwnd, IDC_COMBOCP, CB_GETCURSEL, 0, 0)))
+ index = CPDEFINDEX;
+ ActualAccount->CP = CodePageNamesSupp[index].CP;
+
+ if (NewAcc)
+ ActualAccount->TimeLeft = Interval * 60;
+
+ BOOL CheckStart = (IsDlgButtonChecked(m_hwnd, IDC_CHECKSTART) == BST_CHECKED);
+ BOOL CheckForce = (IsDlgButtonChecked(m_hwnd, IDC_CHECKFORCE) == BST_CHECKED);
+
+ ActualAccount->Flags =
+ (Check ? YAMN_ACC_ENA : 0) |
+ (CheckSSL ? YAMN_ACC_SSL23 : 0) |
+ (CheckNoTLS ? YAMN_ACC_NOTLS : 0) |
+ (CheckAPOP ? YAMN_ACC_APOP : 0) |
+ (CheckABody ? YAMN_ACC_BODY : 0) |
+ (ActualAccount->Flags & YAMN_ACC_POPN);
+
+ ActualAccount->StatusFlags &= 0xFFFF;
+ ActualAccount->StatusFlags |=
+ (CheckStart ? YAMN_ACC_STARTS : 0) |
+ (CheckForce ? YAMN_ACC_FORCE : 0);
+
+ ActualAccount->NewMailN.Flags =
+ (CheckMsg ? YAMN_ACC_MSG : 0) |
+ (CheckIco ? YAMN_ACC_ICO : 0) |
+ (ActualAccount->NewMailN.Flags & YAMN_ACC_POP) |
+ (ActualAccount->NewMailN.Flags & YAMN_ACC_POPC) |
+ (CheckApp ? YAMN_ACC_APP : 0) |
+ (CheckKBN ? YAMN_ACC_KBN : 0) |
+ (CheckContact ? YAMN_ACC_CONT : 0) |
+ (CheckContactNick ? YAMN_ACC_CONTNICK : 0) |
+ (CheckContactNoEvent ? YAMN_ACC_CONTNOEVENT : 0) |
+ YAMN_ACC_MSGP; //this is default: when new mail arrives and window was displayed, leave it displayed.
+
+ ActualAccount->NoNewMailN.Flags =
+ (ActualAccount->NoNewMailN.Flags & YAMN_ACC_POP) |
+ (ActualAccount->NoNewMailN.Flags & YAMN_ACC_POPC) |
+ (CheckNMsgP ? YAMN_ACC_MSGP : 0);
+
+ ActualAccount->BadConnectN.Flags =
+ (CheckFMsg ? YAMN_ACC_MSG : 0) |
+ (CheckFIco ? YAMN_ACC_ICO : 0) |
+ (ActualAccount->BadConnectN.Flags & YAMN_ACC_POP) |
+ (ActualAccount->BadConnectN.Flags & YAMN_ACC_POPC);
+ }
+ btnDel.Enable();
+
+ DlgSetItemText(m_hwnd, (WPARAM)IDC_STTIMELEFT, nullptr);
+
+ index = cmbAccount.GetCurSel();
+ cmbAccount.ResetContent();
+
+ if (POP3Plugin->FirstAccount != nullptr)
+ for (auto *p = POP3Plugin->FirstAccount; p != nullptr; p = p->Next)
+ if (p->Name != nullptr)
+ cmbAccount.AddStringA(p->Name);
+
+ cmbAccount.SetCurSel(index);
+ return true;
+ }
+
void OnDestroy() override
{
WindowList_Remove(YAMNVar.MessageWnds, m_hwnd);
@@ -447,7 +628,7 @@ public:
void onClick_Add(CCtrlButton *)
{
- DlgSetItemText(m_hwnd, (WPARAM)IDC_STTIMELEFT, nullptr);
+ DlgSetItemText(m_hwnd, IDC_STTIMELEFT, nullptr);
DlgShowAccount(0);
DlgEnableAccount(true);
btnDel.Disable();
@@ -517,187 +698,6 @@ public:
if (ActualAccount != nullptr)
ActualAccount->TimeLeft = ActualAccount->Interval;
}
-
- bool OnApply() override
- {
- char Text[MAX_PATH];
- wchar_t TextW[MAX_PATH];
- BOOL Translated, NewAcc = FALSE;
- size_t Length;
- int index;
-
- if (!GetDlgItemTextA(m_hwnd, IDC_COMBOACCOUNT, Text, _countof(Text)))
- return false;
-
- BOOL Check = (IsDlgButtonChecked(m_hwnd, IDC_CHECK) == BST_CHECKED);
- BOOL CheckSSL = (IsDlgButtonChecked(m_hwnd, IDC_CHECKSSL) == BST_CHECKED);
- BOOL CheckNoTLS = (IsDlgButtonChecked(m_hwnd, IDC_CHECKNOTLS) == BST_CHECKED);
- BOOL CheckAPOP = (IsDlgButtonChecked(m_hwnd, IDC_CHECKAPOP) == BST_CHECKED);
-
- BOOL CheckABody = (IsDlgButtonChecked(m_hwnd, IDC_AUTOBODY) == BST_CHECKED);
- BOOL CheckMsg = (IsDlgButtonChecked(m_hwnd, IDC_CHECKMSG) == BST_CHECKED);
- BOOL CheckIco = (IsDlgButtonChecked(m_hwnd, IDC_CHECKICO) == BST_CHECKED);
-
- BOOL CheckApp = (IsDlgButtonChecked(m_hwnd, IDC_CHECKAPP) == BST_CHECKED);
- BOOL CheckKBN = (IsDlgButtonChecked(m_hwnd, IDC_CHECKKBN) == BST_CHECKED);
- BOOL CheckContact = (IsDlgButtonChecked(m_hwnd, IDC_CHECKCONTACT) == BST_CHECKED);
- BOOL CheckContactNick = (IsDlgButtonChecked(m_hwnd, IDC_CHECKCONTACTNICK) == BST_CHECKED);
- BOOL CheckContactNoEvent = (IsDlgButtonChecked(m_hwnd, IDC_CHECKCONTACTNOEVENT) == BST_CHECKED);
-
- BOOL CheckFMsg = (IsDlgButtonChecked(m_hwnd, IDC_CHECKFMSG) == BST_CHECKED);
- BOOL CheckFIco = (IsDlgButtonChecked(m_hwnd, IDC_CHECKFICO) == BST_CHECKED);
-
- BOOL CheckNMsgP = (IsDlgButtonChecked(m_hwnd, IDC_CHECKNMSGP) == BST_CHECKED);
-
- UINT Port = GetDlgItemInt(m_hwnd, IDC_EDITPORT, &Translated, FALSE);
- if (!Translated) {
- MessageBox(m_hwnd, TranslateT("This is not a valid number value"), TranslateT("Input error"), MB_OK);
- SetFocus(GetDlgItem(m_hwnd, IDC_EDITPORT));
- return false;
- }
-
- UINT Interval = GetDlgItemInt(m_hwnd, IDC_EDITINTERVAL, &Translated, FALSE);
- if (!Translated) {
- MessageBox(m_hwnd, TranslateT("This is not a valid number value"), TranslateT("Input error"), MB_OK);
- SetFocus(GetDlgItem(m_hwnd, IDC_EDITINTERVAL));
- return false;
- }
-
- GetDlgItemTextA(m_hwnd, IDC_EDITAPP, Text, _countof(Text));
- if (CheckApp && !(Length = mir_strlen(Text))) {
- MessageBox(m_hwnd, TranslateT("Please select application to run"), TranslateT("Input error"), MB_OK);
- return false;
- }
-
- GetDlgItemTextA(m_hwnd, IDC_COMBOACCOUNT, Text, _countof(Text));
- if (!(Length = mir_strlen(Text))) {
- GetDlgItemTextA(m_hwnd, IDC_EDITNAME, Text, _countof(Text));
- if (!(Length = mir_strlen(Text)))
- return false;
- }
-
- DlgSetItemTextW(m_hwnd, IDC_STTIMELEFT, TranslateT("Please wait while no account is in use."));
-
- if (nullptr == (ActualAccount = (CPOP3Account*)FindAccountByName(POP3Plugin, Text))) {
- NewAcc = TRUE;
- SWriteGuard swb(POP3Plugin->AccountBrowserSO);
- if (nullptr == (ActualAccount = (CPOP3Account*)GetNextFreeAccount(POP3Plugin))) {
- swb.Uninit();
- MessageBox(m_hwnd, TranslateT("Cannot allocate memory space for new account"), TranslateT("Memory error"), MB_OK);
- return false;
- }
- DlgEnableAccount(true);
- }
-
- {
- SWriteGuard swa(ActualAccount->AccountAccessSO);
- if (swa.Succeeded()) {
- GetDlgItemTextA(m_hwnd, IDC_EDITNAME, Text, _countof(Text));
- if (!(Length = mir_strlen(Text)))
- return false;
- if (nullptr != ActualAccount->Name)
- delete[] ActualAccount->Name;
- ActualAccount->Name = new char[mir_strlen(Text) + 1];
- mir_strcpy(ActualAccount->Name, Text);
-
- GetDlgItemTextA(m_hwnd, IDC_EDITSERVER, Text, _countof(Text));
- if (nullptr != ActualAccount->Server->Name)
- delete[] ActualAccount->Server->Name;
- ActualAccount->Server->Name = new char[mir_strlen(Text) + 1];
- mir_strcpy(ActualAccount->Server->Name, Text);
-
- GetDlgItemTextA(m_hwnd, IDC_EDITLOGIN, Text, _countof(Text));
- if (nullptr != ActualAccount->Server->Login)
- delete[] ActualAccount->Server->Login;
- ActualAccount->Server->Login = new char[mir_strlen(Text) + 1];
- mir_strcpy(ActualAccount->Server->Login, Text);
-
- GetDlgItemTextA(m_hwnd, IDC_EDITPASS, Text, _countof(Text));
- if (nullptr != ActualAccount->Server->Passwd)
- delete[] ActualAccount->Server->Passwd;
- ActualAccount->Server->Passwd = new char[mir_strlen(Text) + 1];
- mir_strcpy(ActualAccount->Server->Passwd, Text);
-
- GetDlgItemTextW(m_hwnd, IDC_EDITAPP, TextW, _countof(TextW));
- if (nullptr != ActualAccount->NewMailN.App)
- delete[] ActualAccount->NewMailN.App;
- ActualAccount->NewMailN.App = new wchar_t[mir_wstrlen(TextW) + 1];
- mir_wstrcpy(ActualAccount->NewMailN.App, TextW);
-
- GetDlgItemTextW(m_hwnd, IDC_EDITAPPPARAM, TextW, _countof(TextW));
- if (nullptr != ActualAccount->NewMailN.AppParam)
- delete[] ActualAccount->NewMailN.AppParam;
- ActualAccount->NewMailN.AppParam = new wchar_t[mir_wstrlen(TextW) + 1];
- mir_wstrcpy(ActualAccount->NewMailN.AppParam, TextW);
-
- ActualAccount->Server->Port = Port;
- ActualAccount->Interval = Interval * 60;
-
- if (CB_ERR == (index = SendDlgItemMessage(m_hwnd, IDC_COMBOCP, CB_GETCURSEL, 0, 0)))
- index = CPDEFINDEX;
- ActualAccount->CP = CodePageNamesSupp[index].CP;
-
- if (NewAcc)
- ActualAccount->TimeLeft = Interval * 60;
-
- BOOL CheckStart = (IsDlgButtonChecked(m_hwnd, IDC_CHECKSTART) == BST_CHECKED);
- BOOL CheckForce = (IsDlgButtonChecked(m_hwnd, IDC_CHECKFORCE) == BST_CHECKED);
-
- ActualAccount->Flags =
- (Check ? YAMN_ACC_ENA : 0) |
- (CheckSSL ? YAMN_ACC_SSL23 : 0) |
- (CheckNoTLS ? YAMN_ACC_NOTLS : 0) |
- (CheckAPOP ? YAMN_ACC_APOP : 0) |
- (CheckABody ? YAMN_ACC_BODY : 0) |
- (ActualAccount->Flags & YAMN_ACC_POPN);
-
- ActualAccount->StatusFlags &= 0xFFFF;
- ActualAccount->StatusFlags |=
- (CheckStart ? YAMN_ACC_STARTS : 0) |
- (CheckForce ? YAMN_ACC_FORCE : 0);
-
- ActualAccount->NewMailN.Flags =
- (CheckMsg ? YAMN_ACC_MSG : 0) |
- (CheckIco ? YAMN_ACC_ICO : 0) |
- (ActualAccount->NewMailN.Flags & YAMN_ACC_POP) |
- (ActualAccount->NewMailN.Flags & YAMN_ACC_POPC) |
- (CheckApp ? YAMN_ACC_APP : 0) |
- (CheckKBN ? YAMN_ACC_KBN : 0) |
- (CheckContact ? YAMN_ACC_CONT : 0) |
- (CheckContactNick ? YAMN_ACC_CONTNICK : 0) |
- (CheckContactNoEvent ? YAMN_ACC_CONTNOEVENT : 0) |
- YAMN_ACC_MSGP; //this is default: when new mail arrives and window was displayed, leave it displayed.
-
- ActualAccount->NoNewMailN.Flags =
- (ActualAccount->NoNewMailN.Flags & YAMN_ACC_POP) |
- (ActualAccount->NoNewMailN.Flags & YAMN_ACC_POPC) |
- (CheckNMsgP ? YAMN_ACC_MSGP : 0);
-
- ActualAccount->BadConnectN.Flags =
- (CheckFMsg ? YAMN_ACC_MSG : 0) |
- (CheckFIco ? YAMN_ACC_ICO : 0) |
- (ActualAccount->BadConnectN.Flags & YAMN_ACC_POP) |
- (ActualAccount->BadConnectN.Flags & YAMN_ACC_POPC);
- }
- }
- btnDel.Enable();
-
- DlgSetItemText(m_hwnd, (WPARAM)IDC_STTIMELEFT, nullptr);
-
- index = cmbAccount.GetCurSel();
- cmbAccount.ResetContent();
-
- if (POP3Plugin->FirstAccount != nullptr)
- for (auto *p = POP3Plugin->FirstAccount; p != nullptr; p = p->Next)
- if (p->Name != nullptr)
- cmbAccount.AddStringA(p->Name);
-
- index = cmbAccount.SetCurSel(index);
-
- WritePOP3Accounts();
- RefreshContact();
- return TRUE;
- }
};
/////////////////////////////////////////////////////////////////////////////////////////
@@ -780,6 +780,7 @@ class CPopupOptsDlg : public CBaseOptionsDlg
SendDlgItemMessage(m_hwnd, IDC_CPB, CPM_SETCOLOUR, 0, (LPARAM)GetSysColor(COLOR_BTNFACE));
SendDlgItemMessage(m_hwnd, IDC_CPT, CPM_SETCOLOUR, 0, (LPARAM)GetSysColor(COLOR_WINDOWTEXT));
}
+
if (ActualAccount->BadConnectN.Flags & YAMN_ACC_POPC) {
SendDlgItemMessage(m_hwnd, IDC_CPFB, CPM_SETCOLOUR, 0, (LPARAM)ActualAccount->BadConnectN.PopupB);
SendDlgItemMessage(m_hwnd, IDC_CPFT, CPM_SETCOLOUR, 0, (LPARAM)ActualAccount->BadConnectN.PopupT);
@@ -788,6 +789,7 @@ class CPopupOptsDlg : public CBaseOptionsDlg
SendDlgItemMessage(m_hwnd, IDC_CPFB, CPM_SETCOLOUR, 0, (LPARAM)GetSysColor(COLOR_BTNFACE));
SendDlgItemMessage(m_hwnd, IDC_CPFT, CPM_SETCOLOUR, 0, (LPARAM)GetSysColor(COLOR_WINDOWTEXT));
}
+
if (ActualAccount->NoNewMailN.Flags & YAMN_ACC_POPC) {
SendDlgItemMessage(m_hwnd, IDC_CPNB, CPM_SETCOLOUR, 0, (LPARAM)ActualAccount->NoNewMailN.PopupB);
SendDlgItemMessage(m_hwnd, IDC_CPNT, CPM_SETCOLOUR, 0, (LPARAM)ActualAccount->NoNewMailN.PopupT);
@@ -996,59 +998,57 @@ public:
}
DlgSetItemTextW(m_hwnd, IDC_STTIMELEFT, TranslateT("Please wait while no account is in use."));
- {
- SWriteGuard swa(ActualAccount->AccountAccessSO);
-
- ActualAccount->Flags =
- (ActualAccount->Flags & YAMN_ACC_ENA) |
- (ActualAccount->Flags & YAMN_ACC_SSL23) |
- (ActualAccount->Flags & YAMN_ACC_NOTLS) |
- (ActualAccount->Flags & YAMN_ACC_APOP) |
- (ActualAccount->Flags & YAMN_ACC_BODY) |
- (CheckPopN ? YAMN_ACC_POPN : 0);
- ActualAccount->NewMailN.Flags =
- (ActualAccount->NewMailN.Flags & YAMN_ACC_MSG) |
- (ActualAccount->NewMailN.Flags & YAMN_ACC_ICO) |
- (CheckPopup ? YAMN_ACC_POP : 0) |
- (CheckPopupW ? YAMN_ACC_POPC : 0) |
- (ActualAccount->NewMailN.Flags & YAMN_ACC_APP) |
- (ActualAccount->NewMailN.Flags & YAMN_ACC_KBN) |
- (ActualAccount->NewMailN.Flags & YAMN_ACC_CONT) |
- (ActualAccount->NewMailN.Flags & YAMN_ACC_CONTNICK) |
- (ActualAccount->NewMailN.Flags & YAMN_ACC_CONTNOEVENT) |
- YAMN_ACC_MSGP;
-
- ActualAccount->NoNewMailN.Flags =
- (CheckNPopup ? YAMN_ACC_POP : 0) |
- (CheckNPopupW ? YAMN_ACC_POPC : 0) |
- (ActualAccount->NoNewMailN.Flags & YAMN_ACC_MSGP);
-
- ActualAccount->BadConnectN.Flags =
- (ActualAccount->BadConnectN.Flags & YAMN_ACC_MSG) |
- (ActualAccount->BadConnectN.Flags & YAMN_ACC_ICO) |
- (CheckFPopup ? YAMN_ACC_POP : 0) |
- (CheckFPopupW ? YAMN_ACC_POPC : 0);
-
- ActualAccount->NewMailN.PopupB = SendDlgItemMessage(m_hwnd, IDC_CPB, CPM_GETCOLOUR, 0, 0);
- ActualAccount->NewMailN.PopupT = SendDlgItemMessage(m_hwnd, IDC_CPT, CPM_GETCOLOUR, 0, 0);
- ActualAccount->NewMailN.PopupTime = Time;
-
- ActualAccount->NoNewMailN.PopupB = SendDlgItemMessage(m_hwnd, IDC_CPNB, CPM_GETCOLOUR, 0, 0);
- ActualAccount->NoNewMailN.PopupT = SendDlgItemMessage(m_hwnd, IDC_CPNT, CPM_GETCOLOUR, 0, 0);
- ActualAccount->NoNewMailN.PopupTime = TimeN;
-
- ActualAccount->BadConnectN.PopupB = SendDlgItemMessage(m_hwnd, IDC_CPFB, CPM_GETCOLOUR, 0, 0);
- ActualAccount->BadConnectN.PopupT = SendDlgItemMessage(m_hwnd, IDC_CPFT, CPM_GETCOLOUR, 0, 0);
- ActualAccount->BadConnectN.PopupTime = TimeF;
- }
- WritePOP3Accounts();
- RefreshContact();
+ SWriteGuard swa(ActualAccount->AccountAccessSO);
+
+ ActualAccount->Flags =
+ (ActualAccount->Flags & YAMN_ACC_ENA) |
+ (ActualAccount->Flags & YAMN_ACC_SSL23) |
+ (ActualAccount->Flags & YAMN_ACC_NOTLS) |
+ (ActualAccount->Flags & YAMN_ACC_APOP) |
+ (ActualAccount->Flags & YAMN_ACC_BODY) |
+ (CheckPopN ? YAMN_ACC_POPN : 0);
+
+ ActualAccount->NewMailN.Flags =
+ (ActualAccount->NewMailN.Flags & YAMN_ACC_MSG) |
+ (ActualAccount->NewMailN.Flags & YAMN_ACC_ICO) |
+ (CheckPopup ? YAMN_ACC_POP : 0) |
+ (CheckPopupW ? YAMN_ACC_POPC : 0) |
+ (ActualAccount->NewMailN.Flags & YAMN_ACC_APP) |
+ (ActualAccount->NewMailN.Flags & YAMN_ACC_KBN) |
+ (ActualAccount->NewMailN.Flags & YAMN_ACC_CONT) |
+ (ActualAccount->NewMailN.Flags & YAMN_ACC_CONTNICK) |
+ (ActualAccount->NewMailN.Flags & YAMN_ACC_CONTNOEVENT) |
+ YAMN_ACC_MSGP;
+
+ ActualAccount->NoNewMailN.Flags =
+ (CheckNPopup ? YAMN_ACC_POP : 0) |
+ (CheckNPopupW ? YAMN_ACC_POPC : 0) |
+ (ActualAccount->NoNewMailN.Flags & YAMN_ACC_MSGP);
+
+ ActualAccount->BadConnectN.Flags =
+ (ActualAccount->BadConnectN.Flags & YAMN_ACC_MSG) |
+ (ActualAccount->BadConnectN.Flags & YAMN_ACC_ICO) |
+ (CheckFPopup ? YAMN_ACC_POP : 0) |
+ (CheckFPopupW ? YAMN_ACC_POPC : 0);
+
+ ActualAccount->NewMailN.PopupB = SendDlgItemMessage(m_hwnd, IDC_CPB, CPM_GETCOLOUR, 0, 0);
+ ActualAccount->NewMailN.PopupT = SendDlgItemMessage(m_hwnd, IDC_CPT, CPM_GETCOLOUR, 0, 0);
+ ActualAccount->NewMailN.PopupTime = Time;
+
+ ActualAccount->NoNewMailN.PopupB = SendDlgItemMessage(m_hwnd, IDC_CPNB, CPM_GETCOLOUR, 0, 0);
+ ActualAccount->NoNewMailN.PopupT = SendDlgItemMessage(m_hwnd, IDC_CPNT, CPM_GETCOLOUR, 0, 0);
+ ActualAccount->NoNewMailN.PopupTime = TimeN;
+
+ ActualAccount->BadConnectN.PopupB = SendDlgItemMessage(m_hwnd, IDC_CPFB, CPM_GETCOLOUR, 0, 0);
+ ActualAccount->BadConnectN.PopupT = SendDlgItemMessage(m_hwnd, IDC_CPFT, CPM_GETCOLOUR, 0, 0);
+ ActualAccount->BadConnectN.PopupTime = TimeF;
return TRUE;
}
};
-//--------------------------------------------------------------------------------------------------
+/////////////////////////////////////////////////////////////////////////////////////////
+// Module entry point
int YAMNOptInitSvc(WPARAM wParam, LPARAM)
{
@@ -1065,8 +1065,7 @@ int YAMNOptInitSvc(WPARAM wParam, LPARAM)
odp.pDialog = new CGeneralOptDlg();
g_plugin.addOptions(wParam, &odp);
- odp.szGroup.a = LPGEN("Popups");
- odp.szTab.a = LPGEN("YAMN");
+ odp.szTab.a = LPGEN("Popups");
odp.pDialog = new CPopupOptsDlg();
g_plugin.addOptions(wParam, &odp);
return 0;
diff --git a/protocols/YAMN/src/services.cpp b/protocols/YAMN/src/services.cpp
index b72de25011..ae6e711f25 100644
--- a/protocols/YAMN/src/services.cpp
+++ b/protocols/YAMN/src/services.cpp
@@ -247,22 +247,3 @@ void CreateServiceFunctions(void)
// Function contact list context menu click
CreateServiceFunction(MS_YAMN_CLISTCONTEXTAPP, ContactApplication);
}
-
-// Function to put all enabled contact to the Online status
-void RefreshContact(void)
-{
- CAccount *Finder;
- for (Finder = POP3Plugin->FirstAccount; Finder != nullptr; Finder = Finder->Next) {
- if (Finder->hContact != NULL) {
- Contact::Hide(Finder->hContact, !(Finder->Flags & YAMN_ACC_ENA) && (Finder->NewMailN.Flags & YAMN_ACC_CONT));
- }
- else if ((Finder->Flags & YAMN_ACC_ENA) && (Finder->NewMailN.Flags & YAMN_ACC_CONT)) {
- Finder->hContact = db_add_contact();
- Proto_AddToContact(Finder->hContact, YAMN_DBMODULE);
- g_plugin.setString(Finder->hContact, "Id", Finder->Name);
- g_plugin.setString(Finder->hContact, "Nick", Finder->Name);
- g_plugin.setWord(Finder->hContact, "Status", ID_STATUS_ONLINE);
- db_set_s(Finder->hContact, "CList", "StatusMsg", Translate("No new mail message"));
- }
- }
-}
diff --git a/protocols/YAMN/src/stdafx.h b/protocols/YAMN/src/stdafx.h
index 98d6d40465..630ce63544 100644
--- a/protocols/YAMN/src/stdafx.h
+++ b/protocols/YAMN/src/stdafx.h
@@ -52,7 +52,7 @@ struct CMPlugin : public PLUGIN<CMPlugin>
void AccountMailCheck(CAccount *ActualAccount, bool bForce);
void CreateServiceFunctions(void);
void HookEvents(void);
-void RefreshContact(void);
+
void ContactDoubleclicked(WPARAM wParam, LPARAM lParam);
INT_PTR ClistContactDoubleclicked(WPARAM wParam, LPARAM lParam);