diff options
Diffstat (limited to 'protocols/YAMN')
-rw-r--r-- | protocols/YAMN/src/account.cpp | 34 | ||||
-rw-r--r-- | protocols/YAMN/src/account.h | 5 | ||||
-rw-r--r-- | protocols/YAMN/src/browser/browser.h | 2 | ||||
-rw-r--r-- | protocols/YAMN/src/browser/mailbrowser.cpp | 110 | ||||
-rw-r--r-- | protocols/YAMN/src/mails/mails.cpp | 70 | ||||
-rw-r--r-- | protocols/YAMN/src/mails/mails.h | 36 | ||||
-rw-r--r-- | protocols/YAMN/src/proto/pop3/pop3comm.cpp | 76 | ||||
-rw-r--r-- | protocols/YAMN/src/proto/pop3/pop3opt.cpp | 8 | ||||
-rw-r--r-- | protocols/YAMN/src/protoplugin.h | 8 | ||||
-rw-r--r-- | protocols/YAMN/src/stdafx.h | 35 |
10 files changed, 182 insertions, 202 deletions
diff --git a/protocols/YAMN/src/account.cpp b/protocols/YAMN/src/account.cpp index 692a881d52..fec65bebc5 100644 --- a/protocols/YAMN/src/account.cpp +++ b/protocols/YAMN/src/account.cpp @@ -36,6 +36,20 @@ void CAccount::CheckMail() }
}
+// Creates new mail for plugin (calling plugin's constructor, when plugin imported to YAMN)
+YAMNMAIL* CAccount::CreateMail()
+{
+ if (Plugin == nullptr)
+ return nullptr;
+
+ // Let plugin create its own structure, which can be derived from CAccount structure
+ if (Plugin->MailFcn->NewMailFcnPtr != nullptr)
+ return Plugin->MailFcn->NewMailFcnPtr(this);
+
+ // We suggest plugin uses standard CAccount structure, so we create it
+ return new YAMNMAIL();
+}
+
void CAccount::RefreshContact()
{
if (hContact == 0) {
@@ -129,14 +143,14 @@ void DeInitAccount(CAccount *Which) delete[] Which->Server;
}
- DeleteMessagesToEndFcn(Which, (HYAMNMAIL)Which->Mails);
+ DeleteMessagesToEndFcn(Which, (YAMNMAIL *)Which->Mails);
}
void StopSignalFcn(CAccount *Which)
// set event that we are going to delete account
{
Which->AbleToWork = FALSE;
-
+
// do not use synchronizing objects anymore
// any access to these objects then ends with WAIT_FAILED
Which->AccountAccessSO.Stop();
@@ -210,7 +224,7 @@ uint32_t ReadStringFromMemory(char **Parser, char *End, char **StoreTo) if (Finder >= End)
return EACC_FILECOMPATIBILITY;
-
+
if (uint32_t Size = Finder - *Parser) {
char *Dest = *StoreTo = new char[Size + 1];
for (; *Parser <= Finder; (*Parser)++, Dest++)
@@ -240,7 +254,7 @@ uint32_t ReadStringFromMemoryW(wchar_t **Parser, wchar_t *End, wchar_t **StoreTo if (Finder >= (wchar_t *)End)
return EACC_FILECOMPATIBILITY;
-
+
if (uint32_t Size = Finder - *Parser) {
wchar_t *Dest = *StoreTo = new wchar_t[Size + 1];
for (; *Parser <= Finder; (*Parser)++, Dest++)
@@ -313,7 +327,7 @@ uint32_t ReadMessagesFromMemory(CAccount *Which, char **Parser, char *End) {
char *Finder;
uint32_t Size, Stat;
- HYAMNMAIL ActualMail = nullptr;
+ YAMNMAIL *ActualMail = nullptr;
struct CMimeItem *items;
char *ReadString;
@@ -327,11 +341,11 @@ uint32_t ReadMessagesFromMemory(CAccount *Which, char **Parser, char *End) return EACC_FILECOMPATIBILITY;
if (Size = Finder - *Parser) {
if (Which->Mails == nullptr) { // First message in queue
- if (nullptr == (Which->Mails = ActualMail = CreateAccountMail(Which)))
+ if (nullptr == (Which->Mails = ActualMail = Which->CreateMail()))
return EACC_ALLOC;
}
else {
- if (nullptr == (ActualMail->Next = CreateAccountMail(Which)))
+ if (nullptr == (ActualMail->Next = Which->CreateMail()))
return EACC_ALLOC;
ActualMail = ActualMail->Next;
@@ -465,7 +479,7 @@ uint32_t ReadAccountFromMemory(CAccount *Which, char **Parser, char *End) mir_snwprintf(Debug, L"STFlags: %04x, remaining %d chars", Which->StatusFlags, End - *Parser);
MessageBox(NULL, Debug, L"debug", MB_OK);
#endif
-
+
(*Parser) += sizeof(uint32_t); // PluginFlags
#ifdef DEBUG_FILEREAD
mir_snwprintf(Debug, L"PFlags: %04x, remaining %d chars", Which->PluginFlags, End - *Parser);
@@ -640,7 +654,7 @@ uint32_t WriteStringToFileW(HANDLE File, wchar_t *Source) DWORD WriteMessagesToFile(HANDLE File, CAccount *Which)
{
DWORD WrittenBytes, Stat;
- HYAMNMAIL ActualMail = (HYAMNMAIL)Which->Mails;
+ YAMNMAIL *ActualMail = (YAMNMAIL *)Which->Mails;
struct CMimeItem *items;
while (ActualMail != nullptr) {
@@ -817,7 +831,7 @@ CAccount* GetNextFreeAccount(YAMN_PROTOPLUGIN *Plugin) Plugin->FirstAccount = CreatePluginAccount(Plugin);
return Plugin->FirstAccount;
}
-
+
CAccount *Finder;
for (Finder = Plugin->FirstAccount; Finder->Next != nullptr; Finder = Finder->Next);
Finder->Next = CreatePluginAccount(Plugin);
diff --git a/protocols/YAMN/src/account.h b/protocols/YAMN/src/account.h index afe325fcef..70d7f45b5f 100644 --- a/protocols/YAMN/src/account.h +++ b/protocols/YAMN/src/account.h @@ -323,8 +323,9 @@ struct CAccount : public MZeroedObject CAccount *Next; - void CheckMail(); - void RefreshContact(); + void CheckMail(); + YAMNMAIL* CreateMail(); + void RefreshContact(); }; #endif diff --git a/protocols/YAMN/src/browser/browser.h b/protocols/YAMN/src/browser/browser.h index cdd0ffb1ba..64f01d3147 100644 --- a/protocols/YAMN/src/browser/browser.h +++ b/protocols/YAMN/src/browser/browser.h @@ -12,7 +12,7 @@ struct YAMN_MAILBROWSERPARAM struct YAMN_MAILSHOWPARAM
{
CAccount *account;
- HYAMNMAIL mail;
+ YAMNMAIL *mail;
};
struct BadConnectionParam
diff --git a/protocols/YAMN/src/browser/mailbrowser.cpp b/protocols/YAMN/src/browser/mailbrowser.cpp index 83e6edbbcf..f06885f474 100644 --- a/protocols/YAMN/src/browser/mailbrowser.cpp +++ b/protocols/YAMN/src/browser/mailbrowser.cpp @@ -38,7 +38,6 @@ 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
@@ -49,19 +48,16 @@ struct CMailNumbersSub 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
{
- struct CMailNumbersSub Real;
- struct CMailNumbersSub Virtual;
+ CMailNumbersSub Real;
+ CMailNumbersSub Virtual;
};
struct CMailWinUserInfo
@@ -97,11 +93,6 @@ struct CSortList // returns handle of account
inline CAccount *GetWindowAccount(HWND hDialog);
-// Looks to mail flags and increment mail counter (e.g. if mail is new, increments the new mail counter
-// msgq- mail, which increments the counters
-// MN- counnters structure
-void IncrementMailCounters(HYAMNMAIL msgq, struct CMailNumbers *MN);
-
enum
{
UPDATE_FAIL = 0, // function failed
@@ -124,7 +115,7 @@ int UpdateMails(HWND hDlg, CAccount *ActualAccount, uint32_t nflags, uint32_t nn // nflags- what to do or not to do (e.g. to show mailbrowser window or prohibit to show)
// nflags- flags what to do when new mail arrives
// nnflags- flags what to do when no new mail arrives
-void DoMailActions(HWND hDlg, CAccount *ActualAccount, struct CMailNumbers *MN, uint32_t nflags, uint32_t nnflags);
+void DoMailActions(HWND hDlg, CAccount *ActualAccount, CMailNumbers *MN, uint32_t nflags, uint32_t nnflags);
// Looks for items in mailbrowser and if they were deleted, delete them from browser window
// hListView- handle of listview window
@@ -164,25 +155,25 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR #define LVORDER_NONE 0
#define LVORDER_DESCENDING -1
-// list view sort type
+// list view sort type
#define LVSORTPRIORITY_NONE -1
-// List view column info.
-typedef struct _SAMPLELISTVIEWCOLUMN
+// List view column info.
+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
-} SAMPLELISTVIEWCOLUMN;
-
-// Compare priority
-typedef struct _LVCOMPAREINFO
+ 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
+};
+
+// Compare priority
+struct LVCOMPAREINFO
{
- int iIdx; // Index
- int iPriority; // Priority
-} LVCOMPAREINFO, *LPLVCOMPAREINFO;
+ int iIdx; // Index
+ int iPriority; // Priority
+};
// --------------------------------------------------------------------------------------------------
@@ -203,7 +194,10 @@ inline CAccount *GetWindowAccount(HWND hDlg) return (mwui == nullptr) ? nullptr : mwui->Account;
}
-void IncrementMailCounters(HYAMNMAIL msgq, struct CMailNumbers *MN)
+// Looks to mail flags and increment mail counter (e.g. if mail is new, increments the new mail counter
+// msgq- mail, which increments the counters
+// MN- counnters structure
+static void IncrementMailCounters(YAMNMAIL *msgq, CMailNumbers *MN)
{
if (msgq->Flags & YAMN_MSG_VIRTUAL)
MN->Virtual.Total++;
@@ -295,8 +289,7 @@ void IncrementMailCounters(HYAMNMAIL msgq, struct CMailNumbers *MN) int UpdateMails(HWND hDlg, CAccount *ActualAccount, uint32_t nflags, uint32_t nnflags)
{
- struct CMailNumbers MN;
-
+ CMailNumbers MN;
BOOL Loaded;
BOOL RunMailBrowser, RunPopups;
@@ -318,7 +311,7 @@ int UpdateMails(HWND hDlg, CAccount *ActualAccount, uint32_t nflags, uint32_t nn memset(&MN, 0, sizeof(MN));
- for (HYAMNMAIL msgq = (HYAMNMAIL)ActualAccount->Mails; msgq != nullptr; msgq = msgq->Next) {
+ for (YAMNMAIL *msgq = (YAMNMAIL *)ActualAccount->Mails; msgq != nullptr; msgq = msgq->Next) {
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
@@ -372,9 +365,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((YAMNMAIL *)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((YAMNMAIL *)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;
@@ -392,20 +385,21 @@ int UpdateMails(HWND hDlg, CAccount *ActualAccount, uint32_t nflags, uint32_t nn int ChangeExistingMailStatus(HWND hListView, CAccount *ActualAccount)
{
- LVITEM item;
- HYAMNMAIL mail, msgq;
+ YAMNMAIL *mail, *msgq;
int in = ListView_GetItemCount(hListView);
+
+ LVITEM item;
item.mask = LVIF_PARAM;
for (int i = 0; i < in; i++) {
item.iItem = i;
item.iSubItem = 0;
if (TRUE == ListView_GetItem(hListView, &item))
- mail = (HYAMNMAIL)item.lParam;
+ mail = (YAMNMAIL *)item.lParam;
else
continue;
- for (msgq = (HYAMNMAIL)ActualAccount->Mails; (msgq != nullptr) && (msgq != mail); msgq = msgq->Next); // found the same mail in account queue
+ for (msgq = (YAMNMAIL *)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--;
@@ -454,7 +448,7 @@ int AddNewMailsToListView(HWND hListView, CAccount *ActualAccount, uint32_t nfla NewMailPopup.iSeconds = ActualAccount->NewMailN.PopupTime;
NewMailPopup.PluginWindowProc = NewMailPopupProc;
- for (HYAMNMAIL msgq = (HYAMNMAIL)ActualAccount->Mails; msgq != nullptr; msgq = msgq->Next, lfoundi++) {
+ for (YAMNMAIL *msgq = (YAMNMAIL *)ActualAccount->Mails; msgq != nullptr; msgq = msgq->Next, lfoundi++) {
// now we hide mail pointer to item's lParam member. We can later use it to retrieve mail datas
Extracted = FALSE; FromStr.Empty();
@@ -540,7 +534,7 @@ int AddNewMailsToListView(HWND hListView, CAccount *ActualAccount, uint32_t nfla return TRUE;
}
-void DoMailActions(HWND hDlg, CAccount *ActualAccount, struct CMailNumbers *MN, uint32_t nflags, uint32_t nnflags)
+void DoMailActions(HWND hDlg, CAccount *ActualAccount, CMailNumbers *MN, uint32_t nflags, uint32_t nnflags)
{
NOTIFYICONDATA nid = {};
nid.cbSize = sizeof(nid);
@@ -797,7 +791,7 @@ LRESULT CALLBACK NoNewMailPopupProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM l DestroyWindow(hWnd);
return 0;
}
-
+
return DefWindowProc(hWnd, msg, wParam, lParam);
}
@@ -946,8 +940,8 @@ int CALLBACK ListViewCompareProc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSo int nResult = 0;
char *str1;
char *str2;
- HYAMNMAIL email1 = (HYAMNMAIL)lParam1;
- HYAMNMAIL email2 = (HYAMNMAIL)lParam2;
+ YAMNMAIL *email1 = (YAMNMAIL *)lParam1;
+ YAMNMAIL *email2 = (YAMNMAIL *)lParam2;
struct CShortHeader Header1;
struct CShortHeader Header2;
memset(&Header1, 0, sizeof(Header1));
@@ -1115,7 +1109,7 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg, UINT msg, WPARAM wParam, LPAR 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;
-
+
if (!body) if (!_stricmp(Header->name, "Body")) { body = Header->value; continue; }
if (!contentType) if (!_stricmp(Header->name, "Content-Type")) contentType = Header->value;
if (!transEncoding) if (!_stricmp(Header->name, "Content-Transfer-Encoding")) transEncoding = Header->value;
@@ -1577,17 +1571,17 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR break;
// 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) {
+ for (YAMNMAIL *Parser = (YAMNMAIL *)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
{
- DeleteMessageFromQueueFcn((HYAMNMAIL *)&ActualAccount->Mails, Parser, 1);
+ DeleteMessageFromQueueFcn((YAMNMAIL **)&ActualAccount->Mails, Parser, 1);
DeleteAccountMail(ActualAccount->Plugin, Parser);
}
}
// mark mails as read (remove "new" and "unseen" flags)
if (mwui->Seen)
- SetRemoveFlagsInQueueFcn((HYAMNMAIL)ActualAccount->Mails, YAMN_MSG_DISPLAY, 0, YAMN_MSG_NEW | YAMN_MSG_UNSEEN, 0);
+ SetRemoveFlagsInQueueFcn((YAMNMAIL *)ActualAccount->Mails, YAMN_MSG_DISPLAY, 0, YAMN_MSG_NEW | YAMN_MSG_UNSEEN, 0);
}
delete mwui;
@@ -1707,7 +1701,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR item.mask = LVIF_PARAM | LVIF_STATE;
item.stateMask = 0xFFFFFFFF;
ListView_GetItem(GetDlgItem(hDlg, IDC_LISTMAILS), &item);
- HYAMNMAIL ActualMail = (HYAMNMAIL)item.lParam;
+ YAMNMAIL *ActualMail = (YAMNMAIL *)item.lParam;
if (nullptr != ActualMail) {
auto *MailParam = new YAMN_MAILSHOWPARAM;
MailParam->account = GetWindowAccount(hDlg);
@@ -1782,7 +1776,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR case IDC_BTNDEL:
{
- HYAMNMAIL ActualMail;
+ YAMNMAIL *ActualMail;
uint32_t Total = 0;
// we use event to signal, that running thread has all needed stack parameters copied
@@ -1803,7 +1797,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR item.mask = LVIF_PARAM | LVIF_STATE;
item.stateMask = 0xFFFFFFFF;
ListView_GetItem(GetDlgItem(hDlg, IDC_LISTMAILS), &item);
- ActualMail = (HYAMNMAIL)item.lParam;
+ ActualMail = (YAMNMAIL *)item.lParam;
if (nullptr == ActualMail)
break;
if (item.state & LVIS_SELECTED) {
@@ -1822,24 +1816,24 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR // Find if there's mail marked to delete, which was deleted before
SWriteGuard swm(ActualAccount->MessagesAccessSO);
if (swm.Succeeded()) {
- for (ActualMail = (HYAMNMAIL)ActualAccount->Mails; ActualMail != nullptr; ActualMail = ActualMail->Next) {
+ for (ActualMail = (YAMNMAIL *)ActualAccount->Mails; ActualMail != nullptr; ActualMail = ActualMail->Next) {
if ((ActualMail->Flags & YAMN_MSG_DELETED) && ((ActualMail->Flags & YAMN_MSG_USERDELETE))) // if selected mail was already deleted
{
- DeleteMessageFromQueueFcn((HYAMNMAIL *)&ActualAccount->Mails, ActualMail, 1);
+ DeleteMessageFromQueueFcn((YAMNMAIL **)&ActualAccount->Mails, ActualMail, 1);
DeleteAccountMail(ActualAccount->Plugin, ActualMail); // delete it from memory
continue;
}
}
-
+
// Set flag to marked mails that they can be deleted
- SetRemoveFlagsInQueueFcn((HYAMNMAIL)ActualAccount->Mails, YAMN_MSG_DISPLAY | YAMN_MSG_USERDELETE, 0, YAMN_MSG_DELETEOK, 1);
-
+ SetRemoveFlagsInQueueFcn((YAMNMAIL *)ActualAccount->Mails, YAMN_MSG_DISPLAY | YAMN_MSG_USERDELETE, 0, YAMN_MSG_DELETEOK, 1);
+
// Create new thread which deletes marked mails.
mir_forkthread(ActualAccount->Plugin->Fcn->DeleteMailsFcnPtr, new DeleteParam(ActualAccount, 0));
}
}
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);
+ SetRemoveFlagsInQueueFcn((YAMNMAIL *)ActualAccount->Mails, YAMN_MSG_DISPLAY | YAMN_MSG_USERDELETE, 0, YAMN_MSG_USERDELETE, 0);
}
CloseHandle(ThreadRunningEV);
@@ -1855,7 +1849,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR 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_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);
@@ -1938,9 +1932,9 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR case CDDS_ITEMPREPAINT | CDDS_SUBITEM:
{
BOOL umma = mwui->UpdateMailsMessagesAccess;
- HYAMNMAIL ActualMail = (HYAMNMAIL)cd->nmcd.lItemlParam;
+ YAMNMAIL *ActualMail = (YAMNMAIL *)cd->nmcd.lItemlParam;
if (!ActualMail)
- ActualMail = (HYAMNMAIL)readItemLParam(cd->nmcd.hdr.hwndFrom, cd->nmcd.dwItemSpec);
+ ActualMail = (YAMNMAIL *)readItemLParam(cd->nmcd.hdr.hwndFrom, cd->nmcd.dwItemSpec);
if (!umma)
if (WAIT_OBJECT_0 != ActualAccount->MessagesAccessSO.WaitToRead())
diff --git a/protocols/YAMN/src/mails/mails.cpp b/protocols/YAMN/src/mails/mails.cpp index 1bcbc60242..9bee7937a9 100644 --- a/protocols/YAMN/src/mails/mails.cpp +++ b/protocols/YAMN/src/mails/mails.cpp @@ -7,33 +7,9 @@ #include "../stdafx.h"
/////////////////////////////////////////////////////////////////////////////////////////
-// Creates new mail for plugin (calling plugin's constructor, when plugin imported to YAMN)
-
-HYAMNMAIL CreateAccountMail(CAccount *Account)
-{
- HYAMNMAIL NewMail;
-
- if (Account->Plugin == nullptr)
- return NULL;
-
- if (Account->Plugin->MailFcn->NewMailFcnPtr != nullptr) {
- // Let plugin create its own structure, which can be derived from CAccount structure
- if (nullptr == (NewMail = Account->Plugin->MailFcn->NewMailFcnPtr(Account)))
- return NULL;
- }
- else {
- // We suggest plugin uses standard CAccount structure, so we create it
- NewMail = new YAMNMAIL();
- NewMail->MailData = nullptr;
- }
- // Init every members of structure, used by YAMN
- return NewMail;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
// Deletes mail for plugin (calling plugin's destructor, when plugin imported to YAMN)
-int DeleteAccountMail(YAMN_PROTOPLUGIN *Plugin, HYAMNMAIL OldMail)
+int DeleteAccountMail(YAMN_PROTOPLUGIN *Plugin, YAMNMAIL *OldMail)
{
struct CMimeItem *TH;
@@ -62,7 +38,7 @@ int DeleteAccountMail(YAMN_PROTOPLUGIN *Plugin, HYAMNMAIL OldMail) if (OldMail->ID != nullptr)
delete[] OldMail->ID;
- delete OldMail; // consider mail as standard HYAMNMAIL, not initialized before and use its own destructor
+ delete OldMail; // consider mail as standard YAMNMAIL *, not initialized before and use its own destructor
return 1;
}
@@ -70,9 +46,9 @@ int DeleteAccountMail(YAMN_PROTOPLUGIN *Plugin, HYAMNMAIL OldMail) // Appends second MIME mail queue to the first one
// Only finds the end of first queue and its Next memember repoints to second one
-void AppendQueueFcn(HYAMNMAIL first, HYAMNMAIL second)
+void AppendQueueFcn(YAMNMAIL *first, YAMNMAIL *second)
{
- HYAMNMAIL Finder = first;
+ YAMNMAIL *Finder = first;
while (Finder->Next != nullptr) Finder = Finder->Next;
Finder->Next = second;
}
@@ -97,16 +73,16 @@ void AppendQueueFcn(HYAMNMAIL first, HYAMNMAIL second) // 1. delete (or move to RemovedOld queue if RemovedOld is not NULL) all mails from OldQueue not found in NewQueue
// 2. delete (or move to RemovedNew queue if RemovedNew is not NULL) all mails from NewQueue found in OldQueue
-void SynchroMessagesFcn(CAccount *Account, HYAMNMAIL *OldQueue, HYAMNMAIL *RemovedOld, HYAMNMAIL *NewQueue, HYAMNMAIL *RemovedNew)
+void SynchroMessagesFcn(CAccount *Account, YAMNMAIL **OldQueue, YAMNMAIL **RemovedOld, YAMNMAIL **NewQueue, YAMNMAIL **RemovedNew)
// deletes messages from new queue, if they are old
// it also deletes messages from old queue, if they are not in mailbox anymore
// "YAMN_MSG_DELETED" messages in old queue remain in old queue (are never removed, although they are not in new queue)
// "YAMN_MSG_DELETED" messages in new queue remain in new queue (are never removed, although they can be in old queue)
{
- HYAMNMAIL Finder, FinderPrev;
- HYAMNMAIL Parser, ParserPrev;
- HYAMNMAIL RemovedOldParser = nullptr;
- HYAMNMAIL RemovedNewParser = nullptr;
+ YAMNMAIL *Finder, *FinderPrev;
+ YAMNMAIL *Parser, *ParserPrev;
+ YAMNMAIL *RemovedOldParser = nullptr;
+ YAMNMAIL *RemovedNewParser = nullptr;
if (RemovedOld != nullptr) *RemovedOld = nullptr;
if (RemovedNew != nullptr) *RemovedNew = nullptr;
@@ -166,7 +142,7 @@ void SynchroMessagesFcn(CAccount *Account, HYAMNMAIL *OldQueue, HYAMNMAIL *Remov else {
FinderPrev->Next = Finder->Next;
// delete from old queue
- if (RemovedOld == nullptr)
+ if (RemovedOld == nullptr)
DeleteAccountMail(Account->Plugin, Finder);
// or move to RemovedOld
else {
@@ -188,9 +164,9 @@ void SynchroMessagesFcn(CAccount *Account, HYAMNMAIL *OldQueue, HYAMNMAIL *Remov // Account- account who owns mails
// From- first mail in queue, which is going to delete
-void DeleteMessagesToEndFcn(CAccount *Account, HYAMNMAIL From)
+void DeleteMessagesToEndFcn(CAccount *Account, YAMNMAIL *From)
{
- HYAMNMAIL Temp;
+ YAMNMAIL *Temp;
while (From != nullptr) {
Temp = From;
From = From->Next;
@@ -204,10 +180,10 @@ void DeleteMessagesToEndFcn(CAccount *Account, HYAMNMAIL From) // Which- mail to delete
// mode- nonzero if you want to decrement numbers in messages that are bigger than the one in Which mail, 0 if not
-void DeleteMessageFromQueueFcn(HYAMNMAIL *From, HYAMNMAIL Which, int mode)
+void DeleteMessageFromQueueFcn(YAMNMAIL **From, YAMNMAIL *Which, int mode)
{
uint32_t Number = Which->Number;
- HYAMNMAIL Parser;
+ YAMNMAIL *Parser;
if (*From == Which) {
Parser = Which->Next;
@@ -225,9 +201,9 @@ void DeleteMessageFromQueueFcn(HYAMNMAIL *From, HYAMNMAIL Which, int mode) if (Parser->Number > Number) Parser->Number--;
}
-void DeleteMessagesFromQueue(HYAMNMAIL *From, HYAMNMAIL Which, int mode = 0)
+void DeleteMessagesFromQueue(YAMNMAIL **From, YAMNMAIL *Which, int mode = 0)
{
- HYAMNMAIL Parser;
+ YAMNMAIL *Parser;
for (Parser = Which; Parser != nullptr; Parser = Parser->Next)
DeleteMessageFromQueueFcn(From, Parser, mode);
@@ -239,9 +215,9 @@ void DeleteMessagesFromQueue(HYAMNMAIL *From, HYAMNMAIL Which, int mode = 0) // ID- pointer to ID
// returns pointer to found message, NULL if not found
-HYAMNMAIL FindMessageByIDFcn(HYAMNMAIL From, char *ID)
+YAMNMAIL *FindMessageByIDFcn(YAMNMAIL *From, char *ID)
{
- HYAMNMAIL Browser;
+ YAMNMAIL *Browser;
for (Browser = From; Browser != nullptr; Browser = Browser->Next)
if (0 == mir_strcmp(Browser->ID, ID))
@@ -343,9 +319,9 @@ void TranslateHeaderFcn(char *stream, int len, struct CMimeItem **head) // Function does not copy the whole mails, it copies only ID string. And ID is copied as string, so
// you can use this fcn only if you have your ID as pointer to char string ended with zero character
-HYAMNMAIL CreateNewDeleteQueueFcn(HYAMNMAIL From)
+YAMNMAIL *CreateNewDeleteQueueFcn(YAMNMAIL *From)
{
- HYAMNMAIL FirstMail, Browser = nullptr;
+ YAMNMAIL *FirstMail, *Browser = nullptr;
for (FirstMail = nullptr; From != nullptr; From = From->Next) {
if ((From->Flags & (YAMN_MSG_USERDELETE | YAMN_MSG_AUTODELETE)) && !(From->Flags & YAMN_MSG_DELETED)) {
@@ -375,11 +351,11 @@ HYAMNMAIL CreateNewDeleteQueueFcn(HYAMNMAIL From) // FlagsToSetRemove- ...to set/remove these flags (see mode)
// mode- nonzero to set, else remove
-void SetRemoveFlagsInQueueFcn(HYAMNMAIL From, uint32_t FlagsSet, uint32_t FlagsNotSet, uint32_t FlagsToSetRemove, int mode)
+void SetRemoveFlagsInQueueFcn(YAMNMAIL *From, uint32_t FlagsSet, uint32_t FlagsNotSet, uint32_t FlagsToSetRemove, int mode)
{
- HYAMNMAIL msgq;
+ YAMNMAIL *msgq;
- for (msgq = (HYAMNMAIL)From; msgq != nullptr; msgq = msgq->Next) {
+ for (msgq = (YAMNMAIL *)From; msgq != nullptr; msgq = msgq->Next) {
if ((FlagsSet == (msgq->Flags & FlagsSet)) && (0 == (msgq->Flags & FlagsNotSet))) {
if (mode)
msgq->Flags = msgq->Flags | FlagsToSetRemove;
diff --git a/protocols/YAMN/src/mails/mails.h b/protocols/YAMN/src/mails/mails.h index 8f800ec318..105bacaeab 100644 --- a/protocols/YAMN/src/mails/mails.h +++ b/protocols/YAMN/src/mails/mails.h @@ -65,7 +65,7 @@ struct CMimeItem }; // this is plugin-independent -typedef struct CMailData +struct CMailData { DWORD Size = 0; int CP = -1; @@ -75,7 +75,7 @@ typedef struct CMailData char *Body = nullptr; // Message body }; -typedef struct CMimeMsgQueue +struct YAMNMAIL : public MZeroedObject { char *ID; //The ID of mail. This ID identifies every mail in the account, so plugin should set it @@ -127,19 +127,17 @@ typedef struct CMimeMsgQueue #define YAMN_MSG_SPAML(maildata,level) ((maildata & YAMN_MSG_SPAMMASK)==level) DWORD Flags; -//Plugins can read mail data, but it can be NULL!!! So plugin should use Load and Save services to load or save data and Unload to release data from memory + + //Plugins can read mail data, but it can be NULL!!! So plugin should use Load and Save services to load or save data and Unload to release data from memory CMailData *MailData; -//Here YAMN stores its own informations about this mail. Not usefull for plugins... -// void *YAMNData; + HWND MsgWindow; -//plugins can store here its own data - void *PluginData; - CMimeMsgQueue(): ID(nullptr), Number(0), Flags(0), MailData(nullptr), MsgWindow(nullptr), PluginData(nullptr), Next(nullptr){} - ~CMimeMsgQueue() {} + //plugins can store here its own data + void *PluginData; - struct CMimeMsgQueue *Next; -} YAMNMAIL,*HYAMNMAIL; + YAMNMAIL *Next; +}; #define LoadedMailData(x) (x->MailData!=nullptr) // @@ -147,14 +145,14 @@ typedef struct CMimeMsgQueue // //typedef void (WINAPI *YAMN_SENDMESSAGEFCN)(UINT,WPARAM,LPARAM); -typedef void (WINAPI *YAMN_SYNCHROMIMEMSGSFCN)(CAccount *,HYAMNMAIL *,HYAMNMAIL *,HYAMNMAIL *,HYAMNMAIL *); -typedef void (WINAPI *YAMN_TRANSLATEHEADERFCN)(char *,int,struct CMimeItem **); -typedef void (WINAPI *YAMN_APPENDQUEUEFCN)(HYAMNMAIL,HYAMNMAIL); -typedef void (WINAPI *YAMN_DELETEMIMEQUEUEFCN)(CAccount *,HYAMNMAIL); -typedef void (WINAPI *YAMN_DELETEMIMEMESSAGEFCN)(HYAMNMAIL *,HYAMNMAIL,int); -typedef HYAMNMAIL (WINAPI *YAMN_FINDMIMEMESSAGEFCN)(HYAMNMAIL,char *); -typedef HYAMNMAIL (WINAPI *YAMN_CREATENEWDELETEQUEUEFCN)(HYAMNMAIL); -typedef void (WINAPI *YAMN_SETREMOVEQUEUEFLAGSFCN)(HYAMNMAIL,DWORD,DWORD,DWORD,int); +typedef void (WINAPI *YAMN_SYNCHROMIMEMSGSFCN)(CAccount *, YAMNMAIL **, YAMNMAIL **, YAMNMAIL **, YAMNMAIL **); +typedef void (WINAPI *YAMN_TRANSLATEHEADERFCN)(char *, int, struct CMimeItem **); +typedef void (WINAPI *YAMN_APPENDQUEUEFCN)(YAMNMAIL *, YAMNMAIL *); +typedef void (WINAPI *YAMN_DELETEMIMEQUEUEFCN)(CAccount *, YAMNMAIL *); +typedef void (WINAPI *YAMN_DELETEMIMEMESSAGEFCN)(YAMNMAIL **, YAMNMAIL *, int); +typedef YAMNMAIL *(WINAPI *YAMN_FINDMIMEMESSAGEFCN)(YAMNMAIL *, char *); +typedef YAMNMAIL *(WINAPI *YAMN_CREATENEWDELETEQUEUEFCN)(YAMNMAIL *); +typedef void (WINAPI *YAMN_SETREMOVEQUEUEFLAGSFCN)(YAMNMAIL *, DWORD, DWORD, DWORD, int); // //================================== QUICK FUNCTION CALL DEFINITIONS ======================================== diff --git a/protocols/YAMN/src/proto/pop3/pop3comm.cpp b/protocols/YAMN/src/proto/pop3/pop3comm.cpp index d712bff6c0..0a98f82848 100644 --- a/protocols/YAMN/src/proto/pop3/pop3comm.cpp +++ b/protocols/YAMN/src/proto/pop3/pop3comm.cpp @@ -18,7 +18,7 @@ HANDLE hNetLib = nullptr; SCOUNTER CPOP3Account::AccountWriterSO;
// Creates new CPOP3Account structure
-CAccount* MIR_CDECL CreatePOP3Account(YAMN_PROTOPLUGIN *Plugin);
+CAccount *MIR_CDECL CreatePOP3Account(YAMN_PROTOPLUGIN *Plugin);
// Deletes CPOP3Account structure
void MIR_CDECL DeletePOP3Account(CAccount *Which);
@@ -39,7 +39,7 @@ DWORD MIR_CDECL WritePOP3Options(HANDLE, CAccount *); DWORD MIR_CDECL ReadPOP3Options(CAccount *, char **, char *);
// Creates new mail for an account
-HYAMNMAIL MIR_CDECL CreatePOP3Mail(CAccount *Account);
+YAMNMAIL *MIR_CDECL CreatePOP3Mail(CAccount *Account);
// Function does all needed work when connection failed or any error occured
// Creates structure containing error code, closes internet session, runs "bad connect" function
@@ -72,15 +72,15 @@ void ExtractStat(char *stream, int *mboxsize, int *mails); // stream- source string
// len- length of source string
// queue- address of first message, where first ID will be stored
-void ExtractUIDL(char *stream, int len, HYAMNMAIL queue);
+void ExtractUIDL(char *stream, int len, YAMNMAIL *queue);
// Extracts mail size on mailbox
// stream- source string
// len- length of source string
// queue- address of first message, where size of message #1 will be stored
-void ExtractList(char *stream, int len, HYAMNMAIL queue);
+void ExtractList(char *stream, int len, YAMNMAIL *queue);
-void ExtractMail(char *stream, int len, HYAMNMAIL queue);
+void ExtractMail(char *stream, int len, YAMNMAIL *queue);
YAMN_PROTOIMPORTFCN POP3ProtocolFunctions =
{
@@ -143,7 +143,7 @@ CPOP3Account::~CPOP3Account() CloseHandle(UseInternetFree);
}
-CAccount* MIR_CDECL CreatePOP3Account(YAMN_PROTOPLUGIN *)
+CAccount *MIR_CDECL CreatePOP3Account(YAMN_PROTOPLUGIN *)
{
// First, we should check whether CAccountVersion matches.
// But this is internal plugin, so YAMN's CAccount structure and our CAccount structure are
@@ -285,9 +285,9 @@ DWORD MIR_CDECL ReadPOP3Options(CAccount *Which, char **Parser, char *End) return 0;
}
-HYAMNMAIL MIR_CDECL CreatePOP3Mail(CAccount *Account)
+YAMNMAIL *MIR_CDECL CreatePOP3Mail(CAccount *Account)
{
- HYAMNMAIL NewMail;
+ YAMNMAIL *NewMail;
// First, we should check whether MAILDATA matches.
// But this is internal plugin, so YAMN's MAILDATA structure and our MAILDATA structure are
// the same, so we do not need to test version. Otherwise, if MAILDATA version does not match
@@ -303,7 +303,7 @@ HYAMNMAIL MIR_CDECL CreatePOP3Mail(CAccount *Account) return nullptr;
}
NewMail->MailData->CP = ((CPOP3Account *)Account)->CP;
- return (HYAMNMAIL)NewMail;
+ return (YAMNMAIL *)NewMail;
}
static void SetContactStatus(CAccount *account, int status)
@@ -323,7 +323,7 @@ static void PostErrorProc(CPOP3Account *ActualAccount, void *ParamToBadConnectio ErrorCode->POP3Error = ActualAccount->Client.POP3Error;
ErrorCode->NetError = ActualAccount->Client.NetClient->NetworkError;
ErrorCode->SystemError = ActualAccount->Client.NetClient->SystemError;
-
+
// if it was normal YAMN call (force check or so on)
if (POP3PluginParam == 0) {
try {
@@ -355,7 +355,7 @@ static void PostErrorProc(CPOP3Account *ActualAccount, void *ParamToBadConnectio void MIR_CDECL SynchroPOP3(CheckParam *WhichTemp)
{
CPop3Client *MyClient;
- HYAMNMAIL NewMails = nullptr, MsgQueuePtr = nullptr;
+ YAMNMAIL *NewMails = nullptr, *MsgQueuePtr = nullptr;
char *DataRX = nullptr;
int mboxsize, msgs, i;
SYSTEMTIME now;
@@ -388,7 +388,7 @@ void MIR_CDECL SynchroPOP3(CheckParam *WhichTemp) SCGuard scq(ActualAccount->InternetQueries);
WaitForSingleObject(ActualAccount->UseInternetFree, INFINITE);
}
-
+
// OK, we enter the "use internet" section. But after we start communication, we can test if we did not enter the "use internet" section only for the reason,
// that previous thread release the internet section because this account has stop signal (we stop account and there are 2 threads: one communicating,
// the second one waiting for network access- the first one ends because we want to stop account, this one is released, but should be stopped as well).
@@ -458,9 +458,9 @@ void MIR_CDECL SynchroPOP3(CheckParam *WhichTemp) DataRX = nullptr;
for (i = 0; i < msgs; i++) {
if (!i)
- MsgQueuePtr = NewMails = CreateAccountMail(ActualAccount);
+ MsgQueuePtr = NewMails = ActualAccount->CreateMail();
else {
- MsgQueuePtr->Next = CreateAccountMail(ActualAccount);
+ MsgQueuePtr->Next = ActualAccount->CreateMail();
MsgQueuePtr = MsgQueuePtr->Next;
}
if (MsgQueuePtr == nullptr) {
@@ -488,10 +488,10 @@ void MIR_CDECL SynchroPOP3(CheckParam *WhichTemp) throw (uint32_t)(ActualAccount->SystemError = EACC_STOPPED);
ActualAccount->LastChecked = now;
- for (MsgQueuePtr = (HYAMNMAIL)ActualAccount->Mails; MsgQueuePtr != nullptr; MsgQueuePtr = MsgQueuePtr->Next) {
+ for (MsgQueuePtr = (YAMNMAIL *)ActualAccount->Mails; MsgQueuePtr != nullptr; MsgQueuePtr = MsgQueuePtr->Next) {
if (MsgQueuePtr->Flags & YAMN_MSG_BODYREQUESTED) {
- HYAMNMAIL NewMsgsPtr = nullptr;
- for (NewMsgsPtr = (HYAMNMAIL)NewMails; NewMsgsPtr != nullptr; NewMsgsPtr = NewMsgsPtr->Next) {
+ YAMNMAIL *NewMsgsPtr = nullptr;
+ for (NewMsgsPtr = (YAMNMAIL *)NewMails; NewMsgsPtr != nullptr; NewMsgsPtr = NewMsgsPtr->Next) {
if (!mir_strcmp(MsgQueuePtr->ID, NewMsgsPtr->ID)) {
wchar_t accstatus[512];
mir_snwprintf(accstatus, TranslateT("Reading body %s"), NewMsgsPtr->ID);
@@ -534,10 +534,10 @@ void MIR_CDECL SynchroPOP3(CheckParam *WhichTemp) }
}
- SynchroMessagesFcn(ActualAccount, (HYAMNMAIL *)&ActualAccount->Mails, nullptr, (HYAMNMAIL *)&NewMails, nullptr); // we get only new mails on server!
+ SynchroMessagesFcn(ActualAccount, (YAMNMAIL **)&ActualAccount->Mails, nullptr, (YAMNMAIL **)&NewMails, nullptr); // we get only new mails on server!
}
- for (MsgQueuePtr = (HYAMNMAIL)ActualAccount->Mails; MsgQueuePtr != nullptr; MsgQueuePtr = MsgQueuePtr->Next) {
+ for (MsgQueuePtr = (YAMNMAIL *)ActualAccount->Mails; MsgQueuePtr != nullptr; MsgQueuePtr = MsgQueuePtr->Next) {
if ((MsgQueuePtr->Flags & YAMN_MSG_BODYREQUESTED) && (MsgQueuePtr->Flags & YAMN_MSG_BODYRECEIVED)) {
MsgQueuePtr->Flags &= ~YAMN_MSG_BODYREQUESTED;
if (MsgQueuePtr->MsgWindow)
@@ -596,7 +596,7 @@ void MIR_CDECL SynchroPOP3(CheckParam *WhichTemp) ActualAccount->Mails = NewMails;
else {
ActualAccount->LastMail = ActualAccount->LastChecked;
- AppendQueueFcn((HYAMNMAIL)ActualAccount->Mails, NewMails);
+ AppendQueueFcn((YAMNMAIL *)ActualAccount->Mails, NewMails);
}
}
@@ -680,7 +680,7 @@ void __cdecl DeleteMailsPOP3(void *param) {
DeleteParam *WhichTemp = (DeleteParam *)param;
- HYAMNMAIL DeleteMails, NewMails = nullptr, MsgQueuePtr = nullptr;
+ YAMNMAIL *DeleteMails, *NewMails = nullptr, *MsgQueuePtr = nullptr;
int mboxsize = 0, msgs = 0, i;
ptrA ServerName, ServerLogin, ServerPasswd;
@@ -700,7 +700,7 @@ void __cdecl DeleteMailsPOP3(void *param) return;
// if there's no mail for deleting, return
- if (nullptr == (DeleteMails = CreateNewDeleteQueueFcn((HYAMNMAIL)ActualAccount->Mails))) {
+ if (nullptr == (DeleteMails = CreateNewDeleteQueueFcn((YAMNMAIL *)ActualAccount->Mails))) {
// We do not wait for free internet when calling from SynchroPOP3. It is because UseInternetFree is blocked
if (POP3_DELETEFROMCHECK != POP3PluginParam) {
YAMN_MAILBROWSERPARAM Param = { ActualAccount, YAMN_ACC_MSGP, YAMN_ACC_MSGP, 0 }; // Just update the window
@@ -797,9 +797,9 @@ void __cdecl DeleteMailsPOP3(void *param) DataRX = nullptr;
for (i = 0; i < msgs; i++) {
if (!i)
- MsgQueuePtr = NewMails = CreateAccountMail(ActualAccount);
+ MsgQueuePtr = NewMails = ActualAccount->CreateMail();
else {
- MsgQueuePtr->Next = CreateAccountMail(ActualAccount);
+ MsgQueuePtr->Next = ActualAccount->CreateMail();
MsgQueuePtr = MsgQueuePtr->Next;
}
if (MsgQueuePtr == nullptr) {
@@ -822,7 +822,7 @@ void __cdecl DeleteMailsPOP3(void *param) DataRX = nullptr;
// we get "new mails" on server (NewMails will contain all mails on server not found in DeleteMails)
// but also in DeleteMails we get only those, which are still on server with their responsable numbers
- SynchroMessagesFcn(ActualAccount, (HYAMNMAIL *)&DeleteMails, nullptr, (HYAMNMAIL *)&NewMails, nullptr);
+ SynchroMessagesFcn(ActualAccount, (YAMNMAIL **)&DeleteMails, nullptr, (YAMNMAIL **)&NewMails, nullptr);
}
}
else SetStatusFcn(ActualAccount, TranslateT("Deleting spam"));
@@ -836,12 +836,12 @@ void __cdecl DeleteMailsPOP3(void *param) for (i = 0, MsgQueuePtr = DeleteMails; MsgQueuePtr != nullptr; i++) {
if (!(MsgQueuePtr->Flags & YAMN_MSG_VIRTUAL)) { // of course we can only delete real mails, not virtual
char *DataRX = MyClient->Dele(MsgQueuePtr->Number);
- HYAMNMAIL Temp = MsgQueuePtr->Next;
+ YAMNMAIL *Temp = MsgQueuePtr->Next;
if (POP3_FOK == MyClient->AckFlag) { // if server answers that mail was deleted
- DeleteMessageFromQueueFcn((HYAMNMAIL *)&DeleteMails, MsgQueuePtr);
- HYAMNMAIL DeletedMail = FindMessageByIDFcn((HYAMNMAIL)ActualAccount->Mails, MsgQueuePtr->ID);
+ DeleteMessageFromQueueFcn((YAMNMAIL **)&DeleteMails, MsgQueuePtr);
+ YAMNMAIL *DeletedMail = FindMessageByIDFcn((YAMNMAIL *)ActualAccount->Mails, MsgQueuePtr->ID);
if ((MsgQueuePtr->Flags & YAMN_MSG_MEMDELETE)) { // if mail should be deleted from memory (or disk)
- DeleteMessageFromQueueFcn((HYAMNMAIL *)&ActualAccount->Mails, DeletedMail); // remove from queue
+ DeleteMessageFromQueueFcn((YAMNMAIL **)&ActualAccount->Mails, DeletedMail); // remove from queue
DeleteAccountMail(POP3Plugin, DeletedMail);
}
else { // else mark it only as "deleted mail"
@@ -867,16 +867,16 @@ void __cdecl DeleteMailsPOP3(void *param) // stored all mails found on server, then we deleted the ones we wanted to delete in this function
// and NewMails queue now contains actual state of mails on server). But we will not use NewMails as actual state, because NewMails does not contain header data (subject, from...)
// We perform deleting from ActualAccount->Mails: we remove from original queue (ActualAccount->Mails) all deleted mails
- SynchroMessagesFcn(ActualAccount, (HYAMNMAIL *)&ActualAccount->Mails, nullptr, (HYAMNMAIL *)&NewMails, nullptr);
+ SynchroMessagesFcn(ActualAccount, (YAMNMAIL **)&ActualAccount->Mails, nullptr, (YAMNMAIL **)&NewMails, nullptr);
// Now ActualAccount->Mails contains all mails when calling this function except the ones, we wanted to delete (these are in DeleteMails)
// And in NewMails we have new mails (if any)
else if (POP3_DELETEFROMCHECK != POP3PluginParam) {
- DeleteMessagesToEndFcn(ActualAccount, (HYAMNMAIL)ActualAccount->Mails);
+ DeleteMessagesToEndFcn(ActualAccount, (YAMNMAIL *)ActualAccount->Mails);
ActualAccount->Mails = nullptr;
}
}
else {
- DeleteMessagesToEndFcn(ActualAccount, (HYAMNMAIL)ActualAccount->Mails);
+ DeleteMessagesToEndFcn(ActualAccount, (YAMNMAIL *)ActualAccount->Mails);
ActualAccount->Mails = nullptr;
}
}
@@ -962,12 +962,12 @@ void ExtractStat(char *stream, int *mboxsize, int *mails) if (1 != sscanf(finder, "%d", mboxsize))
throw (uint32_t)EPOP3_STAT;
}
-void ExtractMail(char *stream, int len, HYAMNMAIL queue)
+void ExtractMail(char *stream, int len, YAMNMAIL *queue)
{
char *finder = stream;
char *finderend;
int msgnr, i;
- HYAMNMAIL queueptr = queue;
+ YAMNMAIL *queueptr = queue;
while (WS(finder) || ENDLINE(finder)) finder++;
while (!ACKLINE(finder)) finder++;
@@ -1005,12 +1005,12 @@ void ExtractMail(char *stream, int len, HYAMNMAIL queue) }
}
-void ExtractUIDL(char *stream, int len, HYAMNMAIL queue)
+void ExtractUIDL(char *stream, int len, YAMNMAIL *queue)
{
char *finder = stream;
char *finderend;
int msgnr, i;
- HYAMNMAIL queueptr = queue;
+ YAMNMAIL *queueptr = queue;
while (WS(finder) || ENDLINE(finder)) finder++;
while (!ACKLINE(finder)) finder++;
@@ -1049,12 +1049,12 @@ void ExtractUIDL(char *stream, int len, HYAMNMAIL queue) }
}
-void ExtractList(char *stream, int len, HYAMNMAIL queue)
+void ExtractList(char *stream, int len, YAMNMAIL *queue)
{
char *finder = stream;
char *finderend;
int msgnr, i;
- HYAMNMAIL queueptr;
+ YAMNMAIL *queueptr;
while (WS(finder) || ENDLINE(finder)) finder++;
while (!ACKLINE(finder)) finder++;
diff --git a/protocols/YAMN/src/proto/pop3/pop3opt.cpp b/protocols/YAMN/src/proto/pop3/pop3opt.cpp index 969d079e08..bfec6d09e4 100644 --- a/protocols/YAMN/src/proto/pop3/pop3opt.cpp +++ b/protocols/YAMN/src/proto/pop3/pop3opt.cpp @@ -58,12 +58,12 @@ struct CBaseOptionsDlg : public CDlgBase SetDlgItemInt(m_hwnd, IDC_EDITFPOPS, pAccount->BadConnectN.PopupTime, FALSE);
for (i = 0; i <= CPLENSUPP; i++)
if ((i < CPLENSUPP) && (CodePageNamesSupp[i].CP == pAccount->CP)) {
- SendDlgItemMessage(m_hwnd, IDC_COMBOCP, CB_SETCURSEL, (WPARAM)i, 0);
+ SendDlgItemMessage(m_hwnd, IDC_COMBOCP, CB_SETCURSEL, i, 0);
break;
}
if (i == CPLENSUPP)
- SendDlgItemMessage(m_hwnd, IDC_COMBOCP, CB_SETCURSEL, (WPARAM)CPDEFINDEX, 0);
+ SendDlgItemMessage(m_hwnd, IDC_COMBOCP, CB_SETCURSEL, 0, 0);
CheckDlgButton(m_hwnd, IDC_CHECK, pAccount->Flags & YAMN_ACC_ENA ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(m_hwnd, IDC_CHECKMSG, pAccount->NewMailN.Flags & YAMN_ACC_MSG ? BST_CHECKED : BST_UNCHECKED);
@@ -108,7 +108,7 @@ struct CBaseOptionsDlg : public CDlgBase SetDlgItemInt(m_hwnd, IDC_EDITPOPS, 0, FALSE);
SetDlgItemInt(m_hwnd, IDC_EDITNPOPS, 0, FALSE);
SetDlgItemInt(m_hwnd, IDC_EDITFPOPS, 0, FALSE);
- SendDlgItemMessage(m_hwnd, IDC_COMBOCP, CB_SETCURSEL, (WPARAM)CPDEFINDEX, 0);
+ SendDlgItemMessage(m_hwnd, IDC_COMBOCP, CB_SETCURSEL, 0, 0);
CheckDlgButton(m_hwnd, IDC_CHECK, BST_CHECKED);
CheckDlgButton(m_hwnd, IDC_CHECKMSG, BST_UNCHECKED);
CheckDlgButton(m_hwnd, IDC_CHECKICO, BST_UNCHECKED);
@@ -476,7 +476,7 @@ public: ActualAccount->Interval = Interval * 60;
if (CB_ERR == (index = cmbCP.GetCurSel()))
- index = CPDEFINDEX;
+ index = 0;
ActualAccount->CP = CodePageNamesSupp[index].CP;
if (NewAcc)
diff --git a/protocols/YAMN/src/protoplugin.h b/protocols/YAMN/src/protoplugin.h index 28b5a777fa..f909ed65f0 100644 --- a/protocols/YAMN/src/protoplugin.h +++ b/protocols/YAMN/src/protoplugin.h @@ -112,10 +112,10 @@ struct YAMN_PROTOIMPORTFCN YAMN_STANDARDFCN UnLoadFcn; }; -typedef HYAMNMAIL (MIR_CDECL *YAMN_NEWMAILFCN)(CAccount *); -typedef void (MIR_CDECL *YAMN_DELETEMAILFCN)(HYAMNMAIL); -typedef DWORD (MIR_CDECL *YAMN_WRITEMAILOPTS)(HANDLE File, HYAMNMAIL); -typedef DWORD (MIR_CDECL *YAMN_READMAILOPTS)(HYAMNMAIL, char **, char *); +typedef YAMNMAIL * (MIR_CDECL *YAMN_NEWMAILFCN)(CAccount *); +typedef void (MIR_CDECL *YAMN_DELETEMAILFCN)(YAMNMAIL *); +typedef DWORD (MIR_CDECL *YAMN_WRITEMAILOPTS)(HANDLE File, YAMNMAIL *); +typedef DWORD (MIR_CDECL *YAMN_READMAILOPTS)(YAMNMAIL *, char **, char *); struct YAMN_MAILIMPORTFCN { diff --git a/protocols/YAMN/src/stdafx.h b/protocols/YAMN/src/stdafx.h index 62c12fa179..b0c9c79792 100644 --- a/protocols/YAMN/src/stdafx.h +++ b/protocols/YAMN/src/stdafx.h @@ -94,12 +94,12 @@ void CodeDecodeString(char *Dest, BOOL Encrypt); uint32_t FileToMemory(wchar_t *FileName, char **MemFile, char **End);
uint32_t AddAccountsFromFile(YAMN_PROTOPLUGIN *Plugin, const wchar_t *pwszFilename);
-CAccount* CreatePluginAccount(YAMN_PROTOPLUGIN *Plugin);
+CAccount *CreatePluginAccount(YAMN_PROTOPLUGIN *Plugin);
int DeleteAccount(YAMN_PROTOPLUGIN *Plugin, CAccount *Which);
void DeletePluginAccount(CAccount *OldAccount);
-CAccount* FindAccountByContact(YAMN_PROTOPLUGIN *Plugin, MCONTACT hContact);
-CAccount* FindAccountByName(YAMN_PROTOPLUGIN *Plugin, const char *SearchedAccount);
-CAccount* GetNextFreeAccount(YAMN_PROTOPLUGIN *Plugin);
+CAccount *FindAccountByContact(YAMN_PROTOPLUGIN *Plugin, MCONTACT hContact);
+CAccount *FindAccountByName(YAMN_PROTOPLUGIN *Plugin, const char *SearchedAccount);
+CAccount *GetNextFreeAccount(YAMN_PROTOPLUGIN *Plugin);
uint32_t WriteAccountsToFile(YAMN_PROTOPLUGIN *Plugin, const wchar_t *pwszFilename);
@@ -123,7 +123,7 @@ void SetStatusFcn(CAccount *Which, wchar_t *Value); INT_PTR UnregisterProtoPlugins();
// From mime.cpp
-// void WINAPI ExtractHeaderFcn(char *,int,uint16_t,HYAMNMAIL); // already in MailExported
+// void WINAPI ExtractHeaderFcn(char *,int,uint16_t,YAMNMAIL *); // already in MailExported
struct _tcptable
{
char *NameBase, *NameSub;
@@ -138,8 +138,6 @@ extern int CPLENSUPP; extern int PosX, PosY, SizeX, SizeY;
extern int HeadPosX, HeadPosY, HeadSizeX, HeadSizeY, HeadSplitPos;
-#define CPDEFINDEX 0 // ACP
-
// From pop3comm.cpp
int RegisterPOP3Plugin(WPARAM, LPARAM);
@@ -168,19 +166,18 @@ extern HCURSOR hCurSplitNS, hCurSplitWE; extern UINT SecTimer;
// From synchro.cpp
-void DeleteMessagesToEndFcn(CAccount *Account, HYAMNMAIL From);
+void DeleteMessagesToEndFcn(CAccount *Account, YAMNMAIL *From);
// From mails.cpp
-void DeleteMessageFromQueueFcn(HYAMNMAIL *From, HYAMNMAIL Which, int mode);
-void SetRemoveFlagsInQueueFcn(HYAMNMAIL From, uint32_t FlagsSet, uint32_t FlagsNotSet, uint32_t FlagsToSet, int mode);
-
-void AppendQueueFcn(HYAMNMAIL first, HYAMNMAIL second);
-HYAMNMAIL CreateAccountMail(CAccount *Account);
-HYAMNMAIL CreateNewDeleteQueueFcn(HYAMNMAIL From);
-int DeleteAccountMail(YAMN_PROTOPLUGIN *Plugin, HYAMNMAIL OldMail);
-void DeleteMessageFromQueueFcn(HYAMNMAIL *From, HYAMNMAIL Which, int mode = 0);
-HYAMNMAIL FindMessageByIDFcn(HYAMNMAIL From, char *ID);
-void SynchroMessagesFcn(CAccount *Account, HYAMNMAIL *OldQueue, HYAMNMAIL *RemovedOld, HYAMNMAIL *NewQueue, HYAMNMAIL *RemovedNew);
+void DeleteMessageFromQueueFcn(YAMNMAIL **From, YAMNMAIL *Which, int mode);
+void SetRemoveFlagsInQueueFcn(YAMNMAIL *From, uint32_t FlagsSet, uint32_t FlagsNotSet, uint32_t FlagsToSet, int mode);
+
+void AppendQueueFcn(YAMNMAIL *first, YAMNMAIL *second);
+YAMNMAIL *CreateNewDeleteQueueFcn(YAMNMAIL *From);
+int DeleteAccountMail(YAMN_PROTOPLUGIN *Plugin, YAMNMAIL *OldMail);
+void DeleteMessageFromQueueFcn(YAMNMAIL **From, YAMNMAIL *Which, int mode = 0);
+YAMNMAIL *FindMessageByIDFcn(YAMNMAIL *From, char *ID);
+void SynchroMessagesFcn(CAccount *Account, YAMNMAIL **OldQueue, YAMNMAIL **RemovedOld, YAMNMAIL **NewQueue, YAMNMAIL **RemovedNew);
void TranslateHeaderFcn(char *stream, int len, struct CMimeItem **head);
// From mime.cpp
@@ -208,7 +205,7 @@ extern HIMAGELIST CSImages; int SetProtocolPluginFcnImportFcn(YAMN_PROTOPLUGIN *Plugin, YAMN_PROTOIMPORTFCN *YAMNFcn, YAMN_MAILIMPORTFCN *YAMNMailFcn);
-YAMN_PROTOPLUGIN* RegisterProtocolPlugin(YAMN_PROTOREGISTRATION *Registration);
+YAMN_PROTOPLUGIN *RegisterProtocolPlugin(YAMN_PROTOREGISTRATION *Registration);
int GetCharsetFromString(char *input, size_t size);
CMStringW ConvertCodedStringToUnicode(char *stream, uint32_t cp, int mode);
|