diff options
author | George Hazan <george.hazan@gmail.com> | 2023-10-16 15:22:53 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2023-10-16 15:22:53 +0300 |
commit | 4a4096bf5d55b9ab033dee43ef40e84dbf34f666 (patch) | |
tree | 558113b9fe571e165eb2a9ac806683e89e228aba /protocols | |
parent | ba19b70f9a12bf7e3c51d44bd0a3ca787da43ffc (diff) |
YAMN: slack debug code removed
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/YAMN/src/account.cpp | 108 | ||||
-rw-r--r-- | protocols/YAMN/src/account.h | 167 | ||||
-rw-r--r-- | protocols/YAMN/src/debug.cpp | 75 | ||||
-rw-r--r-- | protocols/YAMN/src/debug.h | 40 | ||||
-rw-r--r-- | protocols/YAMN/src/mails/decode.cpp | 8 | ||||
-rw-r--r-- | protocols/YAMN/src/mails/mime.cpp | 66 | ||||
-rw-r--r-- | protocols/YAMN/src/proto/netlib.cpp | 30 | ||||
-rw-r--r-- | protocols/YAMN/src/proto/pop3/pop3.cpp | 2 | ||||
-rw-r--r-- | protocols/YAMN/src/proto/pop3/pop3comm.cpp | 50 |
9 files changed, 211 insertions, 335 deletions
diff --git a/protocols/YAMN/src/account.cpp b/protocols/YAMN/src/account.cpp index 572418305e..692a881d52 100644 --- a/protocols/YAMN/src/account.cpp +++ b/protocols/YAMN/src/account.cpp @@ -195,45 +195,24 @@ uint32_t FileToMemory(const wchar_t *FileName, char **MemFile, char **End) #if defined(DEBUG_FILEREAD) || defined(DEBUG_FILEREADMESSAGES)
uint32_t ReadStringFromMemory(char **Parser, wchar_t *End, char **StoreTo, wchar_t *DebugString)
+#else
+uint32_t ReadStringFromMemory(char **Parser, char *End, char **StoreTo)
+#endif
{
- // This is the debug version of ReadStringFromMemory function. This version shows MessageBox where
- // read string is displayed
- wchar_t *Dest, *Finder;
- uint32_t Size;
- wchar_t Debug[65536];
-
- Finder = *Parser;
+ char *Finder = *Parser;
while ((*Finder != (wchar_t)0) && (Finder <= End)) Finder++;
+
+ #if defined(DEBUG_FILEREAD) || defined(DEBUG_FILEREADMESSAGES)
+ wchar_t Debug[65536];
mir_snwprintf(Debug, L"%s: %s,length is %d, remaining %d chars", DebugString, *Parser, Finder - *Parser, End - Finder);
MessageBox(NULL, Debug, L"debug", MB_OK);
- if (Finder >= End)
- return EACC_FILECOMPATIBILITY;
- if (Size = Finder - *Parser) {
- if (NULL == (Dest = *StoreTo = new wchar_t[Size + 1]))
- return EACC_ALLOC;
- for (; *Parser <= Finder; (*Parser)++, Dest++)
- *Dest = **Parser;
- }
- else {
- *StoreTo = NULL;
- (*Parser)++;
- }
- return 0;
-}
-#endif
-
-uint32_t ReadStringFromMemory(char **Parser, char *End, char **StoreTo)
-{
- char *Dest, *Finder;
- uint32_t Size;
+ #endif
- Finder = *Parser;
- while ((*Finder != (wchar_t)0) && (Finder <= End)) Finder++;
if (Finder >= End)
return EACC_FILECOMPATIBILITY;
- if (Size = Finder - *Parser) {
- if (nullptr == (Dest = *StoreTo = new char[Size + 1]))
- return EACC_ALLOC;
+
+ if (uint32_t Size = Finder - *Parser) {
+ char *Dest = *StoreTo = new char[Size + 1];
for (; *Parser <= Finder; (*Parser)++, Dest++)
*Dest = **Parser;
}
@@ -246,45 +225,24 @@ uint32_t ReadStringFromMemory(char **Parser, char *End, char **StoreTo) #if defined(DEBUG_FILEREAD) || defined(DEBUG_FILEREADMESSAGES)
uint32_t ReadStringFromMemoryW(wchar_t **Parser, wchar_t *End, wchar_t **StoreTo, wchar_t *DebugString)
+#else
+uint32_t ReadStringFromMemoryW(wchar_t **Parser, wchar_t *End, wchar_t **StoreTo)
+#endif
{
- // This is the debug version of ReadStringFromMemoryW function. This version shows MessageBox where
- // read string is displayed
- wchar_t *Dest, *Finder;
- uint32_t Size;
- wchar_t Debug[65536];
-
- Finder = *Parser;
+ wchar_t *Finder = *Parser;
while ((*Finder != (wchar_t)0) && (Finder <= (wchar_t *)End)) Finder++;
+
+ #if defined(DEBUG_FILEREAD) || defined(DEBUG_FILEREADMESSAGES)
+ wchar_t Debug[65536];
mir_snwprintf(Debug, L"%s: %s,length is %d, remaining %d chars", DebugString, *Parser, Finder - *Parser, (wchar_t *)End - Finder);
MessageBoxW(NULL, Debug, L"debug", MB_OK);
- if (Finder >= (wchar_t *)End)
- return EACC_FILECOMPATIBILITY;
- if (Size = Finder - *Parser) {
- if (NULL == (Dest = *StoreTo = new wchar_t[Size + 1]))
- return EACC_ALLOC;
- for (; *Parser <= Finder; (*Parser)++, Dest++)
- *Dest = **Parser;
- }
- else {
- *StoreTo = NULL;
- (*Parser)++;
- }
- return 0;
-}
-#endif // if defined(DEBUG...)
-
-uint32_t ReadStringFromMemoryW(wchar_t **Parser, wchar_t *End, wchar_t **StoreTo)
-{
- wchar_t *Dest, *Finder;
- uint32_t Size;
+ #endif
- Finder = *Parser;
- while ((*Finder != (wchar_t)0) && (Finder <= (wchar_t *)End)) Finder++;
if (Finder >= (wchar_t *)End)
return EACC_FILECOMPATIBILITY;
- if (Size = Finder - *Parser) {
- if (nullptr == (Dest = *StoreTo = new wchar_t[Size + 1]))
- return EACC_ALLOC;
+
+ if (uint32_t Size = Finder - *Parser) {
+ wchar_t *Dest = *StoreTo = new wchar_t[Size + 1];
for (; *Parser <= Finder; (*Parser)++, Dest++)
*Dest = **Parser;
}
@@ -368,15 +326,14 @@ uint32_t ReadMessagesFromMemory(CAccount *Which, char **Parser, char *End) if (Finder >= End)
return EACC_FILECOMPATIBILITY;
if (Size = Finder - *Parser) {
- if (Which->Mails == nullptr) // First message in queue
- {
+ if (Which->Mails == nullptr) { // First message in queue
if (nullptr == (Which->Mails = ActualMail = CreateAccountMail(Which)))
return EACC_ALLOC;
}
else {
- if (nullptr == (ActualMail->Next = CreateAccountMail(Which))) {
+ if (nullptr == (ActualMail->Next = CreateAccountMail(Which)))
return EACC_ALLOC;
- }
+
ActualMail = ActualMail->Next;
}
items = nullptr;
@@ -386,7 +343,6 @@ uint32_t ReadMessagesFromMemory(CAccount *Which, char **Parser, char *End) if (Stat = ReadStringFromMemory(Parser, End, &ActualMail->ID))
#endif
return Stat;
- // ActualMail->MailData=new MAILDATA; !!! mem leake !!! this is alloc by CreateAccountMail, no need for doubble alloc !!!!
ActualMail->MailData->Size = *(uint32_t *)(*Parser);
(*Parser) += sizeof(uint32_t);
@@ -415,7 +371,7 @@ uint32_t ReadMessagesFromMemory(CAccount *Which, char **Parser, char *End) break;
#ifdef DEBUG_DECODE
- DebugLog(DecodeFile, "<read name>%s</read name>", ReadString);
+ mir_writeLogA(DecodeFile, "<read name>%s</read name>", ReadString);
#endif
if (items == nullptr)
@@ -436,14 +392,14 @@ uint32_t ReadMessagesFromMemory(CAccount *Which, char **Parser, char *End) return Stat;
items->value = ReadString;
#ifdef DEBUG_DECODE
- DebugLog(DecodeFile, "<read value>%s</read value>\n", ReadString);
+ mir_writeLogA(DecodeFile, "<read value>%s</read value>\n", ReadString);
#endif
} while (1);
}
else
break; // no next messages, new account!
- } while (1);
+ } while (true);
(*Parser)++;
return 0;
}
@@ -509,8 +465,8 @@ 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
- Which->PluginFlags = *(uint32_t *)(*Parser);
- (*Parser) += sizeof(uint32_t);
+
+ (*Parser) += sizeof(uint32_t); // PluginFlags
#ifdef DEBUG_FILEREAD
mir_snwprintf(Debug, L"PFlags: %04x, remaining %d chars", Which->PluginFlags, End - *Parser);
MessageBox(NULL, Debug, L"debug", MB_OK);
@@ -761,9 +717,11 @@ static INT_PTR PerformAccountWriting(YAMN_PROTOPLUGIN *Plugin, HANDLE File) }
CodeDecodeString(ActualAccount->Server->Passwd, FALSE);
+ uint32_t PluginFlags = 0;
+
if ((!WriteFile(File, (char *)&ActualAccount->Flags, sizeof(uint32_t), &WrittenBytes, nullptr) ||
(!WriteFile(File, (char *)&ActualAccount->StatusFlags, sizeof(uint32_t), &WrittenBytes, nullptr)) ||
- (!WriteFile(File, (char *)&ActualAccount->PluginFlags, sizeof(uint32_t), &WrittenBytes, nullptr))))
+ (!WriteFile(File, (char *)&PluginFlags, sizeof(uint32_t), &WrittenBytes, nullptr))))
throw (uint32_t)EACC_SYSTEM;
if (!WriteFile(File, (char *)&ActualAccount->Interval, sizeof(uint16_t), &WrittenBytes, nullptr))
diff --git a/protocols/YAMN/src/account.h b/protocols/YAMN/src/account.h index cadd83a1ec..afe325fcef 100644 --- a/protocols/YAMN/src/account.h +++ b/protocols/YAMN/src/account.h @@ -12,49 +12,49 @@ #include <windows.h> #include <tchar.h> - // - //================================== OTHER DEFINITIONS ======================================== - // +// +// ================================== OTHER DEFINITIONS ======================================== +// +// Error codes returned from functions (services) working with account book files enum { - // 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 - EACC_FILEVERSION, //file should be YAMN book format, but newer version that expected - EACC_FILESIZE, //file has wrong size + 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 + EACC_FILEVERSION, // file should be YAMN book format, but newer version that expected + EACC_FILESIZE, // file has wrong size }; +// Status of account +// used in messages WM_YAMN_CHANGESTATUS +// used also in function GetStatus and SetStatus 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) - ACC_FINDING, //DNS lookup for account - ACC_CONNECTING, //connecting in progress - ACC_LOGGING, //logging in progress - ACC_WORKING, //working - ACC_DISCONNECTING, //disconnecting from server + 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 + ACC_WORKING, // working + ACC_DISCONNECTING, // disconnecting from server }; -#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 +#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 { - //(1) - usable only in newmail notification + // (1) - usable only in newmail notification DWORD Flags = 0; COLORREF PopupB = 0; @@ -82,9 +82,9 @@ struct CServer char *Passwd = nullptr; }; -// -//================================== ACCOUNT DEFINITION ================================== -// +// +// ================================== ACCOUNT DEFINITION ================================== +// #define WAIT_FINISH WAIT_OBJECT_0+1 @@ -232,69 +232,64 @@ struct SWriteGuard ///////////////////////////////////////////////////////////////////////////////////////// // CAccount - basic email account class +// 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 ability 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 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_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) + struct CAccount : public MZeroedObject { - #define YAMN_ACCOUNTFILEVERSION 2 //version of standard file format (YAMN book file format) - // 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) - 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 YAMN_PROTOPLUGIN *Plugin; // free access, because this member should not be changed. The same as YAMN_PLUGIN structure - - char *Name; // 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 - 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 - 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 + // This is set to TRUE by default. When it is needed to stop working on this account, YAMN sets this to zero. + BOOL AbleToWork; - #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 + struct YAMN_PROTOPLUGIN *Plugin; // free access, because this member should not be changed. The same as YAMN_PLUGIN structure - // Plugin flags. Use this DWORD if you want YAMN to store it to YAMN book file. You can set here any value - DWORD PluginFlags; + char *Name; // access only through AccountAccessSO + CServer *Server; // access only through AccountAccessSO + WORD Interval; // access only through AccountAccessSO + DWORD Flags; // access only through AccountAccessSO + DWORD AbilityFlags; // access only through AccountAccessSO + DWORD StatusFlags; // access only through AccountAccessSO - YAMN_NOTIFICATION NewMailN; //access only through AccountAccessSO - YAMN_NOTIFICATION NoNewMailN; //access only through AccountAccessSO - YAMN_NOTIFICATION BadConnectN; //access only through AccountAccessSO + YAMN_NOTIFICATION NewMailN; // access only through AccountAccessSO + YAMN_NOTIFICATION NoNewMailN; // access only through AccountAccessSO + YAMN_NOTIFICATION BadConnectN; // access only through AccountAccessSO - SYSTEMTIME LastChecked; //last check, access only through AccountAccessSO - SYSTEMTIME LastSChecked; //last check (successfull), access only through AccountAccessSO - SYSTEMTIME LastSynchronised; //last synchronisation (successfull), access only through AccountAccessSO - SYSTEMTIME LastMail; //last check when new mail detected, access only through AccountAccessSO + SYSTEMTIME LastChecked; // last check, access only through AccountAccessSO + SYSTEMTIME LastSChecked; // last check (successfull), access only through AccountAccessSO + SYSTEMTIME LastSynchronised; // last synchronisation (successfull), access only through AccountAccessSO + SYSTEMTIME LastMail; // last check when new mail detected, access only through AccountAccessSO - TCHAR Status[255]; //access only through GetStatusFcn() and SetStatusFcn() functions + TCHAR Status[255]; // access only through GetStatusFcn() and SetStatusFcn() functions - DWORD TimeLeft; //access only through AccountAccessSO + DWORD TimeLeft; // access only through AccountAccessSO - HANDLE Mails; //access only through MessagesAccessSO + 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. @@ -322,7 +317,7 @@ struct CAccount : public MZeroedObject // Use MsgsWaitToRead(),MsgsReadDone(),MsgsWaitToWrite(),MsgsWriteDone() synchronization functions SWMRG MessagesAccessSO; - //For clist contact notification + // For clist contact notification MCONTACT hContact; BOOL isCounting; diff --git a/protocols/YAMN/src/debug.cpp b/protocols/YAMN/src/debug.cpp index 65322366ab..92d5a0b3c4 100644 --- a/protocols/YAMN/src/debug.cpp +++ b/protocols/YAMN/src/debug.cpp @@ -11,19 +11,11 @@ #ifdef _DEBUG
-//--------------------------------------------------------------------------------------------------
-//--------------------------------------------------------------------------------------------------
-
-wchar_t DebugUserDirectory[MAX_PATH] = L".";
-CRITICAL_SECTION FileAccessCS;
-
#ifdef DEBUG_COMM
-wchar_t DebugCommFileName2[]=L"%s\\yamn-debug.comm.log";
HANDLE CommFile;
#endif
#ifdef DEBUG_DECODE
-wchar_t DebugDecodeFileName2[]=L"%s\\yamn-debug.decode.log";
HANDLE DecodeFile;
#endif
@@ -32,80 +24,25 @@ HANDLE DecodeFile; void InitDebug()
{
-#if defined (DEBUG_COMM) || defined (DEBUG_DECODE)
- wchar_t DebugFileName[MAX_PATH];
-#endif
- InitializeCriticalSection(&FileAccessCS);
-
#ifdef DEBUG_COMM
- mir_snwprintf(DebugFileName, DebugCommFileName2, DebugUserDirectory);
-
- CommFile=CreateFile(DebugFileName,GENERIC_WRITE,FILE_SHARE_WRITE|FILE_SHARE_READ,NULL,CREATE_ALWAYS,0,NULL);
- DebugLog(CommFile,"Communication debug file created by %s\n",YAMN_VER);
+ CommFile = mir_createLog("YAMN_comm", L"", VARSW(L"%miranda_userdata%\\yamn-debug.comm.log"), 0);
+ mir_writeLogA(CommFile,"Communication debug file created by %s\n",YAMN_VER);
#endif
#ifdef DEBUG_DECODE
- mir_snwprintf(DebugFileName, DebugDecodeFileName2, DebugUserDirectory);
-
- DecodeFile=CreateFile(DebugFileName,GENERIC_WRITE,FILE_SHARE_WRITE|FILE_SHARE_READ,NULL,CREATE_ALWAYS,0,NULL);
- DebugLog(DecodeFile,"Decoding kernel debug file created by %s\n",YAMN_VER);
+ DecodeFile = mir_createLog("YAMN_comm", L"", VARSW(L"%miranda_userdata%\\yamn-debug.decode.log"), 0);
+ mir_writeLogA(DecodeFile, "Decoding kernel debug file created by %s\n", YAMN_VER);
#endif
}
void UnInitDebug()
{
- DeleteCriticalSection(&FileAccessCS);
#ifdef DEBUG_COMM
- DebugLog(CommFile,"File is being closed normally.");
- CloseHandle(CommFile);
+ mir_writeLogA(CommFile,"File is being closed normally.");
#endif
#ifdef DEBUG_DECODE
- DebugLog(DecodeFile,"File is being closed normally.");
- CloseHandle(DecodeFile);
+ mir_writeLogA(DecodeFile,"File is being closed normally.");
#endif
}
-
-void DebugLog(HANDLE File,const char *fmt,...)
-{
- char *str;
- char tids[32];
- va_list vararg;
- int strsize;
- DWORD Written;
-
- va_start(vararg,fmt);
- str=(char *)malloc(strsize=65536);
- mir_snprintf(tids, "[%x]",GetCurrentThreadId());
- while(mir_vsnprintf(str, strsize, fmt, vararg)==-1)
- str=(char *)realloc(str,strsize+=65536);
- va_end(vararg);
- EnterCriticalSection(&FileAccessCS);
- WriteFile(File,tids,(uint32_t)mir_strlen(tids),&Written,nullptr);
- WriteFile(File,str,(uint32_t)mir_strlen(str),&Written,nullptr);
- LeaveCriticalSection(&FileAccessCS);
- free(str);
-}
-
-void DebugLogW(HANDLE File,const wchar_t *fmt,...)
-{
- wchar_t *str;
- char tids[32];
- va_list vararg;
- int strsize;
- DWORD Written;
-
- va_start(vararg,fmt);
- str=(wchar_t *)malloc((strsize=65536)*sizeof(wchar_t));
- mir_snprintf(tids, "[%x]",GetCurrentThreadId());
- while(mir_vsnwprintf(str, strsize, fmt, vararg)==-1)
- str=(wchar_t *)realloc(str,(strsize+=65536)*sizeof(wchar_t));
- va_end(vararg);
- EnterCriticalSection(&FileAccessCS);
- WriteFile(File,tids,(uint32_t)mir_strlen(tids),&Written,nullptr);
- WriteFile(File,str,(uint32_t)mir_wstrlen(str)*sizeof(wchar_t),&Written,nullptr);
- LeaveCriticalSection(&FileAccessCS);
- free(str);
-}
-
#endif //ifdef DEBUG
\ No newline at end of file diff --git a/protocols/YAMN/src/debug.h b/protocols/YAMN/src/debug.h index e2e8e3e506..3224faf406 100644 --- a/protocols/YAMN/src/debug.h +++ b/protocols/YAMN/src/debug.h @@ -3,21 +3,12 @@ #ifdef _DEBUG
-//#define DEBUG_COMM //debug communiation to a file
-//#define DEBUG_DECODE //debug header decoding to a file
-//#define DEBUG_DECODECODEPAGE //add info about codepage used in conversion
-//#define DEBUG_DECODEBASE64 //add info about base64 result
-//#define DEBUG_DECODEQUOTED //add info about quoted printable result
-//#define DEBUG_FILEREAD //debug file reading to message boxes
-//#define DEBUG_FILEREADMESSAGES //debug file reading messages to message boxes
-
-void DebugLog(HANDLE,const char *fmt,...);
-void DebugLogW(HANDLE File,const wchar_t *fmt,...);
-
-#ifdef DEBUG_SYNCHRO
-// Used for synchronization debug
-extern HANDLE SynchroFile;
-#endif
+//#define DEBUG_COMM // debug communication to a file
+//#define DEBUG_DECODE // debug header decoding to a file
+//#define DEBUG_DECODECODEPAGE // add info about codepage used in conversion
+//#define DEBUG_DECODEQUOTED // add info about quoted printable result
+//#define DEBUG_FILEREAD // debug file reading to message boxes
+//#define DEBUG_FILEREADMESSAGES // debug file reading messages to message boxes
#ifdef DEBUG_COMM
// Used for communication debug
@@ -30,21 +21,16 @@ extern HANDLE DecodeFile; #endif
#if defined(DEBUG_FILEREAD) || defined(DEBUG_FILEREADMESSAGES)
-uint32_t ReadStringFromMemory(char **Parser,char *End,char **StoreTo,char *DebugString);
-
-uint32_t ReadStringFromMemoryW(char **Parser,wchar_t *End,char **StoreTo,wchar_t *DebugString);
-
+uint32_t ReadStringFromMemory(char **Parser, char *End, char **StoreTo, char *DebugString);
+
+uint32_t ReadStringFromMemoryW(char **Parser, wchar_t *End, char **StoreTo, wchar_t *DebugString);
+
#else
-uint32_t ReadStringFromMemory(char **Parser,char *End,char **StoreTo);
-
-uint32_t ReadStringFromMemoryW(wchar_t **Parser,wchar_t *End,wchar_t **StoreTo);
+uint32_t ReadStringFromMemory(char **Parser, char *End, char **StoreTo);
+
+uint32_t ReadStringFromMemoryW(wchar_t **Parser, wchar_t *End, wchar_t **StoreTo);
#endif
-//#ifdef DEBUG_ACCOUNTS
-//int GetAccounts();
-//void WriteAccounts();
-//#endif
-
#endif //YAMN_DEBUG
#endif //_DEBUG_H
diff --git a/protocols/YAMN/src/mails/decode.cpp b/protocols/YAMN/src/mails/decode.cpp index 8d8b9e7324..9356d12c43 100644 --- a/protocols/YAMN/src/mails/decode.cpp +++ b/protocols/YAMN/src/mails/decode.cpp @@ -188,7 +188,7 @@ int GetCharsetFromString(char *input, size_t size) *parser = 0;
#ifdef DEBUG_DECODECODEPAGE
- DebugLog(DecodeFile, "<CodePage>%s</CodePage>", pout);
+ mir_writeLogA(DecodeFile, "<CodePage>%s</CodePage>", pout);
#endif
for (int i = 0; i < CPLENALL; i++) {
@@ -239,7 +239,7 @@ int DecodeQuotedPrintable(char *Src, char *Dst, int DstLen, BOOL isQ) {
#ifdef DEBUG_DECODEQUOTED
char *DstTemp = Dst;
- DebugLog(DecodeFile, "<Decode Quoted><Input>%s</Input>", Src);
+ mir_writeLogA(DecodeFile, "<Decode Quoted><Input>%s</Input>", Src);
#endif
for (auto *Limit = Dst + DstLen; *Src != 0 && Dst < Limit; Src++) {
@@ -279,7 +279,7 @@ int DecodeQuotedPrintable(char *Src, char *Dst, int DstLen, BOOL isQ) *Dst = 0;
#ifdef DEBUG_DECODEQUOTED
- DebugLog(DecodeFile, "<Output>%s</Output></Decode Quoted>", DstTemp);
+ mir_writeLogA(DecodeFile, "<Output>%s</Output></Decode Quoted>", DstTemp);
#endif
return 1;
}
@@ -304,7 +304,7 @@ int ConvertStringToUnicode(char *stream, unsigned int cp, wchar_t **out) cp = CP_ACP;
#ifdef DEBUG_DECODECODEPAGE
- DebugLog(DecodeFile, "<CodePage #>%d</CodePage #>", cp);
+ mir_writeLogA(DecodeFile, "<CodePage #>%d</CodePage #>", cp);
#endif
for (Index = 0; Index < sizeof(CodePagesZeroFlags) / sizeof(CodePagesZeroFlags[0]); Index++)
diff --git a/protocols/YAMN/src/mails/mime.cpp b/protocols/YAMN/src/mails/mime.cpp index cc4261d236..87f863c2eb 100644 --- a/protocols/YAMN/src/mails/mime.cpp +++ b/protocols/YAMN/src/mails/mime.cpp @@ -209,55 +209,55 @@ void ExtractShortHeader(CMimeItem *items, CShortHeader *head) if (items->value == nullptr)
continue;
#ifdef DEBUG_DECODE
- DebugLog(DecodeFile, "<Extracting from>");
+ mir_writeLogA(DecodeFile, "<Extracting from>");
#endif
ExtractAddressFromLine(items->value, &head->From, &head->FromNick);
#ifdef DEBUG_DECODE
- DebugLog(DecodeFile, "</Extracting>\n");
+ mir_writeLogA(DecodeFile, "</Extracting>\n");
#endif
}
else if (0 == _strnicmp(items->name, "Return-Path", 11)) {
if (items->value == nullptr)
continue;
#ifdef DEBUG_DECODE
- DebugLog(DecodeFile, "<Extracting return-path>");
+ mir_writeLogA(DecodeFile, "<Extracting return-path>");
#endif
ExtractAddressFromLine(items->value, &head->ReturnPath, &head->ReturnPathNick);
#ifdef DEBUG_DECODE
- DebugLog(DecodeFile, "</Extracting>\n");
+ mir_writeLogA(DecodeFile, "</Extracting>\n");
#endif
}
else if (0 == _strnicmp(items->name, "Subject", 7)) {
if (items->value == nullptr)
continue;
#ifdef DEBUG_DECODE
- DebugLog(DecodeFile, "<Extracting subject>");
+ mir_writeLogA(DecodeFile, "<Extracting subject>");
#endif
ExtractStringFromLine(items->value, &head->Subject);
#ifdef DEBUG_DECODE
- DebugLog(DecodeFile, "</Extracting>\n");
+ mir_writeLogA(DecodeFile, "</Extracting>\n");
#endif
}
else if (0 == _strnicmp(items->name, "Body", 4)) {
if (items->value == nullptr)
continue;
#ifdef DEBUG_DECODE
- DebugLog(DecodeFile, "<Extracting body>");
+ mir_writeLogA(DecodeFile, "<Extracting body>");
#endif
ExtractStringFromLine(items->value, &head->Body);
#ifdef DEBUG_DECODE
- DebugLog(DecodeFile, "</Extracting>\n");
+ mir_writeLogA(DecodeFile, "</Extracting>\n");
#endif
}
else if (0 == _strnicmp(items->name, "Date", 4)) {
if (items->value == nullptr)
continue;
#ifdef DEBUG_DECODE
- DebugLog(DecodeFile, "<Extracting date>");
+ mir_writeLogA(DecodeFile, "<Extracting date>");
#endif
ExtractStringFromLine(items->value, &head->Date);
#ifdef DEBUG_DECODE
- DebugLog(DecodeFile, "</Extracting>\n");
+ mir_writeLogA(DecodeFile, "</Extracting>\n");
#endif
}
else if (0 == _strnicmp(items->name, "Content-Type", 12)) {
@@ -266,11 +266,11 @@ void ExtractShortHeader(CMimeItem *items, CShortHeader *head) char *ContentType = nullptr, *CharSetStr;
#ifdef DEBUG_DECODE
- DebugLog(DecodeFile, "<Extracting Content-Type>");
+ mir_writeLogA(DecodeFile, "<Extracting Content-Type>");
#endif
ExtractStringFromLine(items->value, &ContentType);
#ifdef DEBUG_DECODE
- DebugLog(DecodeFile, "</Extracting>\n");
+ mir_writeLogA(DecodeFile, "</Extracting>\n");
#endif
ToLower(ContentType);
if (nullptr != (CharSetStr = ExtractFromContentType(ContentType, "charset="))) {
@@ -283,7 +283,7 @@ void ExtractShortHeader(CMimeItem *items, CShortHeader *head) if (items->value == nullptr)
continue;
#ifdef DEBUG_DECODE
- DebugLog(DecodeFile, "<Extracting importance>");
+ mir_writeLogA(DecodeFile, "<Extracting importance>");
#endif
if (head->Priority != -1) {
if (0 == strncmp(items->value, "low", 3))
@@ -294,19 +294,19 @@ void ExtractShortHeader(CMimeItem *items, CShortHeader *head) head->Priority = 1;
}
#ifdef DEBUG_DECODE
- DebugLog(DecodeFile, "</Extracting>\n");
+ mir_writeLogA(DecodeFile, "</Extracting>\n");
#endif
}
else if (0 == _strnicmp(items->name, "X-Priority", 10)) {
if (items->value == nullptr)
continue;
#ifdef DEBUG_DECODE
- DebugLog(DecodeFile, "<X-Priority>");
+ mir_writeLogA(DecodeFile, "<X-Priority>");
#endif
if ((*items->value >= '1') && (*items->value <= '5'))
head->Priority = *items->value - '0';
#ifdef DEBUG_DECODE
- DebugLog(DecodeFile, "</Extracting>\n");
+ mir_writeLogA(DecodeFile, "</Extracting>\n");
#endif
}
@@ -387,7 +387,7 @@ void ExtractHeader(CMimeItem *items, int &CP, CHeader *head) CShortHeader ShortHeader = {};
ShortHeader.Priority = ShortHeader.CP = -1;
#ifdef DEBUG_DECODE
- DebugLog(DecodeFile, "<Extracting header>\n");
+ mir_writeLogA(DecodeFile, "<Extracting header>\n");
#endif
ExtractShortHeader(items, &ShortHeader);
@@ -395,61 +395,61 @@ void ExtractHeader(CMimeItem *items, int &CP, CHeader *head) CP = ShortHeader.CP == -1 ? CP : ShortHeader.CP;
#ifdef DEBUG_DECODE
if (NULL != ShortHeader.From)
- DebugLog(DecodeFile, "<Decoded from>%s</Decoded)\n", ShortHeader.From);
+ mir_writeLogA(DecodeFile, "<Decoded from>%s</Decoded)\n", ShortHeader.From);
if (NULL != ShortHeader.FromNick)
- DebugLog(DecodeFile, "<Decoded from-nick>%s</Decoded)\n", ShortHeader.FromNick);
+ mir_writeLogA(DecodeFile, "<Decoded from-nick>%s</Decoded)\n", ShortHeader.FromNick);
if (NULL != ShortHeader.ReturnPath)
- DebugLog(DecodeFile, "<Decoded return-path>%s</Decoded)\n", ShortHeader.ReturnPath);
+ mir_writeLogA(DecodeFile, "<Decoded return-path>%s</Decoded)\n", ShortHeader.ReturnPath);
if (NULL != ShortHeader.ReturnPathNick)
- DebugLog(DecodeFile, "<Decoded return-path nick>%s</Decoded)\n", ShortHeader.ReturnPathNick);
+ mir_writeLogA(DecodeFile, "<Decoded return-path nick>%s</Decoded)\n", ShortHeader.ReturnPathNick);
if (NULL != ShortHeader.Subject)
- DebugLog(DecodeFile, "<Decoded subject>%s</Decoded)\n", ShortHeader.Subject);
+ mir_writeLogA(DecodeFile, "<Decoded subject>%s</Decoded)\n", ShortHeader.Subject);
if (NULL != ShortHeader.Date)
- DebugLog(DecodeFile, "<Decoded date>%s</Decoded)\n", ShortHeader.Date);
- DebugLog(DecodeFile, "</Extracting header>\n");
- DebugLog(DecodeFile, "<Convert>\n");
+ mir_writeLogA(DecodeFile, "<Decoded date>%s</Decoded)\n", ShortHeader.Date);
+ mir_writeLogA(DecodeFile, "</Extracting header>\n");
+ mir_writeLogA(DecodeFile, "<Convert>\n");
#endif
head->wszFrom = ConvertCodedStringToUnicode(ShortHeader.From, CP, MIME_PLAIN);
#ifdef DEBUG_DECODE
if (NULL != head->From)
- DebugLogW(DecodeFile, L"<Converted from>%s</Converted>\n", head->From);
+ mir_writeLogW(DecodeFile, L"<Converted from>%s</Converted>\n", head->From);
#endif
head->wszFromNick = ConvertCodedStringToUnicode(ShortHeader.FromNick, CP, MIME_MAIL);
#ifdef DEBUG_DECODE
if (NULL != head->FromNick)
- DebugLogW(DecodeFile, L"<Converted from-nick>%s</Converted>\n", head->FromNick);
+ mir_writeLogW(DecodeFile, L"<Converted from-nick>%s</Converted>\n", head->FromNick);
#endif
head->wszReturnPath = ConvertCodedStringToUnicode(ShortHeader.ReturnPath, CP, MIME_PLAIN);
#ifdef DEBUG_DECODE
if (NULL != head->ReturnPath)
- DebugLogW(DecodeFile, L"<Converted return-path>%s</Converted>\n", head->ReturnPath);
+ mir_writeLogW(DecodeFile, L"<Converted return-path>%s</Converted>\n", head->ReturnPath);
#endif
head->wszReturnPathNick = ConvertCodedStringToUnicode(ShortHeader.ReturnPathNick, CP, MIME_MAIL);
#ifdef DEBUG_DECODE
if (NULL != head->ReturnPathNick)
- DebugLogW(DecodeFile, L"<Converted return-path nick>%s</Converted>\n", head->ReturnPathNick);
+ mir_writeLogW(DecodeFile, L"<Converted return-path nick>%s</Converted>\n", head->ReturnPathNick);
#endif
head->wszSubject = ConvertCodedStringToUnicode(ShortHeader.Subject, CP, MIME_PLAIN);
#ifdef DEBUG_DECODE
if (NULL != head->Subject)
- DebugLogW(DecodeFile, L"<Converted subject>%s</Converted>\n", head->Subject);
+ mir_writeLogW(DecodeFile, L"<Converted subject>%s</Converted>\n", head->Subject);
#endif
head->wszDate = ConvertCodedStringToUnicode(ShortHeader.Date, CP, MIME_PLAIN);
#ifdef DEBUG_DECODE
if (NULL != head->Date)
- DebugLogW(DecodeFile, L"<Converted date>%s</Converted>\n", head->Date);
+ mir_writeLogW(DecodeFile, L"<Converted date>%s</Converted>\n", head->Date);
#endif
head->wszBody = ConvertCodedStringToUnicode(ShortHeader.Body, CP, MIME_PLAIN);
#ifdef DEBUG_DECODE
if (NULL != head->Body)
- DebugLogW(DecodeFile, L"<Converted Body>%s</Converted>\n", head->Body);
+ mir_writeLogW(DecodeFile, L"<Converted Body>%s</Converted>\n", head->Body);
#endif
#ifdef DEBUG_DECODE
- DebugLog(DecodeFile, "</Convert>\n");
+ mir_writeLogA(DecodeFile, "</Convert>\n");
#endif
DeleteShortHeaderContent(&ShortHeader);
diff --git a/protocols/YAMN/src/proto/netlib.cpp b/protocols/YAMN/src/proto/netlib.cpp index 21c1f771fa..4354b6e9be 100644 --- a/protocols/YAMN/src/proto/netlib.cpp +++ b/protocols/YAMN/src/proto/netlib.cpp @@ -33,7 +33,7 @@ void __stdcall SSL_DebugLog(const char *fmt, ...) HANDLE RegisterNLClient(char *name)
{
#ifdef DEBUG_COMM
- DebugLog(CommFile, "<Register PROXY support>");
+ mir_writeLogA(CommFile, "<Register PROXY support>");
#endif
NETLIBUSER nlu = {};
@@ -44,9 +44,9 @@ HANDLE RegisterNLClient(char *name) #ifdef DEBUG_COMM
if (NULL == hNetlibUser)
- DebugLog(CommFile, "<error></Register PROXY support>\n");
+ mir_writeLogA(CommFile, "<error></Register PROXY support>\n");
else
- DebugLog(CommFile, "</Register PROXY support>\n");
+ mir_writeLogA(CommFile, "</Register PROXY support>\n");
#endif
return hNetlibUser;
}
@@ -84,7 +84,7 @@ void CNLClient::Connect(const char *servername, const int port) isTLSed = false;
#ifdef DEBUG_COMM
- DebugLog(CommFile, "<connect>\n");
+ mir_writeLogA(CommFile, "<connect>\n");
#endif
try {
if (nullptr == (hConnection = Netlib_OpenConnection(hNetlibUser, servername, port))) {
@@ -92,13 +92,13 @@ void CNLClient::Connect(const char *servername, const int port) throw NetworkError = (uint32_t)ENL_CONNECT;
}
#ifdef DEBUG_COMM
- DebugLog(CommFile, "</connect>\n");
+ mir_writeLogA(CommFile, "</connect>\n");
#endif
return;
}
catch (...) {
#ifdef DEBUG_COMM
- DebugLog(CommFile, "<error></connect>\n");
+ mir_writeLogA(CommFile, "<error></connect>\n");
#endif
throw;
}
@@ -120,7 +120,7 @@ void CNLClient::Send(const char *query) if (hConnection == nullptr)
return;
#ifdef DEBUG_COMM
- DebugLog(CommFile, "<send>%s", query);
+ mir_writeLogA(CommFile, "<send>%s", query);
#endif
try {
if ((SOCKET_ERROR == (Sent = LocalNetlib_Send(hConnection, query, (int)mir_strlen(query), MSG_DUMPASTEXT))) || Sent != (unsigned int)mir_strlen(query)) {
@@ -128,12 +128,12 @@ void CNLClient::Send(const char *query) throw NetworkError = (uint32_t)ENL_SEND;
}
#ifdef DEBUG_COMM
- DebugLog(CommFile, "</send>\n");
+ mir_writeLogA(CommFile, "</send>\n");
#endif
}
catch (...) {
#ifdef DEBUG_COMM
- DebugLog(CommFile, "<error></send>\n");
+ mir_writeLogA(CommFile, "<error></send>\n");
#endif
throw;
}
@@ -161,7 +161,7 @@ int CNLClient::LocalNetlib_Recv(HNETLIBCONN hConn, char *buf, int len, int flags char *CNLClient::Recv(char *buf, int buflen)
{
#ifdef DEBUG_COMM
- DebugLog(CommFile, "<reading>");
+ mir_writeLogA(CommFile, "<reading>");
#endif
try {
if (buf == nullptr)
@@ -197,14 +197,14 @@ char *CNLClient::Recv(char *buf, int buflen) }
#ifdef DEBUG_COMM
*(buf + Rcv) = 0; //end the buffer to write it to file
- DebugLog(CommFile, "%s", buf);
- DebugLog(CommFile, "</reading>\n");
+ mir_writeLogA(CommFile, "%s", buf);
+ mir_writeLogA(CommFile, "</reading>\n");
#endif
return(buf);
}
catch (...) {
#ifdef DEBUG_COMM
- DebugLog(CommFile, "<error></reading>\n");
+ mir_writeLogA(CommFile, "<error></reading>\n");
#endif
throw;
}
@@ -221,12 +221,12 @@ void CNLClient::Disconnect() void UnregisterNLClient()
{
#ifdef DEBUG_COMM
- DebugLog(CommFile, "<Unregister PROXY support>");
+ mir_writeLogA(CommFile, "<Unregister PROXY support>");
#endif
Netlib_CloseHandle(hNetlibUser);
hNetlibUser = nullptr;
#ifdef DEBUG_COMM
- DebugLog(CommFile, "</Unregister PROXY support>\n");
+ mir_writeLogA(CommFile, "</Unregister PROXY support>\n");
#endif
}
diff --git a/protocols/YAMN/src/proto/pop3/pop3.cpp b/protocols/YAMN/src/proto/pop3/pop3.cpp index 8d24a5218c..31bb24314f 100644 --- a/protocols/YAMN/src/proto/pop3/pop3.cpp +++ b/protocols/YAMN/src/proto/pop3/pop3.cpp @@ -41,7 +41,7 @@ char *CPop3Client::Connect(const char *servername, const int port, BOOL UseSSL, NetClient = new CNLClient;
#ifdef DEBUG_DECODE
- DebugLog(DecodeFile, "Connect:servername: %s port:%d\n", servername, port);
+ mir_writeLogA(DecodeFile, "Connect:servername: %s port:%d\n", servername, port);
#endif
POP3Error = EPOP3_CONNECT;
NetClient->Connect(servername, port);
diff --git a/protocols/YAMN/src/proto/pop3/pop3comm.cpp b/protocols/YAMN/src/proto/pop3/pop3comm.cpp index c734847ff5..89c5c4e359 100644 --- a/protocols/YAMN/src/proto/pop3/pop3comm.cpp +++ b/protocols/YAMN/src/proto/pop3/pop3comm.cpp @@ -583,7 +583,7 @@ void MIR_CDECL SynchroPOP3(CheckParam *WhichTemp) TranslateHeaderFcn(Temp, MyClient->NetClient->Rcv - (Temp - DataRX), &MsgQueuePtr->MailData->TranslatedHeader);
#ifdef DEBUG_DECODE
- DebugLog(DecodeFile, "</New mail>\n");
+ mir_writeLogA(DecodeFile, "</New mail>\n");
#endif
MsgQueuePtr->Flags |= YAMN_MSG_NORMALNEW;
if (autoretr)
@@ -655,7 +655,7 @@ void MIR_CDECL SynchroPOP3(CheckParam *WhichTemp) if (ActualAccount->Client.POP3Error == EPOP3_STOPPED)
ActualAccount->SystemError = EACC_STOPPED;
#ifdef DEBUG_COMM
- DebugLog(CommFile, "ERROR: %x\n", ErrorCode);
+ mir_writeLogA(CommFile, "ERROR: %x\n", ErrorCode);
#endif
{
SWriteGuard swm(ActualAccount->MessagesAccessSO);
@@ -684,7 +684,7 @@ void MIR_CDECL SynchroPOP3(CheckParam *WhichTemp) }
#ifdef DEBUG_COMM
- DebugLog(CommFile, "</--------Communication-------->\n");
+ mir_writeLogA(CommFile, "</--------Communication-------->\n");
#endif
}
@@ -743,7 +743,7 @@ void __cdecl DeleteMailsPOP3(void *param) try {
SetContactStatus(ActualAccount, ID_STATUS_OCCUPIED);
#ifdef DEBUG_COMM
- DebugLog(CommFile, "<--------Communication-------->\n");
+ mir_writeLogA(CommFile, "<--------Communication-------->\n");
#endif
if ((MyClient->NetClient == nullptr) || !MyClient->NetClient->Connected()) {
SetStatusFcn(ActualAccount, TranslateT("Connecting to server"));
@@ -787,7 +787,7 @@ void __cdecl DeleteMailsPOP3(void *param) }
#ifdef DEBUG_DECODE
- DebugLog(DecodeFile, "<--------Deleting requested mails-------->\n");
+ mir_writeLogA(DecodeFile, "<--------Deleting requested mails-------->\n");
#endif
if (POP3_DELETEFROMCHECK != POP3PluginParam) // We do not need to get mails on server as we have already it from check function
{
@@ -796,13 +796,13 @@ void __cdecl DeleteMailsPOP3(void *param) char *DataRX = MyClient->Stat();
#ifdef DEBUG_DECODE
- DebugLog(DecodeFile, "<Extracting stat>\n");
+ mir_writeLogA(DecodeFile, "<Extracting stat>\n");
#endif
ExtractStat(DataRX, &mboxsize, &msgs);
#ifdef DEBUG_DECODE
- DebugLog(DecodeFile, "<MailBoxSize>%d</MailBoxSize>\n", mboxsize);
- DebugLog(DecodeFile, "<Msgs>%d</Msgs>\n", msgs);
- DebugLog(DecodeFile, "</Extracting stat>\n");
+ mir_writeLogA(DecodeFile, "<MailBoxSize>%d</MailBoxSize>\n", mboxsize);
+ mir_writeLogA(DecodeFile, "<Msgs>%d</Msgs>\n", msgs);
+ mir_writeLogA(DecodeFile, "</Extracting stat>\n");
#endif
if (DataRX != nullptr)
free(DataRX);
@@ -822,12 +822,12 @@ void __cdecl DeleteMailsPOP3(void *param) if (msgs) {
#ifdef DEBUG_DECODE
- DebugLog(DecodeFile, "<Extracting UIDL>\n");
+ mir_writeLogA(DecodeFile, "<Extracting UIDL>\n");
#endif
DataRX = MyClient->Uidl();
ExtractUIDL(DataRX, MyClient->NetClient->Rcv, NewMails);
#ifdef DEBUG_DECODE
- DebugLog(DecodeFile, "</Extracting UIDL>\n");
+ mir_writeLogA(DecodeFile, "</Extracting UIDL>\n");
#endif
if (DataRX != nullptr)
free(DataRX);
@@ -894,7 +894,7 @@ void __cdecl DeleteMailsPOP3(void *param) }
#ifdef DEBUG_DECODE
- DebugLog(DecodeFile, "</--------Deleting requested mails-------->\n");
+ mir_writeLogA(DecodeFile, "</--------Deleting requested mails-------->\n");
#endif
// TODO: now, we have in NewMails new mails. If NewMails is not NULL, we found some new mails, so Checking for new mail should be performed
@@ -931,7 +931,7 @@ void __cdecl DeleteMailsPOP3(void *param) if (ActualAccount->Client.POP3Error == EPOP3_STOPPED)
ActualAccount->SystemError = EACC_STOPPED;
#ifdef DEBUG_COMM
- DebugLog(CommFile, "ERROR %x\n", ErrorCode);
+ mir_writeLogA(CommFile, "ERROR %x\n", ErrorCode);
#endif
switch (ActualAccount->SystemError) {
@@ -951,7 +951,7 @@ void __cdecl DeleteMailsPOP3(void *param) DeleteMessagesToEndFcn(ActualAccount, DeleteMails);
#ifdef DEBUG_COMM
- DebugLog(CommFile, "</--------Communication-------->\n");
+ mir_writeLogA(CommFile, "</--------Communication-------->\n");
#endif
// WriteAccounts();
@@ -989,14 +989,14 @@ void ExtractMail(char *stream, int len, HYAMNMAIL queue) if (DOTLINE(finder + 1)) // at the end of stream
break;
#ifdef DEBUG_DECODE
- DebugLog(DecodeFile, "<Message>\n");
+ mir_writeLogA(DecodeFile, "<Message>\n");
#endif
SkipSpaces(finder); // jump whitespace
if (1 != sscanf(finder, "%d", &msgnr))
throw (uint32_t)EPOP3_UIDL;
#ifdef DEBUG_DECODE
- DebugLog(DecodeFile, "<Nr>%d</Nr>\n", msgnr);
+ mir_writeLogA(DecodeFile, "<Nr>%d</Nr>\n", msgnr);
#endif
SkipNonSpaces(finder);
@@ -1009,8 +1009,8 @@ void ExtractMail(char *stream, int len, HYAMNMAIL queue) queueptr->MailData->Body[i] = 0; // ends string
queueptr->Number = msgnr;
#ifdef DEBUG_DECODE
- DebugLog(DecodeFile, "<ID>%s</ID>\n", queueptr->MailData->Body);
- DebugLog(DecodeFile, "</Message>\n");
+ mir_writeLogA(DecodeFile, "<ID>%s</ID>\n", queueptr->MailData->Body);
+ mir_writeLogA(DecodeFile, "</Message>\n");
#endif
queueptr = queueptr->Next;
while (!ENDLINE(finder)) finder++;
@@ -1032,13 +1032,13 @@ void ExtractUIDL(char *stream, int len, HYAMNMAIL queue) if (DOTLINE(finder + 1)) // at the end of stream
break;
#ifdef DEBUG_DECODE
- DebugLog(DecodeFile, "<Message>\n");
+ mir_writeLogA(DecodeFile, "<Message>\n");
#endif
SkipSpaces(finder);
if (1 != sscanf(finder, "%d", &msgnr))
throw (uint32_t)EPOP3_UIDL;
#ifdef DEBUG_DECODE
- DebugLog(DecodeFile, "<Nr>%d</Nr>\n", msgnr);
+ mir_writeLogA(DecodeFile, "<Nr>%d</Nr>\n", msgnr);
#endif
// for (i=1,queueptr=queue;(queueptr->Next != NULL) && (i<msgnr);queueptr=queueptr->Next,i++);
// if (i != msgnr)
@@ -1053,8 +1053,8 @@ void ExtractUIDL(char *stream, int len, HYAMNMAIL queue) queueptr->ID[i] = 0; // ends string
queueptr->Number = msgnr;
#ifdef DEBUG_DECODE
- DebugLog(DecodeFile, "<ID>%s</ID>\n", queueptr->ID);
- DebugLog(DecodeFile, "</Message>\n");
+ mir_writeLogA(DecodeFile, "<ID>%s</ID>\n", queueptr->ID);
+ mir_writeLogA(DecodeFile, "</Message>\n");
#endif
queueptr = queueptr->Next;
while (!ENDLINE(finder)) finder++;
@@ -1076,13 +1076,13 @@ void ExtractList(char *stream, int len, HYAMNMAIL queue) if (DOTLINE(finder + 1)) // at the end of stream
break;
#ifdef DEBUG_DECODE
- DebugLog(DecodeFile, "<Message>\n", NULL, 0);
+ mir_writeLogA(DecodeFile, "<Message>\n", NULL, 0);
#endif
SkipSpaces(finder);
if (1 != sscanf(finder, "%d", &msgnr)) // message nr.
throw (uint32_t)EPOP3_LIST;
#ifdef DEBUG_DECODE
- DebugLog(DecodeFile, "<Nr>%d</Nr>\n", msgnr);
+ mir_writeLogA(DecodeFile, "<Nr>%d</Nr>\n", msgnr);
#endif
for (i = 1, queueptr = queue; (queueptr->Next != nullptr) && (i < msgnr); queueptr = queueptr->Next, i++);
@@ -1095,7 +1095,7 @@ void ExtractList(char *stream, int len, HYAMNMAIL queue) if (1 != sscanf(finder, "%u", &queueptr->MailData->Size))
throw (uint32_t)EPOP3_LIST;
#ifdef DEBUG_DECODE
- DebugLog(DecodeFile, "<Nr>%d</Nr>\n", queueptr->MailData->Size);
+ mir_writeLogA(DecodeFile, "<Nr>%d</Nr>\n", queueptr->MailData->Size);
#endif
while (!ENDLINE(finder)) finder++;
}
|