From 6e67be23d4796ce8a3d39408aa2e02b632c67b47 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 12 Mar 2019 18:15:37 +0300 Subject: YAMN: warning fixes --- plugins/ExternalAPI/m_account.h | 218 +++++----- plugins/ExternalAPI/m_filterplugin.h | 2 +- plugins/ExternalAPI/m_mails.h | 71 ++-- plugins/ExternalAPI/m_protoplugin.h | 28 +- protocols/YAMN/src/account.cpp | 60 +-- protocols/YAMN/src/browser/badconnect.cpp | 6 +- protocols/YAMN/src/browser/browser.h | 8 +- protocols/YAMN/src/browser/mailbrowser.cpp | 66 +-- protocols/YAMN/src/filterplugin.cpp | 2 +- protocols/YAMN/src/mails/mails.cpp | 10 +- protocols/YAMN/src/mails/mime.cpp | 661 ++++++++++++++--------------- protocols/YAMN/src/main.cpp | 3 +- protocols/YAMN/src/proto/pop3/pop3comm.cpp | 36 +- protocols/YAMN/src/services.cpp | 10 +- protocols/YAMN/src/stdafx.h | 20 +- protocols/YAMN/src/yamn.cpp | 4 +- 16 files changed, 585 insertions(+), 620 deletions(-) diff --git a/plugins/ExternalAPI/m_account.h b/plugins/ExternalAPI/m_account.h index c6a342fd3d..ed342bafeb 100644 --- a/plugins/ExternalAPI/m_account.h +++ b/plugins/ExternalAPI/m_account.h @@ -13,14 +13,14 @@ #include #include "m_synchro.h" //include synchronizing objects. If you want to write protocol plugin, which works with YAMN accounts, it must use YAMN synchronizing objects -// -//================================== OTHER DEFINITIONS ======================================== -// + // + //================================== OTHER DEFINITIONS ======================================== + // enum { -// Error codes returned from functions (services) working with account book files - EACC_SYSTEM=1, //use GetLastError() to retrieve detailed information about error + // Error codes returned from functions (services) working with account book files + EACC_SYSTEM = 1, //use GetLastError() to retrieve detailed information about error EACC_ALLOC, //problem with memory allocation EACC_FILECOMPATIBILITY, //file is corrupted EACC_ENDOFFILE, //unexpected end of file occured @@ -30,10 +30,10 @@ enum enum { -// Status of account -// used in messages WM_YAMN_CHANGESTATUS -// used also in function GetStatus and SetStatus - ACC_IDLE=0, //account is IDLE (no work is performed with account) + // Status of account + // used in messages WM_YAMN_CHANGESTATUS + // used also in function GetStatus and SetStatus + ACC_IDLE = 0, //account is IDLE (no work is performed with account) ACC_FINDING, //DNS lookup for account ACC_CONNECTING, //connecting in progress ACC_LOGGING, //logging in progress @@ -41,53 +41,48 @@ enum ACC_DISCONNECTING, //disconnecting from server }; -typedef struct CNotification -{ -//#define YAMN_NOTIFICATIONVERSION is not implemented, use YAMN_ACCOUNTVERSION instead - CNotification(): PopupB(0), PopupT(0), PopupTime(0), App(nullptr), AppParam(nullptr), Sound(nullptr), TrayIcon1(nullptr), TrayIcon2(nullptr) {} - -#define YAMN_ACC_SND 0x00000001 //Plays sound (1) -#define YAMN_ACC_MSG 0x00000002 //Shows dialog -#define YAMN_ACC_ICO 0x00000004 //Shows system tray icon (1) -#define YAMN_ACC_ICOB 0x00000008 //not used now, enables tray icon flashing (1) -#define YAMN_ACC_APP 0x00000010 //Runs application (1) -#define YAMN_ACC_POP 0x00000020 //Shows popup -#define YAMN_ACC_POPC 0x00000040 //Use custom colors in popup -#define YAMN_ACC_MSGP 0x00000080 //Persistant messgage. This means, when an situation occurs (e.g. new mail) and message is displayed, it is not destroyed when YAMN_ACC_MSG is not set -#define YAMN_ACC_KBN 0x00000100 //Use Keyboard notify -#define YAMN_ACC_CONT 0x00000200 //Use Contact notify -#define YAMN_ACC_CONTNICK 0x00000400 //Use Contact Nick replacement -#define YAMN_ACC_CONTNOEVENT 0x00000800 //Suppress event for this contact -//(1) - usable only in newmail notification - DWORD Flags; - - COLORREF PopupB; - COLORREF PopupT; - DWORD PopupTime; - WCHAR *App; - WCHAR *AppParam; - -//These parameters are not stored in standard YAMN book file and therefore must be set by plugin - char *Sound; - HICON TrayIcon1; - HICON TrayIcon2; -} YAMN_NOTIFICATION,*PYAMN_NOTIFICATION; - -typedef struct CServer +#define YAMN_ACC_SND 0x00000001 // Plays sound (1) +#define YAMN_ACC_MSG 0x00000002 // Shows dialog +#define YAMN_ACC_ICO 0x00000004 // Shows system tray icon (1) +#define YAMN_ACC_ICOB 0x00000008 // not used now, enables tray icon flashing (1) +#define YAMN_ACC_APP 0x00000010 // Runs application (1) +#define YAMN_ACC_POP 0x00000020 // Shows popup +#define YAMN_ACC_POPC 0x00000040 // Use custom colors in popup +#define YAMN_ACC_MSGP 0x00000080 // Persistant messgage. This means, when an situation occurs (e.g. new mail) and message is displayed, it is not destroyed when YAMN_ACC_MSG is not set +#define YAMN_ACC_KBN 0x00000100 // Use Keyboard notify +#define YAMN_ACC_CONT 0x00000200 // Use Contact notify +#define YAMN_ACC_CONTNICK 0x00000400 // Use Contact Nick replacement +#define YAMN_ACC_CONTNOEVENT 0x00000800 // Suppress event for this contact + +struct YAMN_NOTIFICATION { - CServer(): Name(nullptr), Login(nullptr), Passwd(nullptr) {} - - char *Name; - DWORD Port; + //(1) - usable only in newmail notification + DWORD Flags = 0; + + COLORREF PopupB = 0; + COLORREF PopupT = 0; + DWORD PopupTime = 0; + WCHAR *App = nullptr; + WCHAR *AppParam = nullptr; + + // These parameters are not stored in standard YAMN book file and therefore must be set by plugin + char *Sound = nullptr; + HICON TrayIcon1 = nullptr; + HICON TrayIcon2 = nullptr; +}; - char *Login; +struct CServer +{ + char *Name = nullptr; + DWORD Port = 0; -// Password encryption definitions -#define STARTCODEPSW 0x50 -#define ADDCODEPSW 0x0 - char *Passwd; + char *Login = nullptr; -} *PSERVER; + // Password encryption definitions + #define STARTCODEPSW 0x50 + #define ADDCODEPSW 0x0 + char *Passwd = nullptr; +}; // //================================== ACCOUNT DEFINITION ================================== @@ -95,54 +90,53 @@ typedef struct CServer typedef struct CAccount { -#define YAMN_ACCOUNTFILEVERSION 2 //version of standard file format (YAMN book file format) -#define YAMN_ACCOUNTVERSION 3 -//If changes are made in this structure, version is changed. -//So then YAMN does not initialzie your structure, if version does not matches. + #define YAMN_ACCOUNTFILEVERSION 2 //version of standard file format (YAMN book file format) + #define YAMN_ACCOUNTVERSION 3 + + // If changes are made in this structure, version is changed. + // So then YAMN does not initialzie your structure, if version does not matches. - BOOL AbleToWork; //This is set to TRUE by default. When it is needed to stop working on this account, YAMN sets this to zero. + BOOL AbleToWork; // This is set to TRUE by default. When it is needed to stop working on this account, YAMN sets this to zero. - struct CYAMNProtoPlugin *Plugin; //free access, because this member should not be changed. The same as YAMN_PLUGIN structure + struct CYAMNProtoPlugin *Plugin; // free access, because this member should not be changed. The same as YAMN_PLUGIN structure - char *Name; //access only through AccountAccessSO + char *Name; // access only through AccountAccessSO -// DWORD Abilities; //access only through AccountAccessSO - - PSERVER Server; //access only through AccountAccessSO + CServer *Server; //access only through AccountAccessSO WORD Interval; //access only through AccountAccessSO -// YAMN account flags (set by user) -#define YAMN_ACC_ENA 0x00000001 //Enables account. If account is disabled, no countdown is performed -#define YAMN_ACC_POPN 0x00000002 //Shows one popup per one new mail or for N mails -#define YAMN_ACC_APOP 0x00000004 //Use APOP authentication -#define YAMN_ACC_SSL23 0x00000008 //Use SSLv2,3 -#define YAMN_ACC_NOTLS 0x00000010 //Don't try StartTLS (STLS) even available -#define YAMN_ACC_BODY 0x00000020 //Always retrieve body of the message + // YAMN account flags (set by user) + #define YAMN_ACC_ENA 0x00000001 //Enables account. If account is disabled, no countdown is performed + #define YAMN_ACC_POPN 0x00000002 //Shows one popup per one new mail or for N mails + #define YAMN_ACC_APOP 0x00000004 //Use APOP authentication + #define YAMN_ACC_SSL23 0x00000008 //Use SSLv2,3 + #define YAMN_ACC_NOTLS 0x00000010 //Don't try StartTLS (STLS) even available + #define YAMN_ACC_BODY 0x00000020 //Always retrieve body of the message DWORD Flags; //access only through AccountAccessSO -// YAMN account flags (set by plugin) -#define YAMN_ACC_BROWSE 0x00000001 //Can browse mails. On this account we can run mailbrowser window -#define YAMN_ACC_POPUP 0x00000002 //Popups of new mail belonging to this account can be showed + // YAMN account flags (set by plugin) + #define YAMN_ACC_BROWSE 0x00000001 //Can browse mails. On this account we can run mailbrowser window + #define YAMN_ACC_POPUP 0x00000002 //Popups of new mail belonging to this account can be showed DWORD AbilityFlags; -// YAMN account status flags -#define YAMN_ACC_ST0 0x00000001 //Check (countdown) when Offline -#define YAMN_ACC_ST1 0x00000002 //Check (countdown) when Online -#define YAMN_ACC_ST2 0x00000004 //Check (countdown) when Away -#define YAMN_ACC_ST3 0x00000008 //Check (countdown) when Not available -#define YAMN_ACC_ST4 0x00000010 //Check (countdown) when Occupied -#define YAMN_ACC_ST5 0x00000020 //Check (countdown) when DND -#define YAMN_ACC_ST6 0x00000040 //Check (countdown) when Free for chat -#define YAMN_ACC_ST7 0x00000080 //Check (countdown) when Invisible -#define YAMN_ACC_ST8 0x00000100 //Check (countdown) when On the phone -#define YAMN_ACC_ST9 0x00000200 //Check (countdown) when Out to lunch -#define YAMN_ACC_STARTA 0x00010000 //Check on start anyway -#define YAMN_ACC_STARTS 0x00020000 //Check on start regarding to status setting -#define YAMN_ACC_FORCE 0x00040000 //Check when "check new mail" item pressed (it is called forced checking) + // YAMN account status flags + #define YAMN_ACC_ST0 0x00000001 //Check (countdown) when Offline + #define YAMN_ACC_ST1 0x00000002 //Check (countdown) when Online + #define YAMN_ACC_ST2 0x00000004 //Check (countdown) when Away + #define YAMN_ACC_ST3 0x00000008 //Check (countdown) when Not available + #define YAMN_ACC_ST4 0x00000010 //Check (countdown) when Occupied + #define YAMN_ACC_ST5 0x00000020 //Check (countdown) when DND + #define YAMN_ACC_ST6 0x00000040 //Check (countdown) when Free for chat + #define YAMN_ACC_ST7 0x00000080 //Check (countdown) when Invisible + #define YAMN_ACC_ST8 0x00000100 //Check (countdown) when On the phone + #define YAMN_ACC_ST9 0x00000200 //Check (countdown) when Out to lunch + #define YAMN_ACC_STARTA 0x00010000 //Check on start anyway + #define YAMN_ACC_STARTS 0x00020000 //Check on start regarding to status setting + #define YAMN_ACC_FORCE 0x00040000 //Check when "check new mail" item pressed (it is called forced checking) DWORD StatusFlags; //access only through AccountAccessSO -// Plugin flags. Use this DWORD if you want YAMN to store it to YAMN book file. You can set here any value + // Plugin flags. Use this DWORD if you want YAMN to store it to YAMN book file. You can set here any value DWORD PluginFlags; YAMN_NOTIFICATION NewMailN; //access only through AccountAccessSO @@ -160,45 +154,45 @@ typedef struct CAccount HANDLE Mails; //access only through MessagesAccessSO -//Account members are mostly the same, but there can be protocol (POP3,IMAP...) special features. -//To use them, only inherit this class and add your own features. -//First idea was to add pointer to void, where plugin can store its own values. -//But this solution is better in my opinion. + // Account members are mostly the same, but there can be protocol (POP3,IMAP...) special features. + // To use them, only inherit this class and add your own features. + // First idea was to add pointer to void, where plugin can store its own values. + // But this solution is better in my opinion. -//This is event with counter. Event is signaled when no threads are using account (and will not be using) -//Very usefull for account delete operation + // This is event with counter. Event is signaled when no threads are using account (and will not be using) + // Very usefull for account delete operation PSCOUNTER UsingThreads; -//We have to achieve, that only one thread can write to account and more threads can read. -//Writing to account means that we change account parameters -//Reading from account meands we read account parameters -//Use WaitToRead(), ReadDone(), WaitToWrite(), WriteDone() synchronization functions -//For plugins, this is a pointer to void. It does not matter for plugin what is this variable for, -//because plugin works only with synchronization routines. And why is this void * ? It is because -//plugin does not need to include headers for SWMRG structures... + // We have to achieve, that only one thread can write to account and more threads can read. + // Writing to account means that we change account parameters + // Reading from account meands we read account parameters + // Use WaitToRead(), ReadDone(), WaitToWrite(), WriteDone() synchronization functions + // For plugins, this is a pointer to void. It does not matter for plugin what is this variable for, + // because plugin works only with synchronization routines. And why is this void * ? It is because + // plugin does not need to include headers for SWMRG structures... PSWMRG AccountAccessSO; -//We have to achieve, that only one thread can write to account mails and more threads can read. -//While some thread writes mails, other thread can write to account. This can be small problem, but it never appears in YAMN. -//But you should think about this note if you want to add some features in the future -//Writing to messages means any changes to message queue or message data -//Reading from messages means reading message queue (browsing through all messages) or reading message data -//Use MsgsWaitToRead(),MsgsReadDone(),MsgsWaitToWrite(),MsgsWriteDone() synchronization functions + // We have to achieve, that only one thread can write to account mails and more threads can read. + // While some thread writes mails, other thread can write to account. This can be small problem, but it never appears in YAMN. + // But you should think about this note if you want to add some features in the future + // Writing to messages means any changes to message queue or message data + // Reading from messages means reading message queue (browsing through all messages) or reading message data + // Use MsgsWaitToRead(),MsgsReadDone(),MsgsWaitToWrite(),MsgsWriteDone() synchronization functions PSWMRG MessagesAccessSO; -//For clist contact notification - MCONTACT hContact; + //For clist contact notification + MCONTACT hContact; BOOL isCounting; - struct CAccount *Next; -} *HACCOUNT; + CAccount *Next; +}; // //================================== FUNCTIONS DEFINITIONS ======================================== // -typedef void (WINAPI *YAMN_SETSTATUSFCN)(HACCOUNT,TCHAR *); -typedef void (WINAPI *YAMN_GETSTATUSFCN)(HACCOUNT,TCHAR *); +typedef void (WINAPI *YAMN_SETSTATUSFCN)(CAccount*, TCHAR *); +typedef void (WINAPI *YAMN_GETSTATUSFCN)(CAccount*, TCHAR *); // //================================== QUICK FUNCTION CALL DEFINITIONS ======================================== diff --git a/plugins/ExternalAPI/m_filterplugin.h b/plugins/ExternalAPI/m_filterplugin.h index cd81c4254c..80f7ccd910 100644 --- a/plugins/ExternalAPI/m_filterplugin.h +++ b/plugins/ExternalAPI/m_filterplugin.h @@ -11,7 +11,7 @@ #ifndef YAMN_STANDARDFCN typedef DWORD (WINAPI *YAMN_STANDARDFCN)(LPVOID); #endif -typedef DWORD (WINAPI *YAMN_FILTERMAILFCN)(HACCOUNT,DWORD,HYAMNMAIL,DWORD); +typedef DWORD (WINAPI *YAMN_FILTERMAILFCN)(CAccount *,DWORD,HYAMNMAIL,DWORD); typedef struct CFilterImportFcn { diff --git a/plugins/ExternalAPI/m_mails.h b/plugins/ExternalAPI/m_mails.h index e5ef0cc692..ea53511b72 100644 --- a/plugins/ExternalAPI/m_mails.h +++ b/plugins/ExternalAPI/m_mails.h @@ -9,81 +9,72 @@ //================================== OTHER DEFINITIONS ======================================== // -typedef struct CShortNames +struct CShortNames { char *Value; char *ValueNick; - struct CShortNames *Next; -} YAMN_MIMESHORTNAMES,*PYAMN_MIMESHORTNAMES; + CShortNames *Next; +}; -typedef struct CNames +struct CMimeNames { WCHAR *Value; WCHAR *ValueNick; - struct CNames *Next; -} YAMN_MIMENAMES,*PYAMN_MIMENAMES; + CMimeNames *Next; +}; -struct CShortHeader //this header is used in to get non-unicode data from mime header +struct CShortHeader { char *From; char *FromNick; char *ReturnPath; char *ReturnPathNick; char *Subject; - PYAMN_MIMESHORTNAMES To; - PYAMN_MIMESHORTNAMES Cc; - PYAMN_MIMESHORTNAMES Bcc; + CShortNames *To; + CShortNames *Cc; + CShortNames *Bcc; char *Date; char Priority; char *Body; int CP; - - CShortHeader() {} - ~CShortHeader() {} }; -struct CHeader //this header is used in miranda to store final results of mime reading in Unicode +struct CHeader { WCHAR *From; WCHAR *FromNick; WCHAR *ReturnPath; WCHAR *ReturnPathNick; WCHAR *Subject; - PYAMN_MIMENAMES To; - PYAMN_MIMENAMES Cc; - PYAMN_MIMENAMES Bcc; + CMimeNames *To; + CMimeNames *Cc; + CMimeNames *Bcc; WCHAR *Date; TCHAR Priority; WCHAR *Body; - - CHeader() {} - ~CHeader() {} }; struct CMimeItem { - char *name; - char *value; - struct CMimeItem *Next; - CMimeItem(): name(nullptr), value(nullptr), Next(nullptr){} + char *name = nullptr; + char *value = nullptr; + CMimeItem *Next = nullptr; }; -typedef struct CMailData //this is plugin-independent +// this is plugin-independent +typedef struct CMailData { -#define YAMN_MAILDATAVERSION 3 - - DWORD Size; - int CP; - - struct CMimeItem *TranslatedHeader; //MIME items - struct CMimeItem *Additional; //MIME items not read from server (custom, for filter plugins etc.) - char *Body; //Message body + #define YAMN_MAILDATAVERSION 3 + DWORD Size = 0; + int CP = -1; - CMailData(): CP(-1), Size(0), TranslatedHeader(nullptr), Body(nullptr) {} -} MAILDATA,*PMAILDATA; + CMimeItem *TranslatedHeader = nullptr; // MIME items + CMimeItem *Additional = nullptr; // MIME items not read from server (custom, for filter plugins etc.) + char *Body = nullptr; // Message body +}; typedef struct CMimeMsgQueue { @@ -139,7 +130,7 @@ 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 - PMAILDATA MailData; + CMailData *MailData; //Here YAMN stores its own informations about this mail. Not usefull for plugins... // void *YAMNData; HWND MsgWindow; @@ -159,7 +150,7 @@ typedef struct CMimeMsgQueue //CreateAccountMail Service //Your plugin should call this to create new mail for your plugin. -//WPARAM- (HACCOUNT) Account handle +//WPARAM- (CAccount *) Account handle //LPARAM- CMailData version (use YAMN_MAILVERSION definition) //returns pointer to (HYAMNMAIL) or pointer to your structure returned from imported NewMailFcnPtr, if implemented #define MS_YAMN_CREATEACCOUNTMAIL "YAMN/Service/CreateMail" @@ -184,7 +175,7 @@ typedef struct CMimeMsgQueue //LPARAM- (DWORD) version of MAILDATA structure (use YAMN_MAILDATAVERSION definition) //returns pointer to new allocated MailData structure (the same value as MailData member) #define MS_YAMN_LOADMAILDATA "YAMN/Service/LoadMailData" -#define LoadMailData(x) (PMAILDATA)CallService(MS_YAMN_LOADMAILDATA,(WPARAM)x,(LPARAM)YAMN_MAILDATAVERSION) +#define LoadMailData(x) (CMailData*)CallService(MS_YAMN_LOADMAILDATA,(WPARAM)x,(LPARAM)YAMN_MAILDATAVERSION) //UnloadMailData Service //This service frees mail data from memory. It does not care if data were saved or not. So you should save mail before you @@ -209,10 +200,10 @@ typedef struct CMimeMsgQueue // //typedef void (WINAPI *YAMN_SENDMESSAGEFCN)(UINT,WPARAM,LPARAM); -typedef void (WINAPI *YAMN_SYNCHROMIMEMSGSFCN)(HACCOUNT,HYAMNMAIL *,HYAMNMAIL *,HYAMNMAIL *,HYAMNMAIL *); +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)(HACCOUNT,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); diff --git a/plugins/ExternalAPI/m_protoplugin.h b/plugins/ExternalAPI/m_protoplugin.h index cbbe8e0ed1..70e8c29937 100644 --- a/plugins/ExternalAPI/m_protoplugin.h +++ b/plugins/ExternalAPI/m_protoplugin.h @@ -21,7 +21,7 @@ struct CheckParam //in any way. YAMN is waiting for this event. If you do not signal it, YAMN is blocked. HANDLE ThreadRunningEV; //ActualAccount- the only parameter used in Check function and should contain all needed information I think :) - HACCOUNT AccountParam; + CAccount *AccountParam; //I thought it, but this is needed, too #define YAMN_NORMALCHECK 0 @@ -46,7 +46,7 @@ struct DeleteParam //in any way. YAMN is waiting for this event. If you do not signal it, YAMN is blocked. HANDLE ThreadRunningEV; //ActualAccount- which account to delete - HACCOUNT AccountParam; + CAccount *AccountParam; //YAMN writes here some informations that are needed to pass to mail browser function (or bad connection or no new mail) void *BrowserParam; //Calling thread can write here its own parameter. Usefull when protocol calls its own delete function. YAMN always sets this parameter to NULL @@ -61,11 +61,11 @@ struct DeleteParam typedef DWORD(WINAPI *YAMN_STANDARDFCN)(LPVOID); #endif typedef struct CYAMNVariables *(WINAPI *YAMN_GETVARIABLESFCN)(DWORD); -typedef HACCOUNT(WINAPI *YAMN_NEWACCOUNTFCN)(struct CYAMNProtoPlugin *, DWORD); -typedef void (WINAPI *YAMN_STOPACCOUNTFCN)(HACCOUNT); -typedef void (WINAPI *YAMN_DELETEACCOUNTFCN)(HACCOUNT); -typedef DWORD(WINAPI *YAMN_WRITEPLUGINOPTS)(HANDLE File, HACCOUNT); -typedef DWORD(WINAPI *YAMN_READPLUGINOPTS)(HACCOUNT, char **, char *); +typedef CAccount *(WINAPI *YAMN_NEWACCOUNTFCN)(struct CYAMNProtoPlugin *, DWORD); +typedef void (WINAPI *YAMN_STOPACCOUNTFCN)(CAccount *); +typedef void (WINAPI *YAMN_DELETEACCOUNTFCN)(CAccount *); +typedef DWORD(WINAPI *YAMN_WRITEPLUGINOPTS)(HANDLE File, CAccount *); +typedef DWORD(WINAPI *YAMN_READPLUGINOPTS)(CAccount *, char **, char *); typedef DWORD(WINAPI *YAMN_CHECKFCN)(struct CheckParam *); typedef void(__cdecl *YAMN_DELETEFCN)(void *); typedef TCHAR* (WINAPI *YAMN_GETERRORSTRINGWFCN)(DWORD); @@ -145,7 +145,7 @@ typedef struct CAccountImportFcn YAMN_STANDARDFCN UnLoadFcn; } YAMN_PROTOIMPORTFCN, *PYAMN_PROTOIMPORTFCN; -typedef HYAMNMAIL(WINAPI *YAMN_NEWMAILFCN)(HACCOUNT, DWORD); +typedef HYAMNMAIL(WINAPI *YAMN_NEWMAILFCN)(CAccount *, DWORD); typedef void (WINAPI *YAMN_DELETEMAILFCN)(HYAMNMAIL); typedef DWORD(WINAPI *YAMN_WRITEMAILOPTS)(HANDLE File, HYAMNMAIL); typedef DWORD(WINAPI *YAMN_READMAILOPTS)(HYAMNMAIL, char **, char *); @@ -210,7 +210,7 @@ typedef struct CProtoPluginRegistration typedef struct CYAMNProtoPlugin { //Pointer to first protocol plugin account - HACCOUNT FirstAccount; + CAccount * FirstAccount; //We prevent browsing through accounts (chained list) from deleting or adding any account //If we want to delete or add, we must have "write" access to AccountBrowserSO @@ -256,13 +256,13 @@ typedef struct CProtoPluginQueue //Your plugin should call this to create new account for your plugin. //WPARAM- (HYAMNPLUGIN) Plugin handle //LPARAM- CAccount version (use YAMN_ACCOUNTVERSION definition) -//returns pointer to (HACCOUNT) or pointer to your structure returned from imported NewAccountFcnPtr, if implemented +//returns pointer to (CAccount *) or pointer to your structure returned from imported NewAccountFcnPtr, if implemented #define MS_YAMN_CREATEPLUGINACCOUNT "YAMN/Service/CreateAccount" //DeletePluginAccount Service //Deletes plugin's account from memory. You probably won't use this service, because it deletes only account //without any synchronization. Use MS_YAMN_DELETEACCOUNT instead. -//WPARAM- (HACCOUNT) to delete +//WPARAM- (CAccount *) to delete //LPARAM- any value //returns zero if failed, otherwise returns nonzero #define MS_YAMN_DELETEPLUGINACCOUNT "YAMN/Service/DeletePluginAccount" @@ -271,7 +271,7 @@ typedef struct CProtoPluginQueue //Searches accounts queue for first account that belongs to plugin //WPARAM- (HYAMNPLUGIN) Plugin handle //LPARAM- (TCHAR *)string, name of account to find -//returns found HACCOUNT handle or NULL if not found +//returns found CAccount * handle or NULL if not found #define MS_YAMN_FINDACCOUNTBYNAME "YAMN/Service/FindAccountByName" //GetNextFreeAccount Service @@ -284,14 +284,14 @@ typedef struct CProtoPluginQueue // //WPARAM- (HYAMNPLUGIN) Plugin handle //LPARAM- CAccount version (use YAMN_ACCOUNTVERSION definition) -//returns new HACCOUNT handle or NULL if not found +//returns new CAccount * handle or NULL if not found #define MS_YAMN_GETNEXTFREEACCOUNT "YAMN/Service/GetNextFreeAccount" //DeleteAccount Service //Deletes account from plugin account queue. It also deletes it, but in background (when needed). //This deleting is full synchronized and safe. It is recommended for plugins to use this service. //WPARAM- (HYAMNPLUGIN) Plugin handle -//LPARAM- (HACCOUNT) Account to delete +//LPARAM- (CAccount *) Account to delete #define MS_YAMN_DELETEACCOUNT "YAMN/Service/DeleteAccount" //ReadAccounts Service diff --git a/protocols/YAMN/src/account.cpp b/protocols/YAMN/src/account.cpp index 0755276f7b..36ac6e7072 100644 --- a/protocols/YAMN/src/account.cpp +++ b/protocols/YAMN/src/account.cpp @@ -48,7 +48,7 @@ INT_PTR CreatePluginAccountSvc(WPARAM wParam, LPARAM lParam) if (Plugin != nullptr) { - HACCOUNT NewAccount; + CAccount *NewAccount; if (Plugin->Fcn->NewAccountFcnPtr != nullptr) //Let plugin create its own structure, which can be derived from CAccount structure NewAccount = Plugin->Fcn->NewAccountFcnPtr(Plugin, YAMN_ACCOUNTVERSION); @@ -71,7 +71,7 @@ INT_PTR CreatePluginAccountSvc(WPARAM wParam, LPARAM lParam) INT_PTR DeletePluginAccountSvc(WPARAM wParam, LPARAM) { - HACCOUNT OldAccount = (HACCOUNT)wParam; + CAccount *OldAccount = (CAccount *)wParam; if (OldAccount->Plugin->Fcn != nullptr) { @@ -87,15 +87,15 @@ INT_PTR DeletePluginAccountSvc(WPARAM wParam, LPARAM) #ifdef DEBUG_SYNCHRO DebugLog(SynchroFile,"DeletePluginAccountSvc:delete OldAccount\n"); #endif - delete OldAccount; //consider account as standard YAMN HACCOUNT and use its own destructor + delete OldAccount; //consider account as standard YAMN CAccount *and use its own destructor } return 1; } - delete OldAccount; //consider account as standard YAMN HACCOUNT, not initialized before and use its own destructor + delete OldAccount; //consider account as standard YAMN CAccount *, not initialized before and use its own destructor return 1; } -int InitAccount(HACCOUNT Which) +int InitAccount(CAccount *Which) { //initialize synchronizing objects Which->AccountAccessSO = new SWMRG; @@ -124,7 +124,7 @@ int InitAccount(HACCOUNT Which) return 1; } -void DeInitAccount(HACCOUNT Which) +void DeInitAccount(CAccount *Which) { //delete YAMN allocated fields if (Which->Name != nullptr) @@ -147,7 +147,7 @@ void DeInitAccount(HACCOUNT Which) DeleteMessagesToEndFcn(Which, (HYAMNMAIL)Which->Mails); } -void StopSignalFcn(HACCOUNT Which) +void StopSignalFcn(CAccount *Which) //set event that we are going to delete account { #ifdef DEBUG_SYNCHRO @@ -379,7 +379,7 @@ static DWORD ReadNotificationFromMemory(char **Parser, char *End, YAMN_NOTIFICAT return 0; } -DWORD ReadMessagesFromMemory(HACCOUNT Which, char **Parser, char *End) +DWORD ReadMessagesFromMemory(CAccount *Which, char **Parser, char *End) { char *Finder; DWORD Size, Stat; @@ -481,7 +481,7 @@ DWORD ReadMessagesFromMemory(HACCOUNT Which, char **Parser, char *End) return 0; } -DWORD ReadAccountFromMemory(HACCOUNT Which, char **Parser, char *End) +DWORD ReadAccountFromMemory(CAccount *Which, char **Parser, char *End) { DWORD Stat; #ifdef DEBUG_FILEREAD @@ -638,7 +638,7 @@ static INT_PTR PerformAccountReading(HYAMNPROTOPLUGIN Plugin, char *MemFile, cha char *Parser; DWORD Ver, Stat; - HACCOUNT ActualAccount, FirstAllocatedAccount; + CAccount *ActualAccount, *FirstAllocatedAccount; Ver = *(DWORD *)MemFile; if (Ver > YAMN_ACCOUNTFILEVERSION) @@ -655,7 +655,7 @@ static INT_PTR PerformAccountReading(HYAMNPROTOPLUGIN Plugin, char *MemFile, cha #ifdef DEBUG_SYNCHRO DebugLog(SynchroFile,"AddAccountsFromFile:AccountBrowserSO-write enter\n"); #endif - if (nullptr == (ActualAccount = (HACCOUNT)CallService(MS_YAMN_GETNEXTFREEACCOUNT, (WPARAM)Plugin, (LPARAM)YAMN_ACCOUNTVERSION))) + if (nullptr == (ActualAccount = (CAccount *)CallService(MS_YAMN_GETNEXTFREEACCOUNT, (WPARAM)Plugin, (LPARAM)YAMN_ACCOUNTVERSION))) { #ifdef DEBUG_SYNCHRO DebugLog(SynchroFile,"AddAccountsFromFile:AccountBrowserSO-write done\n"); @@ -668,7 +668,7 @@ static INT_PTR PerformAccountReading(HYAMNPROTOPLUGIN Plugin, char *MemFile, cha do { - HACCOUNT Temp; + CAccount *Temp; #ifdef DEBUG_SYNCHRO DebugLog(SynchroFile,"AddAccountsFromFile:ActualAccountSO-write wait\n"); @@ -704,7 +704,7 @@ static INT_PTR PerformAccountReading(HYAMNPROTOPLUGIN Plugin, char *MemFile, cha #endif WriteDoneFcn(ActualAccount->AccountAccessSO); - if ((Stat != EACC_ENDOFFILE) && (nullptr == (ActualAccount = (HACCOUNT)CallService(MS_YAMN_GETNEXTFREEACCOUNT, (WPARAM)Plugin, (LPARAM)YAMN_ACCOUNTVERSION)))) + if ((Stat != EACC_ENDOFFILE) && (nullptr == (ActualAccount = (CAccount *)CallService(MS_YAMN_GETNEXTFREEACCOUNT, (WPARAM)Plugin, (LPARAM)YAMN_ACCOUNTVERSION)))) { for (ActualAccount = FirstAllocatedAccount; ActualAccount != nullptr; ActualAccount = Temp) { @@ -778,7 +778,7 @@ DWORD WriteStringToFileW(HANDLE File, WCHAR *Source) return 0; } -DWORD WriteMessagesToFile(HANDLE File, HACCOUNT Which) +DWORD WriteMessagesToFile(HANDLE File, CAccount *Which) { DWORD WrittenBytes, Stat; HYAMNMAIL ActualMail = (HYAMNMAIL)Which->Mails; @@ -813,7 +813,7 @@ DWORD WriteMessagesToFile(HANDLE File, HACCOUNT Which) static INT_PTR PerformAccountWriting(HYAMNPROTOPLUGIN Plugin, HANDLE File) { DWORD WrittenBytes, Stat; - HACCOUNT ActualAccount; + CAccount *ActualAccount; DWORD Ver = YAMN_ACCOUNTFILEVERSION; BOOL Writed = FALSE; DWORD ReturnValue = 0, EnterCode; @@ -987,7 +987,7 @@ INT_PTR FindAccountByNameSvc(WPARAM wParam, LPARAM lParam) { HYAMNPROTOPLUGIN Plugin = (HYAMNPROTOPLUGIN)wParam; char *SearchedAccount = (char *)lParam; - HACCOUNT Finder; + CAccount *Finder; #ifdef DEBUG_SYNCHRO DebugLog(SynchroFile,"FindAccountByName:AccountBrowserSO-read wait\n"); @@ -1009,15 +1009,15 @@ INT_PTR FindAccountByNameSvc(WPARAM wParam, LPARAM lParam) INT_PTR GetNextFreeAccountSvc(WPARAM wParam, LPARAM lParam) { HYAMNPROTOPLUGIN Plugin = (HYAMNPROTOPLUGIN)wParam; - HACCOUNT Finder; + CAccount *Finder; if (Plugin->FirstAccount == nullptr) { - Plugin->FirstAccount = (HACCOUNT)CallService(MS_YAMN_CREATEPLUGINACCOUNT, wParam, lParam); + Plugin->FirstAccount = (CAccount *)CallService(MS_YAMN_CREATEPLUGINACCOUNT, wParam, lParam); return (INT_PTR)Plugin->FirstAccount; } for (Finder = Plugin->FirstAccount; Finder->Next != nullptr; Finder = Finder->Next); - Finder->Next = (HACCOUNT)CallService(MS_YAMN_CREATEPLUGINACCOUNT, wParam, lParam); + Finder->Next = (CAccount *)CallService(MS_YAMN_CREATEPLUGINACCOUNT, wParam, lParam); return (INT_PTR)Finder->Next; } @@ -1025,11 +1025,11 @@ INT_PTR GetNextFreeAccountSvc(WPARAM wParam, LPARAM lParam) int FindPluginAccount(WPARAM wParam,LPARAM lParam) { HYAMNPROTOPLUGIN Plugin=(HYAMNPROTOPLUGIN)wParam; -HACCOUNT Finder=(HACCOUNT)lParam; +CAccount *Finder=(CAccount *)lParam; if (Finder=NULL) Finder=Plugin->FirstAccount; -// for (;Finder != NULL && Finder->PluginID != Plugin->PluginInfo->PluginID;Finder=(HACCOUNT)Finder->Next); +// for (;Finder != NULL && Finder->PluginID != Plugin->PluginInfo->PluginID;Finder=(CAccount *)Finder->Next); return (int)Finder; } */ @@ -1061,8 +1061,8 @@ INT_PTR DeleteAccountSvc(WPARAM wParam, LPARAM lParam) //5. delete account from memory HYAMNPROTOPLUGIN Plugin = (HYAMNPROTOPLUGIN)wParam; - HACCOUNT Which = (HACCOUNT)lParam; - HACCOUNT Finder; + CAccount *Which = (CAccount *)lParam; + CAccount *Finder; //1. set stop signal StopSignalFcn(Which); @@ -1121,14 +1121,14 @@ INT_PTR DeleteAccountSvc(WPARAM wParam, LPARAM lParam) void __cdecl DeleteAccountInBackground(void *Value) { - HACCOUNT Which = (HACCOUNT)Value; + CAccount *Which = (CAccount *)Value; WaitForSingleObject(Which->UsingThreads->Event, INFINITE); CallService(MS_YAMN_DELETEPLUGINACCOUNT, (WPARAM)Which, 0); } int StopAccounts(HYAMNPROTOPLUGIN Plugin) { - HACCOUNT Finder; + CAccount *Finder; //1. wait to get write access #ifdef DEBUG_SYNCHRO @@ -1159,7 +1159,7 @@ int StopAccounts(HYAMNPROTOPLUGIN Plugin) int WaitForAllAccounts(HYAMNPROTOPLUGIN Plugin, BOOL GetAccountBrowserAccess) { - HACCOUNT Finder; + CAccount *Finder; if (GetAccountBrowserAccess) { @@ -1198,7 +1198,7 @@ int WaitForAllAccounts(HYAMNPROTOPLUGIN Plugin, BOOL GetAccountBrowserAccess) int DeleteAccounts(HYAMNPROTOPLUGIN Plugin) { - HACCOUNT Finder; + CAccount *Finder; //1. wait to get write access #ifdef DEBUG_SYNCHRO @@ -1213,7 +1213,7 @@ int DeleteAccounts(HYAMNPROTOPLUGIN Plugin) for (Finder = Plugin->FirstAccount; Finder != nullptr;) { - HACCOUNT Next = Finder->Next; + CAccount *Next = Finder->Next; DeletePluginAccountSvc((WPARAM)Finder, 0); Finder = Next; } @@ -1226,7 +1226,7 @@ int DeleteAccounts(HYAMNPROTOPLUGIN Plugin) return 1; } -void WINAPI GetStatusFcn(HACCOUNT Which, wchar_t *Value) +void WINAPI GetStatusFcn(CAccount *Which, wchar_t *Value) { if (Which == nullptr) return; @@ -1235,7 +1235,7 @@ void WINAPI GetStatusFcn(HACCOUNT Which, wchar_t *Value) mir_wstrcpy(Value, Which->Status); } -void WINAPI SetStatusFcn(HACCOUNT Which, wchar_t *Value) +void WINAPI SetStatusFcn(CAccount *Which, wchar_t *Value) { if (Which != nullptr) { mir_cslock lck(csAccountStatusCS); diff --git a/protocols/YAMN/src/browser/badconnect.cpp b/protocols/YAMN/src/browser/badconnect.cpp index 02db99b77d..678eb1f337 100644 --- a/protocols/YAMN/src/browser/badconnect.cpp +++ b/protocols/YAMN/src/browser/badconnect.cpp @@ -21,7 +21,7 @@ LRESULT CALLBACK BadConnectPopupProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM STARTUPINFOW si; memset(&si, 0, sizeof(si)); si.cb = sizeof(si); - HACCOUNT ActualAccount = (HACCOUNT)PUGetPluginData(hWnd); + CAccount *ActualAccount = (CAccount *)PUGetPluginData(hWnd); #ifdef DEBUG_SYNCHRO DebugLog(SynchroFile, "PopupProc:LEFTCLICK:ActualAccountSO-read wait\n"); #endif @@ -79,7 +79,7 @@ INT_PTR CALLBACK DlgProcYAMNBadConnection(HWND hDlg, UINT msg, WPARAM wParam, LP case WM_INITDIALOG: { BOOL ShowPopup, ShowMsg, ShowIco; - HACCOUNT ActualAccount; + CAccount *ActualAccount; DWORD ErrorCode; char* TitleStrA; char *Message1A = nullptr; @@ -206,7 +206,7 @@ void __cdecl BadConnection(void *Param) { MSG msg; HWND hBadConnect; - HACCOUNT ActualAccount; + CAccount *ActualAccount; struct BadConnectionParam MyParam = *(struct BadConnectionParam *)Param; ActualAccount = MyParam.account; diff --git a/protocols/YAMN/src/browser/browser.h b/protocols/YAMN/src/browser/browser.h index abab95f761..381ecfb9f5 100644 --- a/protocols/YAMN/src/browser/browser.h +++ b/protocols/YAMN/src/browser/browser.h @@ -5,7 +5,7 @@ typedef struct MailBrowserWinParam { #define YAMN_MAILBROWSERVERSION 1 HANDLE ThreadRunningEV; - HACCOUNT account; + CAccount *account; DWORD nflags; //flags YAMN_ACC_??? when new mails DWORD nnflags; //flags YAMN_ACC_??? when no new mails void *Param; @@ -14,7 +14,7 @@ typedef struct MailBrowserWinParam typedef struct MailShowMsgWinParam { HANDLE ThreadRunningEV; - HACCOUNT account; + CAccount *account; HYAMNMAIL mail; } YAMN_MAILSHOWPARAM, *PYAMN_MAILSHOWPARAM; @@ -22,7 +22,7 @@ typedef struct NoNewMailParam { #define YAMN_NONEWMAILVERSION 1 HANDLE ThreadRunningEV; - HACCOUNT account; + CAccount *account; DWORD flags; void *Param; } YAMN_NONEWMAILPARAM,*PYAMN_NONEWMAILPARAM; @@ -31,7 +31,7 @@ typedef struct BadConnectionParam { #define YAMN_BADCONNECTIONVERSION 1 HANDLE ThreadRunningEV; - HACCOUNT account; + CAccount *account; UINT_PTR errcode; void *Param; } YAMN_BADCONNECTIONPARAM,*PYAMN_BADCONNECTIONPARAM; diff --git a/protocols/YAMN/src/browser/mailbrowser.cpp b/protocols/YAMN/src/browser/mailbrowser.cpp index 78007bc5b2..6321141135 100644 --- a/protocols/YAMN/src/browser/mailbrowser.cpp +++ b/protocols/YAMN/src/browser/mailbrowser.cpp @@ -62,7 +62,7 @@ struct CMailNumbers struct CMailWinUserInfo { - HACCOUNT Account; + CAccount *Account; int TrayIconState; BOOL UpdateMailsMessagesAccess; BOOL Seen; @@ -88,10 +88,10 @@ struct CSortList int iSubItem; }; -// Retrieves HACCOUNT, whose mails are displayed in ListMails +// Retrieves CAccount *, whose mails are displayed in ListMails // hLM- handle of dialog window // returns handle of account -inline HACCOUNT GetWindowAccount(HWND hDialog); +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 @@ -111,7 +111,7 @@ enum // nflags- flags what to do when new mail arrives // nnflags- flags what to do when no new mail arrives // returns one of UPDATE_XXX value(not implemented yet) -int UpdateMails(HWND hDlg, HACCOUNT ActualAccount, DWORD nflags, DWORD nnflags); +int UpdateMails(HWND hDlg, CAccount *ActualAccount, DWORD nflags, DWORD nnflags); // When new mail occurs, shows window, plays sound, runs application... // hDlg- dialog handle. Dialog of mailbrowser is already created and actions are performed over this window @@ -120,14 +120,14 @@ int UpdateMails(HWND hDlg, HACCOUNT ActualAccount, DWORD nflags, DWORD nnflags); // 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, HACCOUNT ActualAccount, struct CMailNumbers *MN, DWORD nflags, DWORD nnflags); +void DoMailActions(HWND hDlg, CAccount *ActualAccount, struct CMailNumbers *MN, DWORD nflags, DWORD nnflags); // Looks for items in mailbrowser and if they were deleted, delete them from browser window // hListView- handle of listview window // ActualAccount- handle of account, whose mails are show // MailNumbers- pointer to structure, in which function stores numbers of mails with some property // returns one of UPDATE_XXX value (not implemented yet) -int ChangeExistingMailStatus(HWND hListView, HACCOUNT ActualAccount); +int ChangeExistingMailStatus(HWND hListView, CAccount *ActualAccount); // Adds new mails to ListView and if any new, shows multi popup (every new message is new popup window created by popup plugin) // hListView- handle of listview window @@ -136,7 +136,7 @@ int ChangeExistingMailStatus(HWND hListView, HACCOUNT ActualAccount); // MailNumbers- pointer to structure, in which function stores numbers of mails with some property // nflags- flags what to do when new mail arrives // returns one of UPDATE_XXX value (not implemented yet) -int AddNewMailsToListView(HWND hListView, HACCOUNT ActualAccount, DWORD nflags); +int AddNewMailsToListView(HWND hListView, CAccount *ActualAccount, DWORD nflags); // Window callback procedure for popup window (created by popup plugin) LRESULT CALLBACK NewMailPopupProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); @@ -200,7 +200,7 @@ LPARAM readItemLParam(HWND hwnd, DWORD iItem) return item.lParam; } -inline HACCOUNT GetWindowAccount(HWND hDlg) +inline CAccount *GetWindowAccount(HWND hDlg) { struct CMailWinUserInfo *mwui = (struct CMailWinUserInfo *)GetWindowLongPtr(hDlg, DWLP_USER); @@ -311,7 +311,7 @@ void IncrementMailCounters(HYAMNMAIL msgq, struct CMailNumbers *MN) MN->Real.EventNC++; } -int UpdateMails(HWND hDlg, HACCOUNT ActualAccount, DWORD nflags, DWORD nnflags) +int UpdateMails(HWND hDlg, CAccount *ActualAccount, DWORD nflags, DWORD nnflags) { struct CMailNumbers MN; @@ -444,7 +444,7 @@ int UpdateMails(HWND hDlg, HACCOUNT ActualAccount, DWORD nflags, DWORD nnflags) return 1; } -int ChangeExistingMailStatus(HWND hListView, HACCOUNT ActualAccount) +int ChangeExistingMailStatus(HWND hListView, CAccount *ActualAccount) { LVITEM item; HYAMNMAIL mail, msgq; @@ -471,7 +471,7 @@ int ChangeExistingMailStatus(HWND hListView, HACCOUNT ActualAccount) } void MimeDateToLocalizedDateTime(char *datein, WCHAR *dateout, int lendateout); -int AddNewMailsToListView(HWND hListView, HACCOUNT ActualAccount, DWORD nflags) +int AddNewMailsToListView(HWND hListView, CAccount *ActualAccount, DWORD nflags) { WCHAR *FromStr; WCHAR SizeStr[20]; @@ -620,7 +620,7 @@ int AddNewMailsToListView(HWND hListView, HACCOUNT ActualAccount, DWORD nflags) return TRUE; } -void DoMailActions(HWND hDlg, HACCOUNT ActualAccount, struct CMailNumbers *MN, DWORD nflags, DWORD nnflags) +void DoMailActions(HWND hDlg, CAccount *ActualAccount, struct CMailNumbers *MN, DWORD nflags, DWORD nnflags) { NOTIFYICONDATA nid = {}; nid.cbSize = sizeof(nid); @@ -793,7 +793,7 @@ LRESULT CALLBACK NewMailPopupProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa // if clicked and it's new mail popup window if ((HIWORD(wParam) == STN_CLICKED) && (-1 != (PluginParam = (INT_PTR)PUGetPluginData(hWnd)))) { MCONTACT hContact = 0; - HACCOUNT Account; + CAccount *Account; if (PluginParam) { PYAMN_MAILSHOWPARAM MailParam = new YAMN_MAILSHOWPARAM; memcpy(MailParam, (PINT_PTR)PluginParam, sizeof(YAMN_MAILSHOWPARAM)); @@ -807,11 +807,11 @@ LRESULT CALLBACK NewMailPopupProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa hContact = PUGetContact(hWnd); if (!g_plugin.getString(hContact, "Id", &dbv)) { - Account = (HACCOUNT)CallService(MS_YAMN_FINDACCOUNTBYNAME, (WPARAM)POP3Plugin, (LPARAM)dbv.pszVal); + Account = (CAccount *)CallService(MS_YAMN_FINDACCOUNTBYNAME, (WPARAM)POP3Plugin, (LPARAM)dbv.pszVal); db_free(&dbv); } else - Account = (HACCOUNT)hContact; //???? + Account = (CAccount *)hContact; //???? #ifdef DEBUG_SYNCHRO @@ -865,19 +865,19 @@ LRESULT CALLBACK NewMailPopupProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa break; case WM_YAMN_STOPACCOUNT: { - HACCOUNT ActualAccount; + CAccount *ActualAccount; DBVARIANT dbv; MCONTACT hContact = PUGetContact(hWnd); if (!g_plugin.getString(hContact, "Id", &dbv)) { - ActualAccount = (HACCOUNT)CallService(MS_YAMN_FINDACCOUNTBYNAME, (WPARAM)POP3Plugin, (LPARAM)dbv.pszVal); + ActualAccount = (CAccount *)CallService(MS_YAMN_FINDACCOUNTBYNAME, (WPARAM)POP3Plugin, (LPARAM)dbv.pszVal); db_free(&dbv); } else - ActualAccount = (HACCOUNT)hContact; + ActualAccount = (CAccount *)hContact; - if ((HACCOUNT)wParam != ActualAccount) + if ((CAccount *)wParam != ActualAccount) break; DestroyWindow(hWnd); return 0; @@ -894,17 +894,17 @@ LRESULT CALLBACK NoNewMailPopupProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM l switch (msg) { case WM_COMMAND: if ((HIWORD(wParam) == STN_CLICKED) && (msg == WM_COMMAND)) { - HACCOUNT ActualAccount; + CAccount *ActualAccount; DBVARIANT dbv; MCONTACT hContact = PUGetContact(hWnd); if (!g_plugin.getString(hContact, "Id", &dbv)) { - ActualAccount = (HACCOUNT)CallService(MS_YAMN_FINDACCOUNTBYNAME, (WPARAM)POP3Plugin, (LPARAM)dbv.pszVal); + ActualAccount = (CAccount *)CallService(MS_YAMN_FINDACCOUNTBYNAME, (WPARAM)POP3Plugin, (LPARAM)dbv.pszVal); db_free(&dbv); } else - ActualAccount = (HACCOUNT)hContact; + ActualAccount = (CAccount *)hContact; #ifdef DEBUG_SYNCHRO DebugLog(SynchroFile, "PopupProc:LEFTCLICK:ActualAccountSO-read wait\n"); @@ -957,19 +957,19 @@ LRESULT CALLBACK NoNewMailPopupProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM l break; case WM_YAMN_STOPACCOUNT: { - HACCOUNT ActualAccount; + CAccount *ActualAccount; DBVARIANT dbv; MCONTACT hContact = PUGetContact(hWnd); if (!g_plugin.getString(hContact, "Id", &dbv)) { - ActualAccount = (HACCOUNT)CallService(MS_YAMN_FINDACCOUNTBYNAME, (WPARAM)POP3Plugin, (LPARAM)dbv.pszVal); + ActualAccount = (CAccount *)CallService(MS_YAMN_FINDACCOUNTBYNAME, (WPARAM)POP3Plugin, (LPARAM)dbv.pszVal); db_free(&dbv); } else - ActualAccount = (HACCOUNT)hContact; + ActualAccount = (CAccount *)hContact; - if ((HACCOUNT)wParam != ActualAccount) + if ((CAccount *)wParam != ActualAccount) break; DestroyWindow(hWnd); @@ -1449,7 +1449,7 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg, UINT msg, WPARAM wParam, LPAR if (nullptr == MailParam) break; - if ((HACCOUNT)wParam != MailParam->account) + if ((CAccount *)wParam != MailParam->account) break; #ifdef DEBUG_SYNCHRO DebugLog(SynchroFile, "ShowMessage:STOPACCOUNT:sending destroy msg\n"); @@ -1626,7 +1626,7 @@ CREADTEVIEWMESSAGEWINDOW: INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) { - HACCOUNT ActualAccount; + CAccount *ActualAccount; int Items; switch (msg) { @@ -1788,7 +1788,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR if (nullptr == (ActualAccount = GetWindowAccount(hDlg))) break; - if ((HACCOUNT)wParam != ActualAccount) + if ((CAccount *)wParam != ActualAccount) break; wchar_t accstatus[512]; @@ -1812,7 +1812,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR DebugLog(SynchroFile, "MailBrowser:CHANGECONTENT:posting UPDATEMAILS\n"); #endif if (ThisThreadWindow) { - if (!UpdateMails(hDlg, (HACCOUNT)wParam, UpdateParams.Flags->nflags, UpdateParams.Flags->nnflags)) + 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 @@ -1842,7 +1842,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR if (nullptr == (ActualAccount = GetWindowAccount(hDlg))) return 0; - if ((HACCOUNT)wParam != ActualAccount) + if ((CAccount *)wParam != ActualAccount) return 0; nflags = um->Flags->nflags; @@ -1858,7 +1858,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR case WM_YAMN_STOPACCOUNT: if (nullptr == (ActualAccount = GetWindowAccount(hDlg))) break; - if ((HACCOUNT)wParam != ActualAccount) + if ((CAccount *)wParam != ActualAccount) break; PostQuitMessage(0); return 1; @@ -2295,7 +2295,7 @@ void __cdecl MailBrowser(void *Param) BOOL WndFound = FALSE; struct MailBrowserWinParam MyParam = *(struct MailBrowserWinParam *)Param; - HACCOUNT ActualAccount = MyParam.account; + CAccount *ActualAccount = MyParam.account; SCIncFcn(ActualAccount->UsingThreads); // we will not use params in stack anymore diff --git a/protocols/YAMN/src/filterplugin.cpp b/protocols/YAMN/src/filterplugin.cpp index dca5780152..35d18bf75c 100644 --- a/protocols/YAMN/src/filterplugin.cpp +++ b/protocols/YAMN/src/filterplugin.cpp @@ -158,7 +158,7 @@ int WINAPI SetFilterPluginFcnImportFcn(HYAMNFILTERPLUGIN Plugin,DWORD Importance INT_PTR FilterMailSvc(WPARAM wParam,LPARAM lParam) { - HACCOUNT Account=(HACCOUNT)wParam; + CAccount *Account=(CAccount *)wParam; HYAMNMAIL Mail=(HYAMNMAIL)lParam; PYAMN_FILTERPLUGINQUEUE ActualPlugin; diff --git a/protocols/YAMN/src/mails/mails.cpp b/protocols/YAMN/src/mails/mails.cpp index ee570fa8e2..7345a46dfc 100644 --- a/protocols/YAMN/src/mails/mails.cpp +++ b/protocols/YAMN/src/mails/mails.cpp @@ -50,12 +50,12 @@ void WINAPI AppendQueueFcn(HYAMNMAIL first,HYAMNMAIL second); //So function works like: //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 WINAPI SynchroMessagesFcn(HACCOUNT Account,HYAMNMAIL *OldQueue,HYAMNMAIL *RemovedOld,HYAMNMAIL *NewQueue,HYAMNMAIL *RemovedNew); +void WINAPI SynchroMessagesFcn(CAccount *Account,HYAMNMAIL *OldQueue,HYAMNMAIL *RemovedOld,HYAMNMAIL *NewQueue,HYAMNMAIL *RemovedNew); //Deletes messages from mail From to the end // Account- account who owns mails // From- first mail in queue, which is going to delete -void WINAPI DeleteMessagesToEndFcn(HACCOUNT Account,HYAMNMAIL From); +void WINAPI DeleteMessagesToEndFcn(CAccount *Account,HYAMNMAIL From); //Removes message from queue, does not delete from memory // From- queue pointer @@ -118,7 +118,7 @@ struct CExportedServices MailExportedSvc[]= INT_PTR CreateAccountMailSvc(WPARAM wParam,LPARAM lParam) { - HACCOUNT Account=(HACCOUNT)wParam; + CAccount *Account=(CAccount *)wParam; DWORD MailVersion=(DWORD)lParam; HYAMNMAIL NewMail; @@ -219,7 +219,7 @@ INT_PTR SaveMailDataSvc(WPARAM, LPARAM lParam) return (INT_PTR)0; } -void WINAPI SynchroMessagesFcn(HACCOUNT Account,HYAMNMAIL *OldQueue,HYAMNMAIL *RemovedOld,HYAMNMAIL *NewQueue,HYAMNMAIL *RemovedNew) +void WINAPI SynchroMessagesFcn(CAccount *Account,HYAMNMAIL *OldQueue,HYAMNMAIL *RemovedOld,HYAMNMAIL *NewQueue,HYAMNMAIL *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) @@ -311,7 +311,7 @@ void WINAPI SynchroMessagesFcn(HACCOUNT Account,HYAMNMAIL *OldQueue,HYAMNMAIL *R } } -void WINAPI DeleteMessagesToEndFcn(HACCOUNT Account,HYAMNMAIL From) +void WINAPI DeleteMessagesToEndFcn(CAccount *Account,HYAMNMAIL From) { HYAMNMAIL Temp; while(From != nullptr) diff --git a/protocols/YAMN/src/mails/mime.cpp b/protocols/YAMN/src/mails/mime.cpp index 52ac1a5ff7..8db0b045d9 100644 --- a/protocols/YAMN/src/mails/mime.cpp +++ b/protocols/YAMN/src/mails/mime.cpp @@ -6,45 +6,45 @@ #include "../stdafx.h" -//-------------------------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------------------------- -//Copies one string to another -// srcstart- source string -// srcend- address to the end of source string -// dest- pointer that stores new allocated string that contains copy of source string -// mode- MIME_PLAIN or MIME_MAIL (MIME_MAIL deletes '"' characters (or '<' and '>') if they are at start and end of source string -void CopyToHeader(char *srcstart,char *srcend,char **dest,int mode); + //Copies one string to another + // srcstart- source string + // srcend- address to the end of source string + // dest- pointer that stores new allocated string that contains copy of source string + // mode- MIME_PLAIN or MIME_MAIL (MIME_MAIL deletes '"' characters (or '<' and '>') if they are at start and end of source string +void CopyToHeader(char *srcstart, char *srcend, char **dest, int mode); //Extracts email address (finds nick name and mail and then stores them to strings) // finder- source string // storeto- pointer that receives address of mail string // storetonick- pointer that receives address of nickname -void ExtractAddressFromLine(char *finder,char **storeto,char **storetonick); +void ExtractAddressFromLine(char *finder, char **storeto, char **storetonick); //Extracts simple text from string // finder- source string // storeto- pointer that receives address of string -void ExtractStringFromLine(char *finder,char **storeto); +void ExtractStringFromLine(char *finder, char **storeto); //Extracts some item from content-type string //Example: ContentType string: "TEXT/PLAIN; charset=US-ASCII", item:"charset=", returns: "US-ASCII" // ContetType- content-type string // value- string item // returns extracted string (or NULL when not found) -char *ExtractFromContentType(char *ContentType,char *value); +char *ExtractFromContentType(char *ContentType, char *value); //Extracts info from header text into header members //Note that this function as well as struct CShortHeadwer can be always changed, because there are many items to extract //(e.g. the X-Priority and Importance and so on) // items- translated header (see TranslateHeaderFcn) // head- header to be filled with values extracted from items -void ExtractShortHeader(struct CMimeItem *items,struct CShortHeader *head); +void ExtractShortHeader(struct CMimeItem *items, struct CShortHeader *head); //Extracts header to mail using ExtractShortHeader fcn. // items- translated header (see TranslateHeaderFcn) // CP- codepage used when no default found // head- header to be filled with values extracted from items, in unicode (wide char) -void ExtractHeader(struct CMimeItem *items,int &CP,struct CHeader *head); +void ExtractHeader(struct CMimeItem *items, int &CP, struct CHeader *head); //Deletes items in CShortHeader structure // head- structure whose items are deleted @@ -52,11 +52,11 @@ void DeleteShortHeaderContent(struct CShortHeader *head); //Deletes list of YAMN_MIMENAMES structures // Names- pointer to first item of list -void DeleteNames(PYAMN_MIMENAMES Names); +void DeleteNames(CMimeNames *Names); //Deletes list of YAMN_MIMESHORTNAMES structures // Names- pointer to first item of list -void DeleteShortNames(PYAMN_MIMESHORTNAMES Names); +void DeleteShortNames(CShortNames *Names); //Makes a string lowercase // string- string to be lowercased @@ -65,360 +65,342 @@ void inline ToLower(char *string); //-------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------- -void CopyToHeader(char *srcstart,char *srcend,char **dest,int mode) +void CopyToHeader(char *srcstart, char *srcend, char **dest, int mode) { char *dst; - if (dest==nullptr) + if (dest == nullptr) return; - if (srcstart>=srcend) + if (srcstart >= srcend) return; - if ((mode==MIME_MAIL) && (((*srcstart=='"') && (*(srcend-1)=='"')) || ((*srcstart=='<') && (*(srcend-1)=='>')))) - { + if ((mode == MIME_MAIL) && (((*srcstart == '"') && (*(srcend - 1) == '"')) || ((*srcstart == '<') && (*(srcend - 1) == '>')))) { srcstart++; srcend--; } - if (srcstart>=srcend) + if (srcstart >= srcend) return; if (nullptr != *dest) - delete[] *dest; - if (nullptr==(*dest=new char[srcend-srcstart+1])) + delete[] * dest; + if (nullptr == (*dest = new char[srcend - srcstart + 1])) return; - dst=*dest; + dst = *dest; - for (;srcstart' at the end of line - CopyToHeader(finder,finderend+1,storeto,MIME_MAIL); + CopyToHeader(finder, finderend + 1, storeto, MIME_MAIL); else //at the end of line, there's '>' { - char *finder2=finderend; - while((*finder2 != '<') && (finder2>finder)) finder2--; //go to matching '<' or to the start - CopyToHeader(finder2,finderend+1,storeto,MIME_MAIL); - if (*finder2=='<') //if we found '<', the rest copy as from nick + char *finder2 = finderend; + while ((*finder2 != '<') && (finder2 > finder)) finder2--; //go to matching '<' or to the start + CopyToHeader(finder2, finderend + 1, storeto, MIME_MAIL); + if (*finder2 == '<') //if we found '<', the rest copy as from nick { finder2--; - while(WS(finder2) || ENDLINE(finder2)) finder2--; //parse whitespace - CopyToHeader(finder,finder2+1,storetonick,MIME_MAIL); //and store nickname + while (WS(finder2) || ENDLINE(finder2)) finder2--; //parse whitespace + CopyToHeader(finder, finder2 + 1, storetonick, MIME_MAIL); //and store nickname } } } - else - { - char *finderend=finder+1; - do - { + else { + char *finderend = finder + 1; + do { if (ENDLINEWS(finderend)) //after endline information continues - finderend+=2; - while(!ENDLINE(finderend) && (*finderend != '>') && !EOS(finderend)) finderend++; //seek to the matching < or to the end of line or to the end of string - }while(ENDLINEWS(finderend)); - CopyToHeader(finder,finderend+1,storeto,MIME_MAIL); //go to first '>' or to the end and copy - finder=finderend+1; - while(WS(finder)) finder++; //parse whitespace + finderend += 2; + while (!ENDLINE(finderend) && (*finderend != '>') && !EOS(finderend)) finderend++; //seek to the matching < or to the end of line or to the end of string + } + while (ENDLINEWS(finderend)); + CopyToHeader(finder, finderend + 1, storeto, MIME_MAIL); //go to first '>' or to the end and copy + finder = finderend + 1; + while (WS(finder)) finder++; //parse whitespace if (!ENDLINE(finder) && !EOS(finder)) //if there are chars yet, it's nick { - finderend=finder+1; - while(!ENDLINE(finderend) && !EOS(finderend)) finderend++; //seek to the end of line or to the end of string + finderend = finder + 1; + while (!ENDLINE(finderend) && !EOS(finderend)) finderend++; //seek to the end of line or to the end of string finderend--; - while(WS(finderend)) finderend--; //find the end of line, no whitespace - CopyToHeader(finder,finderend+1,storetonick,MIME_MAIL); + while (WS(finderend)) finderend--; //find the end of line, no whitespace + CopyToHeader(finder, finderend + 1, storetonick, MIME_MAIL); } } } -void ExtractStringFromLine(char *finder,char **storeto) +void ExtractStringFromLine(char *finder, char **storeto) { - if (finder==nullptr) - { - *storeto=nullptr; + if (finder == nullptr) { + *storeto = nullptr; return; } - while(WS(finder)) finder++; - char *finderend=finder; + while (WS(finder)) finder++; + char *finderend = finder; - do - { + do { if (ENDLINEWS(finderend)) finderend++; //after endline information continues - while(!ENDLINE(finderend) && !EOS(finderend)) finderend++; - }while(ENDLINEWS(finderend)); + while (!ENDLINE(finderend) && !EOS(finderend)) finderend++; + } + while (ENDLINEWS(finderend)); finderend--; - while(WS(finderend)) finderend--; //find the end of line, no whitespace - CopyToHeader(finder,finderend+1,storeto,MIME_PLAIN); + while (WS(finderend)) finderend--; //find the end of line, no whitespace + CopyToHeader(finder, finderend + 1, storeto, MIME_PLAIN); } -char *ExtractFromContentType(char *ContentType,char *value) +char *ExtractFromContentType(char *ContentType, char *value) { char *lowered = _strdup(ContentType); ToLower(lowered); - char *finder=strstr(lowered,value); - if (finder==nullptr) { - free (lowered); + char *finder = strstr(lowered, value); + if (finder == nullptr) { + free(lowered); return nullptr; } - finder = finder-lowered+ContentType; - free (lowered); + finder = finder - lowered + ContentType; + free(lowered); - char *temp,*copier; + char *temp, *copier; char *CopiedString; - temp=finder-1; - while((temp>ContentType) && WS(temp)) temp--; //now we have to find, if the word "Charset=" is located after ';' like "; Charset=" + temp = finder - 1; + while ((temp > ContentType) && WS(temp)) temp--; //now we have to find, if the word "Charset=" is located after ';' like "; Charset=" if (*temp != ';' && !ENDLINE(temp) && temp != ContentType) return nullptr; - finder=finder+mir_strlen(value); //jump over value string + finder = finder + mir_strlen(value); //jump over value string - while(WS(finder)) finder++; //jump over whitespaces - temp=finder; - while(*temp != 0 && *temp != ';') temp++; //jump to the end of setting (to the next ;) + while (WS(finder)) finder++; //jump over whitespaces + temp = finder; + while (*temp != 0 && *temp != ';') temp++; //jump to the end of setting (to the next ;) temp--; - while(WS(temp)) temp--; //remove whitespaces from the end - if (*finder=='\"') { //remove heading and tailing quotes + while (WS(temp)) temp--; //remove whitespaces from the end + if (*finder == '\"') { //remove heading and tailing quotes finder++; - if (*temp=='\"') temp--; + if (*temp == '\"') temp--; } - if (nullptr==(CopiedString=new char[++temp-finder+1])) + if (nullptr == (CopiedString = new char[++temp - finder + 1])) return nullptr; - for (copier=CopiedString;finder != temp;*copier++=*finder++); //copy string - *copier=0; //and end it with zero character + for (copier = CopiedString; finder != temp; *copier++ = *finder++); //copy string + *copier = 0; //and end it with zero character return CopiedString; } -void ExtractShortHeader(struct CMimeItem *items,struct CShortHeader *head) +void ExtractShortHeader(struct CMimeItem *items, struct CShortHeader *head) { - for (;items != nullptr;items=items->Next) - { + for (; items != nullptr; items = items->Next) { //at the start of line //MessageBox(NULL,items->value,items->name,0); - if (0==_strnicmp(items->name,"From",4)) - { - if (items->value==nullptr) + if (0 == _strnicmp(items->name, "From", 4)) { + if (items->value == nullptr) continue; - #ifdef DEBUG_DECODE - DebugLog(DecodeFile,""); - #endif - ExtractAddressFromLine(items->value,&head->From,&head->FromNick); - #ifdef DEBUG_DECODE - DebugLog(DecodeFile,"\n"); - #endif + #ifdef DEBUG_DECODE + DebugLog(DecodeFile, ""); + #endif + ExtractAddressFromLine(items->value, &head->From, &head->FromNick); + #ifdef DEBUG_DECODE + DebugLog(DecodeFile, "\n"); + #endif } - else if (0==_strnicmp(items->name,"Return-Path",11)) - { - if (items->value==nullptr) + else if (0 == _strnicmp(items->name, "Return-Path", 11)) { + if (items->value == nullptr) continue; - #ifdef DEBUG_DECODE - DebugLog(DecodeFile,""); - #endif - ExtractAddressFromLine(items->value,&head->ReturnPath,&head->ReturnPathNick); - #ifdef DEBUG_DECODE - DebugLog(DecodeFile,"\n"); - #endif + #ifdef DEBUG_DECODE + DebugLog(DecodeFile, ""); + #endif + ExtractAddressFromLine(items->value, &head->ReturnPath, &head->ReturnPathNick); + #ifdef DEBUG_DECODE + DebugLog(DecodeFile, "\n"); + #endif } - else if (0==_strnicmp(items->name,"Subject",7)) - { - if (items->value==nullptr) + else if (0 == _strnicmp(items->name, "Subject", 7)) { + if (items->value == nullptr) continue; - #ifdef DEBUG_DECODE - DebugLog(DecodeFile,""); - #endif - ExtractStringFromLine(items->value,&head->Subject); - #ifdef DEBUG_DECODE - DebugLog(DecodeFile,"\n"); - #endif + #ifdef DEBUG_DECODE + DebugLog(DecodeFile, ""); + #endif + ExtractStringFromLine(items->value, &head->Subject); + #ifdef DEBUG_DECODE + DebugLog(DecodeFile, "\n"); + #endif } - else if (0==_strnicmp(items->name,"Body",4)) - { - if (items->value==nullptr) + else if (0 == _strnicmp(items->name, "Body", 4)) { + if (items->value == nullptr) continue; - #ifdef DEBUG_DECODE - DebugLog(DecodeFile,""); - #endif - ExtractStringFromLine(items->value,&head->Body); - #ifdef DEBUG_DECODE - DebugLog(DecodeFile,"\n"); - #endif + #ifdef DEBUG_DECODE + DebugLog(DecodeFile, ""); + #endif + ExtractStringFromLine(items->value, &head->Body); + #ifdef DEBUG_DECODE + DebugLog(DecodeFile, "\n"); + #endif } - else if (0==_strnicmp(items->name,"Date",4)) - { - if (items->value==nullptr) + else if (0 == _strnicmp(items->name, "Date", 4)) { + if (items->value == nullptr) continue; - #ifdef DEBUG_DECODE - DebugLog(DecodeFile,""); - #endif - ExtractStringFromLine(items->value,&head->Date); - #ifdef DEBUG_DECODE - DebugLog(DecodeFile,"\n"); - #endif + #ifdef DEBUG_DECODE + DebugLog(DecodeFile, ""); + #endif + ExtractStringFromLine(items->value, &head->Date); + #ifdef DEBUG_DECODE + DebugLog(DecodeFile, "\n"); + #endif } - else if (0==_strnicmp(items->name,"Content-Type",12)) - { - if (items->value==nullptr) + else if (0 == _strnicmp(items->name, "Content-Type", 12)) { + if (items->value == nullptr) continue; - char *ContentType=nullptr,*CharSetStr; - #ifdef DEBUG_DECODE - DebugLog(DecodeFile,""); - #endif - ExtractStringFromLine(items->value,&ContentType); - #ifdef DEBUG_DECODE - DebugLog(DecodeFile,"\n"); - #endif + char *ContentType = nullptr, *CharSetStr; + #ifdef DEBUG_DECODE + DebugLog(DecodeFile, ""); + #endif + ExtractStringFromLine(items->value, &ContentType); + #ifdef DEBUG_DECODE + DebugLog(DecodeFile, "\n"); + #endif ToLower(ContentType); - if (nullptr != (CharSetStr=ExtractFromContentType(ContentType,"charset="))) - { - head->CP=GetCharsetFromString(CharSetStr,mir_strlen(CharSetStr)); + if (nullptr != (CharSetStr = ExtractFromContentType(ContentType, "charset="))) { + head->CP = GetCharsetFromString(CharSetStr, mir_strlen(CharSetStr)); delete[] CharSetStr; } delete[] ContentType; } - else if (0==_strnicmp(items->name,"Importance",10)) - { - if (items->value==nullptr) + else if (0 == _strnicmp(items->name, "Importance", 10)) { + if (items->value == nullptr) continue; - #ifdef DEBUG_DECODE - DebugLog(DecodeFile,""); - #endif - if (head->Priority != -1) - { - if (0==strncmp(items->value,"low",3)) - head->Priority=5; - else if (0==strncmp(items->value,"normal",6)) - head->Priority=3; - else if (0==strncmp(items->value,"high",4)) - head->Priority=1; + #ifdef DEBUG_DECODE + DebugLog(DecodeFile, ""); + #endif + if (head->Priority != -1) { + if (0 == strncmp(items->value, "low", 3)) + head->Priority = 5; + else if (0 == strncmp(items->value, "normal", 6)) + head->Priority = 3; + else if (0 == strncmp(items->value, "high", 4)) + head->Priority = 1; } - #ifdef DEBUG_DECODE - DebugLog(DecodeFile,"\n"); - #endif + #ifdef DEBUG_DECODE + DebugLog(DecodeFile, "\n"); + #endif } - else if (0==_strnicmp(items->name,"X-Priority",10)) - { - if (items->value==nullptr) + else if (0 == _strnicmp(items->name, "X-Priority", 10)) { + if (items->value == nullptr) continue; - #ifdef DEBUG_DECODE - DebugLog(DecodeFile,""); - #endif - if ((*items->value>='1') && (*items->value<='5')) - head->Priority=*items->value-'0'; - #ifdef DEBUG_DECODE - DebugLog(DecodeFile,"\n"); - #endif + #ifdef DEBUG_DECODE + DebugLog(DecodeFile, ""); + #endif + if ((*items->value >= '1') && (*items->value <= '5')) + head->Priority = *items->value - '0'; + #ifdef DEBUG_DECODE + DebugLog(DecodeFile, "\n"); + #endif } } } -void ExtractHeader(struct CMimeItem *items,int &CP,struct CHeader *head) +void ExtractHeader(struct CMimeItem *items, int &CP, struct CHeader *head) { struct CShortHeader ShortHeader; memset(&ShortHeader, 0, sizeof(struct CShortHeader)); - ShortHeader.Priority=ShortHeader.CP=-1; - #ifdef DEBUG_DECODE - DebugLog(DecodeFile,"\n"); - #endif - ExtractShortHeader(items,&ShortHeader); - - head->Priority=ShortHeader.Priority==-1 ? 3 : ShortHeader.Priority; - CP=ShortHeader.CP==-1 ? CP : ShortHeader.CP; - #ifdef DEBUG_DECODE + ShortHeader.Priority = ShortHeader.CP = -1; +#ifdef DEBUG_DECODE + DebugLog(DecodeFile, "\n"); +#endif + ExtractShortHeader(items, &ShortHeader); + + head->Priority = ShortHeader.Priority == -1 ? 3 : ShortHeader.Priority; + CP = ShortHeader.CP == -1 ? CP : ShortHeader.CP; +#ifdef DEBUG_DECODE if (NULL != ShortHeader.From) - DebugLog(DecodeFile,"%s%s%s%s%s%s%s%s%s%s%s\n"); - DebugLog(DecodeFile,"\n"); - #endif + DebugLog(DecodeFile, "%s\n"); + DebugLog(DecodeFile, "\n"); +#endif - ConvertCodedStringToUnicode(ShortHeader.From,&head->From,CP,MIME_PLAIN); + ConvertCodedStringToUnicode(ShortHeader.From, &head->From, CP, MIME_PLAIN); - #ifdef DEBUG_DECODE +#ifdef DEBUG_DECODE if (NULL != head->From) - DebugLogW(DecodeFile,L"%s\n",head->From); - #endif - ConvertCodedStringToUnicode(ShortHeader.FromNick,&head->FromNick,CP,MIME_MAIL); - #ifdef DEBUG_DECODE + DebugLogW(DecodeFile, L"%s\n", head->From); +#endif + ConvertCodedStringToUnicode(ShortHeader.FromNick, &head->FromNick, CP, MIME_MAIL); +#ifdef DEBUG_DECODE if (NULL != head->FromNick) - DebugLogW(DecodeFile,L"%s\n",head->FromNick); - #endif - ConvertCodedStringToUnicode(ShortHeader.ReturnPath,&head->ReturnPath,CP,MIME_PLAIN); - #ifdef DEBUG_DECODE + DebugLogW(DecodeFile, L"%s\n", head->FromNick); +#endif + ConvertCodedStringToUnicode(ShortHeader.ReturnPath, &head->ReturnPath, CP, MIME_PLAIN); +#ifdef DEBUG_DECODE if (NULL != head->ReturnPath) - DebugLogW(DecodeFile,L"%s\n",head->ReturnPath); - #endif - ConvertCodedStringToUnicode(ShortHeader.ReturnPathNick,&head->ReturnPathNick,CP,MIME_MAIL); - #ifdef DEBUG_DECODE + DebugLogW(DecodeFile, L"%s\n", head->ReturnPath); +#endif + ConvertCodedStringToUnicode(ShortHeader.ReturnPathNick, &head->ReturnPathNick, CP, MIME_MAIL); +#ifdef DEBUG_DECODE if (NULL != head->ReturnPathNick) - DebugLogW(DecodeFile,L"%s\n",head->ReturnPathNick); - #endif - ConvertCodedStringToUnicode(ShortHeader.Subject,&head->Subject,CP,MIME_PLAIN); - #ifdef DEBUG_DECODE + DebugLogW(DecodeFile, L"%s\n", head->ReturnPathNick); +#endif + ConvertCodedStringToUnicode(ShortHeader.Subject, &head->Subject, CP, MIME_PLAIN); +#ifdef DEBUG_DECODE if (NULL != head->Subject) - DebugLogW(DecodeFile,L"%s\n",head->Subject); - #endif - ConvertCodedStringToUnicode(ShortHeader.Date,&head->Date,CP,MIME_PLAIN); - #ifdef DEBUG_DECODE + DebugLogW(DecodeFile, L"%s\n", head->Subject); +#endif + ConvertCodedStringToUnicode(ShortHeader.Date, &head->Date, CP, MIME_PLAIN); +#ifdef DEBUG_DECODE if (NULL != head->Date) - DebugLogW(DecodeFile,L"%s\n",head->Date); - #endif + DebugLogW(DecodeFile, L"%s\n", head->Date); +#endif - ConvertCodedStringToUnicode(ShortHeader.Body,&head->Body,CP,MIME_PLAIN); - #ifdef DEBUG_DECODE + ConvertCodedStringToUnicode(ShortHeader.Body, &head->Body, CP, MIME_PLAIN); +#ifdef DEBUG_DECODE if (NULL != head->Body) - DebugLogW(DecodeFile,L"%s\n",head->Body); - #endif + DebugLogW(DecodeFile, L"%s\n", head->Body); +#endif - #ifdef DEBUG_DECODE - DebugLog(DecodeFile,"\n"); - #endif +#ifdef DEBUG_DECODE + DebugLog(DecodeFile, "\n"); +#endif DeleteShortHeaderContent(&ShortHeader); -// head->From=L"Frommmm"; -// head->Subject=L"Subject"; + // head->From=L"Frommmm"; + // head->Subject=L"Subject"; return; } @@ -450,32 +432,32 @@ void DeleteHeaderContent(struct CHeader *head) if (head->Bcc != nullptr) DeleteNames(head->Bcc); } -void DeleteNames(PYAMN_MIMENAMES Names) +void DeleteNames(CMimeNames *Names) { - PYAMN_MIMENAMES Parser=Names,Old; - for (;Parser != nullptr;Parser=Parser->Next) - { + CMimeNames *Parser = Names; + for (; Parser != nullptr; Parser = Parser->Next) { if (Parser->Value != nullptr) delete[] Parser->Value; if (Parser->ValueNick != nullptr) delete[] Parser->ValueNick; - Old=Parser; - Parser=Parser->Next; + + CMimeNames *Old = Parser; + Parser = Parser->Next; delete Old; } } -void DeleteShortNames(PYAMN_MIMESHORTNAMES Names) +void DeleteShortNames(CShortNames *Names) { - PYAMN_MIMESHORTNAMES Parser=Names,Old; - for (;Parser != nullptr;Parser=Parser->Next) - { + CShortNames *Parser = Names; + for (; Parser != nullptr; Parser = Parser->Next) { if (Parser->Value != nullptr) delete[] Parser->Value; if (Parser->ValueNick != nullptr) delete[] Parser->ValueNick; - Old=Parser; - Parser=Parser->Next; + + CShortNames *Old = Parser; + Parser = Parser->Next; delete Old; } } @@ -483,8 +465,8 @@ void DeleteShortNames(PYAMN_MIMESHORTNAMES Names) void inline ToLower(char *string) { - for (;*string != 0;string++) - if (*string>='A' && *string<='Z') *string=*string-'A'+'a'; + for (; *string != 0; string++) + if (*string >= 'A' && *string <= 'Z') *string = *string - 'A' + 'a'; } #define TE_UNKNOWN @@ -506,47 +488,46 @@ struct APartDataType void ParseAPart(APartDataType *data) { size_t len = mir_strlen(data->Src); - try - { - char *finder=data->Src; - char *prev1,*prev2,*prev3; + try { + char *finder = data->Src; + char *prev1, *prev2, *prev3; - while(finder<=(data->Src+len)) - { - while(ENDLINEWS(finder)) finder++; + while (finder <= (data->Src + len)) { + while (ENDLINEWS(finder)) finder++; //at the start of line - if (finder>data->Src) { - if (*(finder-2)=='\r' || *(finder-2)=='\n') - *(finder-2)=0; - if (*(finder-1)=='\r' || *(finder-1)=='\n') - *(finder-1)=0; + if (finder > data->Src) { + if (*(finder - 2) == '\r' || *(finder - 2) == '\n') + *(finder - 2) = 0; + if (*(finder - 1) == '\r' || *(finder - 1) == '\n') + *(finder - 1) = 0; } - prev1=finder; + prev1 = finder; - while(*finder != ':' && !EOS(finder) && !ENDLINE(finder)) finder++; - if (ENDLINE(finder)||EOS(finder)) { + while (*finder != ':' && !EOS(finder) && !ENDLINE(finder)) finder++; + if (ENDLINE(finder) || EOS(finder)) { // no ":" in the line? here the body begins; data->body = prev1; break; } - prev2=finder++; + prev2 = finder++; - while(WS(finder) && !EOS(finder)) finder++; + while (WS(finder) && !EOS(finder)) finder++; if (!EOS(finder)) - prev3=finder; + prev3 = finder; else break; - do - { - if (ENDLINEWS(finder)) finder+=2; //after endline information continues - while(!ENDLINE(finder) && !EOS(finder)) finder++; - }while(ENDLINEWS(finder)); + do { + if (ENDLINEWS(finder)) finder += 2; //after endline information continues + while (!ENDLINE(finder) && !EOS(finder)) finder++; + } + while (ENDLINEWS(finder)); - if (!_strnicmp(prev1,"Content-type",prev2-prev1)) { + if (!_strnicmp(prev1, "Content-type", prev2 - prev1)) { data->ContType = prev3; - } else if (!_strnicmp(prev1,"Content-Transfer-Encoding",prev2-prev1)) { + } + else if (!_strnicmp(prev1, "Content-Transfer-Encoding", prev2 - prev1)) { data->TransEnc = prev3; } @@ -557,19 +538,19 @@ void ParseAPart(APartDataType *data) finder++; if (ENDLINE(finder)) { // end of headers. message body begins - if (finder>data->Src) { - if (*(finder-2)=='\r' || *(finder-2)=='\n') - *(finder-2)=0; - if (*(finder-1)=='\r' || *(finder-1)=='\n') - *(finder-1)=0; + if (finder > data->Src) { + if (*(finder - 2) == '\r' || *(finder - 2) == '\n') + *(finder - 2) = 0; + if (*(finder - 1) == '\r' || *(finder - 1) == '\n') + *(finder - 1) = 0; } finder++; if (ENDLINE(finder))finder++; prev1 = finder; - while (!EOS(finder+1))finder++; + while (!EOS(finder + 1))finder++; if (ENDLINE(finder))finder--; prev2 = finder; - if (prev2>prev1) { // yes, we have body + if (prev2 > prev1) { // yes, we have body data->body = prev1; } break; // there is nothing else @@ -577,17 +558,16 @@ void ParseAPart(APartDataType *data) } } } - catch(...) - { + catch (...) { MessageBox(nullptr, TranslateT("Translate header error"), L"", 0); } if (data->body) data->bodyLen = (int)mir_strlen(data->body); } //from decode.cpp -int DecodeQuotedPrintable(char *Src,char *Dst,int DstLen, BOOL isQ); -int DecodeBase64(char *Src,char *Dst,int DstLen); -int ConvertStringToUnicode(char *stream,unsigned int cp,WCHAR **out); +int DecodeQuotedPrintable(char *Src, char *Dst, int DstLen, BOOL isQ); +int DecodeBase64(char *Src, char *Dst, int DstLen); +int ConvertStringToUnicode(char *stream, unsigned int cp, WCHAR **out); WCHAR *ParseMultipartBody(char *src, char *bond) { @@ -597,68 +577,69 @@ WCHAR *ParseMultipartBody(char *src, char *bond) int i; char *courbond = srcback; WCHAR *dest; - for (;(courbond=strstr(courbond,bond));numparts++,courbond+=sizebond); + for (; (courbond = strstr(courbond, bond)); numparts++, courbond += sizebond); APartDataType *partData = new APartDataType[numparts]; memset(partData, 0, sizeof(APartDataType)*numparts); partData[0].Src = courbond = srcback; - for (i=1;(courbond=strstr(courbond,bond));i++,courbond+=sizebond) { - *(courbond-2) = 0; - partData[i].Src = courbond+sizebond; + for (i = 1; (courbond = strstr(courbond, bond)); i++, courbond += sizebond) { + *(courbond - 2) = 0; + partData[i].Src = courbond + sizebond; while (ENDLINE(partData[i].Src)) partData[i].Src++; } - size_t resultSize=0; - for (i=0;iClient.Stopped = TRUE; if (((HPOP3ACCOUNT)Which)->Client.NetClient != nullptr) //we should inform also network client. Usefull only when network client implements this feature @@ -244,7 +244,7 @@ int RegisterPOP3Plugin(WPARAM, LPARAM) //Then, we read all mails for accounts. //You must first register account, before using this function as YAMN must use CreatePOP3Account function to add new accounts - //But if CreatePOP3Account is not implemented (equals to NULL), YAMN creates account as YAMN's standard HACCOUNT + //But if CreatePOP3Account is not implemented (equals to NULL), YAMN creates account as YAMN's standard CAccount * if (FileName) CallService(MS_YAMN_DELETEFILENAME, (WPARAM)FileName, 0); //shoud not happen (only for secure) FileName = (wchar_t *)CallService(MS_YAMN_GETFILENAME, (WPARAM)L"pop3", 0); @@ -277,7 +277,7 @@ int RegisterPOP3Plugin(WPARAM, LPARAM) break; } - HACCOUNT Finder; + CAccount *Finder; DBVARIANT dbv; for (Finder = POP3Plugin->FirstAccount; Finder != nullptr; Finder = Finder->Next) { @@ -348,7 +348,7 @@ DWORD WINAPI WritePOP3Accounts() return ReturnValue; } -DWORD WINAPI WritePOP3Options(HANDLE File, HACCOUNT Which) +DWORD WINAPI WritePOP3Options(HANDLE File, CAccount *Which) { DWORD WrittenBytes; DWORD Ver = POP3_FILEVERSION; @@ -359,7 +359,7 @@ DWORD WINAPI WritePOP3Options(HANDLE File, HACCOUNT Which) return 0; } -DWORD WINAPI ReadPOP3Options(HACCOUNT Which, char **Parser, char *End) +DWORD WINAPI ReadPOP3Options(CAccount *Which, char **Parser, char *End) { DWORD Ver; #ifdef DEBUG_FILEREAD @@ -383,7 +383,7 @@ DWORD WINAPI ReadPOP3Options(HACCOUNT Which, char **Parser, char *End) return 0; } -HYAMNMAIL WINAPI CreatePOP3Mail(HACCOUNT Account, DWORD) +HYAMNMAIL WINAPI CreatePOP3Mail(CAccount *Account, DWORD) { HYAMNMAIL NewMail; //First, we should check whether MAILDATA matches. @@ -396,7 +396,7 @@ HYAMNMAIL WINAPI CreatePOP3Mail(HACCOUNT Account, DWORD) if (nullptr == (NewMail = new YAMNMAIL)) return nullptr; - if (nullptr == (NewMail->MailData = new MAILDATA)) + if (nullptr == (NewMail->MailData = new CMailData())) { delete NewMail; return nullptr; @@ -405,7 +405,7 @@ HYAMNMAIL WINAPI CreatePOP3Mail(HACCOUNT Account, DWORD) return (HYAMNMAIL)NewMail; } -static void SetContactStatus(HACCOUNT account, int status) +static void SetContactStatus(CAccount *account, int status) { if ((account->hContact) && (account->NewMailN.Flags & YAMN_ACC_CONT)) g_plugin.setWord(account->hContact, "Status", status); diff --git a/protocols/YAMN/src/services.cpp b/protocols/YAMN/src/services.cpp index e9ba7b0aaf..3ddae133c6 100644 --- a/protocols/YAMN/src/services.cpp +++ b/protocols/YAMN/src/services.cpp @@ -71,7 +71,7 @@ static INT_PTR ContactApplication(WPARAM wParam, LPARAM) if (g_plugin.getString(wParam, "Id", &dbv)) return 0; - HACCOUNT ActualAccount = (HACCOUNT)CallService(MS_YAMN_FINDACCOUNTBYNAME, (WPARAM)POP3Plugin, (LPARAM)dbv.pszVal); + CAccount *ActualAccount = (CAccount *)CallService(MS_YAMN_FINDACCOUNTBYNAME, (WPARAM)POP3Plugin, (LPARAM)dbv.pszVal); if (ActualAccount != nullptr) { STARTUPINFOW si = { 0 }; si.cb = sizeof(si); @@ -121,7 +121,7 @@ DWORD WINAPI SWMRGWaitToRead(PSWMRG pSWMRG, DWORD dwTimeout); static INT_PTR AccountMailCheck(WPARAM wParam, LPARAM lParam) { //This service will check/sincronize the account pointed by wParam - HACCOUNT ActualAccount = (HACCOUNT)wParam; + CAccount *ActualAccount = (CAccount *)wParam; // copy/paste make mistakes if (ActualAccount != nullptr) { //we use event to signal, that running thread has all needed stack parameters copied @@ -173,7 +173,7 @@ static INT_PTR ContactMailCheck(WPARAM hContact, LPARAM) if (g_plugin.getString(hContact, "Id", &dbv)) return 0; - HACCOUNT ActualAccount = (HACCOUNT)CallService(MS_YAMN_FINDACCOUNTBYNAME, (WPARAM)POP3Plugin, (LPARAM)dbv.pszVal); + CAccount *ActualAccount = (CAccount *)CallService(MS_YAMN_FINDACCOUNTBYNAME, (WPARAM)POP3Plugin, (LPARAM)dbv.pszVal); if (ActualAccount != nullptr) { //we use event to signal, that running thread has all needed stack parameters copied HANDLE ThreadRunningEV; @@ -225,7 +225,7 @@ static INT_PTR ContactMailCheck(WPARAM hContact, LPARAM) if (g_plugin.getString(wParam, "Id", &dbv)) return; - HACCOUNT ActualAccount = (HACCOUNT)CallService(MS_YAMN_FINDACCOUNTBYNAME, (WPARAM)POP3Plugin, (LPARAM)dbv.pszVal); + CAccount *ActualAccount = (CAccount *)CallService(MS_YAMN_FINDACCOUNTBYNAME, (WPARAM)POP3Plugin, (LPARAM)dbv.pszVal); if (ActualAccount != nullptr) { #ifdef DEBUG_SYNCHRO DebugLog(SynchroFile, "Service_ContactDoubleclicked:ActualAccountSO-read wait\n"); @@ -430,7 +430,7 @@ void CreateServiceFunctions(void) //Function to put all enabled contact to the Online status void RefreshContact(void) { - HACCOUNT Finder; + CAccount *Finder; for (Finder = POP3Plugin->FirstAccount; Finder != nullptr; Finder = Finder->Next) { if (Finder->hContact != NULL) { if ((Finder->Flags & YAMN_ACC_ENA) && (Finder->NewMailN.Flags & YAMN_ACC_CONT)) diff --git a/protocols/YAMN/src/stdafx.h b/protocols/YAMN/src/stdafx.h index 246e9468fa..f0919e24b8 100644 --- a/protocols/YAMN/src/stdafx.h +++ b/protocols/YAMN/src/stdafx.h @@ -79,9 +79,9 @@ extern struct YAMNExportedFcns *pYAMNFcn; // From account.cpp INT_PTR CreatePluginAccountSvc(WPARAM wParam, LPARAM lParam); INT_PTR DeletePluginAccountSvc(WPARAM wParam, LPARAM); -int InitAccount(HACCOUNT Which); -void DeInitAccount(HACCOUNT Which); -void StopSignalFcn(HACCOUNT Which); +int InitAccount(CAccount *Which); +void DeInitAccount(CAccount *Which); +void StopSignalFcn(CAccount *Which); void CodeDecodeString(char *Dest, BOOL Encrypt); DWORD FileToMemory(wchar_t *FileName, char **MemFile, char **End); @@ -89,15 +89,15 @@ DWORD FileToMemory(wchar_t *FileName, char **MemFile, char **End); DWORD ReadStringFromMemory(char **Parser,char *End,char **StoreTo,char *DebugString); #endif DWORD ReadStringFromMemory(char **Parser, char *End, char **StoreTo); -DWORD ReadMessagesFromMemory(HACCOUNT Which, char **Parser, char *End); -DWORD ReadAccountFromMemory(HACCOUNT Which, char **Parser, wchar_t *End); +DWORD ReadMessagesFromMemory(CAccount *Which, char **Parser, char *End); +DWORD ReadAccountFromMemory(CAccount *Which, char **Parser, wchar_t *End); INT_PTR AddAccountsFromFileSvc(WPARAM wParam, LPARAM lParam); DWORD WriteStringToFile(HANDLE File, char *Source); DWORD WriteStringToFileW(HANDLE File, WCHAR *Source); -DWORD WriteMessagesToFile(HANDLE File, HACCOUNT Which); +DWORD WriteMessagesToFile(HANDLE File, CAccount *Which); DWORD WINAPI WritePOP3Accounts(); INT_PTR WriteAccountsToFileSvc(WPARAM wParam, LPARAM lParam); INT_PTR FindAccountByNameSvc(WPARAM wParam, LPARAM lParam); @@ -109,8 +109,8 @@ int StopAccounts(HYAMNPROTOPLUGIN Plugin); int WaitForAllAccounts(HYAMNPROTOPLUGIN Plugin, BOOL GetAccountBrowserAccess = FALSE); int DeleteAccounts(HYAMNPROTOPLUGIN Plugin); -void WINAPI GetStatusFcn(HACCOUNT Which, wchar_t *Value); -void WINAPI SetStatusFcn(HACCOUNT Which, wchar_t *Value); +void WINAPI GetStatusFcn(CAccount *Which, wchar_t *Value); +void WINAPI SetStatusFcn(CAccount *Which, wchar_t *Value); INT_PTR UnregisterProtoPlugins(); INT_PTR RegisterProtocolPluginSvc(WPARAM, LPARAM); @@ -182,7 +182,7 @@ HANDLE WINAPI g_GetIconHandle(int idx); HICON WINAPI g_LoadIconEx(int idx, bool big = false); //From synchro.cpp -void WINAPI DeleteMessagesToEndFcn(HACCOUNT Account, HYAMNMAIL From); +void WINAPI DeleteMessagesToEndFcn(CAccount *Account, HYAMNMAIL From); DWORD WINAPI WaitToWriteFcn(PSWMRG SObject, PSCOUNTER SCounter = nullptr); void WINAPI WriteDoneFcn(PSWMRG SObject, PSCOUNTER SCounter = nullptr); DWORD WINAPI WaitToReadFcn(PSWMRG SObject); @@ -209,7 +209,7 @@ char *ExtractFromContentType(char *ContentType, char *value); WCHAR *ParseMultipartBody(char *src, char *bond); //From account.cpp -void WINAPI GetStatusFcn(HACCOUNT Which, wchar_t *Value); +void WINAPI GetStatusFcn(CAccount *Which, wchar_t *Value); extern HYAMNPROTOPLUGIN POP3Plugin; diff --git a/protocols/YAMN/src/yamn.cpp b/protocols/YAMN/src/yamn.cpp index e45e22f06e..982c1abb5c 100644 --- a/protocols/YAMN/src/yamn.cpp +++ b/protocols/YAMN/src/yamn.cpp @@ -96,7 +96,7 @@ INT_PTR GetVariablesSvc(WPARAM wParam, LPARAM) void CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD) { - HACCOUNT ActualAccount; + CAccount *ActualAccount; DWORD Status, tid; // we use event to signal, that running thread has all needed stack parameters copied @@ -252,7 +252,7 @@ ChangeIsCountingStatusLabel: INT_PTR ForceCheckSvc(WPARAM, LPARAM) { - HACCOUNT ActualAccount; + CAccount *ActualAccount; DWORD tid; //we use event to signal, that running thread has all needed stack parameters copied -- cgit v1.2.3