summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-05-26 21:22:43 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-05-26 21:22:43 +0000
commitc5bc8f21d5b87482f737c5ca64a4d46ebe7a2497 (patch)
treec13b62a3f1224750108aa33919ef6f9a32a2767d
parent17f839d0a607c05ae390d6306d81ecea19c7ea45 (diff)
YAMN became partially Unicode
git-svn-id: http://svn.miranda-ng.org/main/trunk@186 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--plugins/YAMN/YAMN_10.vcxproj6
-rw-r--r--plugins/YAMN/account.cpp588
-rw-r--r--plugins/YAMN/browser/badconnect.cpp109
-rw-r--r--plugins/YAMN/browser/mailbrowser.cpp585
-rw-r--r--plugins/YAMN/debug.cpp13
-rw-r--r--plugins/YAMN/debug.h11
-rw-r--r--plugins/YAMN/filterplugin.cpp68
-rw-r--r--plugins/YAMN/mails/decode.cpp362
-rw-r--r--plugins/YAMN/mails/mails.cpp112
-rw-r--r--plugins/YAMN/mails/mime.cpp180
-rw-r--r--plugins/YAMN/main.cpp210
-rw-r--r--plugins/YAMN/proto/netlib.cpp31
-rw-r--r--plugins/YAMN/proto/pop3/pop3.cpp126
-rw-r--r--plugins/YAMN/proto/pop3/pop3.h2
-rw-r--r--plugins/YAMN/proto/pop3/pop3comm.cpp365
-rw-r--r--plugins/YAMN/proto/pop3/pop3opt.cpp788
-rw-r--r--plugins/YAMN/proto/pop3/pop3opt.h16
-rw-r--r--plugins/YAMN/protoplugin.cpp92
-rw-r--r--plugins/YAMN/services.cpp95
-rw-r--r--plugins/YAMN/synchro.cpp59
-rw-r--r--plugins/YAMN/yamn.cpp164
-rw-r--r--plugins/YAMN/yamn.h121
22 files changed, 1803 insertions, 2300 deletions
diff --git a/plugins/YAMN/YAMN_10.vcxproj b/plugins/YAMN/YAMN_10.vcxproj
index 8e6d249b0c..c244050217 100644
--- a/plugins/YAMN/YAMN_10.vcxproj
+++ b/plugins/YAMN/YAMN_10.vcxproj
@@ -33,7 +33,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
- <CharacterSet>MultiByte</CharacterSet>
+ <CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
@@ -100,7 +100,7 @@
<AdditionalIncludeDirectories>../../include;../ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_WINDOWS;_USRDLL;_DEBUG;YAMN_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<StructMemberAlignment>4Bytes</StructMemberAlignment>
<AssemblerListingLocation>
</AssemblerListingLocation>
@@ -193,7 +193,7 @@
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;YAMN_DEBUG;WIN9X;YAMN_VER_BETA;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<BrowseInformation>true</BrowseInformation>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
diff --git a/plugins/YAMN/account.cpp b/plugins/YAMN/account.cpp
index bc52aa0371..532640c15b 100644
--- a/plugins/YAMN/account.cpp
+++ b/plugins/YAMN/account.cpp
@@ -12,187 +12,14 @@
#include <stdio.h>
#endif
-//- imported ---------------------------------------------------------------------------------------
-//--------------------------------------------------------------------------------------------------
-
-extern PSWMRG PluginBrowserSO;
-extern TCHAR AccountFileName[];
-extern TCHAR *CurDir;
-extern PLUGININFO pluginInfo;
-extern YAMN_VARIABLES YAMNVar;
-
-extern BOOL WINAPI SWMRGInitialize(PSWMRG pSWMRG,TCHAR *Name);
-extern void WINAPI SWMRGDelete(PSWMRG pSWMRG);
-extern DWORD WINAPI SWMRGWaitToWrite(PSWMRG pSWMRG,DWORD dwTimeout);
-extern void WINAPI SWMRGDoneWriting(PSWMRG pSWMRG);
-extern DWORD WINAPI SWMRGWaitToRead(PSWMRG pSWMRG, DWORD dwTimeout);
-extern void WINAPI SWMRGDoneReading(PSWMRG pSWMRG);
-extern DWORD WINAPI WaitToReadFcn(PSWMRG SObject);
-extern void WINAPI ReadDoneFcn(PSWMRG SObject);
-extern HYAMNPROTOPLUGIN FindPlugin(DWORD PluginID);
-
-extern void WINAPI DeleteMessagesToEndFcn(HACCOUNT Account,HYAMNMAIL From);
-
-//--------------------------------------------------------------------------------------------------
-//--------------------------------------------------------------------------------------------------
-
-// SMALL INTRO
-// Accounts are queued in a queue (chained list). Pointer to first account is called "FirstAccount"
-// Account queue is ended with NULL- pointered account (NULL handle)
-// FirstAccount has every plugin in its own YAMN_PLUGIN structure
-
//Account status CS
//When we check some account, thread should change status of account to idle, connecting etc.
//So if we want to read status, we have to successfully write and then read.
-LPCRITICAL_SECTION AccountStatusCS;
+CRITICAL_SECTION AccountStatusCS;
//File Writing CS
//When 2 threads want to write to file...
-LPCRITICAL_SECTION FileWritingCS;
-
-// Creates new account, which has plugin specified structure
-INT_PTR CreatePluginAccountSvc(WPARAM wParam,LPARAM lParam);
-
-// Deletes account from memory
-INT_PTR DeletePluginAccountSvc(WPARAM wParam,LPARAM);
-
-// Initializes standard YAMN account parameters
-int InitAccount(HACCOUNT Which);
-
-// Deinitializes (deletes) standard YAMN account parameters
-void DeInitAccount(HACCOUNT Which);
-
-// Sends signal (sets event) in AccountAccessSO and MessagesAccessSO
-// This event makes that all calls to ...WaitToRead or ...WaitToWrite are returned to WAIT_FAILED
-void StopSignalFcn(HACCOUNT Which);
-
-// Function used to encrypt password (codes / decodes string)
-// There's a problem when a character is going to be encrypted to (TCHAR)0, (end of string)
-// Dest- input and output string (input/output length of string is 1:1)
-// Encrypt- TRUE for encryption, FALSE for decryption
-void CodeDecodeString(TCHAR *Dest,BOOL Encrypt);
-
-// Only do the main work for FileToMemoryX functions. FileToMemoryX only opens file.
-static DWORD PostFileToMemory(HANDLE File,TCHAR **MemFile,TCHAR **End);
-
-// Reads the file and stores the content to allocated memory
-// FileName- name of file
-// MemFile- pointer to the pointer of TCHAR, new allocated memory by this function
-// End- where new allocated memory filled with file contents ends
-DWORD FileToMemoryA(char *FileName,TCHAR **MemFile,TCHAR **End);
-
-// Same as FileToMemoryA, but Unicode filename
-DWORD FileToMemoryW(char *FileName,TCHAR **MemFile,TCHAR **End);
-
-// Reads string that ends with character 0 and copies it to new allocated memory
-// Parser-pointer to memory with string
-// function sets this parameter to point at the next char after read string
-// End-information how long this string can be (in pointer to last possible char)
-// StoreTo-function allocates memory and copies the string, allocated memory returned in StoreTo
-// DebugString-the debug message showed in debug version
-#if defined(DEBUG_FILEREAD) || defined(DEBUG_FILEREADMESSAGES)
-DWORD ReadStringFromMemory(TCHAR **Parser,TCHAR *End,TCHAR **StoreTo,TCHAR *DebugString);
-#endif
-DWORD ReadStringFromMemory(TCHAR **Parser,TCHAR *End,TCHAR **StoreTo);
-#ifndef UNICODE
- #if defined(DEBUG_FILEREAD) || defined(DEBUG_FILEREADMESSAGES)
-DWORD ReadStringFromMemoryW(WCHAR **Parser,TCHAR *End,WCHAR **StoreTo,WCHAR *DebugString);
- #endif //if defined(DEBUG...)
-DWORD ReadStringFromMemoryW(WCHAR **Parser,TCHAR *End,WCHAR **StoreTo);
-#endif //ifdef Unicode
-
-// Reads notification parameters from memory
-// Parser-pointer to memory with string
-// function sets this parameter to point at the next char after read string
-// End-information how long this string can be (in pointer to last possible char)
-// Which-pointer to notification structure to fill with read parameters
-static DWORD ReadNotificationFromMemory(TCHAR **Parser,TCHAR *End,YAMN_NOTIFICATION *Which);
-
-// Reads messages from memory
-// Which- address of account that mails (messages) belong to
-// Parser- pointer to data from memory, function changes it to the next char after messages read
-// End- the last possible char of messages
-DWORD ReadMessagesFromMemory(HACCOUNT Which,TCHAR **Parser,TCHAR *End);
-
-// Does all needed operations to read account
-static INT_PTR PerformAccountReading(HYAMNPROTOPLUGIN Plugin,TCHAR *MemFile,TCHAR *End);
-
-// Read one account from memory
-// Which- address of account
-// Parser- pointer to data from memory, function changes it to the next char after account read
-// End- the last possible char of account
-DWORD ReadAccountFromMemory(HACCOUNT Which,TCHAR **Parser,TCHAR *End);
-
-// Inserts accounts read from file to actual account queue
-INT_PTR AddAccountsFromFileASvc(WPARAM wParam,LPARAM lParam);
-
-// Same as AddAccountsFromFileA, but filename is (WCHAR *) type- Unicode string
-INT_PTR AddAccountsFromFileWSvc(WPARAM,LPARAM);
-
-// Writes simple string to file
-// File- handle of open file for writing
-// Source- string to write, ended with zero character
-DWORD WriteStringToFile(HANDLE File,TCHAR *Source);
-#ifndef UNICODE
-DWORD WriteStringToFileW(HANDLE File,WCHAR *Source);
-#else
-#define ReadStringFromMemoryW ReadStringFromMemory
-#endif
-
-// Writes mails to file
-// File- handle of file
-// Which- address of account that mails belong to
-DWORD WriteMessagesToFile(HANDLE File,HACCOUNT Which);
-
-// Does all needed operations to write account to file
-static INT_PTR PerformAccountWriting(HYAMNPROTOPLUGIN Plugin,HANDLE File);
-
-// Writes accounts to file
-// Accounts are read from plugin's account queue
-// Function writes account data and calls WriteMessagesToFile to store account mails
-INT_PTR WriteAccountsToFileASvc(WPARAM wParam,LPARAM lParam);
-
-// Same as WriteAccountsToFileA, but filename is (WCHAR *) type- Unicode string
-INT_PTR WriteAccountsToFileWSvc(WPARAM wParam,LPARAM lParam);
-
-// Finds account by name and returns a pointer to it, or NULL when not found
-// we do not have to synchronize accounts for read access, because we never change name of account
-// (so if we want to change name of account we have to delete and create the new one)
-INT_PTR FindAccountByNameSvc(WPARAM wParam,LPARAM lParam);
-
-// Allocates a new account, and returns pointer to it
-// calling function should have write access (using AccountBrowserSO)
-// because new account is queues do account queue
-INT_PTR GetNextFreeAccountSvc(WPARAM wParam,LPARAM lParam);
-
-// Finds account for plugin
-//int FindPluginAccount(WPARAM wParam,LPARAM lParam);
-
-// Removes requested account from queue
-// and deletes it in memory calling new thread function, that does it in the background
-// This is very easy and the most secure way for plugins to delete account
-INT_PTR DeleteAccountSvc(WPARAM wParam,LPARAM);
-
-// This function is used as a thread function, that waits to signal for deleting account from memory
-// This signal is signaled in UsingAccount.Event (this signales that no thread will be use account in the future)
-DWORD WINAPI DeleteAccountInBackground(LPVOID Which);
-
-// Sends signal that all works with Plugin accounts should be stopped and accounts should not be used anymore.
-int StopAccounts(HYAMNPROTOPLUGIN Plugin);
-
-// Wait for accounts to finish its work
-int WaitForAllAccounts(HYAMNPROTOPLUGIN Plugin,BOOL GetAccountBrowserAccess=FALSE);
-
-// Deletes protocol accounts using protocol defined delete function.
-int DeleteAccounts(HYAMNPROTOPLUGIN Plugin);
-
-// If you want to get directly account status, call this function
-// You don't have to be in read-access to account and you can call this to retrieve status
-void WINAPI GetStatusFcn(HACCOUNT Which,char *Value);
-
-// If you want to set directly account status, call this function
-// You don't have to be in write-access to account and you can call this to retrieve status
-void WINAPI SetStatusFcn(HACCOUNT Which,char *Value);
+CRITICAL_SECTION FileWritingCS;
struct CExportedFunctions AccountExportedFcn[]=
{
@@ -223,12 +50,12 @@ INT_PTR CreatePluginAccountSvc(WPARAM wParam,LPARAM lParam)
HACCOUNT NewAccount;
//test if we are going to initialize members of suitable structure (structures of plugin and YAMN must match)
- if(AccountVersion!=YAMN_ACCOUNTVERSION)
+ if (AccountVersion!=YAMN_ACCOUNTVERSION)
return NULL;
- if(Plugin!=NULL)
+ if (Plugin!=NULL)
{
- if(Plugin->Fcn->NewAccountFcnPtr!=NULL)
+ if (Plugin->Fcn->NewAccountFcnPtr!=NULL)
{
//Let plugin create its own structure, which can be derived from CAccount structure
NewAccount=Plugin->Fcn->NewAccountFcnPtr(Plugin,YAMN_ACCOUNTVERSION);
@@ -241,7 +68,7 @@ INT_PTR CreatePluginAccountSvc(WPARAM wParam,LPARAM lParam)
NewAccount->Plugin=Plugin;
}
//If not created successfully
- if(NewAccount==NULL)
+ if (NewAccount==NULL)
return NULL;
//Init every members of structure, used by YAMN
InitAccount(NewAccount);
@@ -255,11 +82,11 @@ INT_PTR DeletePluginAccountSvc(WPARAM wParam,LPARAM)
{
HACCOUNT OldAccount=(HACCOUNT)wParam;
- if(OldAccount->Plugin->Fcn!=NULL)
+ if (OldAccount->Plugin->Fcn!=NULL)
{
//Deinit every members and allocated fields of structure used by YAMN
DeInitAccount(OldAccount);
- if(OldAccount->Plugin->Fcn->DeleteAccountFcnPtr!=NULL)
+ if (OldAccount->Plugin->Fcn->DeleteAccountFcnPtr!=NULL)
{
//Let plugin delete its own CAccount derived structure
OldAccount->Plugin->Fcn->DeleteAccountFcnPtr(OldAccount);
@@ -309,15 +136,15 @@ int InitAccount(HACCOUNT Which)
void DeInitAccount(HACCOUNT Which)
{
//delete YAMN allocated fields
- if(Which->Name!=NULL)
+ if (Which->Name!=NULL)
delete[] Which->Name;
- if(Which->Server->Name!=NULL)
+ if (Which->Server->Name!=NULL)
delete[] Which->Server->Name;
- if(Which->Server->Login!=NULL)
+ if (Which->Server->Login!=NULL)
delete[] Which->Server->Login;
- if(Which->Server->Passwd!=NULL)
+ if (Which->Server->Passwd!=NULL)
delete[] Which->Server->Passwd;
- if(Which->Server!=NULL)
+ if (Which->Server!=NULL)
delete[] Which->Server;
SWMRGDelete(Which->AccountAccessSO);
@@ -341,16 +168,16 @@ void StopSignalFcn(HACCOUNT Which)
SetEvent(Which->MessagesAccessSO->hFinishEV);
}
-void CodeDecodeString(TCHAR *Dest,BOOL Encrypt)
+void CodeDecodeString(char *Dest,BOOL Encrypt)
{
TCHAR Code=STARTCODEPSW;
- if(Dest==NULL)
+ if (Dest==NULL)
return;
for(;*Dest!=(TCHAR)0;Dest++)
{
- if(Encrypt)
+ if (Encrypt)
*Dest=*Dest+Code;
else
*Dest=*Dest-Code;
@@ -358,55 +185,55 @@ void CodeDecodeString(TCHAR *Dest,BOOL Encrypt)
}
}
-static DWORD PostFileToMemory(HANDLE File,TCHAR **MemFile,TCHAR **End)
+static DWORD PostFileToMemory(HANDLE File,char **MemFile,char **End)
{
DWORD FileSize,ReadBytes;
-
- if(!(FileSize=GetFileSize(File,NULL)))
- {
+ if (!(FileSize=GetFileSize(File,NULL))) {
CloseHandle(File);
return EACC_FILESIZE;
}
-//allocate space in memory, where we copy the whole file
- if(NULL==(*MemFile=(char *)new char[FileSize]))
+
+ //allocate space in memory, where we copy the whole file
+ if (NULL==(*MemFile = new char[FileSize]))
{
CloseHandle(File);
return EACC_ALLOC;
}
-//copy file to memory
- if(!ReadFile(File,(LPVOID)*MemFile,FileSize,&ReadBytes,NULL))
+
+ //copy file to memory
+ if (!ReadFile(File,(LPVOID)*MemFile,FileSize,&ReadBytes,NULL))
{
CloseHandle(File);
delete[] *MemFile;
return EACC_SYSTEM;
}
CloseHandle(File);
- *End=*MemFile+FileSize/sizeof(TCHAR);
+ *End = *MemFile + FileSize;
return 0;
}
-DWORD FileToMemoryA(char *FileName,TCHAR **MemFile,TCHAR **End)
+DWORD FileToMemoryA(char *FileName,char **MemFile,char **End)
{
HANDLE File;
- if(INVALID_HANDLE_VALUE==(File=CreateFile(FileName,GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL)))
+ if (INVALID_HANDLE_VALUE==(File=CreateFileA(FileName,GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL)))
return EACC_SYSTEM;
return PostFileToMemory(File,MemFile,End);
}
-DWORD FileToMemoryW(WCHAR *FileName,TCHAR **MemFile,TCHAR **End)
+DWORD FileToMemoryW(WCHAR *FileName,char **MemFile,char **End)
{
HANDLE File;
- if(INVALID_HANDLE_VALUE==(File=CreateFileW(FileName,GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL)))
+ if (INVALID_HANDLE_VALUE==(File=CreateFileW(FileName,GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL)))
return EACC_SYSTEM;
return PostFileToMemory(File,MemFile,End);
}
#if defined(DEBUG_FILEREAD) || defined(DEBUG_FILEREADMESSAGES)
-DWORD ReadStringFromMemory(TCHAR **Parser,TCHAR *End,TCHAR **StoreTo,TCHAR *DebugString)
+DWORD ReadStringFromMemory(char **Parser,TCHAR *End,char **StoreTo,TCHAR *DebugString)
{
//This is the debug version of ReadStringFromMemory function. This version shows MessageBox where
//read string is displayed
@@ -418,11 +245,11 @@ DWORD ReadStringFromMemory(TCHAR **Parser,TCHAR *End,TCHAR **StoreTo,TCHAR *Debu
while((*Finder!=(TCHAR)0) && (Finder<=End)) Finder++;
_stprintf(Debug,_T("%s: %s,length is %d, remaining %d chars"),DebugString,*Parser,Finder-*Parser,End-Finder);
MessageBox(NULL,Debug,_T("debug"),MB_OK);
- if(Finder>=End)
+ if (Finder>=End)
return EACC_FILECOMPATIBILITY;
- if(Size=Finder-*Parser)
+ if (Size=Finder-*Parser)
{
- if(NULL==(Dest=*StoreTo=new TCHAR[Size+1]))
+ if (NULL==(Dest=*StoreTo=new TCHAR[Size+1]))
return EACC_ALLOC;
for(;*Parser<=Finder;(*Parser)++,Dest++)
*Dest=**Parser;
@@ -436,18 +263,18 @@ DWORD ReadStringFromMemory(TCHAR **Parser,TCHAR *End,TCHAR **StoreTo,TCHAR *Debu
}
#endif
-DWORD ReadStringFromMemory(TCHAR **Parser,TCHAR *End,TCHAR **StoreTo)
+DWORD ReadStringFromMemory(char **Parser,char *End,char **StoreTo)
{
- TCHAR *Dest,*Finder;
+ char *Dest,*Finder;
DWORD Size;
Finder=*Parser;
while((*Finder!=(TCHAR)0) && (Finder<=End)) Finder++;
- if(Finder>=End)
+ if (Finder>=End)
return EACC_FILECOMPATIBILITY;
- if(Size=Finder-*Parser)
+ if (Size=Finder-*Parser)
{
- if(NULL==(Dest=*StoreTo=new TCHAR[Size+1]))
+ if (NULL==(Dest=*StoreTo=new char[Size+1]))
return EACC_ALLOC;
for(;*Parser<=Finder;(*Parser)++,Dest++)
*Dest=**Parser;
@@ -460,7 +287,6 @@ DWORD ReadStringFromMemory(TCHAR **Parser,TCHAR *End,TCHAR **StoreTo)
return 0;
}
-#ifndef UNICODE
#if defined(DEBUG_FILEREAD) || defined(DEBUG_FILEREADMESSAGES)
DWORD ReadStringFromMemoryW(WCHAR **Parser,TCHAR *End,WCHAR **StoreTo,WCHAR *DebugString)
{
@@ -474,11 +300,11 @@ DWORD ReadStringFromMemoryW(WCHAR **Parser,TCHAR *End,WCHAR **StoreTo,WCHAR *Deb
while((*Finder!=(WCHAR)0) && (Finder<=(WCHAR *)End)) Finder++;
swprintf(Debug,L"%s: %s,length is %d, remaining %d chars",DebugString,*Parser,Finder-*Parser,(WCHAR *)End-Finder);
MessageBoxW(NULL,Debug,L"debug",MB_OK);
- if(Finder>=(WCHAR *)End)
+ if (Finder>=(WCHAR *)End)
return EACC_FILECOMPATIBILITY;
- if(Size=Finder-*Parser)
+ if (Size=Finder-*Parser)
{
- if(NULL==(Dest=*StoreTo=new WCHAR[Size+1]))
+ if (NULL==(Dest=*StoreTo=new WCHAR[Size+1]))
return EACC_ALLOC;
for(;*Parser<=Finder;(*Parser)++,Dest++)
*Dest=**Parser;
@@ -499,11 +325,11 @@ DWORD ReadStringFromMemoryW(WCHAR **Parser,TCHAR *End,WCHAR **StoreTo)
Finder=*Parser;
while((*Finder!=(WCHAR)0) && (Finder<=(WCHAR *)End)) Finder++;
- if(Finder>=(WCHAR *)End)
+ if (Finder>=(WCHAR *)End)
return EACC_FILECOMPATIBILITY;
- if(Size=Finder-*Parser)
+ if (Size=Finder-*Parser)
{
- if(NULL==(Dest=*StoreTo=new WCHAR[Size+1]))
+ if (NULL==(Dest=*StoreTo=new WCHAR[Size+1]))
return EACC_ALLOC;
for(;*Parser<=Finder;(*Parser)++,Dest++)
*Dest=**Parser;
@@ -515,9 +341,8 @@ DWORD ReadStringFromMemoryW(WCHAR **Parser,TCHAR *End,WCHAR **StoreTo)
}
return 0;
}
-#endif //ifdef unicode
-static DWORD ReadNotificationFromMemory(TCHAR **Parser,TCHAR *End,YAMN_NOTIFICATION *Which)
+static DWORD ReadNotificationFromMemory(char **Parser,char *End,YAMN_NOTIFICATION *Which)
{
DWORD Stat;
#ifdef DEBUG_FILEREAD
@@ -525,8 +350,8 @@ static DWORD ReadNotificationFromMemory(TCHAR **Parser,TCHAR *End,YAMN_NOTIFICAT
#endif
Which->Flags=*(DWORD *)(*Parser);
- (*Parser)+=sizeof(DWORD)/sizeof(TCHAR);
- if(*Parser>=End)
+ (*Parser)+=sizeof(DWORD);
+ if (*Parser>=End)
return EACC_FILECOMPATIBILITY;
#ifdef DEBUG_FILEREAD
_stprintf(Debug,_T("NFlags: %04x, remaining %d chars"),Which->Flags,End-*Parser);
@@ -534,24 +359,24 @@ static DWORD ReadNotificationFromMemory(TCHAR **Parser,TCHAR *End,YAMN_NOTIFICAT
#endif
Which->PopUpB=*(COLORREF *)(*Parser);
- (*Parser)+=sizeof(COLORREF)/sizeof(TCHAR);
- if(*Parser>=End)
+ (*Parser)+=sizeof(COLORREF);
+ if (*Parser>=End)
return EACC_FILECOMPATIBILITY;
#ifdef DEBUG_FILEREAD
_stprintf(Debug,_T("PopUpB: %04x, remaining %d chars"),Which->PopUpB,End-*Parser);
MessageBox(NULL,Debug,_T("debug"),MB_OK);
#endif
Which->PopUpT=*(COLORREF *)(*Parser);
- (*Parser)+=sizeof(COLORREF)/sizeof(TCHAR);
- if(*Parser>=End)
+ (*Parser)+=sizeof(COLORREF);
+ if (*Parser>=End)
return EACC_FILECOMPATIBILITY;
#ifdef DEBUG_FILEREAD
_stprintf(Debug,_T("PopUpT: %04x, remaining %d chars"),Which->PopUpT,End-*Parser);
MessageBox(NULL,Debug,_T("debug"),MB_OK);
#endif
Which->PopUpTime=*(DWORD *)(*Parser);
- (*Parser)+=sizeof(DWORD)/sizeof(TCHAR);
- if(*Parser>=End)
+ (*Parser)+=sizeof(DWORD);
+ if (*Parser>=End)
return EACC_FILECOMPATIBILITY;
#ifdef DEBUG_FILEREAD
_stprintf(Debug,_T("PopUpTime: %04x, remaining %d chars"),Which->PopUpTime,End-*Parser);
@@ -559,23 +384,23 @@ static DWORD ReadNotificationFromMemory(TCHAR **Parser,TCHAR *End,YAMN_NOTIFICAT
#endif
#ifdef DEBUG_FILEREAD
- if(Stat=ReadStringFromMemoryW((WCHAR **)Parser,End,&Which->App,L"App"))
+ if (Stat=ReadStringFromMemoryW((WCHAR **)Parser,(WCHAR*)End,&Which->App,L"App"))
#else
- if(Stat=ReadStringFromMemoryW((WCHAR **)Parser,End,&Which->App))
+ if (Stat=ReadStringFromMemoryW((WCHAR **)Parser,(WCHAR*)End,&Which->App))
#endif
return Stat;
#ifdef DEBUG_FILEREAD
- if(Stat=ReadStringFromMemoryW((WCHAR **)Parser,End,&Which->AppParam,L"AppParam"))
+ if (Stat=ReadStringFromMemoryW((WCHAR **)Parser,(WCHAR*)End,&Which->AppParam,L"AppParam"))
#else
- if(Stat=ReadStringFromMemoryW((WCHAR **)Parser,End,&Which->AppParam))
+ if (Stat=ReadStringFromMemoryW((WCHAR **)Parser,(WCHAR*)End,&Which->AppParam))
#endif
return Stat;
return 0;
}
-DWORD ReadMessagesFromMemory(HACCOUNT Which,TCHAR **Parser,TCHAR *End)
+DWORD ReadMessagesFromMemory(HACCOUNT Which,char **Parser,char *End)
{
- TCHAR *Finder;
+ char *Finder;
DWORD Size,Stat;
HYAMNMAIL ActualMail=NULL;
struct CMimeItem *items;
@@ -588,77 +413,77 @@ DWORD ReadMessagesFromMemory(HACCOUNT Which,TCHAR **Parser,TCHAR *End)
{
Finder=*Parser;
while((*Finder!=(TCHAR)0) && (Finder<=End)) Finder++;
- if(Finder>=End)
+ if (Finder>=End)
return EACC_FILECOMPATIBILITY;
- if(Size=Finder-*Parser)
+ if (Size=Finder-*Parser)
{
- if(Which->Mails==NULL) //First message in queue
+ if (Which->Mails==NULL) //First message in queue
{
- if(NULL==(Which->Mails=ActualMail=CreateAccountMail(Which)))
+ if (NULL==(Which->Mails=ActualMail=CreateAccountMail(Which)))
return EACC_ALLOC;
}
else
{
- if(NULL==(ActualMail->Next=CreateAccountMail(Which))){
+ if (NULL==(ActualMail->Next=CreateAccountMail(Which))){
return EACC_ALLOC;
}
ActualMail=ActualMail->Next;
}
items=NULL;
#ifdef DEBUG_FILEREADMESSAGES
- if(Stat=ReadStringFromMemory(Parser,End,&ActualMail->ID,_T("ID")))
+ if (Stat=ReadStringFromMemory(Parser,End,&ActualMail->ID,_T("ID")))
#else
- if(Stat=ReadStringFromMemory(Parser,End,&ActualMail->ID))
+ 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=*(DWORD *)(*Parser);
- (*Parser)+=sizeof(DWORD)/sizeof(TCHAR);
- if(*Parser>=End)
+ (*Parser)+=sizeof(DWORD);
+ if (*Parser>=End)
return EACC_FILECOMPATIBILITY;
ActualMail->Flags=*(DWORD *)(*Parser);
- (*Parser)+=sizeof(DWORD)/sizeof(TCHAR);
- if(*Parser>=End)
+ (*Parser)+=sizeof(DWORD);
+ if (*Parser>=End)
return EACC_FILECOMPATIBILITY;
ActualMail->Number=*(DWORD *)(*Parser);
- (*Parser)+=sizeof(DWORD)/sizeof(TCHAR);
- if(*Parser>=End)
+ (*Parser)+=sizeof(DWORD);
+ if (*Parser>=End)
return EACC_FILECOMPATIBILITY;
- if((NULL!=Which->Plugin->MailFcn) && (NULL!=Which->Plugin->MailFcn->ReadMailOptsFcnPtr))
+ if ((NULL!=Which->Plugin->MailFcn) && (NULL!=Which->Plugin->MailFcn->ReadMailOptsFcnPtr))
Which->Plugin->MailFcn->ReadMailOptsFcnPtr(ActualMail,Parser,End); //read plugin mail settings from file
do
{
-#ifdef DEBUG_FILEREADMESSAGES
- if(Stat=ReadStringFromMemory(Parser,End,&ReadString,_T("Name")))
+#if defined(DEBUG_FILEREADMESSAGES) || defined(DEBUG_FILEREAD)
+ if (Stat=ReadStringFromMemory(Parser,End,&ReadString,_T("Name")))
#else
- if(Stat=ReadStringFromMemory(Parser,End,&ReadString))
+ if (Stat=ReadStringFromMemory(Parser,End,&ReadString))
#endif
return Stat;
- if(ReadString==NULL)
+ if (ReadString==NULL)
break;
#ifdef DEBUG_DECODE
DebugLog(DecodeFile,"<read name>%s</read name>",ReadString);
#endif
- if(items==NULL)
+ if (items==NULL)
items=ActualMail->MailData->TranslatedHeader=new struct CMimeItem;
else
{
items->Next=new struct CMimeItem;
items=items->Next;
}
- if(items==NULL)
+ if (items==NULL)
return EACC_ALLOC;
items->name=ReadString;
#ifdef DEBUG_FILEREADMESSAGES
- if(Stat=ReadStringFromMemory(Parser,End,&ReadString,_T("Value")))
+ if (Stat=ReadStringFromMemory(Parser,End,&ReadString,_T("Value")))
#else
- if(Stat=ReadStringFromMemory(Parser,End,&ReadString))
+ if (Stat=ReadStringFromMemory(Parser,End,&ReadString))
#endif
return Stat;
items->value=ReadString;
@@ -675,97 +500,98 @@ DWORD ReadMessagesFromMemory(HACCOUNT Which,TCHAR **Parser,TCHAR *End)
return 0;
}
-DWORD ReadAccountFromMemory(HACCOUNT Which,TCHAR **Parser,TCHAR *End)
+DWORD ReadAccountFromMemory(HACCOUNT Which,char **Parser,char *End)
{
DWORD Stat;
#ifdef DEBUG_FILEREAD
TCHAR Debug[65536];
#endif
-//Read name of account
+ //Read name of account
+
#ifdef DEBUG_FILEREAD
- if(Stat=ReadStringFromMemory(Parser,End,&Which->Name,_T("Name")))
+ if (Stat=ReadStringFromMemory(Parser,End,&Which->Name,_T("Name")))
#else
- if(Stat=ReadStringFromMemory(Parser,End,&Which->Name))
+ if (Stat=ReadStringFromMemory(Parser,End,&Which->Name))
#endif
return Stat;
- if(Which->Name==NULL)
+ if (Which->Name==NULL)
return EACC_FILECOMPATIBILITY;
-//Read server parameters
+ //Read server parameters
#ifdef DEBUG_FILEREAD
- if(Stat=ReadStringFromMemory(Parser,End,&Which->Server->Name,_T("Server")))
+ if (Stat=ReadStringFromMemory(Parser,End,&Which->Server->Name,_T("Server")))
#else
- if(Stat=ReadStringFromMemory(Parser,End,&Which->Server->Name))
+ if (Stat=ReadStringFromMemory(Parser,End,&Which->Server->Name))
#endif
return Stat;
Which->Server->Port=*(WORD *)(*Parser);
- (*Parser)+=sizeof(WORD)/sizeof(TCHAR);
- if(*Parser>=End)
+ (*Parser)+=sizeof(WORD);
+ if (*Parser>=End)
return EACC_FILECOMPATIBILITY;
#ifdef DEBUG_FILEREAD
_stprintf(Debug,_T("Port: %d, remaining %d chars"),Which->Server->Port,End-*Parser);
MessageBox(NULL,Debug,_T("debug"),MB_OK);
#endif
#ifdef DEBUG_FILEREAD
- if(Stat=ReadStringFromMemory(Parser,End,&Which->Server->Login,_T("Login")))
+ if (Stat=ReadStringFromMemory(Parser,End,&Which->Server->Login,_T("Login")))
#else
- if(Stat=ReadStringFromMemory(Parser,End,&Which->Server->Login))
+ if (Stat=ReadStringFromMemory(Parser,End,&Which->Server->Login))
#endif
return Stat;
#ifdef DEBUG_FILEREAD
- if(Stat=ReadStringFromMemory(Parser,End,&Which->Server->Passwd,_T("Password")))
+ if (Stat=ReadStringFromMemory(Parser,End,&Which->Server->Passwd,_T("Password")))
#else
- if(Stat=ReadStringFromMemory(Parser,End,&Which->Server->Passwd))
+ if (Stat=ReadStringFromMemory(Parser,End,&Which->Server->Passwd))
#endif
return Stat;
CodeDecodeString(Which->Server->Passwd,FALSE);
-//Read account flags
+ //Read account flags
Which->Flags=*(DWORD *)(*Parser);
- (*Parser)+=sizeof(DWORD)/sizeof(TCHAR);
- if(*Parser>=End)
+ (*Parser)+=sizeof(DWORD);
+ if (*Parser>=End)
return EACC_FILECOMPATIBILITY;
#ifdef DEBUG_FILEREAD
_stprintf(Debug,_T("Flags: %04x, remaining %d chars"),Which->Flags,End-*Parser);
MessageBox(NULL,Debug,_T("debug"),MB_OK);
#endif
Which->StatusFlags=*(DWORD *)(*Parser);
- (*Parser)+=sizeof(DWORD)/sizeof(TCHAR);
+ (*Parser)+=sizeof(DWORD);
#ifdef DEBUG_FILEREAD
_stprintf(Debug,_T("STFlags: %04x, remaining %d chars"),Which->StatusFlags,End-*Parser);
MessageBox(NULL,Debug,_T("debug"),MB_OK);
#endif
Which->PluginFlags=*(DWORD *)(*Parser);
- (*Parser)+=sizeof(DWORD)/sizeof(TCHAR);
+ (*Parser)+=sizeof(DWORD);
#ifdef DEBUG_FILEREAD
_stprintf(Debug,_T("PFlags: %04x, remaining %d chars"),Which->PluginFlags,End-*Parser);
MessageBox(NULL,Debug,_T("debug"),MB_OK);
#endif
-//Read account miscellaneous parameters
+ //Read account miscellaneous parameters
Which->Interval=*(WORD *)(*Parser);
Which->TimeLeft=Which->Interval; //check on loading
- (*Parser)+=sizeof(WORD)/sizeof(TCHAR);
- if(*Parser>=End)
+ (*Parser)+=sizeof(WORD);
+ if (*Parser>=End)
return EACC_FILECOMPATIBILITY;
#ifdef DEBUG_FILEREAD
_stprintf(Debug,_T("Interval: %d, remaining %d chars"),Which->Interval,End-*Parser);
MessageBox(NULL,Debug,_T("debug"),MB_OK);
#endif
-//Read notification parameters
- if(Stat=ReadNotificationFromMemory(Parser,End,&Which->NewMailN))
+ //Read notification parameters
+ if (Stat=ReadNotificationFromMemory(Parser,End,&Which->NewMailN))
return Stat;
- if(Stat=ReadNotificationFromMemory(Parser,End,&Which->NoNewMailN))
+ if (Stat=ReadNotificationFromMemory(Parser,End,&Which->NoNewMailN))
return Stat;
- if(Stat=ReadNotificationFromMemory(Parser,End,&Which->BadConnectN))
+ if (Stat=ReadNotificationFromMemory(Parser,End,&Which->BadConnectN))
return Stat;
-//Let plugin read its own data stored in file
- if(Which->Plugin->Fcn!=NULL && Which->Plugin->Fcn->ReadPluginOptsFcnPtr!=NULL)
- if(Stat=Which->Plugin->Fcn->ReadPluginOptsFcnPtr(Which,Parser,End))
+ //Let plugin read its own data stored in file
+ if (Which->Plugin->Fcn!=NULL && Which->Plugin->Fcn->ReadPluginOptsFcnPtr!=NULL)
+ if (Stat=Which->Plugin->Fcn->ReadPluginOptsFcnPtr(Which,Parser,End))
return Stat;
-//Read mails
+ //Read mails
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"ReadAccountFromMemory:ActualAccountMsgsSO-write wait\n");
#endif
@@ -773,7 +599,7 @@ DWORD ReadAccountFromMemory(HACCOUNT Which,TCHAR **Parser,TCHAR *End)
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"ReadAccountFromMemory:ActualAccountMsgsSO-write enter\n");
#endif
- if(Stat=ReadMessagesFromMemory(Which,Parser,End))
+ if (Stat=ReadMessagesFromMemory(Which,Parser,End))
{
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"ReadAccountFromMemory:ActualAccountMsgsSO-write done\n");
@@ -786,60 +612,60 @@ DWORD ReadAccountFromMemory(HACCOUNT Which,TCHAR **Parser,TCHAR *End)
#endif
WriteDoneFcn(Which->MessagesAccessSO);
-//Read timestamps
+ //Read timestamps
Which->LastChecked=*(SYSTEMTIME *)(*Parser);
- (*Parser)+=sizeof(SYSTEMTIME)/sizeof(TCHAR);
- if(*Parser>=End)
+ (*Parser)+=sizeof(SYSTEMTIME);
+ if (*Parser>=End)
return EACC_FILECOMPATIBILITY;
#ifdef DEBUG_FILEREAD
_stprintf(Debug,_T("LastChecked: %04x, remaining %d chars"),Which->LastChecked,End-*Parser);
MessageBox(NULL,Debug,_T("debug"),MB_OK);
#endif
Which->LastSChecked=*(SYSTEMTIME *)(*Parser);
- (*Parser)+=sizeof(SYSTEMTIME)/sizeof(TCHAR);
- if(*Parser>=End)
+ (*Parser)+=sizeof(SYSTEMTIME);
+ if (*Parser>=End)
return EACC_FILECOMPATIBILITY;
#ifdef DEBUG_FILEREAD
_stprintf(Debug,_T("LastSChecked: %04x, remaining %d chars"),Which->LastSChecked,End-*Parser);
MessageBox(NULL,Debug,_T("debug"),MB_OK);
#endif
Which->LastSynchronised=*(SYSTEMTIME *)(*Parser);
- (*Parser)+=sizeof(SYSTEMTIME)/sizeof(TCHAR);
- if(*Parser>=End)
+ (*Parser)+=sizeof(SYSTEMTIME);
+ if (*Parser>=End)
return EACC_FILECOMPATIBILITY;
#ifdef DEBUG_FILEREAD
_stprintf(Debug,_T("LastSynchronised: %04x, remaining %d chars"),Which->LastSynchronised,End-*Parser);
MessageBox(NULL,Debug,_T("debug"),MB_OK);
#endif
Which->LastMail=*(SYSTEMTIME *)(*Parser);
- (*Parser)+=sizeof(SYSTEMTIME)/sizeof(TCHAR);
- if(*Parser>End) //WARNING! There's only > at the end of testing
+ (*Parser)+=sizeof(SYSTEMTIME);
+ if (*Parser>End) //WARNING! There's only > at the end of testing
return EACC_FILECOMPATIBILITY;
#ifdef DEBUG_FILEREAD
_stprintf(Debug,_T("LastMail: %04x, remaining %d chars"),Which->LastMail,End-*Parser);
MessageBox(NULL,Debug,_T("debug"),MB_OK);
#endif
- if(*Parser==End)
+ if (*Parser==End)
return EACC_ENDOFFILE;
return 0;
-
+
}
-static INT_PTR PerformAccountReading(HYAMNPROTOPLUGIN Plugin,TCHAR *MemFile,TCHAR *End)
+static INT_PTR PerformAccountReading(HYAMNPROTOPLUGIN Plugin,char *MemFile,char *End)
{
-//Retrieve info for account from memory
- TCHAR *Parser;
+ //Retrieve info for account from memory
+ char *Parser;
DWORD Ver,Stat;
HACCOUNT ActualAccount,FirstAllocatedAccount;
Ver=*(DWORD *)MemFile;
- if(Ver>YAMN_ACCOUNTFILEVERSION)
+ if (Ver>YAMN_ACCOUNTFILEVERSION)
{
delete[] MemFile;
return EACC_FILEVERSION;
}
- Parser=MemFile+sizeof(Ver)/sizeof(TCHAR);
+ Parser=MemFile+sizeof(Ver);
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"AddAccountsFromFile:AccountBrowserSO-write wait\n");
@@ -848,7 +674,7 @@ static INT_PTR PerformAccountReading(HYAMNPROTOPLUGIN Plugin,TCHAR *MemFile,TCHA
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"AddAccountsFromFile:AccountBrowserSO-write enter\n");
#endif
- if(NULL==(ActualAccount=(HACCOUNT)CallService(MS_YAMN_GETNEXTFREEACCOUNT,(WPARAM)Plugin,(LPARAM)YAMN_ACCOUNTVERSION)))
+ if (NULL==(ActualAccount=(HACCOUNT)CallService(MS_YAMN_GETNEXTFREEACCOUNT,(WPARAM)Plugin,(LPARAM)YAMN_ACCOUNTVERSION)))
{
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"AddAccountsFromFile:AccountBrowserSO-write done\n");
@@ -858,7 +684,7 @@ static INT_PTR PerformAccountReading(HYAMNPROTOPLUGIN Plugin,TCHAR *MemFile,TCHA
return EACC_ALLOC;
}
FirstAllocatedAccount=ActualAccount;
-
+
do
{
HACCOUNT Temp;
@@ -872,10 +698,10 @@ static INT_PTR PerformAccountReading(HYAMNPROTOPLUGIN Plugin,TCHAR *MemFile,TCHA
#endif
Stat=ReadAccountFromMemory(ActualAccount,&Parser,End);
- if(ActualAccount->StatusFlags & (YAMN_ACC_STARTA | YAMN_ACC_STARTS))
+ if (ActualAccount->StatusFlags & (YAMN_ACC_STARTA | YAMN_ACC_STARTS))
ActualAccount->TimeLeft=1; //check on loading
- if(Stat && (Stat!=EACC_ENDOFFILE))
+ if (Stat && (Stat!=EACC_ENDOFFILE))
{
for(ActualAccount=FirstAllocatedAccount;ActualAccount!=NULL;ActualAccount=Temp)
{
@@ -883,7 +709,7 @@ static INT_PTR PerformAccountReading(HYAMNPROTOPLUGIN Plugin,TCHAR *MemFile,TCHA
delete ActualAccount;
}
delete[] MemFile;
- if(Plugin->FirstAccount==FirstAllocatedAccount)
+ if (Plugin->FirstAccount==FirstAllocatedAccount)
Plugin->FirstAccount=NULL;
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"AddAccountsFromFile:ActualAccountSO-write done\n");
@@ -891,13 +717,13 @@ static INT_PTR PerformAccountReading(HYAMNPROTOPLUGIN Plugin,TCHAR *MemFile,TCHA
SWMRGDoneWriting(Plugin->AccountBrowserSO);
return (INT_PTR)Stat;
}
-
+
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"AddAccountsFromFile:ActualAccountSO-write done\n");
#endif
WriteDoneFcn(ActualAccount->AccountAccessSO);
- if((Stat!=EACC_ENDOFFILE) && (NULL==(ActualAccount=(HACCOUNT)CallService(MS_YAMN_GETNEXTFREEACCOUNT,(WPARAM)Plugin,(LPARAM)YAMN_ACCOUNTVERSION))))
+ if ((Stat!=EACC_ENDOFFILE) && (NULL==(ActualAccount=(HACCOUNT)CallService(MS_YAMN_GETNEXTFREEACCOUNT,(WPARAM)Plugin,(LPARAM)YAMN_ACCOUNTVERSION))))
{
for(ActualAccount=FirstAllocatedAccount;ActualAccount!=NULL;ActualAccount=Temp)
{
@@ -905,7 +731,7 @@ static INT_PTR PerformAccountReading(HYAMNPROTOPLUGIN Plugin,TCHAR *MemFile,TCHA
delete ActualAccount;
}
delete[] MemFile;
- if(Plugin->FirstAccount==FirstAllocatedAccount)
+ if (Plugin->FirstAccount==FirstAllocatedAccount)
Plugin->FirstAccount=NULL;
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"AddAccountsFromFile:AccountBrowserSO-write done\n");
@@ -924,46 +750,44 @@ static INT_PTR PerformAccountReading(HYAMNPROTOPLUGIN Plugin,TCHAR *MemFile,TCHA
return 0;
}
+// Add accounts from file to memory
INT_PTR AddAccountsFromFileASvc(WPARAM wParam,LPARAM lParam)
-//Add accounts from file to memory
{
DWORD Stat;
- TCHAR *MemFile,*End;
+ char *MemFile,*End;
- if(Stat=FileToMemoryA((char *)lParam,&MemFile,&End))
+ if (Stat=FileToMemoryA((char *)lParam,&MemFile,&End))
return (INT_PTR)Stat;
return PerformAccountReading((HYAMNPROTOPLUGIN)wParam,MemFile,End);
-
}
INT_PTR AddAccountsFromFileWSvc(WPARAM wParam,LPARAM lParam)
//Add accounts from file to memory
{
DWORD Stat;
- TCHAR *MemFile,*End;
+ char *MemFile,*End;
- if(Stat=FileToMemoryW((WCHAR *)lParam,&MemFile,&End))
+ if (Stat=FileToMemoryW((WCHAR *)lParam,&MemFile,&End))
return (INT_PTR)Stat;
return PerformAccountReading((HYAMNPROTOPLUGIN)wParam,MemFile,End);
-
}
-DWORD WriteStringToFile(HANDLE File,TCHAR *Source)
+DWORD WriteStringToFile(HANDLE File,char *Source)
{
DWORD Length,WrittenBytes;
- TCHAR null=(TCHAR)0;
+ char null = 0;
- if((Source==NULL) || !(Length=(DWORD)_tcslen(Source)))
+ if ((Source==NULL) || !(Length=(DWORD)strlen(Source)))
{
- if(!WriteFile(File,&null,sizeof(TCHAR),&WrittenBytes,NULL))
+ if (!WriteFile(File,&null,1,&WrittenBytes,NULL))
{
CloseHandle(File);
return EACC_SYSTEM;
}
}
- else if(!WriteFile(File,Source,(Length+1)*sizeof(TCHAR),&WrittenBytes,NULL))
+ else if (!WriteFile(File,Source,(Length+1),&WrittenBytes,NULL))
{
CloseHandle(File);
return EACC_SYSTEM;
@@ -971,25 +795,23 @@ DWORD WriteStringToFile(HANDLE File,TCHAR *Source)
return 0;
}
-#ifndef UNICODE
DWORD WriteStringToFileW(HANDLE File,WCHAR *Source)
{
DWORD Length,WrittenBytes;
WCHAR null=(WCHAR)0;
- if((Source==NULL) || !(Length=(DWORD)wcslen(Source)))
+ if ((Source==NULL) || !(Length=(DWORD)wcslen(Source)))
{
- if(!WriteFile(File,&null,sizeof(WCHAR),&WrittenBytes,NULL))
+ if (!WriteFile(File,&null,sizeof(WCHAR),&WrittenBytes,NULL))
{
CloseHandle(File);
return EACC_SYSTEM;
}
}
- else if(!WriteFile(File,Source,(Length+1)*sizeof(WCHAR),&WrittenBytes,NULL))
+ else if (!WriteFile(File,Source,(Length+1)*sizeof(WCHAR),&WrittenBytes,NULL))
return EACC_SYSTEM;
return 0;
}
-#endif
DWORD WriteMessagesToFile(HANDLE File,HACCOUNT Which)
{
@@ -999,26 +821,26 @@ DWORD WriteMessagesToFile(HANDLE File,HACCOUNT Which)
while(ActualMail!=NULL)
{
- if(Stat=WriteStringToFile(File,ActualMail->ID))
+ if (Stat=WriteStringToFile(File,ActualMail->ID))
return Stat;
- if(!WriteFile(File,(char *)&ActualMail->MailData->Size,sizeof(ActualMail->MailData->Size),&WrittenBytes,NULL) ||
+ if (!WriteFile(File,(char *)&ActualMail->MailData->Size,sizeof(ActualMail->MailData->Size),&WrittenBytes,NULL) ||
!WriteFile(File,(char *)&ActualMail->Flags,sizeof(ActualMail->Flags),&WrittenBytes,NULL) ||
!WriteFile(File,(char *)&ActualMail->Number,sizeof(ActualMail->Number),&WrittenBytes,NULL))
return EACC_SYSTEM;
- if((NULL!=Which->Plugin->MailFcn) && (NULL!=Which->Plugin->MailFcn->WriteMailOptsFcnPtr))
+ if ((NULL!=Which->Plugin->MailFcn) && (NULL!=Which->Plugin->MailFcn->WriteMailOptsFcnPtr))
Which->Plugin->MailFcn->WriteMailOptsFcnPtr(File,ActualMail); //write plugin mail options to file
for(items=ActualMail->MailData->TranslatedHeader;items!=NULL;items=items->Next)
{
- if(Stat=WriteStringToFile(File,items->name))
+ if (Stat=WriteStringToFile(File,items->name))
return Stat;
- if(Stat=WriteStringToFile(File,items->value))
+ if (Stat=WriteStringToFile(File,items->value))
return Stat;
}
- if(Stat=WriteStringToFile(File,_T("")))
+ if (Stat=WriteStringToFile(File,""))
return Stat;
ActualMail=ActualMail->Next;
}
- if(Stat=WriteStringToFile(File,_T("")))
+ if (Stat=WriteStringToFile(File,""))
return Stat;
return 0;
}
@@ -1051,7 +873,7 @@ static INT_PTR PerformAccountWriting(HYAMNPROTOPLUGIN Plugin,HANDLE File)
DebugLog(SynchroFile,"WriteAccountsToFile:ActualAccountSO-read wait\n");
#endif
EnterCode=WaitToReadFcn(ActualAccount->AccountAccessSO);
- if(EnterCode==WAIT_FINISH) //account is about to delete
+ if (EnterCode==WAIT_FINISH) //account is about to delete
{
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"WriteAccountsToFile:ActualAccountSO-read wait failed\n");
@@ -1059,12 +881,12 @@ static INT_PTR PerformAccountWriting(HYAMNPROTOPLUGIN Plugin,HANDLE File)
ActualAccount=ActualAccount->Next;
continue;
}
- if(EnterCode==WAIT_FAILED) //account is deleted
+ if (EnterCode==WAIT_FAILED) //account is deleted
break;
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"WriteAccountsToFile:ActualAccountSO-read enter\n");
#endif
- if((ActualAccount->Name==NULL) || (*ActualAccount->Name==(TCHAR)0))
+ if ((ActualAccount->Name==NULL) || (*ActualAccount->Name==(TCHAR)0))
{
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"WriteAccountsToFile:ActualAccountSO-read done\n");
@@ -1073,72 +895,72 @@ static INT_PTR PerformAccountWriting(HYAMNPROTOPLUGIN Plugin,HANDLE File)
continue;
}
- if(!Writed && !WriteFile(File,&Ver,sizeof(Ver),&WrittenBytes,NULL))
+ if (!Writed && !WriteFile(File,&Ver,sizeof(Ver),&WrittenBytes,NULL))
throw (DWORD)EACC_SYSTEM;
Writed=TRUE;
- if(Stat=WriteStringToFile(File,ActualAccount->Name))
+ if (Stat=WriteStringToFile(File,ActualAccount->Name))
throw (DWORD)Stat;
- if(Stat=WriteStringToFile(File,ActualAccount->Server->Name))
+ if (Stat=WriteStringToFile(File,ActualAccount->Server->Name))
throw (DWORD)Stat;
- if(!WriteFile(File,(char *)&ActualAccount->Server->Port,2,&WrittenBytes,NULL))
+ if (!WriteFile(File,(char *)&ActualAccount->Server->Port,2,&WrittenBytes,NULL))
throw (DWORD)EACC_SYSTEM;
- if((Stat=WriteStringToFile(File,ActualAccount->Server->Login)))
+ if ((Stat=WriteStringToFile(File,ActualAccount->Server->Login)))
throw (DWORD)Stat;
CodeDecodeString(ActualAccount->Server->Passwd,TRUE);
- if(Stat=WriteStringToFile(File,ActualAccount->Server->Passwd))
+ if (Stat=WriteStringToFile(File,ActualAccount->Server->Passwd))
{
CodeDecodeString(ActualAccount->Server->Passwd,FALSE);
throw (DWORD)Stat;
}
CodeDecodeString(ActualAccount->Server->Passwd,FALSE);
- if((!WriteFile(File,(char *)&ActualAccount->Flags,sizeof(DWORD),&WrittenBytes,NULL) ||
+ if ((!WriteFile(File,(char *)&ActualAccount->Flags,sizeof(DWORD),&WrittenBytes,NULL) ||
(!WriteFile(File,(char *)&ActualAccount->StatusFlags,sizeof(DWORD),&WrittenBytes,NULL)) ||
(!WriteFile(File,(char *)&ActualAccount->PluginFlags,sizeof(DWORD),&WrittenBytes,NULL))))
throw (DWORD)EACC_SYSTEM;
- if(!WriteFile(File,(char *)&ActualAccount->Interval,sizeof(WORD),&WrittenBytes,NULL))
+ if (!WriteFile(File,(char *)&ActualAccount->Interval,sizeof(WORD),&WrittenBytes,NULL))
throw (DWORD)EACC_SYSTEM;
- if((!WriteFile(File,(char *)&ActualAccount->NewMailN.Flags,sizeof(DWORD),&WrittenBytes,NULL)) ||
+ if ((!WriteFile(File,(char *)&ActualAccount->NewMailN.Flags,sizeof(DWORD),&WrittenBytes,NULL)) ||
(!WriteFile(File,(char *)&ActualAccount->NewMailN.PopUpB,sizeof(COLORREF),&WrittenBytes,NULL)) ||
(!WriteFile(File,(char *)&ActualAccount->NewMailN.PopUpT,sizeof(COLORREF),&WrittenBytes,NULL)) ||
(!WriteFile(File,(char *)&ActualAccount->NewMailN.PopUpTime,sizeof(DWORD),&WrittenBytes,NULL)))
throw (DWORD)EACC_SYSTEM;
- if((Stat=WriteStringToFileW(File,ActualAccount->NewMailN.App)) ||
+ if ((Stat=WriteStringToFileW(File,ActualAccount->NewMailN.App)) ||
(Stat=WriteStringToFileW(File,ActualAccount->NewMailN.AppParam)))
throw (DWORD)Stat;
- if((!WriteFile(File,(char *)&ActualAccount->NoNewMailN.Flags,sizeof(DWORD),&WrittenBytes,NULL)) ||
+ if ((!WriteFile(File,(char *)&ActualAccount->NoNewMailN.Flags,sizeof(DWORD),&WrittenBytes,NULL)) ||
(!WriteFile(File,(char *)&ActualAccount->NoNewMailN.PopUpB,sizeof(COLORREF),&WrittenBytes,NULL)) ||
(!WriteFile(File,(char *)&ActualAccount->NoNewMailN.PopUpT,sizeof(COLORREF),&WrittenBytes,NULL)) ||
(!WriteFile(File,(char *)&ActualAccount->NoNewMailN.PopUpTime,sizeof(DWORD),&WrittenBytes,NULL)))
throw (DWORD)EACC_SYSTEM;
- if((Stat=WriteStringToFileW(File,ActualAccount->NoNewMailN.App)) ||
+ if ((Stat=WriteStringToFileW(File,ActualAccount->NoNewMailN.App)) ||
(Stat=WriteStringToFileW(File,ActualAccount->NoNewMailN.AppParam)))
throw (DWORD)Stat;
- if((!WriteFile(File,(char *)&ActualAccount->BadConnectN.Flags,sizeof(DWORD),&WrittenBytes,NULL)) ||
+ if ((!WriteFile(File,(char *)&ActualAccount->BadConnectN.Flags,sizeof(DWORD),&WrittenBytes,NULL)) ||
(!WriteFile(File,(char *)&ActualAccount->BadConnectN.PopUpB,sizeof(COLORREF),&WrittenBytes,NULL)) ||
(!WriteFile(File,(char *)&ActualAccount->BadConnectN.PopUpT,sizeof(COLORREF),&WrittenBytes,NULL)) ||
(!WriteFile(File,(char *)&ActualAccount->BadConnectN.PopUpTime,sizeof(DWORD),&WrittenBytes,NULL)))
throw (DWORD)EACC_SYSTEM;
- if((Stat=WriteStringToFileW(File,ActualAccount->BadConnectN.App)) ||
+ if ((Stat=WriteStringToFileW(File,ActualAccount->BadConnectN.App)) ||
(Stat=WriteStringToFileW(File,ActualAccount->BadConnectN.AppParam)))
throw (DWORD)Stat;
//Let plugin write its own values into file
- if(ActualAccount->Plugin->Fcn!=NULL && ActualAccount->Plugin->Fcn->WritePluginOptsFcnPtr!=NULL)
- if(Stat=ActualAccount->Plugin->Fcn->WritePluginOptsFcnPtr(File,ActualAccount))
+ if (ActualAccount->Plugin->Fcn!=NULL && ActualAccount->Plugin->Fcn->WritePluginOptsFcnPtr!=NULL)
+ if (Stat=ActualAccount->Plugin->Fcn->WritePluginOptsFcnPtr(File,ActualAccount))
throw (DWORD)Stat;
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"WriteAccountsToFile:ActualAccountMsgsSO-read wait\n");
@@ -1147,7 +969,7 @@ static INT_PTR PerformAccountWriting(HYAMNPROTOPLUGIN Plugin,HANDLE File)
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"WriteAccountsToFile:ActualAccountMsgsSO-read enter\n");
#endif
- if(Stat=WriteMessagesToFile(File,ActualAccount))
+ if (Stat=WriteMessagesToFile(File,ActualAccount))
{
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"WriteAccountsToFile:ActualAccountMsgsSO-read done\n");
@@ -1160,7 +982,7 @@ static INT_PTR PerformAccountWriting(HYAMNPROTOPLUGIN Plugin,HANDLE File)
#endif
ReadDoneFcn(ActualAccount->MessagesAccessSO);
- if((!WriteFile(File,(char *)&ActualAccount->LastChecked,sizeof(SYSTEMTIME),&WrittenBytes,NULL)) ||
+ if ((!WriteFile(File,(char *)&ActualAccount->LastChecked,sizeof(SYSTEMTIME),&WrittenBytes,NULL)) ||
(!WriteFile(File,(char *)&ActualAccount->LastSChecked,sizeof(SYSTEMTIME),&WrittenBytes,NULL)) ||
(!WriteFile(File,(char *)&ActualAccount->LastSynchronised,sizeof(SYSTEMTIME),&WrittenBytes,NULL)) ||
(!WriteFile(File,(char *)&ActualAccount->LastMail,sizeof(SYSTEMTIME),&WrittenBytes,NULL)))
@@ -1196,13 +1018,13 @@ INT_PTR WriteAccountsToFileASvc(WPARAM wParam,LPARAM lParam)
HANDLE File;
- EnterCriticalSection(FileWritingCS);
- if(INVALID_HANDLE_VALUE==(File=CreateFileA(FileName,GENERIC_WRITE,FILE_SHARE_WRITE,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL)))
+ EnterCriticalSection(&FileWritingCS);
+ if (INVALID_HANDLE_VALUE==(File=CreateFileA(FileName,GENERIC_WRITE,FILE_SHARE_WRITE,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL)))
{
- LeaveCriticalSection(FileWritingCS);
+ LeaveCriticalSection(&FileWritingCS);
return EACC_SYSTEM;
}
- LeaveCriticalSection(FileWritingCS);
+ LeaveCriticalSection(&FileWritingCS);
return PerformAccountWriting(Plugin,File);
}
@@ -1216,16 +1038,16 @@ INT_PTR WriteAccountsToFileWSvc(WPARAM wParam,LPARAM lParam)
HANDLE File;
- EnterCriticalSection(FileWritingCS);
- if(INVALID_HANDLE_VALUE==(File=CreateFileW(FileName,GENERIC_WRITE,FILE_SHARE_WRITE,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL)))
+ EnterCriticalSection(&FileWritingCS);
+ if (INVALID_HANDLE_VALUE==(File=CreateFileW(FileName,GENERIC_WRITE,FILE_SHARE_WRITE,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL)))
{
- LeaveCriticalSection(FileWritingCS);
+ LeaveCriticalSection(&FileWritingCS);
return EACC_SYSTEM;
}
rv=PerformAccountWriting(Plugin,File);
- LeaveCriticalSection(FileWritingCS);
+ LeaveCriticalSection(&FileWritingCS);
return rv;
}
@@ -1233,7 +1055,7 @@ INT_PTR WriteAccountsToFileWSvc(WPARAM wParam,LPARAM lParam)
INT_PTR FindAccountByNameSvc(WPARAM wParam,LPARAM lParam)
{
HYAMNPROTOPLUGIN Plugin=(HYAMNPROTOPLUGIN)wParam;
- TCHAR *SearchedAccount=(TCHAR *)lParam;
+ char *SearchedAccount=(char *)lParam;
HACCOUNT Finder;
#ifdef DEBUG_SYNCHRO
@@ -1244,7 +1066,7 @@ INT_PTR FindAccountByNameSvc(WPARAM wParam,LPARAM lParam)
DebugLog(SynchroFile,"FindAccountByName:AccountBrowserSO-read enter\n");
#endif
for(Finder=Plugin->FirstAccount;Finder!=NULL;Finder=Finder->Next)
- if((Finder->Name!=NULL) && (0==_tcscmp(SearchedAccount,Finder->Name)))
+ if ((Finder->Name!=NULL) && (0 == strcmp(SearchedAccount,Finder->Name)))
break;
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"FindAccountByName:AccountBrowserSO-read done\n");
@@ -1258,7 +1080,7 @@ INT_PTR GetNextFreeAccountSvc(WPARAM wParam,LPARAM lParam)
HYAMNPROTOPLUGIN Plugin=(HYAMNPROTOPLUGIN)wParam;
HACCOUNT Finder;
- if(Plugin->FirstAccount==NULL)
+ if (Plugin->FirstAccount==NULL)
{
Plugin->FirstAccount=(HACCOUNT)CallService(MS_YAMN_CREATEPLUGINACCOUNT,wParam,lParam);
return (INT_PTR)Plugin->FirstAccount;
@@ -1274,7 +1096,7 @@ int FindPluginAccount(WPARAM wParam,LPARAM lParam)
HYAMNPROTOPLUGIN Plugin=(HYAMNPROTOPLUGIN)wParam;
HACCOUNT Finder=(HACCOUNT)lParam;
- if(Finder=NULL) Finder=Plugin->FirstAccount;
+ if (Finder=NULL) Finder=Plugin->FirstAccount;
// for(;Finder!=NULL && Finder->PluginID!=Plugin->PluginInfo->PluginID;Finder=(HACCOUNT)Finder->Next);
return (int)Finder;
@@ -1315,7 +1137,7 @@ INT_PTR DeleteAccountSvc(WPARAM wParam,LPARAM lParam)
//1. set stop signal
StopSignalFcn(Which);
WindowList_BroadcastAsync(YAMNVar.MessageWnds,WM_YAMN_STOPACCOUNT,(WPARAM)Which,(LPARAM)0);
- if(Plugin->Fcn->StopAccountFcnPtr!=NULL)
+ if (Plugin->Fcn->StopAccountFcnPtr!=NULL)
Plugin->Fcn->StopAccountFcnPtr(Which);
//2. wait to get write access
@@ -1328,7 +1150,7 @@ INT_PTR DeleteAccountSvc(WPARAM wParam,LPARAM lParam)
#endif
//3. remove from queue (chained list)
- if(Plugin->FirstAccount==NULL)
+ if (Plugin->FirstAccount==NULL)
{
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"DeleteAccount:AccountBrowserSO-write done\n");
@@ -1336,7 +1158,7 @@ INT_PTR DeleteAccountSvc(WPARAM wParam,LPARAM lParam)
SWMRGDoneWriting(Plugin->AccountBrowserSO);
return 0;
}
- if(Plugin->FirstAccount==Which)
+ if (Plugin->FirstAccount==Which)
{
Finder=Plugin->FirstAccount->Next;
Plugin->FirstAccount=Finder;
@@ -1358,7 +1180,7 @@ INT_PTR DeleteAccountSvc(WPARAM wParam,LPARAM lParam)
// No, of course not. We will create new thread, that will wait and additionally remove our thread in background.
//5. So, the last point (deleting from memory) is performed in new DeleteAccountInBackground thread
- if((Plugin->Fcn!=NULL) && (Plugin->Fcn->WriteAccountsFcnPtr!=NULL))
+ if ((Plugin->Fcn!=NULL) && (Plugin->Fcn->WriteAccountsFcnPtr!=NULL))
Plugin->Fcn->WriteAccountsFcnPtr();
CloseHandle(CreateThread(NULL,0,DeleteAccountInBackground,(LPVOID)Which,0,&tid));
@@ -1392,7 +1214,7 @@ int StopAccounts(HYAMNPROTOPLUGIN Plugin)
//2. set stop signal
StopSignalFcn(Finder);
WindowList_BroadcastAsync(YAMNVar.MessageWnds,WM_YAMN_STOPACCOUNT,(WPARAM)Finder,(LPARAM)0);
- if(Plugin->Fcn->StopAccountFcnPtr!=NULL)
+ if (Plugin->Fcn->StopAccountFcnPtr!=NULL)
Plugin->Fcn->StopAccountFcnPtr(Finder);
}
@@ -1410,7 +1232,7 @@ int WaitForAllAccounts(HYAMNPROTOPLUGIN Plugin,BOOL GetAccountBrowserAccess)
{
HACCOUNT Finder;
- if(GetAccountBrowserAccess)
+ if (GetAccountBrowserAccess)
{
//1. wait to get write access
#ifdef DEBUG_SYNCHRO
@@ -1433,7 +1255,7 @@ int WaitForAllAccounts(HYAMNPROTOPLUGIN Plugin,BOOL GetAccountBrowserAccess)
DebugLog(SynchroFile,"WaitForAllAccounts:UsingThreadEV signaled\n");
#endif
}
- if(GetAccountBrowserAccess)
+ if (GetAccountBrowserAccess)
{
//leave write access
#ifdef DEBUG_SYNCHRO
@@ -1476,15 +1298,15 @@ int DeleteAccounts(HYAMNPROTOPLUGIN Plugin)
return 1;
}
-void WINAPI GetStatusFcn(HACCOUNT Which,char *Value)
+void WINAPI GetStatusFcn(HACCOUNT Which,TCHAR *Value)
{
- if(Which==NULL)
+ if (Which==NULL)
return;
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"\tGetStatus:AccountStatusCS-cs wait\n");
#endif
- EnterCriticalSection(AccountStatusCS);
+ EnterCriticalSection(&AccountStatusCS);
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"\tGetStatus:AccountStatusCS-cs enter\n");
#endif
@@ -1492,19 +1314,19 @@ void WINAPI GetStatusFcn(HACCOUNT Which,char *Value)
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"\tGetStatus:AccountStatusCS-cs done\n");
#endif
- LeaveCriticalSection(AccountStatusCS);
+ LeaveCriticalSection(&AccountStatusCS);
return;
}
-void WINAPI SetStatusFcn(HACCOUNT Which,char *Value)
+void WINAPI SetStatusFcn(HACCOUNT Which,TCHAR *Value)
{
- if(Which==NULL)
+ if (Which==NULL)
return;
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"\tSetStatus:AccountStatusCS-cs wait\n");
#endif
- EnterCriticalSection(AccountStatusCS);
+ EnterCriticalSection(&AccountStatusCS);
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"\tSetStatus:AccountStatusCS-cs enter\n");
#endif
@@ -1513,7 +1335,7 @@ void WINAPI SetStatusFcn(HACCOUNT Which,char *Value)
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"\tSetStatus:AccountStatusCS-cs done\n");
#endif
- LeaveCriticalSection(AccountStatusCS);
+ LeaveCriticalSection(&AccountStatusCS);
}
/*
diff --git a/plugins/YAMN/browser/badconnect.cpp b/plugins/YAMN/browser/badconnect.cpp
index d8b42b4228..a6c1518339 100644
--- a/plugins/YAMN/browser/badconnect.cpp
+++ b/plugins/YAMN/browser/badconnect.cpp
@@ -3,24 +3,9 @@
*
* (c) majvan 2002,2004
*/
-#include <windows.h>
-#include <stdio.h>
-#include <newpluginapi.h>
-#include <m_utils.h>
-#include <m_skin.h>
-#include <m_langpack.h>
-#include <m_database.h>
-#include <m_popup.h>
+
+#include "../yamn.h"
#include "../main.h"
-#include "m_protoplugin.h"
-#include "m_account.h"
-#include "../debug.h"
-#include "m_messages.h"
-#include "m_mails.h"
-#include "m_yamn.h"
-#include "../resources/resource.h"
-#include "m_browser.h"
-#include <win2k.h>
#define BADCONNECTTITLE "%s - connection error"
#define BADCONNECTMSG "An error occured. Error code: %d"
@@ -31,8 +16,6 @@
extern YAMN_VARIABLES YAMNVar;
//From synchro.cpp
-extern DWORD WINAPI WaitToWriteFcn(PSWMRG SObject,PSCOUNTER SCounter=NULL);
-extern void WINAPI WriteDoneFcn(PSWMRG SObject,PSCOUNTER SCounter=NULL);
extern DWORD WINAPI WaitToReadFcn(PSWMRG SObject);
extern void WINAPI ReadDoneFcn(PSWMRG SObject);
extern DWORD WINAPI SCIncFcn(PSCOUNTER SCounter);
@@ -64,7 +47,7 @@ LRESULT CALLBACK BadConnectPopUpProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lPa
switch(msg)
{
case WM_COMMAND:
- if((HIWORD(wParam)==STN_CLICKED) && (CallService(MS_POPUP_GETPLUGINDATA,(WPARAM)hWnd,(LPARAM)&PluginParam))) //if clicked and it's new mail popup window
+ if ((HIWORD(wParam)==STN_CLICKED) && (CallService(MS_POPUP_GETPLUGINDATA,(WPARAM)hWnd,(LPARAM)&PluginParam))) //if clicked and it's new mail popup window
{
PROCESS_INFORMATION pi;
STARTUPINFOW si;
@@ -76,25 +59,25 @@ LRESULT CALLBACK BadConnectPopUpProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lPa
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"PopUpProc:LEFTCLICK:ActualAccountSO-read wait\n");
#endif
- if(WAIT_OBJECT_0==WaitToReadFcn(ActualAccount->AccountAccessSO))
+ if (WAIT_OBJECT_0==WaitToReadFcn(ActualAccount->AccountAccessSO))
{
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"PopUpProc:LEFTCLICK:ActualAccountSO-read enter\n");
#endif
- if(ActualAccount->BadConnectN.App!=NULL)
+ if (ActualAccount->BadConnectN.App!=NULL)
{
WCHAR *Command;
- if(ActualAccount->BadConnectN.AppParam!=NULL)
+ if (ActualAccount->BadConnectN.AppParam!=NULL)
Command=new WCHAR[wcslen(ActualAccount->BadConnectN.App)+wcslen(ActualAccount->BadConnectN.AppParam)+6];
else
Command=new WCHAR[wcslen(ActualAccount->BadConnectN.App)+6];
- if(Command!=NULL)
+ if (Command!=NULL)
{
lstrcpyW(Command,L"\"");
lstrcatW(Command,ActualAccount->BadConnectN.App);
lstrcatW(Command,L"\" ");
- if(ActualAccount->BadConnectN.AppParam!=NULL)
+ if (ActualAccount->BadConnectN.AppParam!=NULL)
lstrcatW(Command,ActualAccount->BadConnectN.AppParam);
CreateProcessW(NULL,Command,NULL,NULL,FALSE,NORMAL_PRIORITY_CLASS,NULL,NULL,&si,&pi);
delete[] Command;
@@ -143,18 +126,18 @@ LRESULT CALLBACK DlgProcYAMNBadConnection(HWND hDlg,UINT msg,WPARAM wParam,LPARA
{
BOOL ShowPopUp,ShowMsg,ShowIco;
HACCOUNT ActualAccount;
- DWORD ErrorCode;
- char *TitleStrA;
+ DWORD ErrorCode;
+ char* TitleStrA;
char *Message1A=NULL;
WCHAR *Message1W=NULL;
- POPUPDATAEX BadConnectPopUp;
+ POPUPDATAT BadConnectPopUp;
ActualAccount=((struct BadConnectionParam *)lParam)->account;
ErrorCode=((struct BadConnectionParam *)lParam)->errcode;
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"BadConnect:ActualAccountSO-read wait\n");
#endif
- if(WAIT_OBJECT_0!=WaitToReadFcn(ActualAccount->AccountAccessSO))
+ if (WAIT_OBJECT_0!=WaitToReadFcn(ActualAccount->AccountAccessSO))
{
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"BadConnect:ActualAccountSO-read wait failed\n");
@@ -164,14 +147,14 @@ LRESULT CALLBACK DlgProcYAMNBadConnection(HWND hDlg,UINT msg,WPARAM wParam,LPARA
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"BadConnect:ActualAccountSO-read enter\n");
#endif
- TitleStrA=new char[strlen(ActualAccount->Name)+strlen(Translate(BADCONNECTTITLE))];
- sprintf(TitleStrA,Translate(BADCONNECTTITLE),ActualAccount->Name);
+ TitleStrA = new char[strlen(ActualAccount->Name)+strlen(Translate(BADCONNECTTITLE))];
+ wsprintfA(TitleStrA,Translate(BADCONNECTTITLE),ActualAccount->Name);
ShowPopUp=ActualAccount->BadConnectN.Flags & YAMN_ACC_POP;
ShowMsg=ActualAccount->BadConnectN.Flags & YAMN_ACC_MSG;
ShowIco=ActualAccount->BadConnectN.Flags & YAMN_ACC_ICO;
- if(ShowPopUp)
+ if (ShowPopUp)
{
BadConnectPopUp.lchContact=ActualAccount;
BadConnectPopUp.lchIcon=hYamnIcons[3];
@@ -181,48 +164,48 @@ LRESULT CALLBACK DlgProcYAMNBadConnection(HWND hDlg,UINT msg,WPARAM wParam,LPARA
BadConnectPopUp.PluginWindowProc=(WNDPROC)BadConnectPopUpProc;
BadConnectPopUp.PluginData=0; //it's bad connect popup
- lstrcpyn(BadConnectPopUp.lpzContactName,ActualAccount->Name,sizeof(BadConnectPopUp.lpzContactName));
+ lstrcpyn(BadConnectPopUp.lptzContactName,_A2T(ActualAccount->Name),SIZEOF(BadConnectPopUp.lptzContactName));
}
- if(ActualAccount->Plugin->Fcn!=NULL && ActualAccount->Plugin->Fcn->GetErrorStringWFcnPtr!=NULL)
+ if (ActualAccount->Plugin->Fcn!=NULL && ActualAccount->Plugin->Fcn->GetErrorStringWFcnPtr!=NULL)
{
Message1W=ActualAccount->Plugin->Fcn->GetErrorStringWFcnPtr(ErrorCode);
SendMessageW(GetDlgItem(hDlg,IDC_STATICMSG),WM_SETTEXT,(WPARAM)0,(LPARAM)Message1W);
- WideCharToMultiByte(CP_ACP,0,Message1W,-1,(char *)BadConnectPopUp.lpzText,sizeof(BadConnectPopUp.lpzText),NULL,NULL);
- if(ShowPopUp)
- CallService(MS_POPUP_ADDPOPUPEX,(WPARAM)&BadConnectPopUp,0);
+ lstrcpyn(BadConnectPopUp.lptzText,Message1W,sizeof(BadConnectPopUp.lptzText));
+ if (ShowPopUp)
+ PUAddPopUpT(&BadConnectPopUp);
}
- else if(ActualAccount->Plugin->Fcn!=NULL && ActualAccount->Plugin->Fcn->GetErrorStringAFcnPtr!=NULL)
+ else if (ActualAccount->Plugin->Fcn!=NULL && ActualAccount->Plugin->Fcn->GetErrorStringAFcnPtr!=NULL)
{
- Message1A=ActualAccount->Plugin->Fcn->GetErrorStringAFcnPtr(ErrorCode);
- SendMessageA(GetDlgItem(hDlg,IDC_STATICMSG),WM_SETTEXT,(WPARAM)0,(LPARAM)Message1A);
- lstrcpyn(BadConnectPopUp.lpzText,Message1A,sizeof(BadConnectPopUp.lpzText));
- if(ShowPopUp)
- CallService(MS_POPUP_ADDPOPUPEX,(WPARAM)&BadConnectPopUp,0);
+ Message1W=ActualAccount->Plugin->Fcn->GetErrorStringWFcnPtr(ErrorCode);
+ SendMessageW(GetDlgItem(hDlg,IDC_STATICMSG),WM_SETTEXT,(WPARAM)0,(LPARAM)Message1A);
+ lstrcpyn(BadConnectPopUp.lptzText,Message1W,sizeof(BadConnectPopUp.lptzText));
+ if (ShowPopUp)
+ PUAddPopUpT(&BadConnectPopUp);
}
else
{
- Message1A=Translate("Unknown error");
- SendMessageA(GetDlgItem(hDlg,IDC_STATICMSG),WM_SETTEXT,(WPARAM)0,(LPARAM)Message1A);
- lstrcpyn(BadConnectPopUp.lpzText,Message1A,sizeof(BadConnectPopUp.lpzText));
- if(ShowPopUp)
- CallService(MS_POPUP_ADDPOPUPEX,(WPARAM)&BadConnectPopUp,0);
+ Message1W=TranslateT("Unknown error");
+ SendMessageW(GetDlgItem(hDlg,IDC_STATICMSG),WM_SETTEXT,(WPARAM)0,(LPARAM)Message1A);
+ lstrcpyn(BadConnectPopUp.lptzText,Message1W,sizeof(BadConnectPopUp.lptzText));
+ if (ShowPopUp)
+ PUAddPopUpT(&BadConnectPopUp);
}
- if(!ShowMsg && !ShowIco)
+ if (!ShowMsg && !ShowIco)
DestroyWindow(hDlg);
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"BadConnect:ActualAccountSO-read done\n");
#endif
ReadDoneFcn(ActualAccount->AccountAccessSO);
- SendMessage(hDlg,WM_SETTEXT,(WPARAM)0,(LPARAM)TitleStrA);
+ SetWindowTextA(hDlg, TitleStrA);
delete[] TitleStrA;
- if(Message1A!=NULL)
+ if (Message1A!=NULL)
delete[] Message1A;
- if(ActualAccount->Plugin->Fcn!=NULL && ActualAccount->Plugin->Fcn->DeleteErrorStringFcnPtr!=NULL && Message1A!=NULL)
+ if (ActualAccount->Plugin->Fcn!=NULL && ActualAccount->Plugin->Fcn->DeleteErrorStringFcnPtr!=NULL && Message1A!=NULL)
ActualAccount->Plugin->Fcn->DeleteErrorStringFcnPtr(Message1A);
- if(ActualAccount->Plugin->Fcn!=NULL && ActualAccount->Plugin->Fcn->DeleteErrorStringFcnPtr!=NULL && Message1W!=NULL)
+ if (ActualAccount->Plugin->Fcn!=NULL && ActualAccount->Plugin->Fcn->DeleteErrorStringFcnPtr!=NULL && Message1W!=NULL)
ActualAccount->Plugin->Fcn->DeleteErrorStringFcnPtr(Message1W);
return 0;
}
@@ -285,8 +268,8 @@ DWORD WINAPI BadConnection(LPVOID Param)
HACCOUNT ActualAccount;
struct BadConnectionParam MyParam;
NOTIFYICONDATA nid;
- TCHAR *NotIconText=Translate(" - connection error");
- TCHAR *src,*dest;
+ char *NotIconText = Translate(" - connection error"), *src;
+ TCHAR *dest;
int i;
MyParam=*(struct BadConnectionParam *)Param;
@@ -316,7 +299,7 @@ DWORD WINAPI BadConnection(LPVOID Param)
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"BadConnect:ActualAccountSO-read wait\n");
#endif
- if(WAIT_OBJECT_0!=WaitToReadFcn(ActualAccount->AccountAccessSO))
+ if (WAIT_OBJECT_0!=WaitToReadFcn(ActualAccount->AccountAccessSO))
{
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"BadConnect:ActualAccountSO-read wait failed\n");
@@ -330,11 +313,11 @@ DWORD WINAPI BadConnection(LPVOID Param)
for(src=NotIconText;(*src!=(TCHAR)0) && (i+1<sizeof(nid.szTip));*dest++=*src++);
*dest=(TCHAR)0;
- if(ActualAccount->BadConnectN.Flags & YAMN_ACC_SND)
+ if (ActualAccount->BadConnectN.Flags & YAMN_ACC_SND)
CallService(MS_SKIN_PLAYSOUND,0,(LPARAM)YAMN_CONNECTFAILSOUND);
- if(ActualAccount->BadConnectN.Flags & YAMN_ACC_MSG)
+ if (ActualAccount->BadConnectN.Flags & YAMN_ACC_MSG)
ShowWindow(hBadConnect,SW_SHOWNORMAL);
- if(ActualAccount->BadConnectN.Flags & YAMN_ACC_ICO)
+ if (ActualAccount->BadConnectN.Flags & YAMN_ACC_ICO)
Shell_NotifyIcon(NIM_ADD,&nid);
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"BadConnect:ActualAccountSO-read done\n");
@@ -349,7 +332,7 @@ DWORD WINAPI BadConnection(LPVOID Param)
}
// now, write to file. Why? Because we want to write when was new mail last checked
- if((ActualAccount->Plugin->Fcn!=NULL) && (ActualAccount->Plugin->Fcn->WriteAccountsFcnPtr!=NULL) && ActualAccount->AbleToWork)
+ if ((ActualAccount->Plugin->Fcn!=NULL) && (ActualAccount->Plugin->Fcn->WriteAccountsFcnPtr!=NULL) && ActualAccount->AbleToWork)
ActualAccount->Plugin->Fcn->WriteAccountsFcnPtr();
}
__finally
@@ -370,15 +353,15 @@ INT_PTR RunBadConnectionSvc(WPARAM wParam,LPARAM lParam)
HANDLE ThreadRunningEV;
PYAMN_BADCONNECTIONPARAM Param=(PYAMN_BADCONNECTIONPARAM)wParam;
- if((DWORD)lParam!=YAMN_BADCONNECTIONVERSION)
+ if ((DWORD)lParam!=YAMN_BADCONNECTIONVERSION)
return 0;
- if(NULL!=(ThreadRunningEV=CreateEvent(NULL,FALSE,FALSE,NULL)))
+ if (NULL!=(ThreadRunningEV=CreateEvent(NULL,FALSE,FALSE,NULL)))
{
HANDLE NewThread;
Param->ThreadRunningEV=ThreadRunningEV;
- if(NULL!=(NewThread=CreateThread(NULL,0,BadConnection,Param,0,&tid)))
+ if (NULL!=(NewThread=CreateThread(NULL,0,BadConnection,Param,0,&tid)))
{
WaitForSingleObject(ThreadRunningEV,INFINITE);
CloseHandle(NewThread);
diff --git a/plugins/YAMN/browser/mailbrowser.cpp b/plugins/YAMN/browser/mailbrowser.cpp
index 72e408e779..96d47d7962 100644
--- a/plugins/YAMN/browser/mailbrowser.cpp
+++ b/plugins/YAMN/browser/mailbrowser.cpp
@@ -16,90 +16,13 @@
#define _WIN32_WINNT 0x0501
#endif
-
-#include <windows.h>
-#include <stdio.h>
-#include <stddef.h>
-#undef UNICODE
-#include <newpluginapi.h>
-#include <m_utils.h>
-#include <m_skin.h>
-#include <m_langpack.h>
-#include <m_database.h>
-#include <m_clist.h>
-#include <m_popup.h>
-#include "m_kbdnotify.h"
-#include "../main.h"
-#include "m_protoplugin.h"
-#include "m_account.h"
-#include "../debug.h"
-#include "m_messages.h"
-#include "m_mails.h"
-#include "m_yamn.h"
-#include "../resources/resource.h"
-#include <win2k.h>
-
-#undef UNICODE
-#include "m_browser.h"
-
-#ifndef UNICODE
- #define UNICODE
- #define _UNICODE
- #include <commctrl.h> //we need to have unicode commctrl.h
- #include <stdio.h>
- #undef _UNICODE
- #undef UNICODE
-#else
- #include <commctrl.h>
- #undef _UNICODE
- #undef UNICODE
-#endif
-
-
-#ifndef SIZEOF
- #ifdef UNICODE
- #define SIZEOF(x) (sizeof(x)/sizeof(WCHAR))
- #else
- #define SIZEOF(x) sizeof(x)
- #endif
-#endif
+#include "../yamn.h"
+#include "../main.h"
#define TIMER_FLASHING 0x09061979
#define MAILBROWSER_MINXSIZE 200 //min size of mail browser window
#define MAILBROWSER_MINYSIZE 130
-//- imported ---------------------------------------------------------------------------------------
-//--------------------------------------------------------------------------------------------------
-extern char *ProtoName;
-extern HYAMNPROTOPLUGIN POP3Plugin;
-
-extern HANDLE hNewMailHook;
-extern HANDLE WriteToFileEV;
-extern YAMN_VARIABLES YAMNVar;
-extern HICON hYamnIcons[];
-//From synchro.cpp
-extern DWORD WINAPI WaitToWriteFcn(PSWMRG SObject,PSCOUNTER SCounter=NULL);
-extern void WINAPI WriteDoneFcn(PSWMRG SObject,PSCOUNTER SCounter=NULL);
-extern DWORD WINAPI WaitToReadFcn(PSWMRG SObject);
-extern void WINAPI ReadDoneFcn(PSWMRG SObject);
-extern DWORD WINAPI SCIncFcn(PSCOUNTER SCounter);
-extern DWORD WINAPI SCDecFcn(PSCOUNTER SCounter);
-//From mails.cpp
-extern void WINAPI DeleteMessageFromQueueFcn(HYAMNMAIL *From,HYAMNMAIL Which,int mode);
-extern void WINAPI SetRemoveFlagsInQueueFcn(HYAMNMAIL From,DWORD FlagsSet,DWORD FlagsNotSet,DWORD FlagsToSet,int mode);
-//From mime.cpp
-void ExtractHeader(struct CMimeItem *items,int &CP,struct CHeader *head);
-void ExtractShortHeader(struct CMimeItem *items,struct CShortHeader *head);
-void DeleteHeaderContent(struct CHeader *head);
-void DeleteShortHeaderContent(struct CShortHeader *head);
-char *ExtractFromContentType(char *ContentType,char *value);
-WCHAR *ParseMultipartBody(char *src, char *bond);
-//From account.cpp
-void WINAPI GetStatusFcn(HACCOUNT Which,char *Value);
-//from decode.cpp
-int DecodeQuotedPrintable(char *Src,char *Dst,int DstLen, BOOL isQ);
-int DecodeBase64(char *Src,char *Dst,int DstLen);
-
//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
char* s_MonthNames[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
@@ -287,110 +210,110 @@ inline HACCOUNT GetWindowAccount(HWND hDlg)
{
struct CMailWinUserInfo *mwui;
- if(NULL==(mwui=(struct CMailWinUserInfo *)GetWindowLongPtr(hDlg,DWLP_USER)))
+ if (NULL==(mwui=(struct CMailWinUserInfo *)GetWindowLongPtr(hDlg,DWLP_USER)))
return NULL;
return mwui->Account;
}
void IncrementMailCounters(HYAMNMAIL msgq,struct CMailNumbers *MN)
{
- if(msgq->Flags & YAMN_MSG_VIRTUAL)
+ if (msgq->Flags & YAMN_MSG_VIRTUAL)
MN->Virtual.Total++;
else
MN->Real.Total++;
- if(msgq->Flags & YAMN_MSG_NEW)
- if(msgq->Flags & YAMN_MSG_VIRTUAL)
+ if (msgq->Flags & YAMN_MSG_NEW)
+ if (msgq->Flags & YAMN_MSG_VIRTUAL)
MN->Virtual.New++;
else
MN->Real.New++;
- if(msgq->Flags & YAMN_MSG_UNSEEN)
- if(msgq->Flags & YAMN_MSG_VIRTUAL)
+ if (msgq->Flags & YAMN_MSG_UNSEEN)
+ if (msgq->Flags & YAMN_MSG_VIRTUAL)
MN->Virtual.UnSeen++;
else
MN->Real.UnSeen++;
- if((msgq->Flags & (YAMN_MSG_UNSEEN | YAMN_MSG_BROWSER)) == (YAMN_MSG_UNSEEN | YAMN_MSG_BROWSER))
- if(msgq->Flags & YAMN_MSG_VIRTUAL)
+ if ((msgq->Flags & (YAMN_MSG_UNSEEN | YAMN_MSG_BROWSER)) == (YAMN_MSG_UNSEEN | YAMN_MSG_BROWSER))
+ if (msgq->Flags & YAMN_MSG_VIRTUAL)
MN->Virtual.BrowserUC++;
else
MN->Real.BrowserUC++;
- if(msgq->Flags & YAMN_MSG_DISPLAY)
- if(msgq->Flags & YAMN_MSG_VIRTUAL)
+ if (msgq->Flags & YAMN_MSG_DISPLAY)
+ if (msgq->Flags & YAMN_MSG_VIRTUAL)
MN->Virtual.Display++;
else
MN->Real.Display++;
- if((msgq->Flags & (YAMN_MSG_DISPLAYC | YAMN_MSG_DISPLAY)) == (YAMN_MSG_DISPLAYC | YAMN_MSG_DISPLAY))
- if(msgq->Flags & YAMN_MSG_VIRTUAL)
+ if ((msgq->Flags & (YAMN_MSG_DISPLAYC | YAMN_MSG_DISPLAY)) == (YAMN_MSG_DISPLAYC | YAMN_MSG_DISPLAY))
+ if (msgq->Flags & YAMN_MSG_VIRTUAL)
MN->Virtual.DisplayTC++;
else
MN->Real.DisplayTC++;
- if((msgq->Flags & (YAMN_MSG_UNSEEN | YAMN_MSG_DISPLAYC | YAMN_MSG_DISPLAY)) == (YAMN_MSG_UNSEEN | YAMN_MSG_DISPLAYC | YAMN_MSG_DISPLAY))
- if(msgq->Flags & YAMN_MSG_VIRTUAL)
+ if ((msgq->Flags & (YAMN_MSG_UNSEEN | YAMN_MSG_DISPLAYC | YAMN_MSG_DISPLAY)) == (YAMN_MSG_UNSEEN | YAMN_MSG_DISPLAYC | YAMN_MSG_DISPLAY))
+ if (msgq->Flags & YAMN_MSG_VIRTUAL)
MN->Virtual.DisplayUC++;
else
MN->Real.DisplayUC++;
- if(msgq->Flags & YAMN_MSG_POPUP)
- if(msgq->Flags & YAMN_MSG_VIRTUAL)
+ if (msgq->Flags & YAMN_MSG_POPUP)
+ if (msgq->Flags & YAMN_MSG_VIRTUAL)
MN->Virtual.PopUp++;
else
MN->Real.PopUp++;
- if((msgq->Flags & YAMN_MSG_POPUPC) == YAMN_MSG_POPUPC)
- if(msgq->Flags & YAMN_MSG_VIRTUAL)
+ if ((msgq->Flags & YAMN_MSG_POPUPC) == YAMN_MSG_POPUPC)
+ if (msgq->Flags & YAMN_MSG_VIRTUAL)
MN->Virtual.PopUpTC++;
else
MN->Real.PopUpTC++;
- if((msgq->Flags & (YAMN_MSG_NEW | YAMN_MSG_POPUPC)) == (YAMN_MSG_NEW | YAMN_MSG_POPUPC))
- if(msgq->Flags & YAMN_MSG_VIRTUAL)
+ if ((msgq->Flags & (YAMN_MSG_NEW | YAMN_MSG_POPUPC)) == (YAMN_MSG_NEW | YAMN_MSG_POPUPC))
+ if (msgq->Flags & YAMN_MSG_VIRTUAL)
MN->Virtual.PopUpNC++;
else
MN->Real.PopUpNC++;
- if((msgq->Flags & (YAMN_MSG_NEW | YAMN_MSG_POPUP)) == (YAMN_MSG_NEW | YAMN_MSG_POPUP))
- if(msgq->Flags & YAMN_MSG_VIRTUAL)
+ if ((msgq->Flags & (YAMN_MSG_NEW | YAMN_MSG_POPUP)) == (YAMN_MSG_NEW | YAMN_MSG_POPUP))
+ if (msgq->Flags & YAMN_MSG_VIRTUAL)
MN->Virtual.PopUpRun++;
else
MN->Real.PopUpRun++;
- if((msgq->Flags & YAMN_MSG_NEW) && YAMN_MSG_SPAML(msgq->Flags,YAMN_MSG_SPAML2))
- if(msgq->Flags & YAMN_MSG_VIRTUAL)
+ if ((msgq->Flags & YAMN_MSG_NEW) && YAMN_MSG_SPAML(msgq->Flags,YAMN_MSG_SPAML2))
+ if (msgq->Flags & YAMN_MSG_VIRTUAL)
MN->Virtual.PopUpSL2NC++;
else
MN->Real.PopUpSL2NC++;
- if((msgq->Flags & YAMN_MSG_NEW) && YAMN_MSG_SPAML(msgq->Flags,YAMN_MSG_SPAML3))
- if(msgq->Flags & YAMN_MSG_VIRTUAL)
+ if ((msgq->Flags & YAMN_MSG_NEW) && YAMN_MSG_SPAML(msgq->Flags,YAMN_MSG_SPAML3))
+ if (msgq->Flags & YAMN_MSG_VIRTUAL)
MN->Virtual.PopUpSL3NC++;
else
MN->Real.PopUpSL3NC++;
-/* if(msgq->MailData->Flags & YAMN_MSG_SYSTRAY)
- if(msgq->Flags & YAMN_MSG_VIRTUAL)
+/* if (msgq->MailData->Flags & YAMN_MSG_SYSTRAY)
+ if (msgq->Flags & YAMN_MSG_VIRTUAL)
MN->Virtual.SysTray++;
else
MN->Real.SysTray++;
-*/ if((msgq->Flags & (YAMN_MSG_UNSEEN | YAMN_MSG_SYSTRAY)) == (YAMN_MSG_UNSEEN|YAMN_MSG_SYSTRAY))
- if(msgq->Flags & YAMN_MSG_VIRTUAL)
+*/ if ((msgq->Flags & (YAMN_MSG_UNSEEN | YAMN_MSG_SYSTRAY)) == (YAMN_MSG_UNSEEN|YAMN_MSG_SYSTRAY))
+ if (msgq->Flags & YAMN_MSG_VIRTUAL)
MN->Virtual.SysTrayUC++;
else
MN->Real.SysTrayUC++;
-/* if(msgq->MailData->Flags & YAMN_MSG_SOUND)
- if(msgq->Flags & YAMN_MSG_VIRTUAL)
+/* if (msgq->MailData->Flags & YAMN_MSG_SOUND)
+ if (msgq->Flags & YAMN_MSG_VIRTUAL)
MN->Virtual.Sound++;
else
MN->Real.Sound++;
-*/ if((msgq->Flags & (YAMN_MSG_NEW|YAMN_MSG_SOUND)) == (YAMN_MSG_NEW|YAMN_MSG_SOUND))
- if(msgq->Flags & YAMN_MSG_VIRTUAL)
+*/ if ((msgq->Flags & (YAMN_MSG_NEW|YAMN_MSG_SOUND)) == (YAMN_MSG_NEW|YAMN_MSG_SOUND))
+ if (msgq->Flags & YAMN_MSG_VIRTUAL)
MN->Virtual.SoundNC++;
else
MN->Real.SoundNC++;
-/* if(msgq->MailData->Flags & YAMN_MSG_APP)
- if(msgq->Flags & YAMN_MSG_VIRTUAL)
+/* if (msgq->MailData->Flags & YAMN_MSG_APP)
+ if (msgq->Flags & YAMN_MSG_VIRTUAL)
MN->Virtual.App++;
else
MN->Real.App++;
-*/ if((msgq->Flags & (YAMN_MSG_NEW|YAMN_MSG_APP)) == (YAMN_MSG_NEW|YAMN_MSG_APP))
- if(msgq->Flags & YAMN_MSG_VIRTUAL)
+*/ if ((msgq->Flags & (YAMN_MSG_NEW|YAMN_MSG_APP)) == (YAMN_MSG_NEW|YAMN_MSG_APP))
+ if (msgq->Flags & YAMN_MSG_VIRTUAL)
MN->Virtual.AppNC++;
else
MN->Real.AppNC++;
- if((msgq->Flags & (YAMN_MSG_NEW|YAMN_MSG_NEVENT)) == (YAMN_MSG_NEW|YAMN_MSG_NEVENT))
- if(msgq->Flags & YAMN_MSG_VIRTUAL)
+ if ((msgq->Flags & (YAMN_MSG_NEW|YAMN_MSG_NEVENT)) == (YAMN_MSG_NEW|YAMN_MSG_NEVENT))
+ if (msgq->Flags & YAMN_MSG_VIRTUAL)
MN->Virtual.EventNC++;
else
MN->Real.EventNC++;
@@ -412,7 +335,7 @@ int UpdateMails(HWND hDlg,HACCOUNT ActualAccount,DWORD nflags,DWORD nnflags)
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"UpdateMails:ActualAccountSO-read wait\n");
#endif
- if(WAIT_OBJECT_0!=WaitToReadFcn(ActualAccount->AccountAccessSO))
+ if (WAIT_OBJECT_0!=WaitToReadFcn(ActualAccount->AccountAccessSO))
{
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"UpdateMails:ActualAccountSO-read wait failed\n");
@@ -428,7 +351,7 @@ int UpdateMails(HWND hDlg,HACCOUNT ActualAccount,DWORD nflags,DWORD nnflags)
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"UpdateMails:ActualAccountMsgsSO-write wait\n");
#endif
- if(WAIT_OBJECT_0!=WaitToWriteFcn(ActualAccount->MessagesAccessSO))
+ if (WAIT_OBJECT_0!=WaitToWriteFcn(ActualAccount->MessagesAccessSO))
{
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"UpdateMails:ActualAccountMsgsSO-write wait failed\n");
@@ -447,10 +370,10 @@ int UpdateMails(HWND hDlg,HACCOUNT ActualAccount,DWORD nflags,DWORD nnflags)
for(msgq=(HYAMNMAIL)ActualAccount->Mails;msgq!=NULL;msgq=msgq->Next)
{
- if(!LoadedMailData(msgq)) //check if mail is already in memory
+ if (!LoadedMailData(msgq)) //check if mail is already in memory
{
Loaded=false;
- if(NULL==LoadMailData(msgq)) //if we could not load mail to memory, consider this mail deleted and do not display it
+ if (NULL==LoadMailData(msgq)) //if we could not load mail to memory, consider this mail deleted and do not display it
continue;
}
else
@@ -458,11 +381,11 @@ int UpdateMails(HWND hDlg,HACCOUNT ActualAccount,DWORD nflags,DWORD nnflags)
IncrementMailCounters(msgq,&MN);
- if(!Loaded)
+ if (!Loaded)
UnloadMailData(msgq); //do not keep data for mail in memory
}
- if(mwui!=NULL)
+ if (mwui!=NULL)
mwui->UpdateMailsMessagesAccess=TRUE;
//Now we are going to check if extracting data from mail headers are needed.
@@ -480,24 +403,22 @@ int UpdateMails(HWND hDlg,HACCOUNT ActualAccount,DWORD nflags,DWORD nnflags)
RunMailBrowser=TRUE;
else RunMailBrowser=FALSE;
- if( (nflags & YAMN_ACC_POP) &&
+ if ( (nflags & YAMN_ACC_POP) &&
(ActualAccount->Flags & YAMN_ACC_POPN) &&
(MN.Real.PopUpNC+MN.Virtual.PopUpNC) ) //if some popups with mails are needed to show
RunPopUps=TRUE;
else RunPopUps=FALSE;
- if(RunMailBrowser)
+ if (RunMailBrowser)
ChangeExistingMailStatus(GetDlgItem(hDlg,IDC_LISTMAILS),ActualAccount,&MN);
- if(RunMailBrowser || RunPopUps)
+ if (RunMailBrowser || RunPopUps)
AddNewMailsToListView(hDlg==NULL ? NULL : GetDlgItem(hDlg,IDC_LISTMAILS),ActualAccount,&MN,nflags);
- if(RunMailBrowser)
+ if (RunMailBrowser)
{
- WCHAR *TitleStrW;
- char *TitleStrA;
size_t len = strlen(ActualAccount->Name)+strlen(Translate(MAILBROWSERTITLE))+10; //+10 chars for numbers
- TitleStrA=new char[len];
- TitleStrW=new WCHAR[len];
+ char *TitleStrA=new char[len];
+ WCHAR *TitleStrW=new WCHAR[len];
sprintf(TitleStrA,Translate(MAILBROWSERTITLE),ActualAccount->Name,MN.Real.DisplayUC+MN.Virtual.DisplayUC,MN.Real.Display+MN.Virtual.Display);
MultiByteToWideChar(CP_ACP,MB_USEGLYPHCHARS,TitleStrA,-1,TitleStrW,(int)strlen(TitleStrA)+1);
@@ -517,10 +438,10 @@ int UpdateMails(HWND hDlg,HACCOUNT ActualAccount,DWORD nflags,DWORD nnflags)
#endif
SetRemoveFlagsInQueueFcn((HYAMNMAIL)ActualAccount->Mails,YAMN_MSG_NEW,0,YAMN_MSG_NEW,YAMN_FLAG_REMOVE); //rempve the new flag
- if(!RunMailBrowser)
+ if (!RunMailBrowser)
SetRemoveFlagsInQueueFcn((HYAMNMAIL)ActualAccount->Mails,YAMN_MSG_UNSEEN,YAMN_MSG_STAYUNSEEN,YAMN_MSG_UNSEEN,YAMN_FLAG_REMOVE); //remove the unseen flag when it was not displayed and it has not "stay unseen" flag set
- if(mwui!=NULL)
+ if (mwui!=NULL)
{
mwui->UpdateMailsMessagesAccess=FALSE;
mwui->RunFirstTime=FALSE;
@@ -532,9 +453,9 @@ int UpdateMails(HWND hDlg,HACCOUNT ActualAccount,DWORD nflags,DWORD nnflags)
WriteDoneFcn(ActualAccount->MessagesAccessSO);
ReadDoneFcn(ActualAccount->AccountAccessSO);
- if(RunMailBrowser)
+ if (RunMailBrowser)
UpdateWindow(GetDlgItem(hDlg,IDC_LISTMAILS));
- else if(hDlg!=NULL)
+ else if (hDlg!=NULL)
DestroyWindow(hDlg);
return 1;
@@ -553,13 +474,13 @@ int ChangeExistingMailStatus(HWND hListView,HACCOUNT ActualAccount,struct CMailN
{
item.iItem=i;
item.iSubItem=0;
- if(TRUE==ListView_GetItem(hListView,&item))
+ if (TRUE==ListView_GetItem(hListView,&item))
mail=(HYAMNMAIL)item.lParam;
else
continue;
for(msgq=(HYAMNMAIL)ActualAccount->Mails;(msgq!=NULL)&&(msgq!=mail);msgq=msgq->Next); //found the same mail in account queue
- if(msgq==NULL) //if mail was not found
- if(TRUE==ListView_DeleteItem(hListView,i))
+ if (msgq==NULL) //if mail was not found
+ if (TRUE==ListView_DeleteItem(hListView,i))
{
in--;i--;
continue;
@@ -573,7 +494,7 @@ void MimeDateToLocalizedDateTime(char *datein, WCHAR *dateout, int lendateout);
int AddNewMailsToListView(HWND hListView,HACCOUNT ActualAccount,struct CMailNumbers *MN,DWORD nflags)
{
HYAMNMAIL msgq;
- POPUPDATAEX NewMailPopUp = {0};
+ POPUPDATAT NewMailPopUp = {0};
WCHAR *FromStr;
WCHAR SizeStr[20];
@@ -589,7 +510,7 @@ int AddNewMailsToListView(HWND hListView,HACCOUNT ActualAccount,struct CMailNumb
ZeroMemory(&item,sizeof(item));
ZeroMemory(&UnicodeHeader,sizeof(UnicodeHeader));
- if(hListView!=NULL)
+ if (hListView!=NULL)
{
item.mask=LVIF_TEXT | LVIF_PARAM;
item.iItem=0;
@@ -613,10 +534,10 @@ int AddNewMailsToListView(HWND hListView,HACCOUNT ActualAccount,struct CMailNumb
Extracted=FALSE;FromStr=NULL;FromStrNew=FALSE;
- if(hListView!=NULL)
+ if (hListView!=NULL)
{
fi.lParam=(LPARAM)msgq;
- if(-1!=(foundi=ListView_FindItem(hListView,-1,&fi))) //if mail is already in window
+ if (-1!=(foundi=ListView_FindItem(hListView,-1,&fi))) //if mail is already in window
{
lfoundi=foundi;
continue; //do not insert any item
@@ -626,36 +547,36 @@ int AddNewMailsToListView(HWND hListView,HACCOUNT ActualAccount,struct CMailNumb
item.lParam=(LPARAM)msgq;
}
- if(!LoadedMailData(msgq)) //check if mail is already in memory
+ if (!LoadedMailData(msgq)) //check if mail is already in memory
{
Loaded=false;
- if(NULL==LoadMailData(msgq)) //if we could not load mail to memory, consider this mail deleted and do not display it
+ if (NULL==LoadMailData(msgq)) //if we could not load mail to memory, consider this mail deleted and do not display it
continue;
}
else
Loaded=true;
- if(((hListView!=NULL) && (msgq->Flags & YAMN_MSG_DISPLAY)) ||
+ if (((hListView!=NULL) && (msgq->Flags & YAMN_MSG_DISPLAY)) ||
((nflags & YAMN_ACC_POP) && (ActualAccount->Flags & YAMN_ACC_POPN) && (msgq->Flags & YAMN_MSG_POPUP) && (msgq->Flags & YAMN_MSG_NEW)))
{
- if(!Extracted) ExtractHeader(msgq->MailData->TranslatedHeader,msgq->MailData->CP,&UnicodeHeader);
+ if (!Extracted) ExtractHeader(msgq->MailData->TranslatedHeader,msgq->MailData->CP,&UnicodeHeader);
Extracted=TRUE;
- if((UnicodeHeader.From!=NULL) && (UnicodeHeader.FromNick!=NULL))
+ if ((UnicodeHeader.From!=NULL) && (UnicodeHeader.FromNick!=NULL))
{
FromStr=new WCHAR[wcslen(UnicodeHeader.From)+wcslen(UnicodeHeader.FromNick)+4];
swprintf(FromStr,L"%s <%s>",UnicodeHeader.FromNick,UnicodeHeader.From);
FromStrNew=TRUE;
}
- else if(UnicodeHeader.From!=NULL)
+ else if (UnicodeHeader.From!=NULL)
FromStr=UnicodeHeader.From;
- else if(UnicodeHeader.FromNick!=NULL)
+ else if (UnicodeHeader.FromNick!=NULL)
FromStr=UnicodeHeader.FromNick;
- else if(UnicodeHeader.ReturnPath!=NULL)
+ else if (UnicodeHeader.ReturnPath!=NULL)
FromStr=UnicodeHeader.ReturnPath;
- if(NULL==FromStr)
+ if (NULL==FromStr)
{
FromStr=L"";
FromStrNew=FALSE;
@@ -663,7 +584,7 @@ int AddNewMailsToListView(HWND hListView,HACCOUNT ActualAccount,struct CMailNumb
}
- if((hListView!=NULL) && (msgq->Flags & YAMN_MSG_DISPLAY))
+ if ((hListView!=NULL) && (msgq->Flags & YAMN_MSG_DISPLAY))
{
item.iSubItem=0;
item.pszText=FromStr;
@@ -690,34 +611,34 @@ int AddNewMailsToListView(HWND hListView,HACCOUNT ActualAccount,struct CMailNumb
SendMessageW(hListView,LVM_SETITEMTEXTW,(WPARAM)item.iItem,(LPARAM)&item);
}
- if((nflags & YAMN_ACC_POP) && (ActualAccount->Flags & YAMN_ACC_POPN) && (msgq->Flags & YAMN_MSG_POPUP) && (msgq->Flags & YAMN_MSG_NEW))
+ if ((nflags & YAMN_ACC_POP) && (ActualAccount->Flags & YAMN_ACC_POPN) && (msgq->Flags & YAMN_MSG_POPUP) && (msgq->Flags & YAMN_MSG_NEW))
{
- WideCharToMultiByte(CP_ACP,0,FromStr,-1,(char *)NewMailPopUp.lpzContactName,sizeof(NewMailPopUp.lpzContactName),NULL,NULL);
- if(!WideCharToMultiByte(CP_ACP,0,UnicodeHeader.Subject,-1,(char *)NewMailPopUp.lpzText,sizeof(NewMailPopUp.lpzText),NULL,NULL))
- NewMailPopUp.lpzText[0]=0;
+ WideCharToMultiByte(CP_ACP,0,FromStr,-1,(char *)NewMailPopUp.lptzContactName,sizeof(NewMailPopUp.lptzContactName),NULL,NULL);
+ if (!WideCharToMultiByte(CP_ACP,0,UnicodeHeader.Subject,-1,(char *)NewMailPopUp.lptzText,sizeof(NewMailPopUp.lptzText),NULL,NULL))
+ NewMailPopUp.lptzText[0]=0;
PYAMN_MAILSHOWPARAM MailParam = (PYAMN_MAILSHOWPARAM)malloc(sizeof(YAMN_MAILSHOWPARAM));
- if(MailParam) {
+ if (MailParam) {
MailParam->account = ActualAccount;
MailParam->mail = msgq;
MailParam->ThreadRunningEV = 0;
NewMailPopUp.PluginData=MailParam;
- CallService(MS_POPUP_ADDPOPUPEX,(WPARAM)&NewMailPopUp,0);
+ PUAddPopUpT(&NewMailPopUp);
}
}
- if((msgq->Flags & YAMN_MSG_UNSEEN) && (ActualAccount->NewMailN.Flags & YAMN_ACC_KBN))
+ if ((msgq->Flags & YAMN_MSG_UNSEEN) && (ActualAccount->NewMailN.Flags & YAMN_ACC_KBN))
CallService(MS_KBDNOTIFY_EVENTSOPENED,(WPARAM)1,NULL);
- if(FromStrNew)
+ if (FromStrNew)
delete[] FromStr;
- if(Extracted)
+ if (Extracted)
{
DeleteHeaderContent(&UnicodeHeader);
ZeroMemory(&UnicodeHeader,sizeof(UnicodeHeader));
}
- if(!Loaded)
+ if (!Loaded)
{
SaveMailData(msgq);
UnloadMailData(msgq); //do not keep data for mail in memory
@@ -729,20 +650,20 @@ int AddNewMailsToListView(HWND hListView,HACCOUNT ActualAccount,struct CMailNumb
void DoMailActions(HWND hDlg,HACCOUNT ActualAccount,struct CMailNumbers *MN,DWORD nflags,DWORD nnflags)
{
- TCHAR *NotIconText=Translate("- new mail message(s)");
+ char *NotIconText = Translate("- new mail message(s)");
NOTIFYICONDATA nid;
ZeroMemory(&nid,sizeof(nid));
- if(MN->Real.EventNC+MN->Virtual.EventNC)
+ if (MN->Real.EventNC+MN->Virtual.EventNC)
NotifyEventHooks(hNewMailHook,0,0);
- if((nflags & YAMN_ACC_KBN) && (MN->Real.PopUpRun+MN->Virtual.PopUpRun))
+ if ((nflags & YAMN_ACC_KBN) && (MN->Real.PopUpRun+MN->Virtual.PopUpRun))
{
CallService(MS_KBDNOTIFY_STARTBLINK,(WPARAM)MN->Real.PopUpNC+MN->Virtual.PopUpNC,NULL);
}
- if((nflags & YAMN_ACC_CONT) && (MN->Real.PopUpRun+MN->Virtual.PopUpRun))
+ if ((nflags & YAMN_ACC_CONT) && (MN->Real.PopUpRun+MN->Virtual.PopUpRun))
{
char sMsg[250];
_snprintf(sMsg,249,Translate("%s : %d new mail message(s), %d total"),ActualAccount->Name,MN->Real.PopUpNC+MN->Virtual.PopUpNC,MN->Real.PopUpTC+MN->Virtual.PopUpTC);
@@ -760,17 +681,17 @@ void DoMailActions(HWND hDlg,HACCOUNT ActualAccount,struct CMailNumbers *MN,DWOR
}
DBWriteContactSettingString(ActualAccount->hContact, "CList", "StatusMsg", sMsg);
- if(nflags & YAMN_ACC_CONTNICK)
+ if (nflags & YAMN_ACC_CONTNICK)
{
DBWriteContactSettingString(ActualAccount->hContact, ProtoName, "Nick",sMsg);
}
}
- if((nflags & YAMN_ACC_POP) &&
+ if ((nflags & YAMN_ACC_POP) &&
!(ActualAccount->Flags & YAMN_ACC_POPN) &&
(MN->Real.PopUpRun+MN->Virtual.PopUpRun))
{
- POPUPDATAEX NewMailPopUp ={0};
+ POPUPDATAT NewMailPopUp ={0};
NewMailPopUp.lchContact=(ActualAccount->hContact != NULL) ? ActualAccount->hContact : ActualAccount;
NewMailPopUp.lchIcon=hYamnIcons[2];
@@ -781,13 +702,13 @@ void DoMailActions(HWND hDlg,HACCOUNT ActualAccount,struct CMailNumbers *MN,DWOR
NewMailPopUp.PluginWindowProc=(WNDPROC)NewMailPopUpProc;
NewMailPopUp.PluginData=(void *)0; //multiple popups
- lstrcpyn(NewMailPopUp.lpzContactName,ActualAccount->Name,sizeof(NewMailPopUp.lpzContactName));
- sprintf(NewMailPopUp.lpzText,Translate("%d new mail message(s), %d total"),MN->Real.PopUpNC+MN->Virtual.PopUpNC,MN->Real.PopUpTC+MN->Virtual.PopUpTC);
- CallService(MS_POPUP_ADDPOPUPEX,(WPARAM)&NewMailPopUp,0);
+ lstrcpyn(NewMailPopUp.lptzContactName, _A2T(ActualAccount->Name),SIZEOF(NewMailPopUp.lptzContactName));
+ wsprintf(NewMailPopUp.lptzText,TranslateT("%d new mail message(s), %d total"),MN->Real.PopUpNC+MN->Virtual.PopUpNC,MN->Real.PopUpTC+MN->Virtual.PopUpTC);
+ PUAddPopUpT(&NewMailPopUp);
}
//destroy tray icon if no new mail
- if((MN->Real.SysTrayUC+MN->Virtual.SysTrayUC==0) && (hDlg!=NULL))
+ if ((MN->Real.SysTrayUC+MN->Virtual.SysTrayUC==0) && (hDlg!=NULL))
{
nid.hWnd=hDlg;
nid.uID=0;
@@ -795,28 +716,29 @@ void DoMailActions(HWND hDlg,HACCOUNT ActualAccount,struct CMailNumbers *MN,DWOR
}
//and remove the event
- if((nflags & YAMN_ACC_CONT) && (!(nflags & YAMN_ACC_CONTNOEVENT)) && (MN->Real.UnSeen + MN->Virtual.UnSeen==0)) {
+ if ((nflags & YAMN_ACC_CONT) && (!(nflags & YAMN_ACC_CONTNOEVENT)) && (MN->Real.UnSeen + MN->Virtual.UnSeen==0)) {
CallService(MS_CLIST_REMOVEEVENT,(WPARAM)ActualAccount->hContact,(LPARAM)ActualAccount->hContact);
}
- if((MN->Real.BrowserUC+MN->Virtual.BrowserUC==0) && (hDlg!=NULL))
+ if ((MN->Real.BrowserUC+MN->Virtual.BrowserUC==0) && (hDlg!=NULL))
{
- if(!IsWindowVisible(hDlg) && !(nflags & YAMN_ACC_MSG))
+ if (!IsWindowVisible(hDlg) && !(nflags & YAMN_ACC_MSG))
PostMessage(hDlg,WM_DESTROY,(WPARAM)0,(LPARAM)0); //destroy window if no new mail and window is not visible
- if(nnflags & YAMN_ACC_MSG) //if no new mail and msg should be executed
+ if (nnflags & YAMN_ACC_MSG) //if no new mail and msg should be executed
{
SetForegroundWindow(hDlg);
ShowWindow(hDlg,SW_SHOWNORMAL);
}
}
else
- if(hDlg!=NULL) //else insert icon and set window if new mails
+ if (hDlg!=NULL) //else insert icon and set window if new mails
{
SendMessageW(GetDlgItem(hDlg,IDC_LISTMAILS),LVM_SCROLL,(WPARAM)0,(LPARAM)0x7ffffff);
- if((nflags & YAMN_ACC_ICO) && (MN->Real.SysTrayUC+MN->Virtual.SysTrayUC))
+ if ((nflags & YAMN_ACC_ICO) && (MN->Real.SysTrayUC+MN->Virtual.SysTrayUC))
{
- TCHAR *src,*dest;
+ char* src;
+ TCHAR *dest;
int i;
for(src=ActualAccount->Name,dest=nid.szTip,i=0;(*src!=(TCHAR)0) && (i+1<sizeof(nid.szTip));*dest++=*src++);
@@ -831,33 +753,33 @@ void DoMailActions(HWND hDlg,HACCOUNT ActualAccount,struct CMailNumbers *MN,DWOR
Shell_NotifyIcon(NIM_ADD,&nid);
SetTimer(hDlg,TIMER_FLASHING,500,NULL);
}
- if(nflags & YAMN_ACC_MSG) //if no new mail and msg should be executed
+ if (nflags & YAMN_ACC_MSG) //if no new mail and msg should be executed
ShowWindow(hDlg,SW_SHOWNORMAL);
}
- if(MN->Real.AppNC+MN->Virtual.AppNC!=0)
+ if (MN->Real.AppNC+MN->Virtual.AppNC!=0)
{
- if(nflags & YAMN_ACC_APP)
+ if (nflags & YAMN_ACC_APP)
{
PROCESS_INFORMATION pi;
STARTUPINFOW si;
ZeroMemory(&si,sizeof(si));
si.cb=sizeof(si);
- if(ActualAccount->NewMailN.App!=NULL)
+ if (ActualAccount->NewMailN.App!=NULL)
{
WCHAR *Command;
- if(ActualAccount->NewMailN.AppParam!=NULL)
+ if (ActualAccount->NewMailN.AppParam!=NULL)
Command=new WCHAR[wcslen(ActualAccount->NewMailN.App)+wcslen(ActualAccount->NewMailN.AppParam)+6];
else
Command=new WCHAR[wcslen(ActualAccount->NewMailN.App)+6];
- if(Command!=NULL)
+ if (Command!=NULL)
{
lstrcpyW(Command,L"\"");
lstrcatW(Command,ActualAccount->NewMailN.App);
lstrcatW(Command,L"\" ");
- if(ActualAccount->NewMailN.AppParam!=NULL)
+ if (ActualAccount->NewMailN.AppParam!=NULL)
lstrcatW(Command,ActualAccount->NewMailN.AppParam);
CreateProcessW(NULL,Command,NULL,NULL,FALSE,NORMAL_PRIORITY_CLASS,NULL,NULL,&si,&pi);
delete[] Command;
@@ -866,13 +788,13 @@ void DoMailActions(HWND hDlg,HACCOUNT ActualAccount,struct CMailNumbers *MN,DWOR
}
}
- if(MN->Real.SoundNC+MN->Virtual.SoundNC!=0)
- if(nflags & YAMN_ACC_SND)
+ if (MN->Real.SoundNC+MN->Virtual.SoundNC!=0)
+ if (nflags & YAMN_ACC_SND)
CallService(MS_SKIN_PLAYSOUND,0,(LPARAM)YAMN_NEWMAILSOUND);
- if((nnflags & YAMN_ACC_POP) && (MN->Real.PopUpRun+MN->Virtual.PopUpRun==0))
+ if ((nnflags & YAMN_ACC_POP) && (MN->Real.PopUpRun+MN->Virtual.PopUpRun==0))
{
- POPUPDATAEX NoNewMailPopUp;
+ POPUPDATAT NoNewMailPopUp;
NoNewMailPopUp.lchContact=(ActualAccount->hContact != NULL) ? ActualAccount->hContact : ActualAccount;
NoNewMailPopUp.lchIcon=hYamnIcons[1];
@@ -883,19 +805,19 @@ void DoMailActions(HWND hDlg,HACCOUNT ActualAccount,struct CMailNumbers *MN,DWOR
NoNewMailPopUp.PluginWindowProc=(WNDPROC)NoNewMailPopUpProc;
NoNewMailPopUp.PluginData=(void *)0; //it's not new mail popup
- lstrcpyn(NoNewMailPopUp.lpzContactName,ActualAccount->Name,sizeof(NoNewMailPopUp.lpzContactName));
- if(MN->Real.PopUpSL2NC+MN->Virtual.PopUpSL2NC)
- sprintf(NoNewMailPopUp.lpzText,Translate("No new mail message, %d spam(s)"),MN->Real.PopUpSL2NC+MN->Virtual.PopUpSL2NC);
+ lstrcpyn(NoNewMailPopUp.lptzContactName,_A2T(ActualAccount->Name),SIZEOF(NoNewMailPopUp.lptzContactName));
+ if (MN->Real.PopUpSL2NC+MN->Virtual.PopUpSL2NC)
+ wsprintf(NoNewMailPopUp.lptzText,TranslateT("No new mail message, %d spam(s)"),MN->Real.PopUpSL2NC+MN->Virtual.PopUpSL2NC);
else
- lstrcpyn(NoNewMailPopUp.lpzText,Translate("No new mail message"),sizeof(NoNewMailPopUp.lpzText));
- CallService(MS_POPUP_ADDPOPUPEX,(WPARAM)&NoNewMailPopUp,0);
+ lstrcpyn(NoNewMailPopUp.lptzText,TranslateT("No new mail message"),SIZEOF(NoNewMailPopUp.lptzText));
+ PUAddPopUpT(&NoNewMailPopUp);
}
- if((nflags & YAMN_ACC_CONT) && (MN->Real.PopUpRun+MN->Virtual.PopUpRun==0))
+ if ((nflags & YAMN_ACC_CONT) && (MN->Real.PopUpRun+MN->Virtual.PopUpRun==0))
{
- if(ActualAccount->hContact != NULL)
+ if (ActualAccount->hContact != NULL)
{
- if(MN->Real.PopUpTC+MN->Virtual.PopUpTC)
+ if (MN->Real.PopUpTC+MN->Virtual.PopUpTC)
{
char tmp[255];
sprintf(tmp,Translate("%d new mail message(s), %d total"),MN->Real.PopUpNC+MN->Virtual.PopUpNC,MN->Real.PopUpTC+MN->Virtual.PopUpTC);
@@ -904,7 +826,7 @@ void DoMailActions(HWND hDlg,HACCOUNT ActualAccount,struct CMailNumbers *MN,DWOR
else
DBWriteContactSettingString(ActualAccount->hContact, "CList", "StatusMsg", Translate("No new mail message"));
- if(nflags & YAMN_ACC_CONTNICK)
+ if (nflags & YAMN_ACC_CONTNICK)
{
DBWriteContactSettingString(ActualAccount->hContact, ProtoName, "Nick", ActualAccount->Name);
}
@@ -921,7 +843,7 @@ LRESULT CALLBACK NewMailPopUpProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam
{
case WM_COMMAND:
//if clicked and it's new mail popup window
- if((HIWORD(wParam)==STN_CLICKED) && (-1!=(PluginParam=CallService(MS_POPUP_GETPLUGINDATA,(WPARAM)hWnd,(LPARAM)&PluginParam))))
+ if ((HIWORD(wParam)==STN_CLICKED) && (-1!=(PluginParam=CallService(MS_POPUP_GETPLUGINDATA,(WPARAM)hWnd,(LPARAM)&PluginParam))))
{
HANDLE hContact = 0;
HACCOUNT Account;
@@ -930,9 +852,9 @@ LRESULT CALLBACK NewMailPopUpProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam
memcpy(MailParam,(PINT_PTR)PluginParam,sizeof(YAMN_MAILSHOWPARAM));
hContact = MailParam->account->hContact;
Account = MailParam->account;
- if(NULL!=(MailParam->ThreadRunningEV=CreateEvent(NULL,FALSE,FALSE,NULL))){
+ if (NULL!=(MailParam->ThreadRunningEV=CreateEvent(NULL,FALSE,FALSE,NULL))){
HANDLE NewThread;
- if(NULL!=(NewThread=CreateThread(NULL,0,ShowEmailThread,(LPVOID)MailParam,0,NULL)))
+ if (NULL!=(NewThread=CreateThread(NULL,0,ShowEmailThread,(LPVOID)MailParam,0,NULL)))
{
CloseHandle(NewThread);
}
@@ -944,7 +866,7 @@ LRESULT CALLBACK NewMailPopUpProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam
hContact=(HANDLE)CallService(MS_POPUP_GETCONTACT,(WPARAM)hWnd,(LPARAM)0);
- if(!DBGetContactSetting((HANDLE) hContact,ProtoName,"Id",&dbv))
+ if (!DBGetContactSetting((HANDLE) hContact,ProtoName,"Id",&dbv))
{
Account=(HACCOUNT) CallService(MS_YAMN_FINDACCOUNTBYNAME,(WPARAM)POP3Plugin,(LPARAM)dbv.pszVal);
DBFreeVariant(&dbv);
@@ -956,7 +878,7 @@ LRESULT CALLBACK NewMailPopUpProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"PopUpProc:LEFTCLICK:ActualAccountSO-read wait\n");
#endif
- if(WAIT_OBJECT_0==WaitToReadFcn(Account->AccountAccessSO))
+ if (WAIT_OBJECT_0==WaitToReadFcn(Account->AccountAccessSO))
{
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"PopUpProc:LEFTCLICK:ActualAccountSO-read enter\n");
@@ -1012,7 +934,7 @@ LRESULT CALLBACK NewMailPopUpProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam
hContact=(HANDLE)CallService(MS_POPUP_GETCONTACT,(WPARAM)hWnd,(LPARAM)0);
- if(!DBGetContactSetting((HANDLE) hContact,ProtoName,"Id",&dbv))
+ if (!DBGetContactSetting((HANDLE) hContact,ProtoName,"Id",&dbv))
{
ActualAccount=(HACCOUNT) CallService(MS_YAMN_FINDACCOUNTBYNAME,(WPARAM)POP3Plugin,(LPARAM)dbv.pszVal);
DBFreeVariant(&dbv);
@@ -1020,7 +942,7 @@ LRESULT CALLBACK NewMailPopUpProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam
else
ActualAccount = (HACCOUNT) hContact;
- if((HACCOUNT)wParam!=ActualAccount)
+ if ((HACCOUNT)wParam!=ActualAccount)
break;
DestroyWindow(hWnd);
return 0;
@@ -1037,7 +959,7 @@ LRESULT CALLBACK NoNewMailPopUpProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lPar
switch(msg)
{
case WM_COMMAND:
- if((HIWORD(wParam)==STN_CLICKED) && (msg==WM_COMMAND))
+ if ((HIWORD(wParam)==STN_CLICKED) && (msg==WM_COMMAND))
{
HACCOUNT ActualAccount;
HANDLE hContact;
@@ -1045,7 +967,7 @@ LRESULT CALLBACK NoNewMailPopUpProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lPar
hContact=(HANDLE)CallService(MS_POPUP_GETCONTACT,(WPARAM)hWnd,(LPARAM)0);
- if(!DBGetContactSetting((HANDLE) hContact,ProtoName,"Id",&dbv))
+ if (!DBGetContactSetting((HANDLE) hContact,ProtoName,"Id",&dbv))
{
ActualAccount=(HACCOUNT) CallService(MS_YAMN_FINDACCOUNTBYNAME,(WPARAM)POP3Plugin,(LPARAM)dbv.pszVal);
DBFreeVariant(&dbv);
@@ -1056,7 +978,7 @@ LRESULT CALLBACK NoNewMailPopUpProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lPar
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"PopUpProc:LEFTCLICK:ActualAccountSO-read wait\n");
#endif
- if(WAIT_OBJECT_0==WaitToReadFcn(ActualAccount->AccountAccessSO))
+ if (WAIT_OBJECT_0==WaitToReadFcn(ActualAccount->AccountAccessSO))
{
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"PopUpProc:LEFTCLICK:ActualAccountSO-read enter\n");
@@ -1112,7 +1034,7 @@ LRESULT CALLBACK NoNewMailPopUpProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lPar
hContact=(HANDLE)CallService(MS_POPUP_GETCONTACT,(WPARAM)hWnd,(LPARAM)0);
- if(!DBGetContactSetting((HANDLE) hContact,ProtoName,"Id",&dbv))
+ if (!DBGetContactSetting((HANDLE) hContact,ProtoName,"Id",&dbv))
{
ActualAccount=(HACCOUNT) CallService(MS_YAMN_FINDACCOUNTBYNAME,(WPARAM)POP3Plugin,(LPARAM)dbv.pszVal);
DBFreeVariant(&dbv);
@@ -1120,7 +1042,7 @@ LRESULT CALLBACK NoNewMailPopUpProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lPar
else
ActualAccount = (HACCOUNT) hContact;
- if((HACCOUNT)wParam!=ActualAccount)
+ if ((HACCOUNT)wParam!=ActualAccount)
break;
DestroyWindow(hWnd);
@@ -1149,7 +1071,9 @@ LRESULT CALLBACK NoNewMailPopUpProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lPar
#define NUM100NANOSEC 116444736000000000
#define MAXFILETIME 0x7FFF35F4F06C7FFF
#endif
-ULONGLONG MimeDateToFileTime(char *datein){
+
+ULONGLONG MimeDateToFileTime(char *datein)
+{
char *day=0, *month=0, *year=0, *time=0, *shift=0;
SYSTEMTIME st;
ULONGLONG res=0;
@@ -1179,7 +1103,7 @@ ULONGLONG MimeDateToFileTime(char *datein){
st.wYear = atoi(year);
if (strlen(year)<4) if (st.wYear<70)st.wYear += 2000; else st.wYear += 1900;
};
- if (month) for(int i=0;i<12;i++) if(strncmp(month,s_MonthNames[i],3)==0) {st.wMonth = i + 1; break;}
+ if (month) for(int i=0;i<12;i++) if (strncmp(month,s_MonthNames[i],3)==0) {st.wMonth = i + 1; break;}
if (day) st.wDay = atoi(day);
if (time) {
char *h, *m, *s;
@@ -1216,6 +1140,7 @@ ULONGLONG MimeDateToFileTime(char *datein){
}
return res;
}
+
void FileTimeToLocalizedDateTime(LONGLONG filetime, WCHAR *dateout, int lendateout){
int localeID = CallService(MS_LANGPACK_GETLOCALE,0,0);
//int localeID = MAKELCID(LANG_URDU, SORT_DEFAULT);
@@ -1259,13 +1184,15 @@ void FileTimeToLocalizedDateTime(LONGLONG filetime, WCHAR *dateout, int lendateo
}
}
}
-void MimeDateToLocalizedDateTime(char *datein, WCHAR *dateout, int lendateout){
+
+void MimeDateToLocalizedDateTime(char *datein, WCHAR *dateout, int lendateout)
+{
ULONGLONG ft = MimeDateToFileTime(datein);
FileTimeToLocalizedDateTime(ft,dateout,lendateout);
}
int CALLBACK ListViewCompareProc(LPARAM lParam1, LPARAM lParam2,LPARAM lParamSort ) {
- if(lParam1 == NULL || lParam2 == NULL)
+ if (lParam1 == NULL || lParam2 == NULL)
return 0;
int nResult = 0;
@@ -1285,37 +1212,37 @@ int CALLBACK ListViewCompareProc(LPARAM lParam1, LPARAM lParam2,LPARAM lParamSor
switch((int)lParamSort)
{
case 0: //From
- if(Header1.FromNick == NULL)
+ if (Header1.FromNick == NULL)
str1 = Header1.From;
else str1 = Header1.FromNick;
- if(Header2.FromNick == NULL)
+ if (Header2.FromNick == NULL)
str2 = Header2.From;
else str2 = Header2.FromNick;
nResult = strcmp(str1, str2);
- if(bFrom) nResult = -nResult;
+ if (bFrom) nResult = -nResult;
break;
case 1: //Subject
- if(Header1.Subject == NULL)
+ if (Header1.Subject == NULL)
str1 = " ";
else str1 = Header1.Subject;
- if(Header2.Subject == NULL)
+ if (Header2.Subject == NULL)
str2 = " ";
else str2 = Header2.Subject;
nResult = strcmp(str1, str2);
- if(bSub) nResult = -nResult;
+ if (bSub) nResult = -nResult;
break;
case 2: //Size
- if(email1->MailData->Size == email2->MailData->Size) nResult = 0;
- if(email1->MailData->Size > email2->MailData->Size) nResult = 1;
- if(email1->MailData->Size < email2->MailData->Size) nResult = -1;
+ if (email1->MailData->Size == email2->MailData->Size) nResult = 0;
+ if (email1->MailData->Size > email2->MailData->Size) nResult = 1;
+ if (email1->MailData->Size < email2->MailData->Size) nResult = -1;
- if(bSize) nResult = -nResult;
+ if (bSize) nResult = -nResult;
break;
case 3: //Date
@@ -1323,18 +1250,18 @@ int CALLBACK ListViewCompareProc(LPARAM lParam1, LPARAM lParam2,LPARAM lParamSor
ULONGLONG ts1 = 0, ts2 = 0;
ts1 = MimeDateToFileTime(Header1.Date);
ts2 = MimeDateToFileTime(Header2.Date);
- if(ts1 > ts2) nResult = 1;
+ if (ts1 > ts2) nResult = 1;
else if (ts1 < ts2) nResult = -1;
else nResult = 0;
}
- if(bDate) nResult = -nResult;
+ if (bDate) nResult = -nResult;
break;
default:
- if(Header1.Subject == NULL) str1 = " ";
+ if (Header1.Subject == NULL) str1 = " ";
else str1 = Header1.Subject;
- if(Header2.Subject == NULL) str2 = " ";
+ if (Header2.Subject == NULL) str2 = " ";
else str2 = Header2.Subject;
nResult = strcmp(str1, str2);
@@ -1418,9 +1345,9 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg,UINT msg,WPARAM wParam,LPARAM
LVCOLUMNW lvc1={LVCF_FMT | LVCF_TEXT | LVCF_WIDTH,LVCFMT_LEFT,400,iValueW,0,0};
SendMessageW(hListView,LVM_INSERTCOLUMNW,(WPARAM)0,(LPARAM)&lvc0);
SendMessageW(hListView,LVM_INSERTCOLUMNW,(WPARAM)1,(LPARAM)&lvc1);
- if(NULL!=iHeaderW)
+ if (NULL!=iHeaderW)
delete[] iHeaderW;
- if(NULL!=iValueW)
+ if (NULL!=iValueW)
delete[] iValueW;
//WindowList_Add(YAMNVar.MessageWnds,hDlg,NULL);
@@ -1531,7 +1458,7 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg,UINT msg,WPARAM wParam,LPARAM
}
} else if (!_strnicmp(contentType,"multipart/",10)) {
char *bondary=NULL;
- if(NULL!=(bondary=ExtractFromContentType(contentType,"boundary=")))
+ if (NULL!=(bondary=ExtractFromContentType(contentType,"boundary=")))
{
bodyDecoded = ParseMultipartBody(body,bondary);
delete[] bondary;
@@ -1580,9 +1507,9 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg,UINT msg,WPARAM wParam,LPARAM
PYAMN_MAILSHOWPARAM MailParam = (PYAMN_MAILSHOWPARAM)
(lParam?lParam:GetWindowLongPtr(hDlg,DWLP_USER));
- if(NULL==MailParam)
+ if (NULL==MailParam)
break;
- if((HACCOUNT)wParam!=MailParam->account)
+ if ((HACCOUNT)wParam!=MailParam->account)
break;
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"ShowMessage:STOPACCOUNT:sending destroy msg\n");
@@ -1599,7 +1526,7 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg,UINT msg,WPARAM wParam,LPARAM
case WM_DESTROY:
{
RECT coord;
- if(GetWindowRect(hDlg,&coord))
+ if (GetWindowRect(hDlg,&coord))
{
HeadPosX=coord.left;
HeadSizeX=coord.right-coord.left;
@@ -1607,7 +1534,7 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg,UINT msg,WPARAM wParam,LPARAM
HeadSizeY=coord.bottom-coord.top;
}
- //if(!YAMNVar.Shutdown && GetWindowRect(hDlg,&coord)) //the YAMNVar.Shutdown testing is because M<iranda strange functionality at shutdown phase, when call to DBWriteContactSetting freezes calling thread
+ //if (!YAMNVar.Shutdown && GetWindowRect(hDlg,&coord)) //the YAMNVar.Shutdown testing is because M<iranda strange functionality at shutdown phase, when call to DBWriteContactSetting freezes calling thread
//{
// //HeadPosX=coord.left;
// //HeadSizeX=coord.right-coord.left;
@@ -1653,7 +1580,7 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg,UINT msg,WPARAM wParam,LPARAM
return 0;
}
case WM_SIZE:
- if(wParam==SIZE_RESTORED)
+ if (wParam==SIZE_RESTORED)
{
HWND hList = GetDlgItem(hDlg,IDC_LISTHEADERS);
HWND hEdit = GetDlgItem(hDlg,IDC_EDITBODY);
@@ -1708,9 +1635,9 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg,UINT msg,WPARAM wParam,LPARAM
}
if (!sizeNeeded) {
#ifdef _DEBUG
- MessageBox(hDlg,"Nothing To Copy","Debug ShowHeaders",0);
+ MessageBoxA(hDlg,"Nothing To Copy","Debug ShowHeaders",0);
#endif
- } else if(OpenClipboard(hDlg)){
+ } else if (OpenClipboard(hDlg)){
EmptyClipboard();
HGLOBAL hData=GlobalAlloc(GMEM_MOVEABLE,(sizeNeeded+1)*sizeof(WCHAR));
WCHAR *buff = (WCHAR *)GlobalLock(hData);
@@ -1760,7 +1687,7 @@ CREADTEVIEWMESSAGEWINDOW:
WindowList_Add(YAMNVar.MessageWnds,MyParam.mail->MsgWindow,NULL);
MSG msg;
while(GetMessage(&msg,NULL,0,0)){
- if(!IsDialogMessage(MyParam.mail->MsgWindow, &msg)){
+ if (!IsDialogMessage(MyParam.mail->MsgWindow, &msg)){
TranslateMessage(&msg);
DispatchMessage(&msg);
} }
@@ -1800,7 +1727,7 @@ BOOL CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"MailBrowser:INIT:ActualAccountSO-read wait\n");
#endif
- if(WAIT_OBJECT_0!=WaitToReadFcn(ActualAccount->AccountAccessSO))
+ if (WAIT_OBJECT_0!=WaitToReadFcn(ActualAccount->AccountAccessSO))
{
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"MailBrowser:INIT:ActualAccountSO-read enter failed\n");
@@ -1826,7 +1753,7 @@ BOOL CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa
SendMessageW(GetDlgItem(hDlg,IDC_LISTMAILS),LVM_INSERTCOLUMNW,(WPARAM)2,(LPARAM)&lvc2);
SendMessageW(GetDlgItem(hDlg,IDC_LISTMAILS),LVM_INSERTCOLUMNW,(WPARAM)3,(LPARAM)&lvc3);
- if((ActualAccount->NewMailN.App!=NULL) && (wcslen(ActualAccount->NewMailN.App)))
+ if ((ActualAccount->NewMailN.App!=NULL) && (wcslen(ActualAccount->NewMailN.App)))
EnableWindow(GetDlgItem(hDlg,IDC_BTNAPP),(WPARAM)TRUE);
else
EnableWindow(GetDlgItem(hDlg,IDC_BTNAPP),(WPARAM)FALSE);
@@ -1839,14 +1766,13 @@ BOOL CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa
WindowList_Add(YAMNVar.NewMailAccountWnd,hDlg,ActualAccount);
{
- char accstatus[512];
-
+ TCHAR accstatus[512];
GetStatusFcn(ActualAccount,accstatus);
- SetDlgItemTextA(hDlg,IDC_STSTATUS,accstatus);
+ SetDlgItemText(hDlg,IDC_STSTATUS,accstatus);
}
SetTimer(hDlg,TIMER_FLASHING,500,NULL);
- if(ActualAccount->hContact != NULL)
+ if (ActualAccount->hContact != NULL)
{
CallService(MS_CLIST_REMOVEEVENT,(WPARAM)ActualAccount->hContact,(LPARAM)"yamn new mail message");
}
@@ -1865,22 +1791,22 @@ BOOL CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa
struct CMailWinUserInfo *mwui;
mwui=(struct CMailWinUserInfo *)GetWindowLongPtr(hDlg,DWLP_USER);
- if(NULL==(ActualAccount=GetWindowAccount(hDlg)))
+ if (NULL==(ActualAccount=GetWindowAccount(hDlg)))
break;
ColInfo.mask=LVCF_WIDTH;
- if(ListView_GetColumn(GetDlgItem(hDlg,IDC_LISTMAILS),0,&ColInfo))
+ if (ListView_GetColumn(GetDlgItem(hDlg,IDC_LISTMAILS),0,&ColInfo))
FromWidth=ColInfo.cx;
- if(ListView_GetColumn(GetDlgItem(hDlg,IDC_LISTMAILS),1,&ColInfo))
+ if (ListView_GetColumn(GetDlgItem(hDlg,IDC_LISTMAILS),1,&ColInfo))
SubjectWidth=ColInfo.cx;
- if(ListView_GetColumn(GetDlgItem(hDlg,IDC_LISTMAILS),2,&ColInfo))
+ if (ListView_GetColumn(GetDlgItem(hDlg,IDC_LISTMAILS),2,&ColInfo))
SizeWidth=ColInfo.cx;
- if(ListView_GetColumn(GetDlgItem(hDlg,IDC_LISTMAILS),3,&ColInfo))
+ if (ListView_GetColumn(GetDlgItem(hDlg,IDC_LISTMAILS),3,&ColInfo))
SizeDate=ColInfo.cx;
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"MailBrowser:DESTROY:save window position\n");
#endif
- if(!YAMNVar.Shutdown && GetWindowRect(hDlg,&coord)) //the YAMNVar.Shutdown testing is because M<iranda strange functionality at shutdown phase, when call to DBWriteContactSetting freezes calling thread
+ if (!YAMNVar.Shutdown && GetWindowRect(hDlg,&coord)) //the YAMNVar.Shutdown testing is because M<iranda strange functionality at shutdown phase, when call to DBWriteContactSetting freezes calling thread
{
PosX=coord.left;
SizeX=coord.right-coord.left;
@@ -1902,7 +1828,7 @@ BOOL CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"MailBrowser:DESTROY:ActualAccountMsgsSO-write wait\n");
#endif
- if(WAIT_OBJECT_0!=WaitToWriteFcn(ActualAccount->MessagesAccessSO))
+ if (WAIT_OBJECT_0!=WaitToWriteFcn(ActualAccount->MessagesAccessSO))
{
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"MailBrowser:DESTROY:ActualAccountMsgsSO-write wait failed\n");
@@ -1915,7 +1841,7 @@ BOOL CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa
//delete mails from queue, which are deleted from server (spam level 3 mails e.g.)
for(Parser=(HYAMNMAIL)ActualAccount->Mails;Parser!=NULL;Parser=Parser->Next)
{
- if((Parser->Flags & YAMN_MSG_DELETED) && YAMN_MSG_SPAML(Parser->Flags,YAMN_MSG_SPAML3) && mwui->Seen) //if spaml3 was already deleted and user knows about it
+ if ((Parser->Flags & YAMN_MSG_DELETED) && YAMN_MSG_SPAML(Parser->Flags,YAMN_MSG_SPAML3) && mwui->Seen) //if spaml3 was already deleted and user knows about it
{
DeleteMessageFromQueueFcn((HYAMNMAIL *)&ActualAccount->Mails,Parser,1);
CallService(MS_YAMN_DELETEACCOUNTMAIL,(WPARAM)ActualAccount->Plugin,(LPARAM)Parser);
@@ -1923,7 +1849,7 @@ BOOL CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa
}
//mark mails as read (remove "new" and "unseen" flags)
- if(mwui->Seen)
+ if (mwui->Seen)
SetRemoveFlagsInQueueFcn((HYAMNMAIL)ActualAccount->Mails,YAMN_MSG_DISPLAY,0,YAMN_MSG_NEW | YAMN_MSG_UNSEEN,0);
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"MailBrowser:DESTROY:ActualAccountMsgsSO-write done\n");
@@ -1946,21 +1872,22 @@ BOOL CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa
{
struct CMailWinUserInfo *mwui;
- if(NULL==(mwui=(struct CMailWinUserInfo *)GetWindowLongPtr(hDlg,DWLP_USER)))
+ if (NULL==(mwui=(struct CMailWinUserInfo *)GetWindowLongPtr(hDlg,DWLP_USER)))
return 0;
mwui->Seen=TRUE;
}
case WM_YAMN_CHANGESTATUS:
{
HACCOUNT ActualAccount;
- char accstatus[512];
-
- if(NULL==(ActualAccount=GetWindowAccount(hDlg)))
+ if (NULL==(ActualAccount=GetWindowAccount(hDlg)))
break;
- if((HACCOUNT)wParam!=ActualAccount)
+
+ if ((HACCOUNT)wParam!=ActualAccount)
break;
+
+ TCHAR accstatus[512];
GetStatusFcn(ActualAccount,accstatus);
- SetDlgItemTextA(hDlg,IDC_STSTATUS,accstatus);
+ SetDlgItemText(hDlg,IDC_STSTATUS,accstatus);
}
return 1;
case WM_YAMN_CHANGECONTENT:
@@ -1968,7 +1895,7 @@ BOOL CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa
struct CUpdateMails UpdateParams;
BOOL ThisThreadWindow=(GetCurrentThreadId()==GetWindowThreadProcessId(hDlg,NULL));
- if(NULL==(UpdateParams.Copied=CreateEvent(NULL,FALSE,FALSE,NULL)))
+ if (NULL==(UpdateParams.Copied=CreateEvent(NULL,FALSE,FALSE,NULL)))
{
DestroyWindow(hDlg);
return 0;
@@ -1979,14 +1906,14 @@ BOOL CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"MailBrowser:CHANGECONTENT:posting UPDATEMAILS\n");
#endif
- if(ThisThreadWindow)
+ if (ThisThreadWindow)
{
- if(!UpdateMails(hDlg,(HACCOUNT)wParam,UpdateParams.Flags->nflags,UpdateParams.Flags->nnflags))
+ if (!UpdateMails(hDlg,(HACCOUNT)wParam,UpdateParams.Flags->nflags,UpdateParams.Flags->nnflags))
DestroyWindow(hDlg);
}
- else if(PostMessage(hDlg,WM_YAMN_UPDATEMAILS,wParam,(LPARAM)&UpdateParams)) //this ensures UpdateMails will execute the thread who created the browser window
+ else if (PostMessage(hDlg,WM_YAMN_UPDATEMAILS,wParam,(LPARAM)&UpdateParams)) //this ensures UpdateMails will execute the thread who created the browser window
{
- if(!ThisThreadWindow)
+ if (!ThisThreadWindow)
{
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"MailBrowser:CHANGECONTENT:waiting for event\n");
@@ -2012,18 +1939,18 @@ BOOL CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa
DebugLog(SynchroFile,"MailBrowser:UPDATEMAILS\n");
#endif
- if(NULL==(ActualAccount=GetWindowAccount(hDlg)))
+ if (NULL==(ActualAccount=GetWindowAccount(hDlg)))
return 0;
- if((HACCOUNT)wParam!=ActualAccount)
+ if ((HACCOUNT)wParam!=ActualAccount)
return 0;
nflags=um->Flags->nflags;
nnflags=um->Flags->nnflags;
- if(um->Waiting)
+ if (um->Waiting)
SetEvent(um->Copied);
- if(!UpdateMails(hDlg,ActualAccount,nflags,nnflags))
+ if (!UpdateMails(hDlg,ActualAccount,nflags,nnflags))
DestroyWindow(hDlg);
}
return 1;
@@ -2031,9 +1958,9 @@ BOOL CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa
{
HACCOUNT ActualAccount;
- if(NULL==(ActualAccount=GetWindowAccount(hDlg)))
+ if (NULL==(ActualAccount=GetWindowAccount(hDlg)))
break;
- if((HACCOUNT)wParam!=ActualAccount)
+ if ((HACCOUNT)wParam!=ActualAccount)
break;
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"MailBrowser:STOPACCOUNT:sending destroy msg\n");
@@ -2044,7 +1971,7 @@ BOOL CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa
case WM_YAMN_NOTIFYICON:
{
HACCOUNT ActualAccount;
- if(NULL==(ActualAccount=GetWindowAccount(hDlg)))
+ if (NULL==(ActualAccount=GetWindowAccount(hDlg)))
break;
switch(lParam)
@@ -2053,7 +1980,7 @@ BOOL CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"MailBrowser:DBLCLICKICON:ActualAccountSO-read wait\n");
#endif
- if(WAIT_OBJECT_0!=WaitToReadFcn(ActualAccount->AccountAccessSO))
+ if (WAIT_OBJECT_0!=WaitToReadFcn(ActualAccount->AccountAccessSO))
{
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"MailBrowser:DBLCLICKICON:ActualAccountSO-read wait failed\n");
@@ -2063,7 +1990,7 @@ BOOL CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"MailBrowser:DBLCLICKICON:ActualAccountSO-read enter\n");
#endif
- if(ActualAccount->AbilityFlags & YAMN_ACC_BROWSE)
+ if (ActualAccount->AbilityFlags & YAMN_ACC_BROWSE)
{
ShowWindow(hDlg,SW_SHOWNORMAL);
SetForegroundWindow(hDlg);
@@ -2083,7 +2010,7 @@ BOOL CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa
int iSelect;
iSelect=SendMessage(GetDlgItem(hDlg,IDC_LISTMAILS),LVM_GETNEXTITEM,-1,MAKELPARAM((UINT)LVNI_FOCUSED,0)); // return item selected
- if(iSelect!=-1)
+ if (iSelect!=-1)
{
LV_ITEMW item;
HYAMNMAIL ActualMail;
@@ -2094,15 +2021,15 @@ BOOL CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa
item.stateMask=0xFFFFFFFF;
ListView_GetItem(GetDlgItem(hDlg,IDC_LISTMAILS),&item);
ActualMail=(HYAMNMAIL)item.lParam;
- if(NULL!=ActualMail)
+ if (NULL!=ActualMail)
{
//ShowEmailThread
PYAMN_MAILSHOWPARAM MailParam = new YAMN_MAILSHOWPARAM;
MailParam->account = GetWindowAccount(hDlg);
MailParam->mail = ActualMail;
- if(NULL!=(MailParam->ThreadRunningEV=CreateEvent(NULL,FALSE,FALSE,NULL))){
+ if (NULL!=(MailParam->ThreadRunningEV=CreateEvent(NULL,FALSE,FALSE,NULL))){
HANDLE NewThread;
- if(NULL!=(NewThread=CreateThread(NULL,0,ShowEmailThread,MailParam,0,NULL)))
+ if (NULL!=(NewThread=CreateThread(NULL,0,ShowEmailThread,MailParam,0,NULL)))
{
//WaitForSingleObject(MailParam->ThreadRunningEV,INFINITE);
CloseHandle(NewThread);
@@ -2117,7 +2044,7 @@ BOOL CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa
{
HACCOUNT ActualAccount;
- if(NULL==(ActualAccount=GetWindowAccount(hDlg)))
+ if (NULL==(ActualAccount=GetWindowAccount(hDlg)))
break;
switch(wParam)
{
@@ -2133,7 +2060,7 @@ BOOL CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa
HACCOUNT ActualAccount;
int Items;
- if(NULL==(ActualAccount=GetWindowAccount(hDlg)))
+ if (NULL==(ActualAccount=GetWindowAccount(hDlg)))
break;
switch(LOWORD(wParam))
@@ -2162,25 +2089,25 @@ BOOL CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"MailBrowser:BTNAPP:ActualAccountSO-read wait\n");
#endif
- if(WAIT_OBJECT_0==WaitToReadFcn(ActualAccount->AccountAccessSO))
+ if (WAIT_OBJECT_0==WaitToReadFcn(ActualAccount->AccountAccessSO))
{
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"MailBrowser:BTNAPP:ActualAccountSO-read enter\n");
#endif
- if(ActualAccount->NewMailN.App!=NULL)
+ if (ActualAccount->NewMailN.App!=NULL)
{
WCHAR *Command;
- if(ActualAccount->NewMailN.AppParam!=NULL)
+ if (ActualAccount->NewMailN.AppParam!=NULL)
Command=new WCHAR[wcslen(ActualAccount->NewMailN.App)+wcslen(ActualAccount->NewMailN.AppParam)+6];
else
Command=new WCHAR[wcslen(ActualAccount->NewMailN.App)+6];
- if(Command!=NULL)
+ if (Command!=NULL)
{
lstrcpyW(Command,L"\"");
lstrcatW(Command,ActualAccount->NewMailN.App);
lstrcatW(Command,L"\" ");
- if(ActualAccount->NewMailN.AppParam!=NULL)
+ if (ActualAccount->NewMailN.AppParam!=NULL)
lstrcatW(Command,ActualAccount->NewMailN.AppParam);
CreateProcessW(NULL,Command,NULL,NULL,FALSE,NORMAL_PRIORITY_CLASS,NULL,NULL,&si,&pi);
delete[] Command;
@@ -2196,7 +2123,7 @@ BOOL CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa
else
DebugLog(SynchroFile,"MailBrowser:BTNAPP:ActualAccountSO-read enter failed\n");
#endif
- if(!(GetKeyState(VK_SHIFT) & 0x8000) && !(GetKeyState(VK_CONTROL) & 0x8000))
+ if (!(GetKeyState(VK_SHIFT) & 0x8000) && !(GetKeyState(VK_CONTROL) & 0x8000))
DestroyWindow(hDlg);
}
@@ -2209,7 +2136,7 @@ BOOL CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa
DWORD tid,Total=0;
// we use event to signal, that running thread has all needed stack parameters copied
- if(NULL==(ThreadRunningEV=CreateEvent(NULL,FALSE,FALSE,NULL)))
+ if (NULL==(ThreadRunningEV=CreateEvent(NULL,FALSE,FALSE,NULL)))
break;
int Items=ListView_GetItemCount(GetDlgItem(hDlg,IDC_LISTMAILS));
@@ -2217,7 +2144,7 @@ BOOL CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"MailBrowser:BTNDEL:ActualAccountMsgsSO-write wait\n");
#endif
- if(WAIT_OBJECT_0==WaitToWriteFcn(ActualAccount->MessagesAccessSO))
+ if (WAIT_OBJECT_0==WaitToWriteFcn(ActualAccount->MessagesAccessSO))
{
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"MailBrowser:BTNDEL:ActualAccountMsgsSO-write enter\n");
@@ -2230,9 +2157,9 @@ BOOL CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa
item.stateMask=0xFFFFFFFF;
ListView_GetItem(GetDlgItem(hDlg,IDC_LISTMAILS),&item);
ActualMail=(HYAMNMAIL)item.lParam;
- if(NULL==ActualMail)
+ if (NULL==ActualMail)
break;
- if(item.state & LVIS_SELECTED)
+ if (item.state & LVIS_SELECTED)
{
ActualMail->Flags|=YAMN_MSG_USERDELETE; //set to mail we are going to delete it
Total++;
@@ -2245,12 +2172,12 @@ BOOL CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa
#endif
WriteDoneFcn(ActualAccount->MessagesAccessSO);
- if(Total)
+ if (Total)
{
- char DeleteMsg[1024];
+ TCHAR DeleteMsg[1024];
- sprintf(DeleteMsg,Translate("Do you really want to delete %d selected mails?"),Total);
- if(IDOK==MessageBox(hDlg,DeleteMsg,Translate("Delete confirmation"),MB_OKCANCEL | MB_ICONWARNING))
+ wsprintf(DeleteMsg,TranslateT("Do you really want to delete %d selected mails?"),Total);
+ if (IDOK==MessageBox(hDlg,DeleteMsg,TranslateT("Delete confirmation"),MB_OKCANCEL | MB_ICONWARNING))
{
struct DeleteParam ParamToDeleteMails={YAMN_DELETEVERSION,ThreadRunningEV,ActualAccount,NULL};
@@ -2258,14 +2185,14 @@ BOOL CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"MailBrowser:BTNDEL:ActualAccountMsgsSO-write wait\n");
#endif
- if(WAIT_OBJECT_0==WaitToWriteFcn(ActualAccount->MessagesAccessSO))
+ if (WAIT_OBJECT_0==WaitToWriteFcn(ActualAccount->MessagesAccessSO))
{
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"MailBrowser:BTNDEL:ActualAccountMsgsSO-write enter\n");
#endif
for(ActualMail=(HYAMNMAIL)ActualAccount->Mails;ActualMail!=NULL;ActualMail=ActualMail->Next)
{
- if((ActualMail->Flags & YAMN_MSG_DELETED) && ((ActualMail->Flags & YAMN_MSG_USERDELETE))) //if selected mail was already deleted
+ if ((ActualMail->Flags & YAMN_MSG_DELETED) && ((ActualMail->Flags & YAMN_MSG_USERDELETE))) //if selected mail was already deleted
{
DeleteMessageFromQueueFcn((HYAMNMAIL *)&ActualAccount->Mails,ActualMail,1);
CallService(MS_YAMN_DELETEACCOUNTMAIL,(WPARAM)ActualAccount->Plugin,(LPARAM)ActualMail); //delete it from memory
@@ -2277,7 +2204,7 @@ BOOL CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa
// Create new thread which deletes marked mails.
HANDLE NewThread;
- if(NULL!=(NewThread=CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)ActualAccount->Plugin->Fcn->DeleteMailsFcnPtr,(LPVOID)&ParamToDeleteMails,0,&tid)))
+ if (NULL!=(NewThread=CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)ActualAccount->Plugin->Fcn->DeleteMailsFcnPtr,(LPVOID)&ParamToDeleteMails,0,&tid)))
{
WaitForSingleObject(ThreadRunningEV,INFINITE);
CloseHandle(NewThread);
@@ -2295,7 +2222,7 @@ BOOL CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa
}
}
CloseHandle(ThreadRunningEV);
- if(DBGetContactSettingByte(NULL, YAMN_DBMODULE, YAMN_CLOSEDELETE, 0))
+ if (DBGetContactSettingByte(NULL, YAMN_DBMODULE, YAMN_CLOSEDELETE, 0))
DestroyWindow(hDlg);
}
@@ -2304,7 +2231,7 @@ BOOL CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa
}
break;
case WM_SIZE:
- if(wParam==SIZE_RESTORED)
+ if (wParam==SIZE_RESTORED)
{
LONG x=LOWORD(lParam); //((LPRECT)lParam)->right-((LPRECT)lParam)->left;
LONG y=HIWORD(lParam); //((LPRECT)lParam)->bottom-((LPRECT)lParam)->top;
@@ -2331,7 +2258,7 @@ BOOL CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa
nid.hWnd=hDlg;
nid.uID=0;
nid.uFlags=NIF_ICON;
- if(mwui->TrayIconState==0)
+ if (mwui->TrayIconState==0)
nid.hIcon=hYamnIcons[0];
else
nid.hIcon=hYamnIcons[2];
@@ -2354,9 +2281,9 @@ BOOL CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa
break;
case LVN_COLUMNCLICK:
HACCOUNT ActualAccount;
- if(NULL!=(ActualAccount=GetWindowAccount(hDlg))){
+ if (NULL!=(ActualAccount=GetWindowAccount(hDlg))){
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)lParam;
- if(WAIT_OBJECT_0==WaitToReadFcn(ActualAccount->AccountAccessSO))
+ if (WAIT_OBJECT_0==WaitToReadFcn(ActualAccount->AccountAccessSO))
{
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"MailBrowser:COLUMNCLICK:ActualAccountSO-read enter\n");
@@ -2392,7 +2319,7 @@ BOOL CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa
LPNMLVCUSTOMDRAW cd=(LPNMLVCUSTOMDRAW)lParam;
LONG_PTR PaintCode;
- if(NULL==(ActualAccount=GetWindowAccount(hDlg)))
+ if (NULL==(ActualAccount=GetWindowAccount(hDlg)))
break;
switch(cd->nmcd.dwDrawStage)
@@ -2416,13 +2343,13 @@ BOOL CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa
umma= mwui->UpdateMailsMessagesAccess;
}
ActualMail=(HYAMNMAIL)cd->nmcd.lItemlParam;
- if(!ActualMail)
+ if (!ActualMail)
ActualMail=(HYAMNMAIL)readItemLParam(cd->nmcd.hdr.hwndFrom,cd->nmcd.dwItemSpec);
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"MailBrowser:DRAWITEM:ActualAccountMsgsSO-read wait\n");
#endif
- if(!umma)
- if(WAIT_OBJECT_0!=WaitToReadFcn(ActualAccount->MessagesAccessSO))
+ if (!umma)
+ if (WAIT_OBJECT_0!=WaitToReadFcn(ActualAccount->MessagesAccessSO))
{
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"MailBrowser:DRAWITEM:ActualAccountMsgsSO-read wait failed\n");
@@ -2443,17 +2370,17 @@ BOOL CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa
cd->clrTextBk=RGB(160,160,160);
break;
case 0:
- if(cd->nmcd.dwItemSpec & 1)
+ if (cd->nmcd.dwItemSpec & 1)
cd->clrTextBk=RGB(230,230,230);
break;
default:
break;
}
- if(ActualMail->Flags & YAMN_MSG_UNSEEN)
+ if (ActualMail->Flags & YAMN_MSG_UNSEEN)
cd->clrTextBk=RGB(220,235,250);
PaintCode=CDRF_DODEFAULT;
- if(!umma)
+ if (!umma)
{
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"MailBrowser:DRAWITEM:ActualAccountMsgsSO-read done\n");
@@ -2502,9 +2429,9 @@ BOOL CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa
}
if (!sizeNeeded) {
#ifdef _DEBUG
- MessageBox(hDlg,"Nothing To Copy","Debug MailBrowser",0);
+ MessageBoxA(hDlg,"Nothing To Copy","Debug MailBrowser",0);
#endif
- } else if(OpenClipboard(hDlg)){
+ } else if (OpenClipboard(hDlg)){
EmptyClipboard();
HGLOBAL hData=GlobalAlloc(GMEM_MOVEABLE,(sizeNeeded+1)*sizeof(WCHAR));
WCHAR *buff = (WCHAR *)GlobalLock(hData);
@@ -2557,11 +2484,11 @@ LRESULT CALLBACK ListViewSubclassProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM
switch (wParam)
{
case 'A': // ctrl-a
- if(!isAlt && !isShift && isCtrl) SendMessage(hwndParent,WM_COMMAND,IDC_BTNCHECKALL,0);
+ if (!isAlt && !isShift && isCtrl) SendMessage(hwndParent,WM_COMMAND,IDC_BTNCHECKALL,0);
break;
case VK_RETURN:
case VK_SPACE:
- if(!isAlt && !isShift && !isCtrl) SendMessage(hwndParent,WM_YAMN_SHOWSELECTED,0,0);
+ if (!isAlt && !isShift && !isCtrl) SendMessage(hwndParent,WM_YAMN_SHOWSELECTED,0,0);
break;
case VK_DELETE:
SendMessage(hwndParent,WM_COMMAND,IDC_BTNDEL,0);
@@ -2599,7 +2526,7 @@ DWORD WINAPI MailBrowser(LPVOID Param)
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"MailBrowser:ActualAccountSO-read wait\n");
#endif
- if(WAIT_OBJECT_0!=WaitToReadFcn(ActualAccount->AccountAccessSO))
+ if (WAIT_OBJECT_0!=WaitToReadFcn(ActualAccount->AccountAccessSO))
{
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"MailBrowser:ActualAccountSO-read wait failed\n");
@@ -2609,21 +2536,21 @@ DWORD WINAPI MailBrowser(LPVOID Param)
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"MailBrowser:ActualAccountSO-read enter\n");
#endif
- if(!(ActualAccount->AbilityFlags & YAMN_ACC_BROWSE))
+ if (!(ActualAccount->AbilityFlags & YAMN_ACC_BROWSE))
{
MyParam.nflags=MyParam.nflags & ~YAMN_ACC_MSG;
MyParam.nnflags=MyParam.nnflags & ~YAMN_ACC_MSG;
}
- if(!(ActualAccount->AbilityFlags & YAMN_ACC_POPUP))
+ if (!(ActualAccount->AbilityFlags & YAMN_ACC_POPUP))
MyParam.nflags=MyParam.nflags & ~YAMN_ACC_POP;
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"MailBrowser:ActualAccountSO-read done\n");
#endif
ReadDoneFcn(ActualAccount->AccountAccessSO);
- if(NULL!=(hMailBrowser=WindowList_Find(YAMNVar.NewMailAccountWnd,ActualAccount)))
+ if (NULL!=(hMailBrowser=WindowList_Find(YAMNVar.NewMailAccountWnd,ActualAccount)))
WndFound=TRUE;
- if((hMailBrowser==NULL) && ((MyParam.nflags & YAMN_ACC_MSG) || (MyParam.nflags & YAMN_ACC_ICO) || (MyParam.nnflags & YAMN_ACC_MSG)))
+ if ((hMailBrowser==NULL) && ((MyParam.nflags & YAMN_ACC_MSG) || (MyParam.nflags & YAMN_ACC_ICO) || (MyParam.nnflags & YAMN_ACC_MSG)))
{
hMailBrowser=CreateDialogParamW(YAMNVar.hInst,MAKEINTRESOURCEW(IDD_DLGVIEWMESSAGES),NULL,(DLGPROC)DlgProcYAMNMailBrowser,(LPARAM)&MyParam);
SendMessageW(hMailBrowser,WM_SETICON,(WPARAM)ICON_BIG,(LPARAM)hYamnIcons[2]);
@@ -2631,7 +2558,7 @@ DWORD WINAPI MailBrowser(LPVOID Param)
MoveWindow(hMailBrowser,PosX,PosY,SizeX,SizeY,TRUE);
}
- if(hMailBrowser!=NULL)
+ if (hMailBrowser!=NULL)
{
struct CChangeContent Params={MyParam.nflags,MyParam.nnflags}; //if this thread created window, just post message to update mails
@@ -2640,11 +2567,11 @@ DWORD WINAPI MailBrowser(LPVOID Param)
else
UpdateMails(NULL,ActualAccount,MyParam.nflags,MyParam.nnflags); //update mails without displaying or refreshing any window
- if((hMailBrowser!=NULL) && !WndFound) //we process message loop only for thread that created window
+ if ((hMailBrowser!=NULL) && !WndFound) //we process message loop only for thread that created window
{
while(GetMessage(&msg,NULL,0,0))
{
- if(!IsDialogMessage(hMailBrowser, &msg))
+ if (!IsDialogMessage(hMailBrowser, &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
@@ -2652,7 +2579,7 @@ DWORD WINAPI MailBrowser(LPVOID Param)
}
}
- if((!WndFound) && (ActualAccount->Plugin->Fcn!=NULL) && (ActualAccount->Plugin->Fcn->WriteAccountsFcnPtr!=NULL) && ActualAccount->AbleToWork)
+ if ((!WndFound) && (ActualAccount->Plugin->Fcn!=NULL) && (ActualAccount->Plugin->Fcn->WriteAccountsFcnPtr!=NULL) && ActualAccount->AbleToWork)
ActualAccount->Plugin->Fcn->WriteAccountsFcnPtr();
}
__finally
@@ -2672,15 +2599,15 @@ INT_PTR RunMailBrowserSvc(WPARAM wParam,LPARAM lParam)
HANDLE ThreadRunningEV;
PYAMN_MAILBROWSERPARAM Param=(PYAMN_MAILBROWSERPARAM)wParam;
- if((DWORD)lParam!=YAMN_MAILBROWSERVERSION)
+ if ((DWORD)lParam!=YAMN_MAILBROWSERVERSION)
return 0;
- if(NULL!=(ThreadRunningEV=CreateEvent(NULL,FALSE,FALSE,NULL)))
+ if (NULL!=(ThreadRunningEV=CreateEvent(NULL,FALSE,FALSE,NULL)))
{
HANDLE NewThread;
Param->ThreadRunningEV=ThreadRunningEV;
- if(NULL!=(NewThread=CreateThread(NULL,0,MailBrowser,Param,0,&tid)))
+ if (NULL!=(NewThread=CreateThread(NULL,0,MailBrowser,Param,0,&tid)))
{
WaitForSingleObject(ThreadRunningEV,INFINITE);
CloseHandle(NewThread);
diff --git a/plugins/YAMN/debug.cpp b/plugins/YAMN/debug.cpp
index 67fbf5ce09..9b9793a965 100644
--- a/plugins/YAMN/debug.cpp
+++ b/plugins/YAMN/debug.cpp
@@ -7,12 +7,9 @@
* (c) majvan 2002-2004
*/
-/*#include <windows.h>
-#include <tchar.h>
-#include <stdio.h>*/
+#include "yamn.h"
#include "debug.h"
#ifdef YAMN_DEBUG
-#include "yamn.h"
#include "version.h"
#if defined (WIN9X)
@@ -26,7 +23,7 @@
//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
-TCHAR DebugUserDirectory[MAX_PATH]=".";
+TCHAR DebugUserDirectory[MAX_PATH] = _T(".");
LPCRITICAL_SECTION FileAccessCS;
#ifdef DEBUG_SYNCHRO
@@ -52,7 +49,7 @@ void InitDebug()
#if defined (DEBUG_SYNCHRO) || defined (DEBUG_COMM) || defined (DEBUG_DECODE)
TCHAR DebugFileName[MAX_PATH];
#endif
- if(FileAccessCS==NULL)
+ if (FileAccessCS==NULL)
{
FileAccessCS=new CRITICAL_SECTION;
InitializeCriticalSection(FileAccessCS);
@@ -107,7 +104,7 @@ void DebugLog(HANDLE File,const char *fmt,...)
va_start(vararg,fmt);
str=(char *)malloc(strsize=65536);
- _stprintf(tids,_T("[%x]"),GetCurrentThreadId());
+ mir_snprintf(tids, SIZEOF(tids), "[%x]",GetCurrentThreadId());
while(_vsnprintf(str,strsize,fmt,vararg)==-1)
str=(char *)realloc(str,strsize+=65536);
va_end(vararg);
@@ -128,7 +125,7 @@ void DebugLogW(HANDLE File,const WCHAR *fmt,...)
va_start(vararg,fmt);
str=(WCHAR *)malloc((strsize=65536)*sizeof(WCHAR));
- _stprintf(tids,_T("[%x]"),GetCurrentThreadId());
+ mir_snprintf(tids, SIZEOF(tids), "[%x]",GetCurrentThreadId());
while(_vsnwprintf(str,strsize,fmt,vararg)==-1)
str=(WCHAR *)realloc(str,(strsize+=65536)*sizeof(WCHAR));
va_end(vararg);
diff --git a/plugins/YAMN/debug.h b/plugins/YAMN/debug.h
index df6977259c..d2b6764406 100644
--- a/plugins/YAMN/debug.h
+++ b/plugins/YAMN/debug.h
@@ -47,11 +47,18 @@ extern HANDLE DecodeFile;
#endif
#if defined(DEBUG_FILEREAD) || defined(DEBUG_FILEREADMESSAGES)
-DWORD ReadStringFromMemory(TCHAR **Parser,TCHAR *End,TCHAR **StoreTo,TCHAR *DebugString);
+DWORD ReadStringFromMemory(char **Parser,char *End,char **StoreTo,char *DebugString);
#ifndef UNICODE
-DWORD ReadStringFromMemoryW(TCHAR **Parser,TCHAR *End,TCHAR **StoreTo,TCHAR *DebugString);
+#define ReadStringFromMemoryW ReadStringFromMemory
#else
+DWORD ReadStringFromMemoryW(char **Parser,TCHAR *End,char **StoreTo,TCHAR *DebugString);
+ #endif
+#else
+DWORD ReadStringFromMemory(char **Parser,char *End,char **StoreTo);
+ #ifndef UNICODE
#define ReadStringFromMemoryW ReadStringFromMemory
+ #else
+DWORD ReadStringFromMemoryW(WCHAR **Parser,WCHAR *End,WCHAR **StoreTo);
#endif
#endif
diff --git a/plugins/YAMN/filterplugin.cpp b/plugins/YAMN/filterplugin.cpp
index a46301e399..88d18cb260 100644
--- a/plugins/YAMN/filterplugin.cpp
+++ b/plugins/YAMN/filterplugin.cpp
@@ -4,29 +4,7 @@
* (c) majvan 2002-2004
*/
-#include <windows.h>
-#include <tchar.h>
-#include <stdio.h>
-#include <newpluginapi.h>
-#include <m_database.h>
-#include "m_yamn.h"
-#include "m_filterplugin.h"
-#include "m_mails.h"
-#include "debug.h"
-
-//- imported ---------------------------------------------------------------------------------------
-//--------------------------------------------------------------------------------------------------
-
-//From main.cpp
-extern LPCRITICAL_SECTION PluginRegCS;
-extern YAMN_VARIABLES YAMNVar;
-//From synchro.cpp
-extern DWORD WINAPI WaitToWriteFcn(PSWMRG SObject,PSCOUNTER=NULL);
-extern void WINAPI WriteDoneFcn(PSWMRG SObject,PSCOUNTER=NULL);
-//From maild.cpp
-extern INT_PTR LoadMailDataSvc(WPARAM wParam,LPARAM lParam);
-extern INT_PTR UnloadMailDataSvc(WPARAM wParam,LPARAM);
-extern INT_PTR SaveMailDataSvc(WPARAM wParam,LPARAM lParam);
+#include "yamn.h"
//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
@@ -72,11 +50,11 @@ INT_PTR RegisterFilterPluginSvc(WPARAM wParam,LPARAM lParam)
PYAMN_FILTERREGISTRATION Registration=(PYAMN_FILTERREGISTRATION)wParam;
HYAMNFILTERPLUGIN Plugin;
- if(lParam!=YAMN_FILTERREGISTRATIONVERSION)
+ if (lParam!=YAMN_FILTERREGISTRATIONVERSION)
return 0;
- if((Registration->Name==NULL) || (Registration->Ver==NULL))
+ if ((Registration->Name==NULL) || (Registration->Ver==NULL))
return NULL;
- if(NULL==(Plugin=new YAMN_FILTERPLUGIN))
+ if (NULL==(Plugin=new YAMN_FILTERPLUGIN))
return NULL;
Plugin->PluginInfo=Registration;
@@ -93,7 +71,7 @@ INT_PTR UnregisterFilterPlugin(HYAMNFILTERPLUGIN Plugin)
{
PYAMN_FILTERPLUGINQUEUE Parser,Found;
- if(FirstFilterPlugin->Plugin==Plugin)
+ if (FirstFilterPlugin->Plugin==Plugin)
{
Found=FirstFilterPlugin;
FirstFilterPlugin=FirstFilterPlugin->Next;
@@ -101,7 +79,7 @@ INT_PTR UnregisterFilterPlugin(HYAMNFILTERPLUGIN Plugin)
else
{
for(Parser=FirstFilterPlugin;(Parser->Next!=NULL) && (Plugin!=Parser->Next->Plugin);Parser=Parser->Next);
- if(Parser->Next!=NULL)
+ if (Parser->Next!=NULL)
{
Found=Parser->Next;
Parser->Next=Parser->Next->Next;
@@ -109,9 +87,9 @@ INT_PTR UnregisterFilterPlugin(HYAMNFILTERPLUGIN Plugin)
else
Found=NULL;
}
- if(Found!=NULL)
+ if (Found!=NULL)
{
- if(Plugin->FilterFcn->UnLoadFcn!=NULL)
+ if (Plugin->FilterFcn->UnLoadFcn!=NULL)
Plugin->FilterFcn->UnLoadFcn((void *)0);
delete Found->Plugin;
@@ -129,19 +107,19 @@ INT_PTR UnregisterFilterPluginSvc(WPARAM wParam,LPARAM lParam)
{
HYAMNFILTERPLUGIN Plugin=(HYAMNFILTERPLUGIN)wParam;
- EnterCriticalSection(PluginRegCS);
+ EnterCriticalSection(&PluginRegCS);
UnregisterFilterPlugin(Plugin);
- LeaveCriticalSection(PluginRegCS);
+ LeaveCriticalSection(&PluginRegCS);
return 1;
}
INT_PTR UnregisterFilterPlugins()
{
- EnterCriticalSection(PluginRegCS);
+ EnterCriticalSection(&PluginRegCS);
//We remove protocols from the protocol list
while(FirstFilterPlugin!=NULL)
UnregisterFilterPlugin(FirstFilterPlugin->Plugin);
- LeaveCriticalSection(PluginRegCS);
+ LeaveCriticalSection(&PluginRegCS);
return 1;
}
@@ -149,9 +127,9 @@ int WINAPI SetFilterPluginFcnImportFcn(HYAMNFILTERPLUGIN Plugin,DWORD Importance
{
PYAMN_FILTERPLUGINQUEUE Parser,Previous;
- if(YAMNFilterFcnVer!=YAMN_FILTERIMPORTFCNVERSION)
+ if (YAMNFilterFcnVer!=YAMN_FILTERIMPORTFCNVERSION)
return 0;
- if(YAMNFilterFcn==NULL)
+ if (YAMNFilterFcn==NULL)
return 0;
#ifdef DEBUG_SYNCHRO
@@ -160,10 +138,10 @@ int WINAPI SetFilterPluginFcnImportFcn(HYAMNFILTERPLUGIN Plugin,DWORD Importance
Plugin->Importance=Importance;
Plugin->FilterFcn=YAMNFilterFcn;
- EnterCriticalSection(PluginRegCS);
+ EnterCriticalSection(&PluginRegCS);
//We add protocol to the protocol list
for(Previous=NULL,Parser=FirstFilterPlugin;Parser!=NULL && Parser->Next!=NULL && Parser->Plugin->Importance<=Importance;Previous=Parser,Parser=Parser->Next);
- if(Previous==NULL) //insert to the beginnig of queue
+ if (Previous==NULL) //insert to the beginnig of queue
{
FirstFilterPlugin=new YAMN_FILTERPLUGINQUEUE;
FirstFilterPlugin->Plugin=Plugin;
@@ -177,7 +155,7 @@ int WINAPI SetFilterPluginFcnImportFcn(HYAMNFILTERPLUGIN Plugin,DWORD Importance
Previous->Next=Parser; //and in actual plugin set, that next plugin is the one we insert in front of
}
- LeaveCriticalSection(PluginRegCS);
+ LeaveCriticalSection(&PluginRegCS);
return 1;
}
@@ -187,7 +165,7 @@ INT_PTR FilterMailSvc(WPARAM wParam,LPARAM lParam)
HYAMNMAIL Mail=(HYAMNMAIL)lParam;
PYAMN_FILTERPLUGINQUEUE ActualPlugin;
- EnterCriticalSection(PluginRegCS);
+ EnterCriticalSection(&PluginRegCS);
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"FilterMail:ActualAccountMsgsSO-write wait\n");
#endif
@@ -197,7 +175,7 @@ INT_PTR FilterMailSvc(WPARAM wParam,LPARAM lParam)
#endif
for(ActualPlugin=FirstFilterPlugin;ActualPlugin!=NULL;ActualPlugin=ActualPlugin->Next)
{
- if(ActualPlugin->Plugin->FilterFcn->FilterMailFcnPtr!=NULL)
+ if (ActualPlugin->Plugin->FilterFcn->FilterMailFcnPtr!=NULL)
{
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"\tFiltering Mail, running plugin %0x to filter mail\n",ActualPlugin->Plugin);
@@ -211,16 +189,16 @@ INT_PTR FilterMailSvc(WPARAM wParam,LPARAM lParam)
Mail->Flags|=YAMN_MSG_FILTERED;
//Set mail flags according to spamlevel settings
- if((Mail->Flags & YAMN_MSG_SPAMMASK) > YAMN_MSG_SPAML1)
+ if ((Mail->Flags & YAMN_MSG_SPAMMASK) > YAMN_MSG_SPAML1)
Mail->Flags=Mail->Flags & ~(YAMN_MSG_BROWSER | YAMN_MSG_POPUP | YAMN_MSG_SYSTRAY | YAMN_MSG_SOUND | YAMN_MSG_APP | YAMN_MSG_NEVENT);
- if(YAMN_MSG_SPAML(Mail->Flags,YAMN_MSG_SPAML3) || YAMN_MSG_SPAML(Mail->Flags,YAMN_MSG_SPAML4))
+ if (YAMN_MSG_SPAML(Mail->Flags,YAMN_MSG_SPAML3) || YAMN_MSG_SPAML(Mail->Flags,YAMN_MSG_SPAML4))
Mail->Flags=Mail->Flags | (YAMN_MSG_AUTODELETE | YAMN_MSG_DELETEOK); //set message to delete
- if(YAMN_MSG_SPAML(Mail->Flags,YAMN_MSG_SPAML3))
+ if (YAMN_MSG_SPAML(Mail->Flags,YAMN_MSG_SPAML3))
Mail->Flags=Mail->Flags & ~(YAMN_MSG_MEMDELETE); //set message not to delete it immidiatelly from memory
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"FilterMail:ActualAccountMsgsSO-write done\n");
#endif
WriteDoneFcn(Account->MessagesAccessSO);
- LeaveCriticalSection(PluginRegCS);
+ LeaveCriticalSection(&PluginRegCS);
return 1;
}
diff --git a/plugins/YAMN/mails/decode.cpp b/plugins/YAMN/mails/decode.cpp
index 15c23e9f34..704b61c7d3 100644
--- a/plugins/YAMN/mails/decode.cpp
+++ b/plugins/YAMN/mails/decode.cpp
@@ -10,145 +10,145 @@
struct _tcptable CodePageNamesAll[]=
{
- {_T("ANSI"),_T(""),TRUE,CP_ACP},
- {_T("WINDOWS-1"),_T("250"),0,1250},
- {_T("WINDOWS-1"),_T("251"),0,1251},
- {_T("WINDOWS-1"),_T("252"),0,1252},
- {_T("WINDOWS-1"),_T("253"),0,1253},
- {_T("WINDOWS-1"),_T("254"),0,1254},
- {_T("WINDOWS-1"),_T("255"),0,1255},
- {_T("WINDOWS-1"),_T("256"),0,1256},
- {_T("WINDOWS-1"),_T("257"),0,1257},
- {_T("WINDOWS-1"),_T("258"),0,1258},
- {_T("CP1"),_T("250"),0,1250},
- {_T("CP1"),_T("251"),0,1251},
- {_T("CP1"),_T("252"),0,1252},
- {_T("CP1"),_T("253"),0,1253},
- {_T("CP1"),_T("254"),0,1254},
- {_T("CP1"),_T("255"),0,1255},
- {_T("CP1"),_T("256"),0,1256},
- {_T("CP1"),_T("257"),0,1257},
- {_T("CP1"),_T("258"),0,1258},
- {_T("ANSI-1"),_T("250"),0,1250},
- {_T("ANSI-1"),_T("251"),0,1251},
- {_T("ANSI-1"),_T("252"),0,1252},
- {_T("ANSI-1"),_T("253"),0,1253},
- {_T("ANSI-1"),_T("254"),0,1254},
- {_T("ANSI-1"),_T("255"),0,1255},
- {_T("ANSI-1"),_T("256"),0,1256},
- {_T("ANSI-1"),_T("257"),0,1257},
- {_T("ANSI-1"),_T("258"),0,1258},
- {_T("KOI8"),_T("-R"),0,20866},
- {_T("KOI8"),_T(""),0,20866},
- {_T("KOI8"),_T("-U"),0,21866},
- {_T("KOI8"),_T("-RU"),0,21866},
- {_T("US-"),_T("ASCII"),0,20127},
- {_T("CP"),_T("367"),0,20127},
- {_T("ASCII"),_T(""),0,20127},
- {_T("ASCII"),_T("7"),0,20127},
- {_T("ISO-8859"),_T("-1"),0,28591},
- {_T("ISO-8859"),_T("-2"),0,28592},
- {_T("ISO-8859"),_T("-3"),0,28593},
- {_T("ISO-8859"),_T("-4"),0,28594},
- {_T("ISO-8859"),_T("-5"),0,28595},
- {_T("ISO-8859"),_T("-6"),0,28596},
- {_T("ISO-8859"),_T("-7"),0,28597},
- {_T("ISO-8859"),_T("-8"),0,28598},
- {_T("ISO-8859"),_T("-9"),0,28599},
- {_T("ISO-8859"),_T("-15"),0,28605},
- {_T("ISO_8859"),_T("-1"),0,28591},
- {_T("ISO_8859"),_T("-2"),0,28592},
- {_T("ISO_8859"),_T("-3"),0,28593},
- {_T("ISO_8859"),_T("-4"),0,28594},
- {_T("ISO_8859"),_T("-5"),0,28595},
- {_T("ISO_8859"),_T("-6"),0,28596},
- {_T("ISO_8859"),_T("-7"),0,28597},
- {_T("ISO_8859"),_T("-8"),0,28598},
- {_T("ISO_8859"),_T("-9"),0,28599},
- {_T("ISO_8859"),_T("-15"),0,28605},
- {_T("ISO-"),_T("10646-USC2"),0,1200},
- {_T("ISO-2022"),_T("/2-JP"),0,50220},
- {_T("ISO-2022"),_T("-JP"),0,50221},
- {_T("ISO-2022"),_T("/JIS-JP"),0,50222},
- {_T("ISO-2022"),_T("-KR"),0,50225},
- {_T("ISO-2022"),_T("-CH(SP)"),0,50227},
- {_T("ISO-2022"),_T("-CH(TR)"),0,50229},
- {_T("UTF-"),_T("7"),0,65000},
- {_T("UTF-"),_T("8"),0,65001},
- {_T("ARAB-"),_T("TRANSPARENT"),0,710},
- {_T("ASMO-"),_T("TRANSPARENT"),0,720},
- {_T("ASMO-"),_T("449"),0,709},
- {_T("ASMO-"),_T("708"),0,708},
- {_T("BIG5"),_T(""),0,950},
- {_T("EUC-"),_T("CH(SP)"),0,51936},
- {_T("EUC-"),_T("CH(TR)"),0,51950},
- {_T("EUC-"),_T("JP"),0,51932},
- {_T("EUC-"),_T("KR"),0,51949},
- {_T("GB-"),_T("2312"),0,20936},
- {_T("GB"),_T("2312"),0,20936},
- {_T("HZGB-"),_T("2312"),0,52936},
- {_T("IBM-"),_T("037"),0,37},
- {_T("IBM-"),_T("290"),0,290},
- {_T("IBM-"),_T("437"),0,437},
- {_T("IBM-"),_T("500"),0,500},
- {_T("IBM-"),_T("775"),0,775},
- {_T("IBM-"),_T("850"),0,850},
- {_T("IBM-"),_T("852"),0,852},
- {_T("IBM-"),_T("855"),0,855},
- {_T("IBM-"),_T("857"),0,857},
- {_T("IBM-"),_T("860"),0,860},
- {_T("IBM-"),_T("861"),0,861},
- {_T("IBM-"),_T("862"),0,862},
- {_T("IBM-"),_T("863"),0,863},
- {_T("IBM-"),_T("864"),0,864},
- {_T("IBM-"),_T("865"),0,865},
- {_T("IBM-"),_T("866"),0,866},
- {_T("IBM-"),_T("869"),0,869},
- {_T("IBM-"),_T("870"),0,870},
- {_T("IBM-"),_T("875"),0,875},
- {_T("IBM-"),_T("1026"),0,1026},
- {_T("IBM-"),_T("273"),0,20273},
- {_T("IBM-"),_T("277"),0,20277},
- {_T("IBM-"),_T("278"),0,20278},
- {_T("IBM-"),_T("280"),0,20280},
- {_T("IBM-"),_T("284"),0,20284},
- {_T("IBM-"),_T("285"),0,20285},
- {_T("IBM-"),_T("290"),0,20290},
- {_T("IBM-"),_T("297"),0,20297},
- {_T("IBM-"),_T("420"),0,20420},
- {_T("IBM-"),_T("423"),0,20423},
- {_T("IBM-"),_T("871"),0,20871},
- {_T("IBM-"),_T("880"),0,20880},
- {_T("IBM-"),_T("905"),0,20905},
- {_T("IBM-"),_T("THAI"),0,20838},
- {_T("ISCII-"),_T("DEVANAGARI"),0,57002},
- {_T("ISCII-"),_T("BENGALI"),0,57003},
- {_T("ISCII-"),_T("TAMIL"),0,57004},
- {_T("ISCII-"),_T("TELUGU"),0,57005},
- {_T("ISCII-"),_T("ASSAMESE"),0,57006},
- {_T("ISCII-"),_T("ORIYA"),0,57007},
- {_T("ISCII-"),_T("KANNADA"),0,57008},
- {_T("ISCII-"),_T("MALAYALAM"),0,57009},
- {_T("ISCII-"),_T("GUJARATI"),0,57010},
- {_T("ISCII-"),_T("PUNJABI"),0,57011},
- {_T("KOR-"),_T("JOHAB"),0,1361},
- {_T("KSC-"),_T("5601"),0,1361},
- {_T("MAC-"),_T("ROMAN"),0,10000},
- {_T("MAC-"),_T("JP"),0,10001},
- {_T("MAC-"),_T("CH(SP)(BIG5)"),0,10002},
- {_T("MAC-"),_T("KR"),0,10003},
- {_T("MAC-"),_T("AR"),0,10004},
- {_T("MAC-"),_T("HW"),0,10005},
- {_T("MAC-"),_T("GR"),0,10006},
- {_T("MAC-"),_T("CY"),0,10007},
- {_T("MAC-"),_T("CH(SP)(GB2312)"),0,10008},
- {_T("MAC-"),_T("ROMANIA"),0,10010},
- {_T("MAC-"),_T("UA"),0,10017},
- {_T("MAC-"),_T("TH"),0,10021},
- {_T("MAC-"),_T("LAT2"),0,10029},
- {_T("MAC-"),_T("ICE"),0,10079},
- {_T("MAC-"),_T("TR"),0,10081},
- {_T("MAC-"),_T("CR"),0,10082},
+ { "ANSI", "",TRUE,CP_ACP},
+ { "WINDOWS-1", "250",0,1250},
+ { "WINDOWS-1", "251",0,1251},
+ { "WINDOWS-1", "252",0,1252},
+ { "WINDOWS-1", "253",0,1253},
+ { "WINDOWS-1", "254",0,1254},
+ { "WINDOWS-1", "255",0,1255},
+ { "WINDOWS-1", "256",0,1256},
+ { "WINDOWS-1", "257",0,1257},
+ { "WINDOWS-1", "258",0,1258},
+ { "CP1", "250",0,1250},
+ { "CP1", "251",0,1251},
+ { "CP1", "252",0,1252},
+ { "CP1", "253",0,1253},
+ { "CP1", "254",0,1254},
+ { "CP1", "255",0,1255},
+ { "CP1", "256",0,1256},
+ { "CP1", "257",0,1257},
+ { "CP1", "258",0,1258},
+ { "ANSI-1", "250",0,1250},
+ { "ANSI-1", "251",0,1251},
+ { "ANSI-1", "252",0,1252},
+ { "ANSI-1", "253",0,1253},
+ { "ANSI-1", "254",0,1254},
+ { "ANSI-1", "255",0,1255},
+ { "ANSI-1", "256",0,1256},
+ { "ANSI-1", "257",0,1257},
+ { "ANSI-1", "258",0,1258},
+ { "KOI8", "-R",0,20866},
+ { "KOI8", "",0,20866},
+ { "KOI8", "-U",0,21866},
+ { "KOI8", "-RU",0,21866},
+ { "US-", "ASCII",0,20127},
+ { "CP", "367",0,20127},
+ { "ASCII", "",0,20127},
+ { "ASCII", "7",0,20127},
+ { "ISO-8859", "-1",0,28591},
+ { "ISO-8859", "-2",0,28592},
+ { "ISO-8859", "-3",0,28593},
+ { "ISO-8859", "-4",0,28594},
+ { "ISO-8859", "-5",0,28595},
+ { "ISO-8859", "-6",0,28596},
+ { "ISO-8859", "-7",0,28597},
+ { "ISO-8859", "-8",0,28598},
+ { "ISO-8859", "-9",0,28599},
+ { "ISO-8859", "-15",0,28605},
+ { "ISO_8859", "-1",0,28591},
+ { "ISO_8859", "-2",0,28592},
+ { "ISO_8859", "-3",0,28593},
+ { "ISO_8859", "-4",0,28594},
+ { "ISO_8859", "-5",0,28595},
+ { "ISO_8859", "-6",0,28596},
+ { "ISO_8859", "-7",0,28597},
+ { "ISO_8859", "-8",0,28598},
+ { "ISO_8859", "-9",0,28599},
+ { "ISO_8859", "-15",0,28605},
+ { "ISO-", "10646-USC2",0,1200},
+ { "ISO-2022", "/2-JP",0,50220},
+ { "ISO-2022", "-JP",0,50221},
+ { "ISO-2022", "/JIS-JP",0,50222},
+ { "ISO-2022", "-KR",0,50225},
+ { "ISO-2022", "-CH(SP)",0,50227},
+ { "ISO-2022", "-CH(TR)",0,50229},
+ { "UTF-", "7",0,65000},
+ { "UTF-", "8",0,65001},
+ { "ARAB-", "TRANSPARENT",0,710},
+ { "ASMO-", "TRANSPARENT",0,720},
+ { "ASMO-", "449",0,709},
+ { "ASMO-", "708",0,708},
+ { "BIG5", "",0,950},
+ { "EUC-", "CH(SP)",0,51936},
+ { "EUC-", "CH(TR)",0,51950},
+ { "EUC-", "JP",0,51932},
+ { "EUC-", "KR",0,51949},
+ { "GB-", "2312",0,20936},
+ { "GB", "2312",0,20936},
+ { "HZGB-", "2312",0,52936},
+ { "IBM-", "037",0,37},
+ { "IBM-", "290",0,290},
+ { "IBM-", "437",0,437},
+ { "IBM-", "500",0,500},
+ { "IBM-", "775",0,775},
+ { "IBM-", "850",0,850},
+ { "IBM-", "852",0,852},
+ { "IBM-", "855",0,855},
+ { "IBM-", "857",0,857},
+ { "IBM-", "860",0,860},
+ { "IBM-", "861",0,861},
+ { "IBM-", "862",0,862},
+ { "IBM-", "863",0,863},
+ { "IBM-", "864",0,864},
+ { "IBM-", "865",0,865},
+ { "IBM-", "866",0,866},
+ { "IBM-", "869",0,869},
+ { "IBM-", "870",0,870},
+ { "IBM-", "875",0,875},
+ { "IBM-", "1026",0,1026},
+ { "IBM-", "273",0,20273},
+ { "IBM-", "277",0,20277},
+ { "IBM-", "278",0,20278},
+ { "IBM-", "280",0,20280},
+ { "IBM-", "284",0,20284},
+ { "IBM-", "285",0,20285},
+ { "IBM-", "290",0,20290},
+ { "IBM-", "297",0,20297},
+ { "IBM-", "420",0,20420},
+ { "IBM-", "423",0,20423},
+ { "IBM-", "871",0,20871},
+ { "IBM-", "880",0,20880},
+ { "IBM-", "905",0,20905},
+ { "IBM-", "THAI",0,20838},
+ { "ISCII-", "DEVANAGARI",0,57002},
+ { "ISCII-", "BENGALI",0,57003},
+ { "ISCII-", "TAMIL",0,57004},
+ { "ISCII-", "TELUGU",0,57005},
+ { "ISCII-", "ASSAMESE",0,57006},
+ { "ISCII-", "ORIYA",0,57007},
+ { "ISCII-", "KANNADA",0,57008},
+ { "ISCII-", "MALAYALAM",0,57009},
+ { "ISCII-", "GUJARATI",0,57010},
+ { "ISCII-", "PUNJABI",0,57011},
+ { "KOR-", "JOHAB",0,1361},
+ { "KSC-", "5601",0,1361},
+ { "MAC-", "ROMAN",0,10000},
+ { "MAC-", "JP",0,10001},
+ { "MAC-", "CH(SP)(BIG5)",0,10002},
+ { "MAC-", "KR",0,10003},
+ { "MAC-", "AR",0,10004},
+ { "MAC-", "HW",0,10005},
+ { "MAC-", "GR",0,10006},
+ { "MAC-", "CY",0,10007},
+ { "MAC-", "CH(SP)(GB2312)",0,10008},
+ { "MAC-", "ROMANIA",0,10010},
+ { "MAC-", "UA",0,10017},
+ { "MAC-", "TH",0,10021},
+ { "MAC-", "LAT2",0,10029},
+ { "MAC-", "ICE",0,10079},
+ { "MAC-", "TR",0,10081},
+ { "MAC-", "CR",0,10082}
};
int CPLENALL = (sizeof(CodePageNamesAll)/sizeof(CodePageNamesAll[0]));
@@ -209,13 +209,13 @@ int GetCharsetFromString(char *input,size_t size)
char *pin=input;
char *pout,*parser;
- if((size<1) || (parser=pout=new char[size+1])==NULL)
+ if ((size<1) || (parser=pout=new char[size+1])==NULL)
return -1;
while((*pin!=0) && (pin-input< (INT_PTR)size))
{
if ((*pin>='a') && (*pin<='z'))
*parser++=*(pin++)-('a'-'A'); // make it capital
- //else if(*pin=='\"') // this is already done in ExtractFromContentType
+ //else if (*pin=='\"') // this is already done in ExtractFromContentType
// *pin++; //skip the quotes if any
else
*parser++=*pin++;
@@ -228,7 +228,7 @@ int GetCharsetFromString(char *input,size_t size)
#endif
for(int i=0;i<CPLENALL;i++){
size_t len = strlen(CodePageNamesAll[i].NameBase);
- if(0==strncmp(pout,CodePageNamesAll[i].NameBase,len)){
+ if (0==strncmp(pout,CodePageNamesAll[i].NameBase,len)){
if (0==strcmp(pout+len,CodePageNamesAll[i].NameSub)){
delete[] pout;
return CodePageNamesAll[i].CP;
@@ -241,17 +241,17 @@ int GetCharsetFromString(char *input,size_t size)
int FromHexa(char HexValue,char *DecValue)
{
- if(HexValue>='0' && HexValue<='9')
+ if (HexValue>='0' && HexValue<='9')
{
*DecValue=HexValue-'0';
return 1;
}
- if(HexValue>='A' && HexValue<='F')
+ if (HexValue>='A' && HexValue<='F')
{
*DecValue=HexValue-'A'+10;
return 1;
}
- if(HexValue>='a' && HexValue<='f')
+ if (HexValue>='a' && HexValue<='f')
{
*DecValue=HexValue-'a'+10;
return 1;
@@ -261,32 +261,32 @@ int FromHexa(char HexValue,char *DecValue)
int FromBase64(char Base64Value,char *DecValue)
{
- if(Base64Value>='A' && Base64Value<='Z')
+ if (Base64Value>='A' && Base64Value<='Z')
{
*DecValue=Base64Value-'A';
return 1;
}
- if(Base64Value>='a' && Base64Value<='z')
+ if (Base64Value>='a' && Base64Value<='z')
{
*DecValue=Base64Value-'a'+26;
return 1;
}
- if(Base64Value>='0' && Base64Value<='9')
+ if (Base64Value>='0' && Base64Value<='9')
{
*DecValue=Base64Value-'0'+52;
return 1;
}
- if(Base64Value=='+')
+ if (Base64Value=='+')
{
*DecValue=Base64Value-'+'+62;
return 1;
}
- if(Base64Value=='/')
+ if (Base64Value=='/')
{
*DecValue=Base64Value-'/'+63;
return 1;
}
- if(Base64Value=='=')
+ if (Base64Value=='=')
{
*DecValue=0;
return 1;
@@ -301,7 +301,7 @@ int DecodeQuotedPrintable(char *Src,char *Dst,int DstLen, BOOL isQ)
DebugLog(DecodeFile,"<Decode Quoted><Input>%s</Input>",Src);
#endif
for(int Counter=0;((char)*Src!=0) && DstLen && (Counter++<DstLen);Src++,Dst++)
- if(*Src=='=')
+ if (*Src=='=')
{
if (!isQ){
if (Src[1]==0x0D){
@@ -315,12 +315,12 @@ int DecodeQuotedPrintable(char *Src,char *Dst,int DstLen, BOOL isQ)
}
}
char First,Second;
- if(!FromHexa(*(++Src),&First))
+ if (!FromHexa(*(++Src),&First))
{
*Dst++='=';Src--;
continue;
}
- if(!FromHexa(*(++Src),&Second))
+ if (!FromHexa(*(++Src),&Second))
{
*Dst++='=';Src--;Src--;
continue;
@@ -328,7 +328,7 @@ int DecodeQuotedPrintable(char *Src,char *Dst,int DstLen, BOOL isQ)
*Dst=(char)(First)<<4;
*Dst+=Second;
}
- else if(isQ && *Src=='_')
+ else if (isQ && *Src=='_')
*Dst=' ';
else
CopyCharQuotedPrintable: // Yeah. Bad programming stile.
@@ -358,18 +358,18 @@ int DecodeBase64(char *Src,char *Dst,int DstLen)
Src++;
continue;
}
- if((!(Result=FromBase64(*Src,MiniResult+Locator)) && (*Src==0)) || Locator++==3) //end_of_str || end_of_4_bytes
+ if ((!(Result=FromBase64(*Src,MiniResult+Locator)) && (*Src==0)) || Locator++==3) //end_of_str || end_of_4_bytes
{
Locator=0; //next write to the first byte
*Dst++=(char)((MiniResult[0]<<2) | (MiniResult[1]>>4));
- if(Dst==End) goto end; //DstLen exceeded?
+ if (Dst==End) goto end; //DstLen exceeded?
*Dst++=(char)((MiniResult[1]<<4) | (MiniResult[2]>>2));
- if(Dst==End) goto end; //someones don't like goto, but not me
+ if (Dst==End) goto end; //someones don't like goto, but not me
*Dst++=(char)((MiniResult[2]<<6) | MiniResult[3]);
- if(!Result && (*Src==0)) goto end; //end of string?
+ if (!Result && (*Src==0)) goto end; //end of string?
MiniResult[0]=MiniResult[1]=MiniResult[2]=MiniResult[3]=0; //zero 4byte buffer for next loop
}
- if(!Result) return 0; //unrecognised character occured
+ if (!Result) return 0; //unrecognised character occured
Src++;
}
end:
@@ -392,30 +392,30 @@ int ConvertStringToUnicode(char *stream,unsigned int cp,WCHAR **out)
//codepages, which require to have set 0 in dwFlags parameter when calling MultiByteToWideChar
DWORD CodePagesZeroFlags[]={50220,50221,50222,50225,50227,50229,52936,54936,57002,57003,57004,57005,57006,57007,57008,57009,57010,57011,65000,65001};
- if((cp!=CP_ACP) && (cp!=CP_OEMCP) && (cp!=CP_MACCP) && (cp!=CP_THREAD_ACP) && (cp!=CP_SYMBOL) && (cp!=CP_UTF7) && (cp!=CP_UTF8) && !GetCPInfo(cp,&CPInfo))
+ if ((cp!=CP_ACP) && (cp!=CP_OEMCP) && (cp!=CP_MACCP) && (cp!=CP_THREAD_ACP) && (cp!=CP_SYMBOL) && (cp!=CP_UTF7) && (cp!=CP_UTF8) && !GetCPInfo(cp,&CPInfo))
cp=CP_ACP;
#ifdef DEBUG_DECODECODEPAGE
DebugLog(DecodeFile,"<CodePage #>%d</CodePage #>",cp);
#endif
for(Index=0;Index<sizeof(CodePagesZeroFlags)/sizeof(CodePagesZeroFlags[0]);Index++)
- if(CodePagesZeroFlags[Index]==cp)
+ if (CodePagesZeroFlags[Index]==cp)
{
Index=-1;
break;
}
- if(Index==-1)
+ if (Index==-1)
streamlen=MultiByteToWideChar(cp,0,stream,-1,NULL,0);
else
streamlen=MultiByteToWideChar(cp,MB_USEGLYPHCHARS,stream,-1,NULL,0);
- if(*out!=NULL)
+ if (*out!=NULL)
outlen=wcslen(*out);
else
outlen=0;
temp=new WCHAR[streamlen+outlen+1];
- if(*out!=NULL)
+ if (*out!=NULL)
{
for(dest=temp;*src!=(WCHAR)0;src++,dest++) //copy old string from *out to temp
*dest=*src;
@@ -426,14 +426,14 @@ int ConvertStringToUnicode(char *stream,unsigned int cp,WCHAR **out)
dest=temp;
*out=temp;
- if(Index==-1)
+ if (Index==-1)
{
- if(!MultiByteToWideChar(cp,0,stream,-1,dest,streamlen))
+ if (!MultiByteToWideChar(cp,0,stream,-1,dest,streamlen))
return 0;
}
else
{
- if(!MultiByteToWideChar(cp,MB_USEGLYPHCHARS,stream,-1,dest,streamlen))
+ if (!MultiByteToWideChar(cp,MB_USEGLYPHCHARS,stream,-1,dest,streamlen))
return 0;
}
return 1;
@@ -445,22 +445,22 @@ void ConvertCodedStringToUnicode(char *stream,WCHAR **storeto,DWORD cp,int mode)
char Encoding=0;
char *DecodedResult=NULL;
- if(stream==NULL)
+ if (stream==NULL)
return;
while(WS(start)) start++;
WCHAR *tempstore=0;
- if(!ConvertStringToUnicode(stream,cp,&tempstore))return;
+ if (!ConvertStringToUnicode(stream,cp,&tempstore))return;
size_t tempstoreLength = wcslen(tempstore);
size_t outind = 0;
while(*start!=0){
- if(CODES(start)){
+ if (CODES(start)){
finder=start+2;finderend=finder;
while(!CODED(finderend) && !EOS(finderend)) finderend++;
start = finderend;
- if(CODED(finderend))
+ if (CODED(finderend))
{
Encoding=*(finderend+1);
switch(Encoding)
@@ -473,23 +473,23 @@ void ConvertCodedStringToUnicode(char *stream,WCHAR **storeto,DWORD cp,int mode)
default:
goto NotEncoded;
}
- if(-1==(cp=(DWORD)GetCharsetFromString(finder,finderend-finder)))
+ if (-1==(cp=(DWORD)GetCharsetFromString(finder,finderend-finder)))
cp=CP_ACP;
- if(Encoding!=0)
+ if (Encoding!=0)
{
int size,codeend;
char *pcodeend;
finder=finderend+2;
- if(CODED(finder))
+ if (CODED(finder))
finder++;
while(WS(finder)) finder++;
finderend=finder;
while(!CODEE(finderend) && !EOS(finderend)) finderend++;
- if(codeend=CODEE(finderend))
+ if (codeend=CODEE(finderend))
pcodeend=finderend;
while(WS(finderend-1)) finderend--;
- if((mode==MIME_MAIL) && (((*finder=='"') && (*(finderend-1)=='"'))))
+ if ((mode==MIME_MAIL) && (((*finder=='"') && (*(finderend-1)=='"'))))
{
finder++;
finderend--;
@@ -509,7 +509,7 @@ void ConvertCodedStringToUnicode(char *stream,WCHAR **storeto,DWORD cp,int mode)
size=finderend-finder+1+1;
break;
}
- if(DecodedResult!=NULL)
+ if (DecodedResult!=NULL)
delete[] DecodedResult;
DecodedResult=new char[size+1];
switch(Encoding)
@@ -524,9 +524,9 @@ void ConvertCodedStringToUnicode(char *stream,WCHAR **storeto,DWORD cp,int mode)
break;
}
delete[] oneWordEncoded;
- if(codeend)
+ if (codeend)
finderend=pcodeend+2;
- if(WS(finderend)) //if string continues and there's some whitespace, add space to string that is to be converted
+ if (WS(finderend)) //if string continues and there's some whitespace, add space to string that is to be converted
{
size_t len=strlen(DecodedResult);
DecodedResult[len]=' ';
@@ -534,7 +534,7 @@ void ConvertCodedStringToUnicode(char *stream,WCHAR **storeto,DWORD cp,int mode)
finderend++;
}
WCHAR *oneWord=0;
- if(ConvertStringToUnicode(DecodedResult,cp,&oneWord)){
+ if (ConvertStringToUnicode(DecodedResult,cp,&oneWord)){
size_t len = wcslen(oneWord);
memcpy(&tempstore[outind],oneWord,len*sizeof(WCHAR));
outind += len;
diff --git a/plugins/YAMN/mails/mails.cpp b/plugins/YAMN/mails/mails.cpp
index b99a9fd560..5d3c0e9284 100644
--- a/plugins/YAMN/mails/mails.cpp
+++ b/plugins/YAMN/mails/mails.cpp
@@ -124,21 +124,21 @@ INT_PTR CreateAccountMailSvc(WPARAM wParam,LPARAM lParam)
HYAMNMAIL NewMail;
//test if we are going to initialize members of suitable structure (structures of plugin and YAMN must match)
- if(MailVersion!=YAMN_MAILVERSION)
+ if (MailVersion!=YAMN_MAILVERSION)
return NULL;
- if(Account->Plugin!=NULL)
+ if (Account->Plugin!=NULL)
{
- if(Account->Plugin->MailFcn->NewMailFcnPtr!=NULL)
+ if (Account->Plugin->MailFcn->NewMailFcnPtr!=NULL)
{
//Let plugin create its own structure, which can be derived from CAccount structure
- if(NULL==(NewMail=Account->Plugin->MailFcn->NewMailFcnPtr(Account,YAMN_MAILVERSION)))
+ if (NULL==(NewMail=Account->Plugin->MailFcn->NewMailFcnPtr(Account,YAMN_MAILVERSION)))
return NULL;
}
else
{
//We suggest plugin uses standard CAccount structure, so we create it
- if(NULL==(NewMail=new YAMNMAIL))
+ if (NULL==(NewMail=new YAMNMAIL))
//If not created successfully
return NULL;
NewMail->MailData=NULL;
@@ -155,29 +155,29 @@ INT_PTR DeleteAccountMailSvc(WPARAM wParam,LPARAM lParam)
HYAMNMAIL OldMail=(HYAMNMAIL)lParam;
struct CMimeItem *TH;
- if(Plugin->MailFcn!=NULL){
- if(Plugin->MailFcn->DeleteMailFcnPtr!=NULL) {
+ if (Plugin->MailFcn!=NULL){
+ if (Plugin->MailFcn->DeleteMailFcnPtr!=NULL) {
//Let plugin delete its own CMimeMsgQueue derived structure
Plugin->MailFcn->DeleteMailFcnPtr(OldMail);
return 1;
}
}
- if(OldMail->MailData!=NULL) {
- if(OldMail->MailData->Body!=NULL)
+ if (OldMail->MailData!=NULL) {
+ if (OldMail->MailData->Body!=NULL)
delete[] OldMail->MailData->Body;
- if((TH=OldMail->MailData->TranslatedHeader)!=NULL)
+ if ((TH=OldMail->MailData->TranslatedHeader)!=NULL)
for(;OldMail->MailData->TranslatedHeader!=NULL;) {
TH=TH->Next;
- if(OldMail->MailData->TranslatedHeader->name!=NULL)
+ if (OldMail->MailData->TranslatedHeader->name!=NULL)
delete[] OldMail->MailData->TranslatedHeader->name;
- if(OldMail->MailData->TranslatedHeader->value!=NULL)
+ if (OldMail->MailData->TranslatedHeader->value!=NULL)
delete[] OldMail->MailData->TranslatedHeader->value;
delete OldMail->MailData->TranslatedHeader;
OldMail->MailData->TranslatedHeader=TH;
}
delete OldMail->MailData;
}
- if(OldMail->ID!=NULL)
+ if (OldMail->ID!=NULL)
delete[] OldMail->ID;
delete OldMail; //consider mail as standard HYAMNMAIL, not initialized before and use its own destructor
@@ -197,7 +197,7 @@ INT_PTR LoadMailDataSvc(WPARAM wParam,LPARAM lParam)
HYAMNMAIL Mail=(HYAMNMAIL)wParam;
DWORD MailVersion=(DWORD)lParam;
- if(MailVersion!=YAMN_MAILDATAVERSION)
+ if (MailVersion!=YAMN_MAILDATAVERSION)
return NULL;
//now we have all data to memory persisting, so no loading is needed
@@ -217,7 +217,7 @@ INT_PTR SaveMailDataSvc(WPARAM wParam,LPARAM lParam)
HYAMNMAIL Mail=(HYAMNMAIL)wParam;
DWORD MailVersion=(DWORD)lParam;
- if(MailVersion!=YAMN_MAILDATAVERSION)
+ if (MailVersion!=YAMN_MAILDATAVERSION)
return (INT_PTR)-1;
//now we have all data to memory persisting, so no saving is needed
@@ -234,12 +234,12 @@ void WINAPI SynchroMessagesFcn(HACCOUNT Account,HYAMNMAIL *OldQueue,HYAMNMAIL *R
HYAMNMAIL Parser,ParserPrev;
HYAMNMAIL RemovedOldParser =NULL;
HYAMNMAIL RemovedNewParser =NULL;
- if(RemovedOld!=NULL) *RemovedOld=NULL;
- if(RemovedNew!=NULL) *RemovedNew=NULL;
+ if (RemovedOld!=NULL) *RemovedOld=NULL;
+ if (RemovedNew!=NULL) *RemovedNew=NULL;
for(FinderPrev=NULL,Finder=*OldQueue;Finder!=NULL;)
{
- if(Finder->Flags & YAMN_MSG_DELETED) //if old queue contains deleted mail
+ if (Finder->Flags & YAMN_MSG_DELETED) //if old queue contains deleted mail
{
FinderPrev=Finder;
Finder=Finder->Next; //get next message in old queue for testing
@@ -247,28 +247,28 @@ void WINAPI SynchroMessagesFcn(HACCOUNT Account,HYAMNMAIL *OldQueue,HYAMNMAIL *R
}
for(ParserPrev=NULL,Parser=*NewQueue;Parser!=NULL;ParserPrev=Parser,Parser=Parser->Next)
{
- if(Parser->Flags & YAMN_MSG_DELETED)
+ if (Parser->Flags & YAMN_MSG_DELETED)
continue;
- if(Parser->ID==NULL) //simply ignore the message, that has not filled its ID
+ if (Parser->ID==NULL) //simply ignore the message, that has not filled its ID
continue;
- if(0==strcmp(Parser->ID,Finder->ID)) //search for equal message in new queue
+ if (0==strcmp(Parser->ID,Finder->ID)) //search for equal message in new queue
break;
}
- if(Parser!=NULL) //found equal message in new queue
+ if (Parser!=NULL) //found equal message in new queue
{
- if(Parser==*NewQueue)
+ if (Parser==*NewQueue)
*NewQueue=(*NewQueue)->Next;
else
ParserPrev->Next=Parser->Next;
Finder->Number=Parser->Number; //rewrite the number of current message in old queue
- if(RemovedNew==NULL) //delete from new queue
+ if (RemovedNew==NULL) //delete from new queue
DeleteAccountMailSvc((WPARAM)Account->Plugin,(LPARAM)Parser);
else //or move to RemovedNew
{
- if(RemovedNewParser==NULL) //if it is first mail removed from NewQueue
+ if (RemovedNewParser==NULL) //if it is first mail removed from NewQueue
*RemovedNew=Parser; //set RemovedNew queue to point to first message in removed queue
else
RemovedNewParser->Next=Parser; //else don't forget to show to next message in RemovedNew queue
@@ -280,14 +280,14 @@ void WINAPI SynchroMessagesFcn(HACCOUNT Account,HYAMNMAIL *OldQueue,HYAMNMAIL *R
}
else //a message was already deleted from mailbox
{
- if(Finder==*OldQueue) //if we are at the first item in OldQueue
+ if (Finder==*OldQueue) //if we are at the first item in OldQueue
{
*OldQueue=(*OldQueue)->Next; //set OldQueue to next item
- if(RemovedOld==NULL) //delete from old queue
+ if (RemovedOld==NULL) //delete from old queue
DeleteAccountMailSvc((WPARAM)Account->Plugin,(LPARAM)Finder);
else //or move to RemovedOld
{
- if(RemovedOldParser==NULL) //if it is first mail removed from OldQueue
+ if (RemovedOldParser==NULL) //if it is first mail removed from OldQueue
*RemovedOld=Finder; //set RemovedOld queue to point to first message in removed queue
else
RemovedOldParser->Next=Finder; //else don't forget to show to next message in RemovedNew queue
@@ -299,11 +299,11 @@ void WINAPI SynchroMessagesFcn(HACCOUNT Account,HYAMNMAIL *OldQueue,HYAMNMAIL *R
else
{
FinderPrev->Next=Finder->Next;
- if(RemovedOld==NULL) //delete from old queue
+ if (RemovedOld==NULL) //delete from old queue
DeleteAccountMailSvc((WPARAM)Account->Plugin,(LPARAM)Finder);
else //or move to RemovedOld
{
- if(RemovedOldParser==NULL) //if it is first mail removed from OldQueue
+ if (RemovedOldParser==NULL) //if it is first mail removed from OldQueue
*RemovedOld=Finder; //set RemovedOld queue to point to first message in removed queue
else
RemovedOldParser->Next=Finder; //else don't forget to show to next message in RemovedNew queue
@@ -332,7 +332,7 @@ void WINAPI DeleteMessageFromQueueFcn(HYAMNMAIL *From,HYAMNMAIL Which,int mode=0
DWORD Number=Which->Number;
HYAMNMAIL Parser;
- if(*From==Which)
+ if (*From==Which)
{
Parser=Which->Next;
*From=Parser;
@@ -340,14 +340,14 @@ void WINAPI DeleteMessageFromQueueFcn(HYAMNMAIL *From,HYAMNMAIL Which,int mode=0
else
{
for(Parser=*From;Which!=Parser->Next;Parser=Parser->Next)
- if(mode && (Parser->Number>Number)) Parser->Number--;
- if(mode && (Parser->Number>Number)) Parser->Number--;
+ if (mode && (Parser->Number>Number)) Parser->Number--;
+ if (mode && (Parser->Number>Number)) Parser->Number--;
Parser->Next=Parser->Next->Next;
Parser=Which->Next;
}
- if(mode)
+ if (mode)
for(;Parser!=NULL;Parser=Parser->Next)
- if(Parser->Number>Number) Parser->Number--;
+ if (Parser->Number>Number) Parser->Number--;
}
void DeleteMessagesFromQueue(HYAMNMAIL *From,HYAMNMAIL Which,int mode=0)
@@ -363,7 +363,7 @@ HYAMNMAIL WINAPI FindMessageByIDFcn(HYAMNMAIL From,char *ID)
HYAMNMAIL Browser;
for(Browser=From;Browser!=NULL;Browser=Browser->Next)
- if(0==lstrcmp(Browser->ID,ID))
+ if (0==lstrcmpA(Browser->ID,ID))
break;
return Browser;
}
@@ -381,32 +381,32 @@ void WINAPI TranslateHeaderFcn(char *stream,int len,struct CMimeItem **head)
while(ENDLINEWS(finder)) finder++;
//at the start of line
- if(DOTLINE(finder+1)) //at the end of stream
+ if (DOTLINE(finder+1)) //at the end of stream
break;
prev1=finder;
while(*finder!=':' && !EOS(finder)) finder++;
- if(!EOS(finder))
+ if (!EOS(finder))
prev2=finder++;
else
break;
while(WS(finder) && !EOS(finder)) finder++;
- if(!EOS(finder))
+ if (!EOS(finder))
prev3=finder;
else
break;
do
{
- if(ENDLINEWS(finder)) finder+=2; //after endline information continues
+ if (ENDLINEWS(finder)) finder+=2; //after endline information continues
while(!ENDLINE(finder) && !EOS(finder)) finder++;
}while(ENDLINEWS(finder));
- if(Item!=NULL)
+ if (Item!=NULL)
{
- if(NULL==(Item->Next=new struct CMimeItem))
+ if (NULL==(Item->Next=new struct CMimeItem))
break;
Item=Item->Next;
}
@@ -418,30 +418,30 @@ void WINAPI TranslateHeaderFcn(char *stream,int len,struct CMimeItem **head)
Item->Next=NULL;
Item->name=new char [prev2-prev1+1];
- lstrcpyn(Item->name,prev1,prev2-prev1+1);
+ lstrcpynA(Item->name,prev1,prev2-prev1+1);
Item->value=new char [finder-prev3+1];
- lstrcpyn(Item->value,prev3,finder-prev3+1);
+ lstrcpynA(Item->value,prev3,finder-prev3+1);
- if(EOS(finder))
+ if (EOS(finder))
break;
finder++;
- if(ENDLINE(finder)) {
+ if (ENDLINE(finder)) {
finder++;
- if(ENDLINE(finder)) {
+ if (ENDLINE(finder)) {
// end of headers. message body begins
finder++;
- if(ENDLINE(finder))finder++;
+ if (ENDLINE(finder))finder++;
prev1 = finder;
while (!DOTLINE(finder+1))finder++;
if (ENDLINE(finder))finder--;
prev2 = finder;
if (prev2>prev1){ // yes, we have body
- if(NULL==(Item->Next=new struct CMimeItem)) break; // Cant create new item?!
+ if (NULL==(Item->Next=new struct CMimeItem)) break; // Cant create new item?!
Item=Item->Next;
Item->Next=NULL;//just in case;
Item->name=new char[5]; strncpy(Item->name,"Body",5);
Item->value=new char [prev2-prev1];
- lstrcpyn(Item->value,prev1,prev2-prev1-1);
+ lstrcpynA(Item->value,prev1,prev2-prev1-1);
}
break; // there is nothing else
}
@@ -450,7 +450,7 @@ void WINAPI TranslateHeaderFcn(char *stream,int len,struct CMimeItem **head)
}
catch(...)
{
- MessageBox(NULL,"Translate header error","",0);
+ MessageBoxA(NULL,"Translate header error","",0);
}
}
@@ -460,12 +460,12 @@ HYAMNMAIL WINAPI CreateNewDeleteQueueFcn(HYAMNMAIL From)
for(FirstMail=NULL;From!=NULL;From=From->Next)
{
- if((From->Flags & (YAMN_MSG_USERDELETE | YAMN_MSG_AUTODELETE)) && !(From->Flags & YAMN_MSG_DELETED))
+ if ((From->Flags & (YAMN_MSG_USERDELETE | YAMN_MSG_AUTODELETE)) && !(From->Flags & YAMN_MSG_DELETED))
{
- if(FirstMail==NULL)
+ if (FirstMail==NULL)
{
FirstMail=Browser=new YAMNMAIL;
- if(FirstMail==NULL)
+ if (FirstMail==NULL)
break;
}
else
@@ -488,9 +488,9 @@ void WINAPI SetRemoveFlagsInQueueFcn(HYAMNMAIL From,DWORD FlagsSet,DWORD FlagsNo
for(msgq=(HYAMNMAIL)From;msgq!=NULL;msgq=msgq->Next)
{
- if((FlagsSet==(msgq->Flags & FlagsSet)) && (0==(msgq->Flags & FlagsNotSet)))
+ if ((FlagsSet==(msgq->Flags & FlagsSet)) && (0==(msgq->Flags & FlagsNotSet)))
{
- if(mode)
+ if (mode)
msgq->Flags=msgq->Flags | FlagsToSetRemove;
else
msgq->Flags=msgq->Flags & ~FlagsToSetRemove;
diff --git a/plugins/YAMN/mails/mime.cpp b/plugins/YAMN/mails/mime.cpp
index f2364c91c1..294206c7ad 100644
--- a/plugins/YAMN/mails/mime.cpp
+++ b/plugins/YAMN/mails/mime.cpp
@@ -84,30 +84,30 @@ void CopyToHeader(char *srcstart,char *srcend,char **dest,int mode)
{
char *dst;
- if(dest==NULL)
+ if (dest==NULL)
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(NULL!=*dest)
+ if (NULL!=*dest)
delete[] *dest;
- if(NULL==(*dest=new char[srcend-srcstart+1]))
+ if (NULL==(*dest=new char[srcend-srcstart+1]))
return;
dst=*dest;
for(;srcstart<srcend;dst++,srcstart++)
{
- if(ENDLINE(srcstart))
+ if (ENDLINE(srcstart))
{
while(ENDLINE(srcstart) || WS(srcstart)) srcstart++;
*dst=' ';
@@ -121,31 +121,31 @@ void CopyToHeader(char *srcstart,char *srcend,char **dest,int mode)
void ExtractAddressFromLine(char *finder,char **storeto,char **storetonick)
{
- if(finder==NULL)
+ if (finder==NULL)
{
*storeto=*storetonick=NULL;
return;
}
while(WS(finder)) finder++;
- if((*finder)!='<')
+ if ((*finder)!='<')
{
char *finderend=finder+1;
do
{
- if(ENDLINEWS(finderend)) //after endline information continues
+ if (ENDLINEWS(finderend)) //after endline information continues
finderend+=2;
while(!ENDLINE(finderend) && !EOS(finderend)) finderend++; //seek to the end of line or to the end of string
}while(ENDLINEWS(finderend));
finderend--;
while(WS(finderend) || ENDLINE(finderend)) finderend--; //find the end of text, no whitespace
- if(*finderend!='>') //not '>' at the end of line
+ if (*finderend!='>') //not '>' at the end of line
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
+ if (*finder2=='<') //if we found '<', the rest copy as from nick
{
finder2--;
while(WS(finder2) || ENDLINE(finder2)) finder2--; //parse whitespace
@@ -158,14 +158,14 @@ void ExtractAddressFromLine(char *finder,char **storeto,char **storetonick)
char *finderend=finder+1;
do
{
- if(ENDLINEWS(finderend)) //after endline information continues
+ 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
- if(!ENDLINE(finder) && !EOS(finder)) //if there are chars yet, it's nick
+ 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
@@ -178,7 +178,7 @@ void ExtractAddressFromLine(char *finder,char **storeto,char **storetonick)
void ExtractStringFromLine(char *finder,char **storeto)
{
- if(finder==NULL)
+ if (finder==NULL)
{
*storeto=NULL;
return;
@@ -188,7 +188,7 @@ void ExtractStringFromLine(char *finder,char **storeto)
do
{
- if(ENDLINEWS(finderend)) finderend++; //after endline information continues
+ if (ENDLINEWS(finderend)) finderend++; //after endline information continues
while(!ENDLINE(finderend) && !EOS(finderend)) finderend++;
}while(ENDLINEWS(finderend));
finderend--;
@@ -201,7 +201,7 @@ char *ExtractFromContentType(char *ContentType,char *value)
char *lowered = _strdup(ContentType);
ToLower(lowered);
char *finder=strstr(lowered,value);
- if(finder==NULL){
+ if (finder==NULL){
free (lowered);
return NULL;
}
@@ -213,7 +213,7 @@ char *ExtractFromContentType(char *ContentType,char *value)
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)
+ if (*temp!=';' && !ENDLINE(temp) && temp!=ContentType)
return NULL;
finder=finder+strlen(value); //jump over value string
@@ -226,7 +226,7 @@ char *ExtractFromContentType(char *ContentType,char *value)
finder++;
if (*temp=='\"') temp--;
}
- if(NULL==(CopiedString=new char[++temp-finder+1]))
+ if (NULL==(CopiedString=new char[++temp-finder+1]))
return NULL;
for(copier=CopiedString;finder!=temp;*copier++=*finder++); //copy string
*copier=0; //and end it with zero character
@@ -240,9 +240,9 @@ void ExtractShortHeader(struct CMimeItem *items,struct CShortHeader *head)
{
//at the start of line
//MessageBox(NULL,items->value,items->name,0);
- if(0==_strnicmp(items->name,"From",4))
+ if (0==_strnicmp(items->name,"From",4))
{
- if(items->value==NULL)
+ if (items->value==NULL)
continue;
#ifdef DEBUG_DECODE
DebugLog(DecodeFile,"<Extracting from>");
@@ -252,9 +252,9 @@ void ExtractShortHeader(struct CMimeItem *items,struct CShortHeader *head)
DebugLog(DecodeFile,"</Extracting>\n");
#endif
}
- else if(0==_strnicmp(items->name,"Return-Path",11))
+ else if (0==_strnicmp(items->name,"Return-Path",11))
{
- if(items->value==NULL)
+ if (items->value==NULL)
continue;
#ifdef DEBUG_DECODE
DebugLog(DecodeFile,"<Extracting return-path>");
@@ -264,9 +264,9 @@ void ExtractShortHeader(struct CMimeItem *items,struct CShortHeader *head)
DebugLog(DecodeFile,"</Extracting>\n");
#endif
}
- else if(0==_strnicmp(items->name,"Subject",7))
+ else if (0==_strnicmp(items->name,"Subject",7))
{
- if(items->value==NULL)
+ if (items->value==NULL)
continue;
#ifdef DEBUG_DECODE
DebugLog(DecodeFile,"<Extracting subject>");
@@ -276,9 +276,9 @@ void ExtractShortHeader(struct CMimeItem *items,struct CShortHeader *head)
DebugLog(DecodeFile,"</Extracting>\n");
#endif
}
- else if(0==_strnicmp(items->name,"Body",4))
+ else if (0==_strnicmp(items->name,"Body",4))
{
- if(items->value==NULL)
+ if (items->value==NULL)
continue;
#ifdef DEBUG_DECODE
DebugLog(DecodeFile,"<Extracting body>");
@@ -288,9 +288,9 @@ void ExtractShortHeader(struct CMimeItem *items,struct CShortHeader *head)
DebugLog(DecodeFile,"</Extracting>\n");
#endif
}
- else if(0==_strnicmp(items->name,"Date",4))
+ else if (0==_strnicmp(items->name,"Date",4))
{
- if(items->value==NULL)
+ if (items->value==NULL)
continue;
#ifdef DEBUG_DECODE
DebugLog(DecodeFile,"<Extracting date>");
@@ -300,9 +300,9 @@ void ExtractShortHeader(struct CMimeItem *items,struct CShortHeader *head)
DebugLog(DecodeFile,"</Extracting>\n");
#endif
}
- else if(0==_strnicmp(items->name,"Content-Type",12))
+ else if (0==_strnicmp(items->name,"Content-Type",12))
{
- if(items->value==NULL)
+ if (items->value==NULL)
continue;
char *ContentType=NULL,*CharSetStr;
@@ -314,41 +314,41 @@ void ExtractShortHeader(struct CMimeItem *items,struct CShortHeader *head)
DebugLog(DecodeFile,"</Extracting>\n");
#endif
ToLower(ContentType);
- if(NULL!=(CharSetStr=ExtractFromContentType(ContentType,"charset=")))
+ if (NULL!=(CharSetStr=ExtractFromContentType(ContentType,"charset=")))
{
head->CP=GetCharsetFromString(CharSetStr,strlen(CharSetStr));
delete[] CharSetStr;
}
delete[] ContentType;
}
- else if(0==_strnicmp(items->name,"Importance",10))
+ else if (0==_strnicmp(items->name,"Importance",10))
{
- if(items->value==NULL)
+ if (items->value==NULL)
continue;
#ifdef DEBUG_DECODE
DebugLog(DecodeFile,"<Extracting importance>");
#endif
- if(head->Priority!=-1)
+ if (head->Priority!=-1)
{
- if(0==strncmp(items->value,"low",3))
+ if (0==strncmp(items->value,"low",3))
head->Priority=5;
- else if(0==strncmp(items->value,"normal",6))
+ else if (0==strncmp(items->value,"normal",6))
head->Priority=3;
- else if(0==strncmp(items->value,"high",4))
+ else if (0==strncmp(items->value,"high",4))
head->Priority=1;
}
#ifdef DEBUG_DECODE
DebugLog(DecodeFile,"</Extracting>\n");
#endif
}
- else if(0==_strnicmp(items->name,"X-Priority",10))
+ else if (0==_strnicmp(items->name,"X-Priority",10))
{
- if(items->value==NULL)
+ if (items->value==NULL)
continue;
#ifdef DEBUG_DECODE
DebugLog(DecodeFile,"<X-Priority>");
#endif
- if((*items->value>='1') && (*items->value<='5'))
+ if ((*items->value>='1') && (*items->value<='5'))
head->Priority=*items->value-'0';
#ifdef DEBUG_DECODE
DebugLog(DecodeFile,"</Extracting>\n");
@@ -372,17 +372,17 @@ void ExtractHeader(struct CMimeItem *items,int &CP,struct CHeader *head)
head->Priority=ShortHeader.Priority==-1 ? 3 : ShortHeader.Priority;
CP=ShortHeader.CP==-1 ? CP : ShortHeader.CP;
#ifdef DEBUG_DECODE
- if(NULL!=ShortHeader.From)
+ if (NULL!=ShortHeader.From)
DebugLog(DecodeFile,"<Decoded from>%s</Decoded)\n",ShortHeader.From);
- if(NULL!=ShortHeader.FromNick)
+ if (NULL!=ShortHeader.FromNick)
DebugLog(DecodeFile,"<Decoded from-nick>%s</Decoded)\n",ShortHeader.FromNick);
- if(NULL!=ShortHeader.ReturnPath)
+ if (NULL!=ShortHeader.ReturnPath)
DebugLog(DecodeFile,"<Decoded return-path>%s</Decoded)\n",ShortHeader.ReturnPath);
- if(NULL!=ShortHeader.ReturnPathNick)
+ if (NULL!=ShortHeader.ReturnPathNick)
DebugLog(DecodeFile,"<Decoded return-path nick>%s</Decoded)\n",ShortHeader.ReturnPathNick);
- if(NULL!=ShortHeader.Subject)
+ if (NULL!=ShortHeader.Subject)
DebugLog(DecodeFile,"<Decoded subject>%s</Decoded)\n",ShortHeader.Subject);
- if(NULL!=ShortHeader.Date)
+ if (NULL!=ShortHeader.Date)
DebugLog(DecodeFile,"<Decoded date>%s</Decoded)\n",ShortHeader.Date);
DebugLog(DecodeFile,"</Extracting header>\n");
DebugLog(DecodeFile,"<Convert>\n");
@@ -391,38 +391,38 @@ void ExtractHeader(struct CMimeItem *items,int &CP,struct CHeader *head)
ConvertCodedStringToUnicode(ShortHeader.From,&head->From,CP,MIME_PLAIN);
#ifdef DEBUG_DECODE
- if(NULL!=head->From)
+ if (NULL!=head->From)
DebugLogW(DecodeFile,L"<Converted from>%s</Converted>\n",head->From);
#endif
ConvertCodedStringToUnicode(ShortHeader.FromNick,&head->FromNick,CP,MIME_MAIL);
#ifdef DEBUG_DECODE
- if(NULL!=head->FromNick)
+ if (NULL!=head->FromNick)
DebugLogW(DecodeFile,L"<Converted from-nick>%s</Converted>\n",head->FromNick);
#endif
ConvertCodedStringToUnicode(ShortHeader.ReturnPath,&head->ReturnPath,CP,MIME_PLAIN);
#ifdef DEBUG_DECODE
- if(NULL!=head->ReturnPath)
+ if (NULL!=head->ReturnPath)
DebugLogW(DecodeFile,L"<Converted return-path>%s</Converted>\n",head->ReturnPath);
#endif
ConvertCodedStringToUnicode(ShortHeader.ReturnPathNick,&head->ReturnPathNick,CP,MIME_MAIL);
#ifdef DEBUG_DECODE
- if(NULL!=head->ReturnPathNick)
+ if (NULL!=head->ReturnPathNick)
DebugLogW(DecodeFile,L"<Converted return-path nick>%s</Converted>\n",head->ReturnPathNick);
#endif
ConvertCodedStringToUnicode(ShortHeader.Subject,&head->Subject,CP,MIME_PLAIN);
#ifdef DEBUG_DECODE
- if(NULL!=head->Subject)
+ if (NULL!=head->Subject)
DebugLogW(DecodeFile,L"<Converted subject>%s</Converted>\n",head->Subject);
#endif
ConvertCodedStringToUnicode(ShortHeader.Date,&head->Date,CP,MIME_PLAIN);
#ifdef DEBUG_DECODE
- if(NULL!=head->Date)
+ if (NULL!=head->Date)
DebugLogW(DecodeFile,L"<Converted date>%s</Converted>\n",head->Date);
#endif
ConvertCodedStringToUnicode(ShortHeader.Body,&head->Body,CP,MIME_PLAIN);
#ifdef DEBUG_DECODE
- if(NULL!=head->Body)
+ if (NULL!=head->Body)
DebugLogW(DecodeFile,L"<Converted Body>%s</Converted>\n",head->Body);
#endif
@@ -439,30 +439,30 @@ void ExtractHeader(struct CMimeItem *items,int &CP,struct CHeader *head)
void DeleteShortHeaderContent(struct CShortHeader *head)
{
- if(head->From!=NULL) delete[] head->From;
- if(head->FromNick!=NULL) delete[] head->FromNick;
- if(head->ReturnPath!=NULL) delete[] head->ReturnPath;
- if(head->ReturnPathNick!=NULL) delete[] head->ReturnPathNick;
- if(head->Subject!=NULL) delete[] head->Subject;
- if(head->Date!=NULL) delete[] head->Date;
- if(head->To!=NULL) DeleteShortNames(head->To);
- if(head->Cc!=NULL) DeleteShortNames(head->Cc);
- if(head->Bcc!=NULL) DeleteShortNames(head->Bcc);
- if(head->Body!=NULL) delete[] head->Body;
+ if (head->From!=NULL) delete[] head->From;
+ if (head->FromNick!=NULL) delete[] head->FromNick;
+ if (head->ReturnPath!=NULL) delete[] head->ReturnPath;
+ if (head->ReturnPathNick!=NULL) delete[] head->ReturnPathNick;
+ if (head->Subject!=NULL) delete[] head->Subject;
+ if (head->Date!=NULL) delete[] head->Date;
+ if (head->To!=NULL) DeleteShortNames(head->To);
+ if (head->Cc!=NULL) DeleteShortNames(head->Cc);
+ if (head->Bcc!=NULL) DeleteShortNames(head->Bcc);
+ if (head->Body!=NULL) delete[] head->Body;
}
void DeleteHeaderContent(struct CHeader *head)
{
- if(head->From!=NULL) delete[] head->From;
- if(head->FromNick!=NULL) delete[] head->FromNick;
- if(head->ReturnPath!=NULL) delete[] head->ReturnPath;
- if(head->ReturnPathNick!=NULL) delete[] head->ReturnPathNick;
- if(head->Subject!=NULL) delete[] head->Subject;
- if(head->Date!=NULL) delete[] head->Date;
- if(head->Body!=NULL) delete[] head->Body;
- if(head->To!=NULL) DeleteNames(head->To);
- if(head->Cc!=NULL) DeleteNames(head->Cc);
- if(head->Bcc!=NULL) DeleteNames(head->Bcc);
+ if (head->From!=NULL) delete[] head->From;
+ if (head->FromNick!=NULL) delete[] head->FromNick;
+ if (head->ReturnPath!=NULL) delete[] head->ReturnPath;
+ if (head->ReturnPathNick!=NULL) delete[] head->ReturnPathNick;
+ if (head->Subject!=NULL) delete[] head->Subject;
+ if (head->Date!=NULL) delete[] head->Date;
+ if (head->Body!=NULL) delete[] head->Body;
+ if (head->To!=NULL) DeleteNames(head->To);
+ if (head->Cc!=NULL) DeleteNames(head->Cc);
+ if (head->Bcc!=NULL) DeleteNames(head->Bcc);
}
void DeleteNames(PYAMN_MIMENAMES Names)
@@ -470,9 +470,9 @@ void DeleteNames(PYAMN_MIMENAMES Names)
PYAMN_MIMENAMES Parser=Names,Old;
for(;Parser!=NULL;Parser=Parser->Next)
{
- if(Parser->Value!=NULL)
+ if (Parser->Value!=NULL)
delete[] Parser->Value;
- if(Parser->ValueNick!=NULL)
+ if (Parser->ValueNick!=NULL)
delete[] Parser->ValueNick;
Old=Parser;
Parser=Parser->Next;
@@ -485,9 +485,9 @@ void DeleteShortNames(PYAMN_MIMESHORTNAMES Names)
PYAMN_MIMESHORTNAMES Parser=Names,Old;
for(;Parser!=NULL;Parser=Parser->Next)
{
- if(Parser->Value!=NULL)
+ if (Parser->Value!=NULL)
delete[] Parser->Value;
- if(Parser->ValueNick!=NULL)
+ if (Parser->ValueNick!=NULL)
delete[] Parser->ValueNick;
Old=Parser;
Parser=Parser->Next;
@@ -499,7 +499,7 @@ void DeleteShortNames(PYAMN_MIMESHORTNAMES Names)
void inline ToLower(char *string)
{
for(;*string!=0;string++)
- if(*string>='A' && *string<='Z') *string=*string-'A'+'a';
+ if (*string>='A' && *string<='Z') *string=*string-'A'+'a';
}
#define TE_UNKNOWN
@@ -548,14 +548,14 @@ void ParseAPart(APartDataType *data)
prev2=finder++;
while(WS(finder) && !EOS(finder)) finder++;
- if(!EOS(finder))
+ if (!EOS(finder))
prev3=finder;
else
break;
do
{
- if(ENDLINEWS(finder)) finder+=2; //after endline information continues
+ if (ENDLINEWS(finder)) finder+=2; //after endline information continues
while(!ENDLINE(finder) && !EOS(finder)) finder++;
}while(ENDLINEWS(finder));
@@ -565,12 +565,12 @@ void ParseAPart(APartDataType *data)
data->TransEnc = prev3;
}
- if(EOS(finder))
+ if (EOS(finder))
break;
finder++;
- if(ENDLINE(finder)) {
+ if (ENDLINE(finder)) {
finder++;
- if(ENDLINE(finder)) {
+ if (ENDLINE(finder)) {
// end of headers. message body begins
if (finder>data->Src){
if (*(finder-2)=='\r' || *(finder-2)=='\n')
@@ -579,7 +579,7 @@ void ParseAPart(APartDataType *data)
*(finder-1)=0;
}
finder++;
- if(ENDLINE(finder))finder++;
+ if (ENDLINE(finder))finder++;
prev1 = finder;
while (!EOS(finder+1))finder++;
if (ENDLINE(finder))finder--;
@@ -631,7 +631,7 @@ WCHAR *ParseMultipartBody(char *src, char *bond)
}
if (partData[i].ContType){
char *CharSetStr;
- if(NULL!=(CharSetStr=ExtractFromContentType(partData[i].ContType,"charset=")))
+ if (NULL!=(CharSetStr=ExtractFromContentType(partData[i].ContType,"charset=")))
{
partData[i].CodePage=GetCharsetFromString(CharSetStr,strlen(CharSetStr));
delete[] CharSetStr;
@@ -655,10 +655,10 @@ WCHAR *ParseMultipartBody(char *src, char *bond)
}
ConvertStringToUnicode(localBody?localBody:partData[i].body,partData[i].CodePage,&partData[i].wBody);
if (localBody) delete[] localBody;
- } else if(partData[i].ContType && !_strnicmp(partData[i].ContType,"multipart/",10)){
+ } else if (partData[i].ContType && !_strnicmp(partData[i].ContType,"multipart/",10)){
//Multipart in mulitipart recursive? should be SPAM. Ah well
char *bondary=NULL;
- if(NULL!=(bondary=ExtractFromContentType(partData[i].ContType,"boundary=")))
+ if (NULL!=(bondary=ExtractFromContentType(partData[i].ContType,"boundary=")))
{
partData[i].wBody = ParseMultipartBody(partData[i].body,bondary);
delete[] bondary;
@@ -689,13 +689,13 @@ FailBackRaw:
_snprintf(infoline+linesize,100-linesize,"; %s",partData[i].ContType);
linesize = strlen(infoline);
partData[i].ContType=CharSetStr+1;
- if(NULL!=(CharSetStr=ExtractFromContentType(partData[i].ContType,"charset=")))
+ if (NULL!=(CharSetStr=ExtractFromContentType(partData[i].ContType,"charset=")))
{
_snprintf(infoline+linesize,100-linesize,"; %s",CharSetStr);
linesize = strlen(infoline);
delete[] CharSetStr;
}
- if(NULL!=(CharSetStr=ExtractFromContentType(partData[i].ContType,"name=")))
+ if (NULL!=(CharSetStr=ExtractFromContentType(partData[i].ContType,"name=")))
{
_snprintf(infoline+linesize,100-linesize,"; \"%s\"",CharSetStr);
linesize = strlen(infoline);
diff --git a/plugins/YAMN/main.cpp b/plugins/YAMN/main.cpp
index d2bf29ec05..b800fb24f1 100644
--- a/plugins/YAMN/main.cpp
+++ b/plugins/YAMN/main.cpp
@@ -9,8 +9,8 @@
*/
-#include "main.h"
#include "yamn.h"
+#include "main.h"
#include "resources/resource.h"
#include <io.h>
//- imported ---------------------------------------------------------------------------------------
@@ -20,25 +20,22 @@
//CRITICAL_SECTION ASCS;
//CRITICAL_SECTION PRCS;
-extern LPCRITICAL_SECTION PluginRegCS;
+extern CRITICAL_SECTION PluginRegCS;
extern HANDLE ExitEV;
extern HANDLE WriteToFileEV;
extern int PosX,PosY,SizeX,SizeY;
extern int HeadPosX,HeadPosY,HeadSizeX,HeadSizeY,HeadSplitPos;
-//From account.cpp
-extern LPCRITICAL_SECTION AccountStatusCS;
-extern LPCRITICAL_SECTION FileWritingCS;
//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
-WCHAR *ProfileName = NULL; //e.g. "majvan"
-WCHAR *UserDirectory = NULL; //e.g. "F:\WINNT\Profiles\UserXYZ"
+TCHAR ProfileName[MAX_PATH]; //e.g. "majvan"
+TCHAR UserDirectory[MAX_PATH]; //e.g. "F:\WINNT\Profiles\UserXYZ"
char *ProtoName = YAMN_DBMODULE;
//char *AltProtoName;
-char *szMirandaDir = NULL;
-char *szProfileDir = NULL;
+TCHAR szMirandaDir[MAX_PATH];
+TCHAR szProfileDir[MAX_PATH];
INT_PTR YAMN_STATUS;
@@ -134,7 +131,7 @@ PDTT pfnDrawThemeText = 0;
int InitVSApi()
{
- if((hUxTheme = LoadLibraryA("uxtheme.dll")) == 0)
+ if ((hUxTheme = LoadLibraryA("uxtheme.dll")) == 0)
return 0;
pfnIsThemeActive = (PITA)GetProcAddress(hUxTheme, "IsThemeActive");
@@ -144,7 +141,7 @@ int InitVSApi()
pfnDrawThemeText = (PDTT)GetProcAddress(hUxTheme, "DrawThemeText");
MyEnableThemeDialogTexture = (BOOL (WINAPI *)(HANDLE, DWORD))GetProcAddress(hUxTheme, "EnableThemeDialogTexture");
- if(pfnIsThemeActive != 0 && pfnOpenThemeData != 0 && pfnDrawThemeBackground != 0 && pfnCloseThemeData != 0 && pfnDrawThemeText != 0) {
+ if (pfnIsThemeActive != 0 && pfnOpenThemeData != 0 && pfnDrawThemeBackground != 0 && pfnCloseThemeData != 0 && pfnDrawThemeText != 0) {
return 1;
}
return 0;
@@ -156,7 +153,7 @@ int InitVSApi()
int FreeVSApi()
{
- if(hUxTheme != 0)
+ if (hUxTheme != 0)
FreeLibrary(hUxTheme);
return 0;
}
@@ -165,41 +162,40 @@ int FreeVSApi()
//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
-static void GetProfileDirectory(char *szPath,int cbPath)
+static void GetProfileDirectory(TCHAR *szPath,int cbPath)
//This is copied from Miranda's sources. In 0.2.1.0 it is needed, in newer vesions of Miranda use MS_DB_GETPROFILEPATH service
{
- szProfileDir=new char[MAX_PATH];
- if (ServiceExists(MS_DB_GETPROFILEPATH)){
- if (!CallService(MS_DB_GETPROFILEPATH,(WPARAM)cbPath,(LPARAM)szPath)) {
+ if (ServiceExists(MS_DB_GETPROFILEPATH))
+ if (!CallService(MS_DB_GETPROFILEPATHT,(WPARAM)cbPath,(LPARAM)szPath)) {
lstrcpy(szProfileDir,szPath);
return; //success
}
- }
- char szMirandaIni[MAX_PATH],szExpandedProfileDir[MAX_PATH];
+
+ TCHAR szMirandaIni[MAX_PATH],szExpandedProfileDir[MAX_PATH];
DWORD dwAttributes;
lstrcpy(szMirandaIni,szMirandaDir);
- lstrcat(szMirandaIni,"\\mirandaboot.ini");
- GetPrivateProfileString("Database","ProfileDir",".",szProfileDir,sizeof(szProfileDir),szMirandaIni);
+ lstrcat(szMirandaIni, _T("\\mirandaboot.ini"));
+ GetPrivateProfileString( _T("Database"),_T("ProfileDir"),_T("."),szProfileDir,sizeof(szProfileDir),szMirandaIni);
ExpandEnvironmentStrings(szProfileDir,szExpandedProfileDir,sizeof(szExpandedProfileDir));
- _chdir(szMirandaDir);
- if(!_fullpath(szPath,szExpandedProfileDir,cbPath))
+ _tchdir(szMirandaDir);
+ if (!_tfullpath(szPath,szExpandedProfileDir,cbPath))
lstrcpyn(szPath,szMirandaDir,cbPath);
- if(szPath[lstrlen(szPath)-1]=='\\') szPath[lstrlen(szPath)-1]='\0';
- if((dwAttributes=GetFileAttributes(szPath))!=0xffffffff&&dwAttributes&FILE_ATTRIBUTE_DIRECTORY) return;
+ if (szPath[lstrlen(szPath)-1]=='\\') szPath[lstrlen(szPath)-1]='\0';
+ if ((dwAttributes=GetFileAttributes(szPath))!=0xffffffff&&dwAttributes&FILE_ATTRIBUTE_DIRECTORY) return;
CreateDirectory(szPath,NULL);
}
void SetDefaultProtocolIcons()
{
- char szFileName[MAX_PATH+1];
+ TCHAR szFileName[MAX_PATH+1];
char oldname[] = YAMN_DBMODULE"4007_"; // the deprecated one
char dllname[] = "plugins\\"YAMN_DBMODULE".dll,-xxxxx";
// determine whether external icon file exists
lstrcpy(szFileName, szMirandaDir);
- lstrcat(szFileName, "\\icons\\proto_"YAMN_DBMODULE".dll");
- BOOL isDllPresent = (_access(szFileName, 0) == 0);
+ lstrcat(szFileName, _T("\\icons\\proto_") _T(YAMN_DBMODULE) _T(".dll"));
+ BOOL isDllPresent = (_taccess(szFileName, 0) == 0);
WORD statuses[4] = {ID_STATUS_OFFLINE,ID_STATUS_ONLINE,ID_STATUS_NA,ID_STATUS_OCCUPIED};
BYTE indices[4] = {7, 0, 3, 4};
@@ -212,7 +208,7 @@ void SetDefaultProtocolIcons()
DBDeleteContactSetting(NULL, "Icons", oldname);
} else {
DBVARIANT dbv;
- if(!DBGetContactSetting(NULL,"SkinIcons",iconNames[indices[i]],&dbv))
+ if (!DBGetContactSetting(NULL,"SkinIcons",iconNames[indices[i]],&dbv))
{// user won't be able to set status icons different from those in YAMN section
DBWriteContactSettingString(NULL, "Icons", oldname, (char *)dbv.pszVal);
DBFreeVariant(&dbv);
@@ -226,12 +222,7 @@ void SetDefaultProtocolIcons()
extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved)
{
- YAMNVar.hInst=hinstDLL;
- if(fdwReason==DLL_PROCESS_ATTACH)
- {
- if(NULL==(UserDirectory=new WCHAR[MAX_PATH]))
- return FALSE;
- }
+ YAMNVar.hInst = hinstDLL;
return TRUE;
}
@@ -269,7 +260,7 @@ BOOL CALLBACK EnumSystemCodePagesProc(LPTSTR cpStr)
//Get Code Page name
CPINFOEX info;
- if(GetCPInfoEx(cp,0,&info)){
+ if (GetCPInfoEx(cp,0,&info)){
#ifdef YAMN_DEBUG
BOOLEAN found = FALSE;
#endif
@@ -292,7 +283,7 @@ BOOL CALLBACK EnumSystemCodePagesProc(LPTSTR cpStr)
}
int SystemModulesLoaded(WPARAM,LPARAM){
- if(ServiceExists(MS_SKIN2_ADDICON))
+ if (ServiceExists(MS_SKIN2_ADDICON))
{
//MessageBox(NULL,"Icolib present","test",0);
SKINICONDESC sid = {0};
@@ -321,7 +312,7 @@ int SystemModulesLoaded(WPARAM,LPARAM){
mi.pszName = "Check &mail (All Account)";
mi.pszPopupName = NULL;//ProtoName;
mi.pszService = MS_YAMN_FORCECHECK;
- if(DBGetContactSettingByte(NULL, YAMN_DBMODULE, YAMN_SHOWMAINMENU, 1))
+ if (DBGetContactSettingByte(NULL, YAMN_DBMODULE, YAMN_SHOWMAINMENU, 1))
hMenuItemMain = (HANDLE) CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&mi);
mi.pszName = "Check &mail (This Account)";
@@ -336,7 +327,7 @@ int SystemModulesLoaded(WPARAM,LPARAM){
hMenuItemContApp = (HANDLE) CallService(MS_CLIST_ADDCONTACTMENUITEM,0,(LPARAM)&mi);
//Use for the Updater plugin
- if(ServiceExists(MS_UPDATE_REGISTER))
+ if (ServiceExists(MS_UPDATE_REGISTER))
{
Update update = {0};
char szVersion[16];
@@ -357,7 +348,7 @@ int SystemModulesLoaded(WPARAM,LPARAM){
update.szUpdateURL = "http://addons.miranda-im.org/feed.php?dlfile=3411";
update.szVersionURL = "http://addons.miranda-im.org/details.php?action=viewfile&id=3411";
update.pbVersionPrefix = (BYTE *)"<span class=\"fileNameHeader\">YAMN 2in1 ";
- wsprintf(szUrl,"http://www.miranda-fr.net/tweety/yamn/%s.zip",YAMN_FILENAME);
+ wsprintfA(szUrl,"http://www.miranda-fr.net/tweety/yamn/%s.zip",YAMN_FILENAME);
update.szBetaUpdateURL = szUrl;
update.szBetaVersionURL = "http://www.miranda-fr.net/tweety/yamn/yamn_beta.html";
update.pbBetaVersionPrefix = (BYTE *)"YAMN version ";
@@ -371,9 +362,9 @@ int SystemModulesLoaded(WPARAM,LPARAM){
//char AccountFolder[MAX_PATH];
//CallService(MS_DB_GETPROFILEPATH, (WPARAM) MAX_PATH, (LPARAM)AccountFolder);
//sprintf(AccountFolder,"%s\\%s",AccountFolder,ProtoName);
- hAccountFolder = FoldersRegisterCustomPathW(ProtoName,YAMN_DBMODULE" Account Folder", UserDirectory);
+ hAccountFolder = FoldersRegisterCustomPathT(ProtoName,YAMN_DBMODULE" Account Folder", UserDirectory);
- FoldersGetCustomPathW(hAccountFolder, UserDirectory, MAX_PATH, UserDirectory);
+ FoldersGetCustomPathT(hAccountFolder, UserDirectory, MAX_PATH, UserDirectory);
//MultiByteToWideChar(CP_ACP,MB_USEGLYPHCHARS,AccountFolder,-1,UserDirectory,strlen(AccountFolder)+1);
}
@@ -387,8 +378,7 @@ extern HCURSOR hCurSplitNS, hCurSplitWE;
extern "C" int __declspec(dllexport) Load(PLUGINLINK *link)
{
UINT mod,vk;
- char pn[MAX_PATH+1];
- char *fc;
+ TCHAR *fc;
int i,k;
pluginLink=link;
@@ -398,22 +388,16 @@ extern "C" int __declspec(dllexport) Load(PLUGINLINK *link)
YAMN_STATUS = ID_STATUS_OFFLINE;
// we get the Miranda Root Path
- szMirandaDir=new char[MAX_PATH];
- if (ServiceExists(MS_UTILS_PATHTOABSOLUTE)){
- CallService(MS_UTILS_PATHTOABSOLUTE, (WPARAM)".",(LPARAM)szMirandaDir);
- }
+ if (ServiceExists(MS_UTILS_PATHTOABSOLUTET))
+ CallService(MS_UTILS_PATHTOABSOLUTET, (WPARAM)_T("."),(LPARAM)szMirandaDir);
else {
- char *str2;
GetModuleFileName(GetModuleHandle(NULL),szMirandaDir,MAX_PATH);
- str2=strrchr(szMirandaDir,'\\');
- if(str2!=NULL) *str2=0;
+ TCHAR* str2 = _tcsrchr(szMirandaDir,'\\');
+ if (str2!=NULL) *str2=0;
}
// we get the user path where our yamn-account.book.ini is stored from mirandaboot.ini file
- char szProfileDir[MAX_PATH+1];
- GetProfileDirectory(szProfileDir,sizeof(szProfileDir));
- MultiByteToWideChar(CP_ACP,MB_USEGLYPHCHARS,szProfileDir,-1,UserDirectory,(int)strlen(szProfileDir)+1);
-
+ GetProfileDirectory(UserDirectory,SIZEOF(UserDirectory));
// Enumerate all the code pages available for the System Locale
EnumSystemCodePages(EnumSystemCodePagesProc, CP_INSTALLED);
@@ -456,33 +440,21 @@ extern "C" int __declspec(dllexport) Load(PLUGINLINK *link)
pd.cbSize=PROTOCOLDESCRIPTOR_V3_SIZE;
pd.szName=ProtoName;
pd.type=PROTOTYPE_PROTOCOL;
-
CallService(MS_PROTO_REGISTERMODULE,0,(LPARAM)&pd);
- if(NULL==(ProfileName=new WCHAR[MAX_PATH]))
- return 1;
-
- CallService(MS_DB_GETPROFILENAME,(WPARAM)sizeof(pn),(LPARAM)&(*pn)); //not to pass entire array to fcn
- if(NULL!=(fc=strrchr(pn,(int)'.')))
+ CallService(MS_DB_GETPROFILENAMET,(WPARAM)SIZEOF(ProfileName),(LPARAM)ProfileName); //not to pass entire array to fcn
+ if (NULL!=(fc = _tcsrchr(ProfileName, '.')))
*fc=0;
- MultiByteToWideChar(CP_ACP,MB_USEGLYPHCHARS,pn,-1,ProfileName,(int)strlen(pn)+1);
-
- if(NULL==(AccountStatusCS=new CRITICAL_SECTION))
- return 1;
- if(NULL==(FileWritingCS=new CRITICAL_SECTION))
- return 1;
- if(NULL==(PluginRegCS=new CRITICAL_SECTION))
- return 1;
- InitializeCriticalSection(AccountStatusCS);
- InitializeCriticalSection(FileWritingCS);
- InitializeCriticalSection(PluginRegCS);
+ InitializeCriticalSection(&AccountStatusCS);
+ InitializeCriticalSection(&FileWritingCS);
+ InitializeCriticalSection(&PluginRegCS);
- if(NULL==(NoWriterEV=CreateEvent(NULL,TRUE,TRUE,NULL)))
+ if (NULL==(NoWriterEV=CreateEvent(NULL,TRUE,TRUE,NULL)))
return 1;
- if(NULL==(WriteToFileEV=CreateEvent(NULL,FALSE,FALSE,NULL)))
+ if (NULL==(WriteToFileEV=CreateEvent(NULL,FALSE,FALSE,NULL)))
return 1;
- if(NULL==(ExitEV=CreateEvent(NULL,TRUE,FALSE,NULL)))
+ if (NULL==(ExitEV=CreateEvent(NULL,TRUE,FALSE,NULL)))
return 1;
// AccountWriterSO=new SCOUNTER(NoWriterEV);
@@ -541,7 +513,7 @@ extern "C" int __declspec(dllexport) Load(PLUGINLINK *link)
WORD HotKey = MAKEWORD((BYTE)vk,(BYTE)mod);
CloseHandle(CreateThread(NULL,0,YAMNHotKeyThread,(LPVOID)HotKey,0,&HotKeyThreadID));
//Create thread that will be executed every second
- if(!(SecTimer=SetTimer(NULL,0,1000,(TIMERPROC)TimerProc)))
+ if (!(SecTimer=SetTimer(NULL,0,1000,(TIMERPROC)TimerProc)))
return 1;
@@ -559,43 +531,6 @@ extern "C" int __declspec(dllexport) Load(PLUGINLINK *link)
return 0;
}
-extern "C" int __declspec(dllexport) UninstallEx(PLUGINUNINSTALLPARAMS* ppup)
-{
- const char* DocFiles[]={"YAMN-License.txt","YAMN-Readme.txt","YAMN-Readme.developers.txt",NULL};
-
- typedef int (* UNINSTALLFILTERFCN)();
- UNINSTALLFILTERFCN UninstallFilter;
-
- PUIRemoveSkinSound(YAMN_NEWMAILSOUND);
- PUIRemoveSkinSound(YAMN_CONNECTFAILSOUND);
-
- if(UninstallPlugins)
- {
- for(int i=0;i<iDllPlugins;i++)
- {
- if(NULL!=(UninstallFilter=(UNINSTALLFILTERFCN)GetProcAddress(hDllPlugins[i],"UninstallFilter")))
- UninstallFilter();
-
- FreeLibrary(hDllPlugins[i]);
- hDllPlugins[i]=NULL; //for safety
- }
- iDllPlugins = 0;
- if(hDllPlugins){
- free((void *)hDllPlugins);
- hDllPlugins = NULL;
- }
-
-// NotifyEventHooks(ME_YAMN_UNINSTALLPLUGINS,0,0);
- }
- UninstallPOP3(ppup);
-
- MessageBoxA(NULL,"You have to delete manually YAMN plugins located in \"Plugins/YAMN\" folder.","YAMN uninstalling",MB_OK|MB_ICONINFORMATION);
- PUIRemoveFilesInDirectory(ppup->pszDocsPath,DocFiles);
- if(ppup->bDoDeleteSettings)
- PUIRemoveDbModule("YAMN");
- return 0;
-}
-
int Shutdown(WPARAM,LPARAM)
{
DBWriteContactSettingDword(NULL,YAMN_DBMODULE,YAMN_DBMSGPOSX,HeadPosX);
@@ -627,23 +562,16 @@ extern "C" int __declspec(dllexport) Unload(void)
FreeVSApi();
- DeleteCriticalSection(AccountStatusCS);
- delete AccountStatusCS;
- DeleteCriticalSection(FileWritingCS);
- delete FileWritingCS;
- DeleteCriticalSection(PluginRegCS);
+ DeleteCriticalSection(&AccountStatusCS);
+ DeleteCriticalSection(&FileWritingCS);
+ DeleteCriticalSection(&PluginRegCS);
- delete PluginRegCS;
UnhookEvents();
DestroyServiceFunctions();
UnloadPlugins();
delete [] CodePageNamesSupp;
- delete [] szMirandaDir;
- delete [] UserDirectory;
- delete [] szProfileDir;
- delete [] ProfileName;
return 0;
}
@@ -651,26 +579,26 @@ void LoadPlugins()
{
HANDLE hFind;
WIN32_FIND_DATA fd;
- char szSearchPath[MAX_PATH];
- char szPluginPath[MAX_PATH];
+ TCHAR szSearchPath[MAX_PATH];
+ TCHAR szPluginPath[MAX_PATH];
lstrcpy(szSearchPath,szMirandaDir);
- lstrcat(szSearchPath,"\\Plugins\\YAMN\\*.dll");
+ lstrcat(szSearchPath, _T("\\Plugins\\YAMN\\*.dll"));
typedef INT_PTR (*LOADFILTERFCN)(MIRANDASERVICE GetYAMNFcn);
hDllPlugins=NULL;
- if(INVALID_HANDLE_VALUE!=(hFind=FindFirstFile(szSearchPath,&fd)))
+ if (INVALID_HANDLE_VALUE!=(hFind=FindFirstFile(szSearchPath,&fd)))
{
do
{ //rewritten from Miranda sources... Needed because Win32 API has a bug in FindFirstFile, search is done for *.dlllllll... too
- char *dot=strrchr(fd.cFileName,'.');
- if(dot)
+ TCHAR *dot = _tcsrchr(fd.cFileName,'.');
+ if (dot)
{ // we have a dot
- int len=(int)strlen(fd.cFileName); // find the length of the string
- char* end=fd.cFileName+len; // get a pointer to the NULL
+ int len=(int)lstrlen(fd.cFileName); // find the length of the string
+ TCHAR* end = fd.cFileName+len; // get a pointer to the NULL
int safe=(end-dot)-1; // figure out how many chars after the dot are "safe", not including NULL
- if((safe!=3) || (lstrcmpi(dot+1,"dll")!=0)) //not bound, however the "dll" string should mean only 3 chars are compared
+ if ((safe!=3) || (lstrcmpi(dot+1, _T("dll"))!=0)) //not bound, however the "dll" string should mean only 3 chars are compared
continue;
}
else
@@ -680,23 +608,23 @@ void LoadPlugins()
LOADFILTERFCN LoadFilter;
lstrcpy(szPluginPath,szMirandaDir);
- lstrcat(szPluginPath,"\\Plugins\\YAMN\\");
+ lstrcat(szPluginPath, _T("\\Plugins\\YAMN\\"));
lstrcat(szPluginPath,fd.cFileName);
- if((hDll=LoadLibrary(szPluginPath))==NULL) continue;
+ if ((hDll=LoadLibrary(szPluginPath))==NULL) continue;
LoadFilter=(LOADFILTERFCN)GetProcAddress(hDll,"LoadFilter");
- if(NULL==LoadFilter)
+ if (NULL==LoadFilter)
{
FreeLibrary(hDll);
hDll=NULL;
continue;
}
- if(!(*LoadFilter)(GetFcnPtrSvc))
+ if (!(*LoadFilter)(GetFcnPtrSvc))
{
FreeLibrary(hDll);
hDll=NULL;
}
- if(hDll!=NULL)
+ if (hDll!=NULL)
{
hDllPlugins=(HINSTANCE *)realloc((void *)hDllPlugins,(iDllPlugins+1)*sizeof(HINSTANCE));
hDllPlugins[iDllPlugins++]=hDll;
@@ -709,12 +637,12 @@ void LoadPlugins()
void UnloadPlugins()
{
for(int i=iDllPlugins-1;i>=0;i--) {
- if(FreeLibrary(hDllPlugins[i])){
+ if (FreeLibrary(hDllPlugins[i])){
hDllPlugins[i]=NULL; //for safety
iDllPlugins --;
}
}
- if(hDllPlugins){
+ if (hDllPlugins){
free((void *)hDllPlugins);
hDllPlugins = NULL;
}
@@ -791,7 +719,7 @@ int AddTopToolbarIcon(WPARAM,LPARAM)
NULL
};
- if(!DBGetContactSettingByte(NULL,YAMN_DBMODULE,YAMN_TTBFCHECK,1))
+ if (!DBGetContactSettingByte(NULL,YAMN_DBMODULE,YAMN_TTBFCHECK,1))
return 1;
Button.name=Translate("Check mail");
@@ -799,7 +727,7 @@ int AddTopToolbarIcon(WPARAM,LPARAM)
Button.hbBitmapUp = LoadBmpFromIcon(hYamnIcons[5]);
Button.hbBitmapDown = LoadBmpFromIcon(hYamnIcons[6]); //LoadBitmap(YAMNVar.hInst,MAKEINTRESOURCE(IDB_BMTTB));
- if((HANDLE)-1==(hTTButton=(HANDLE)CallService(MS_TTB_ADDBUTTON,(WPARAM)&Button,(LPARAM)0)))
+ if ((HANDLE)-1==(hTTButton=(HANDLE)CallService(MS_TTB_ADDBUTTON,(WPARAM)&Button,(LPARAM)0)))
return 1;
CallService(MS_TTB_SETBUTTONOPTIONS,MAKEWPARAM((WORD)TTBO_TIPNAME,(WORD)hTTButton),(LPARAM)Translate("Check mail"));
return 0;
@@ -807,7 +735,7 @@ int AddTopToolbarIcon(WPARAM,LPARAM)
int UninstallQuestionSvc(WPARAM wParam,LPARAM)
{
-// if(strcmp((char *)wParam,Translate("Yet Another Mail Notifier")))
+// if (strcmp((char *)wParam,Translate("Yet Another Mail Notifier")))
// return 0;
switch(MessageBoxA(NULL,Translate("Do you also want to remove native YAMN plugins settings?"),Translate("YAMN uninstalling"),MB_YESNOCANCEL|MB_ICONQUESTION))
{
diff --git a/plugins/YAMN/proto/netlib.cpp b/plugins/YAMN/proto/netlib.cpp
index f6f497b8da..b7c1864ffa 100644
--- a/plugins/YAMN/proto/netlib.cpp
+++ b/plugins/YAMN/proto/netlib.cpp
@@ -4,15 +4,8 @@
* (c) majvan 2002-2004
*/
-#if !defined(_WIN64)
- #include "../filter/simple/AggressiveOptimize.h"
-#endif
-#include <windows.h>
-#include <stdio.h>
-#include <newpluginapi.h> //CallService,UnHookEvent
-#include <m_netlib.h> //socket thorugh proxy functions
-#include <m_langpack.h> //langpack for "connection" and other words
-#include "../debug.h"
+#include "..\yamn.h"
+#include "m_netlib.h"
#include "netlib.h"
//--------------------------------------------------------------------------------------------------
@@ -48,7 +41,7 @@ HANDLE RegisterNLClient(const char *name)
static NETLIBUSER nlu={0};
char desc[128];
- sprintf(desc, TranslateT("%s connection"),name);
+ sprintf(desc, Translate("%s connection"),name);
#ifdef DEBUG_COMM
DebugLog(CommFile,"<Register PROXY support>");
@@ -60,7 +53,7 @@ HANDLE RegisterNLClient(const char *name)
hNetlibUser=(HANDLE)CallService(MS_NETLIB_REGISTERUSER,0,(LPARAM)&nlu);
#ifdef DEBUG_COMM
- if(NULL==hNetlibUser)
+ if (NULL==hNetlibUser)
DebugLog(CommFile,"<error></Register PROXY support>\n");
else
DebugLog(CommFile,"</Register PROXY support>\n");
@@ -112,7 +105,7 @@ void CNLClient::Connect(const char* servername,const int port) throw(DWORD)
nloc.szHost=servername;
nloc.wPort=port;
nloc.flags=0;
- if(NULL==(hConnection=(HANDLE)CallService(MS_NETLIB_OPENCONNECTION,(WPARAM)hNetlibUser,(LPARAM)&nloc)))
+ if (NULL==(hConnection=(HANDLE)CallService(MS_NETLIB_OPENCONNECTION,(WPARAM)hNetlibUser,(LPARAM)&nloc)))
{
SystemError=WSAGetLastError();
throw NetworkError=(DWORD)ENL_CONNECT;
@@ -149,16 +142,16 @@ void CNLClient::Send(const char *query) throw(DWORD)
{
unsigned int Sent;
- if(NULL==query)
+ if (NULL==query)
return;
- if(hConnection==NULL)
+ if (hConnection==NULL)
return;
#ifdef DEBUG_COMM
DebugLog(CommFile,"<send>%s",query);
#endif
try
{
- if((SOCKET_ERROR==(Sent=LocalNetlib_Send(hConnection,query,(int)strlen(query),MSG_DUMPASTEXT))) || Sent!=(unsigned int)strlen(query))
+ if ((SOCKET_ERROR==(Sent=LocalNetlib_Send(hConnection,query,(int)strlen(query),MSG_DUMPASTEXT))) || Sent!=(unsigned int)strlen(query))
{
SystemError=WSAGetLastError();
throw NetworkError=(DWORD)ENL_SEND;
@@ -203,9 +196,9 @@ char* CNLClient::Recv(char *buf,int buflen) throw(DWORD)
#endif
try
{
- if(buf==NULL)
+ if (buf==NULL)
buf=(char *)malloc(sizeof(char)*(buflen+1));
- if(buf==NULL)
+ if (buf==NULL)
throw NetworkError=(DWORD)ENL_RECVALLOC;
if (!isTLSed)
@@ -228,13 +221,13 @@ char* CNLClient::Recv(char *buf,int buflen) throw(DWORD)
}
ZeroMemory(buf,buflen);
- if(SOCKET_ERROR==(Rcv=LocalNetlib_Recv(hConnection,buf,buflen,MSG_DUMPASTEXT)))
+ if (SOCKET_ERROR==(Rcv=LocalNetlib_Recv(hConnection,buf,buflen,MSG_DUMPASTEXT)))
{
free(buf);
SystemError=WSAGetLastError();
throw NetworkError=(DWORD)ENL_RECV;
}
- if(!Rcv)
+ if (!Rcv)
{
free(buf);
SystemError=WSAGetLastError();
diff --git a/plugins/YAMN/proto/pop3/pop3.cpp b/plugins/YAMN/proto/pop3/pop3.cpp
index 59b824445c..8186406124 100644
--- a/plugins/YAMN/proto/pop3/pop3.cpp
+++ b/plugins/YAMN/proto/pop3/pop3.cpp
@@ -22,20 +22,16 @@
* Windows for my project. majvan
*
*/
-
+
#pragma warning( disable : 4290 )
-#if !defined(_WIN64)
- #include "../../filter/simple/AggressiveOptimize.h"
-#endif
-#include <windows.h>
-#include <stdio.h>
-#include "pop3.h"
-
+#include "..\..\yamn.h"
+#include "pop3.h"
+
extern "C" {
#include "../md5.h"
}
-
+
extern void __stdcall SSL_DebugLog( const char *fmt, ... );
//--------------------------------------------------------------------------------------------------
@@ -46,12 +42,12 @@ extern void __stdcall SSL_DebugLog( const char *fmt, ... );
//returns welcome string returned by server
//sets AckFlag
char *CPop3Client::Connect(const char* servername,const int port,BOOL UseSSL, BOOL NoTLS)
-{
+{
char *temp = 0;
- if(Stopped) //check if we can work with this POP3 client session
+ if (Stopped) //check if we can work with this POP3 client session
throw POP3Error=(DWORD)EPOP3_STOPPED;
- if(NetClient!=NULL)
+ if (NetClient!=NULL)
delete NetClient;
SSL=UseSSL;
NetClient=new CNLClient;
@@ -73,27 +69,27 @@ char *CPop3Client::Connect(const char* servername,const int port,BOOL UseSSL, BO
}
}
- temp = RecvRest(NetClient->Recv(),POP3_SEARCHACK);
- extern BOOL SSLLoaded;
+ temp = RecvRest(NetClient->Recv(),POP3_SEARCHACK);
+ extern BOOL SSLLoaded;
if (!NoTLS & !(SSL)){
- if(NetClient->Stopped) //check if we can work with this POP3 client session
- throw POP3Error=(DWORD)EPOP3_STOPPED;
- NetClient->Send("STLS\r\n");
- free(temp);
- temp=RecvRest(NetClient->Recv(),POP3_SEARCHACK);
- if(AckFlag==POP3_FOK){ // Ok, we are going to tls
- try {
- NetClient->SSLify();
- } catch (...) {
- NetClient->Disconnect();
- return NULL;
- }
-// temp = RecvRest(NetClient->Recv(),POP3_SEARCHACK);
- }
- }
-// SSL_DebugLog("Received: %s",temp);
+ if (NetClient->Stopped) //check if we can work with this POP3 client session
+ throw POP3Error=(DWORD)EPOP3_STOPPED;
+ NetClient->Send("STLS\r\n");
+ free(temp);
+ temp=RecvRest(NetClient->Recv(),POP3_SEARCHACK);
+ if (AckFlag==POP3_FOK){ // Ok, we are going to tls
+ try {
+ NetClient->SSLify();
+ } catch (...) {
+ NetClient->Disconnect();
+ return NULL;
+ }
+// temp = RecvRest(NetClient->Recv(),POP3_SEARCHACK);
+ }
+ }
+// SSL_DebugLog("Received: %s",temp);
return temp;
-}
+}
//Receives data to the end of packet
// prev- previous data read (appends to this string next received data)
@@ -116,19 +112,19 @@ char* CPop3Client::RecvRest(char* prev,int mode,int size)
while(((mode==POP3_SEARCHDOT) && !SearchFromEnd(PrevString+RcvAll-1,RcvAll-3,POP3_SEARCHDOT) && !SearchFromStart(PrevString,2,POP3_SEARCHERR)) || //we are looking for dot or -err phrase
((mode==POP3_SEARCHACK) && (!SearchFromStart(PrevString,RcvAll-3,mode) || !((RcvAll>3) && SearchFromEnd(PrevString+RcvAll-1,1,POP3_SEARCHNL))))) //we are looking for +ok or -err phrase ended with newline
{ //if not found
- if(NetClient->Stopped) //check if we can work with this POP3 client session
+ if (NetClient->Stopped) //check if we can work with this POP3 client session
{
- if(PrevString!=NULL)
+ if (PrevString!=NULL)
free(PrevString);
throw POP3Error=(DWORD)EPOP3_STOPPED;
}
- if(SizeLeft==0) //if block is full
+ if (SizeLeft==0) //if block is full
{
SizeRead+=size;
SizeLeft=size;
LastString=NetClient->Recv(NULL,SizeLeft);
PrevString=(char *)realloc(PrevString,sizeof(char)*(SizeRead+size));
- if(PrevString==NULL)
+ if (PrevString==NULL)
throw POP3Error=(DWORD)EPOP3_RESTALLOC;
memcpy(PrevString+SizeRead,LastString,size);
free(LastString);
@@ -153,11 +149,11 @@ BOOL CPop3Client::SearchFromEnd(char *end,int bs,int mode)
switch(mode)
{
case POP3_SEARCHDOT:
- if(DOTLINE(end))
+ if (DOTLINE(end))
return 1;
break;
case POP3_SEARCHNL:
- if(ENDLINE(end))
+ if (ENDLINE(end))
return 1;
break;
}
@@ -178,21 +174,21 @@ BOOL CPop3Client::SearchFromStart(char *start,int bs,int mode)
switch(mode)
{
case POP3_SEARCHOK:
- if(OKLINE(start))
+ if (OKLINE(start))
{
AckFlag=POP3_FOK;
return 1;
}
break;
case POP3_SEARCHERR:
- if(ERRLINE(start))
+ if (ERRLINE(start))
{
AckFlag=POP3_FERR;
return 1;
}
break;
case POP3_SEARCHACK:
- if(ACKLINE(start))
+ if (ACKLINE(start))
{
OKLINE(start) ? AckFlag=POP3_FOK : AckFlag=POP3_FERR;
return 1;
@@ -209,7 +205,7 @@ BOOL CPop3Client::SearchFromStart(char *start,int bs,int mode)
//sets AckFlag
char* CPop3Client::User(char* name)
{
- if(NetClient->Stopped) //check if we can work with this POP3 client session
+ if (NetClient->Stopped) //check if we can work with this POP3 client session
throw POP3Error=(DWORD)EPOP3_STOPPED;
char query[128];
@@ -218,7 +214,7 @@ char* CPop3Client::User(char* name)
sprintf(query,"USER %s\r\n",name);
NetClient->Send(query);
Result=RecvRest(NetClient->Recv(),POP3_SEARCHACK);
- if(AckFlag==POP3_FERR)
+ if (AckFlag==POP3_FERR)
throw POP3Error=(DWORD)EPOP3_BADUSER;
POP3Error=0;
return Result;
@@ -228,7 +224,7 @@ char* CPop3Client::User(char* name)
//sets AckFlag
char* CPop3Client::Pass(char* pw)
{
- if(NetClient->Stopped) //check if we can work with this POP3 client session
+ if (NetClient->Stopped) //check if we can work with this POP3 client session
throw POP3Error=(DWORD)EPOP3_STOPPED;
char query[128];
@@ -237,7 +233,7 @@ char* CPop3Client::Pass(char* pw)
sprintf(query,"PASS %s\r\n",pw);
NetClient->Send(query);
Result=RecvRest(NetClient->Recv(),POP3_SEARCHACK);
- if(AckFlag==POP3_FERR)
+ if (AckFlag==POP3_FERR)
throw POP3Error=(DWORD)EPOP3_BADPASS;
return Result;
}
@@ -246,7 +242,7 @@ char* CPop3Client::Pass(char* pw)
//sets AckFlag
char* CPop3Client::APOP(char* name, char* pw, char* timestamp)
{
- if(NetClient->Stopped) //check if we can work with this POP3 client session
+ if (NetClient->Stopped) //check if we can work with this POP3 client session
throw POP3Error=(DWORD)EPOP3_STOPPED;
char query[512];
@@ -254,7 +250,7 @@ char* CPop3Client::APOP(char* name, char* pw, char* timestamp)
unsigned char digest[16];
char hexdigest[40];
- if(timestamp==NULL)
+ if (timestamp==NULL)
throw POP3Error=(DWORD)EPOP3_APOP;
MD5Context ctx;
MD5Init(&ctx);
@@ -270,7 +266,7 @@ char* CPop3Client::APOP(char* name, char* pw, char* timestamp)
sprintf(query,"APOP %s %s\r\n",name, hexdigest);
NetClient->Send(query);
Result=RecvRest(NetClient->Recv(),POP3_SEARCHACK);
- if(AckFlag==POP3_FERR)
+ if (AckFlag==POP3_FERR)
throw POP3Error=(DWORD)EPOP3_BADUSER;
return Result;
}
@@ -289,7 +285,7 @@ char* CPop3Client::Quit()
//sets AckFlag
char* CPop3Client::Stat()
{
- if(NetClient->Stopped) //check if we can work with this POP3 client session
+ if (NetClient->Stopped) //check if we can work with this POP3 client session
throw POP3Error=(DWORD)EPOP3_STOPPED;
char query[]="STAT\r\n";
@@ -302,7 +298,7 @@ char* CPop3Client::Stat()
//sets AckFlag
char* CPop3Client::List()
{
- if(NetClient->Stopped) //check if we can work with this POP3 client session
+ if (NetClient->Stopped) //check if we can work with this POP3 client session
throw POP3Error=(DWORD)EPOP3_STOPPED;
char query[]="LIST\r\n";
@@ -315,7 +311,7 @@ char* CPop3Client::List()
//sets AckFlag
char* CPop3Client::Top(int nr, int lines)
{
- if(NetClient->Stopped) //check if we can work with this POP3 client session
+ if (NetClient->Stopped) //check if we can work with this POP3 client session
throw POP3Error=(DWORD)EPOP3_STOPPED;
char query[128];
@@ -329,12 +325,12 @@ char* CPop3Client::Top(int nr, int lines)
//sets AckFlag
char* CPop3Client::Uidl(int nr)
{
- if(NetClient->Stopped) //check if we can work with this POP3 client session
+ if (NetClient->Stopped) //check if we can work with this POP3 client session
throw POP3Error=(DWORD)EPOP3_STOPPED;
char query[128];
- if(nr)
+ if (nr)
{
sprintf(query,"UIDL %d\r\n",nr);
NetClient->Send(query);
@@ -349,7 +345,7 @@ char* CPop3Client::Uidl(int nr)
//sets AckFlag
char* CPop3Client::Dele(int nr)
{
- if(NetClient->Stopped) //check if we can work with this POP3 client session
+ if (NetClient->Stopped) //check if we can work with this POP3 client session
throw POP3Error=(DWORD)EPOP3_STOPPED;
char query[128];
@@ -358,17 +354,17 @@ char* CPop3Client::Dele(int nr)
NetClient->Send(query);
return RecvRest(NetClient->Recv(),POP3_SEARCHACK);
}
-//Performs "RETR" pop query and returns server response
+//Performs "RETR" pop query and returns server response
//sets AckFlag
-char* CPop3Client::Retr(int nr)
-{
- if(NetClient->Stopped) //check if we can work with this POP3 client session
- throw POP3Error=(DWORD)EPOP3_STOPPED;
-
- char query[128];
-
- sprintf(query,"RETR %d\r\n",nr);
- NetClient->Send(query);
- RecvRest(NetClient->Recv(),POP3_SEARCHACK);
- return NetClient->Recv();
+char* CPop3Client::Retr(int nr)
+{
+ if (NetClient->Stopped) //check if we can work with this POP3 client session
+ throw POP3Error=(DWORD)EPOP3_STOPPED;
+
+ char query[128];
+
+ sprintf(query,"RETR %d\r\n",nr);
+ NetClient->Send(query);
+ RecvRest(NetClient->Recv(),POP3_SEARCHACK);
+ return NetClient->Recv();
} \ No newline at end of file
diff --git a/plugins/YAMN/proto/pop3/pop3.h b/plugins/YAMN/proto/pop3/pop3.h
index faa6bd6195..1f7f2ea737 100644
--- a/plugins/YAMN/proto/pop3/pop3.h
+++ b/plugins/YAMN/proto/pop3/pop3.h
@@ -23,7 +23,7 @@ class CPop3Client
{
public:
CPop3Client(): NetClient(NULL), Stopped(FALSE) {}
- ~CPop3Client() {if(NetClient!=NULL) delete NetClient;}
+ ~CPop3Client() {if (NetClient!=NULL) delete NetClient;}
char* Connect(const char* servername,const int port=110,BOOL UseSSL=FALSE, BOOL NoTLS=FALSE);
char* RecvRest(char* prev,int mode,int size=65536);
diff --git a/plugins/YAMN/proto/pop3/pop3comm.cpp b/plugins/YAMN/proto/pop3/pop3comm.cpp
index 44cbfcc83c..7e38cc94c7 100644
--- a/plugins/YAMN/proto/pop3/pop3comm.cpp
+++ b/plugins/YAMN/proto/pop3/pop3comm.cpp
@@ -11,8 +11,8 @@
#pragma warning( disable : 4290 )
-#include "../../main.h"
#include "../../yamn.h"
+#include "../../main.h"
#include "pop3.h"
#include "pop3comm.h" //all we need for POP3 account (POP3 account= YAMN account + some more POP3 specified members)
#include <m_netlib.h> //socket thorugh proxy functions
@@ -53,10 +53,6 @@ void WINAPI StopPOP3Account(HACCOUNT Which);
//Function registers standard functions for YAMN
int RegisterPOP3Plugin(WPARAM,LPARAM);
-//This should be normally exporeted fcn UninstallEx from plugin DLL, but YAMN has already exported one, so this is the same called from YAMN UninstallEx
-//This is used by PluginUninstall
-int UninstallPOP3(PLUGINUNINSTALLPARAMS* ppup);
-
//Unloads all variables created on heap (delete[])
DWORD WINAPI UnLoadPOP3(void *);
@@ -67,7 +63,7 @@ DWORD WINAPI WritePOP3Accounts();
DWORD WINAPI WritePOP3Options(HANDLE,HACCOUNT);
//Function reads plugin's data for account from file
-DWORD WINAPI ReadPOP3Options(HACCOUNT,TCHAR **,TCHAR *);
+DWORD WINAPI ReadPOP3Options(HACCOUNT,char **,char *);
//Creates new mail for an account
HYAMNMAIL WINAPI CreatePOP3Mail(HACCOUNT Account,DWORD CMimeMailVersion);
@@ -156,7 +152,7 @@ YAMN_PROTOREGISTRATION POP3ProtocolRegistration =
"http://forums.miranda-im.org/showthread.php?t=3035",
};
-WCHAR *FileName = NULL;
+static WCHAR *FileName = NULL;
//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
@@ -176,7 +172,7 @@ CPOP3Account::CPOP3Account()
CPOP3Account::~CPOP3Account()
{
CloseHandle(UseInternetFree);
- if(InternetQueries!=NULL)
+ if (InternetQueries!=NULL)
delete InternetQueries;
}
@@ -186,7 +182,7 @@ HACCOUNT WINAPI CreatePOP3Account(HYAMNPROTOPLUGIN Plugin,DWORD CAccountVersion)
//But this is internal plugin, so YAMN's CAccount structure and our CAccount structure are
//the same, so we do not need to test version. Otherwise, if CAccount version does not match
//in your plugin, you should return NULL, like this:
-// if(CAccountVersion!=YAMN_ACCOUNTVERSION) return NULL;
+// if (CAccountVersion!=YAMN_ACCOUNTVERSION) return NULL;
//Now it is needed to construct our POP3 account and return its handle
return (HACCOUNT)new struct CPOP3Account();
@@ -200,7 +196,7 @@ void WINAPI DeletePOP3Account(HACCOUNT Which)
void WINAPI StopPOP3Account(HACCOUNT Which)
{
((HPOP3ACCOUNT)Which)->Client.Stopped=TRUE;
- if(((HPOP3ACCOUNT)Which)->Client.NetClient!=NULL) //we should inform also network client. Usefull only when network client implements this feature
+ if (((HPOP3ACCOUNT)Which)->Client.NetClient!=NULL) //we should inform also network client. Usefull only when network client implements this feature
((HPOP3ACCOUNT)Which)->Client.NetClient->Stopped=TRUE;
}
@@ -209,15 +205,15 @@ int RegisterPOP3Plugin(WPARAM,LPARAM)
{
//Get YAMN variables we can use
- if(NULL==(pYAMNVar=(PYAMN_VARIABLES)CallService(MS_YAMN_GETVARIABLES,(WPARAM)YAMN_VARIABLESVERSION,(LPARAM)0)))
+ if (NULL==(pYAMNVar=(PYAMN_VARIABLES)CallService(MS_YAMN_GETVARIABLES,(WPARAM)YAMN_VARIABLESVERSION,(LPARAM)0)))
return 0;
//We have to get pointers to YAMN exported functions: allocate structure and fill it
- if(NULL==(pYAMNFcn=new struct YAMNExportedFcns))
+ if (NULL==(pYAMNFcn=new struct YAMNExportedFcns))
{UnLoadPOP3(0); return 0;}
//Register new pop3 user in netlib
- if(NULL==(hNetLib=RegisterNLClient("YAMN-POP3")))
+ if (NULL==(hNetLib=RegisterNLClient("YAMN-POP3")))
{UnLoadPOP3(0); return 0;}
pYAMNFcn->SetProtocolPluginFcnImportFcn=(YAMN_SETPROTOCOLPLUGINFCNIMPORTFCN)CallService(MS_YAMN_GETFCNPTR,(WPARAM)YAMN_SETPROTOCOLPLUGINFCNIMPORTID,(LPARAM)0);
@@ -231,7 +227,7 @@ int RegisterPOP3Plugin(WPARAM,LPARAM)
pYAMNFcn->SetStatusFcn=(YAMN_SETSTATUSFCN)CallService(MS_YAMN_GETFCNPTR,(WPARAM)YAMN_SETSTATUSID,(LPARAM)0);
pYAMNFcn->GetStatusFcn=(YAMN_GETSTATUSFCN)CallService(MS_YAMN_GETFCNPTR,(WPARAM)YAMN_GETSTATUSID,(LPARAM)0);
- if(NULL==(pYAMNMailFcn=new struct MailExportedFcns))
+ if (NULL==(pYAMNMailFcn=new struct MailExportedFcns))
{UnLoadPOP3(0); return 0;}
pYAMNMailFcn->SynchroMessagesFcn=(YAMN_SYNCHROMIMEMSGSFCN)CallService(MS_YAMN_GETFCNPTR,(WPARAM)YAMN_SYNCHROMIMEMSGSID,(LPARAM)0);
@@ -243,8 +239,8 @@ int RegisterPOP3Plugin(WPARAM,LPARAM)
pYAMNMailFcn->CreateNewDeleteQueueFcn=(YAMN_CREATENEWDELETEQUEUEFCN)CallService(MS_YAMN_GETFCNPTR,(WPARAM)YAMN_CREATENEWDELETEQUEUEID,(LPARAM)0);
//set static variable
- if(CPOP3Account::AccountWriterSO==NULL) {
- if(NULL==(CPOP3Account::AccountWriterSO=new SCOUNTER))
+ if (CPOP3Account::AccountWriterSO==NULL) {
+ if (NULL==(CPOP3Account::AccountWriterSO=new SCOUNTER))
{UnLoadPOP3(0); return 0;}
}
@@ -252,40 +248,44 @@ int RegisterPOP3Plugin(WPARAM,LPARAM)
//it is quite impossible this function returns zero (failure) as YAMN and internal plugin structre versions are the same
POP3ProtocolRegistration.Name = Translate("POP3 protocol (internal)");
POP3ProtocolRegistration.Description = Translate("Mail notifier and browser for Miranda IM. Included POP3 protocol.");
- if(NULL==(POP3Plugin=(HYAMNPROTOPLUGIN)CallService(MS_YAMN_REGISTERPROTOPLUGIN,(WPARAM)&POP3ProtocolRegistration,(LPARAM)YAMN_PROTOREGISTRATIONVERSION)))
+ if (NULL==(POP3Plugin=(HYAMNPROTOPLUGIN)CallService(MS_YAMN_REGISTERPROTOPLUGIN,(WPARAM)&POP3ProtocolRegistration,(LPARAM)YAMN_PROTOREGISTRATIONVERSION)))
return 0;
//Next we set our imported functions for YAMN
- if(!SetProtocolPluginFcnImport(POP3Plugin,&POP3ProtocolFunctions,YAMN_PROTOIMPORTFCNVERSION,&POP3MailFunctions,YAMN_MAILIMPORTFCNVERSION))
+ if (!SetProtocolPluginFcnImport(POP3Plugin,&POP3ProtocolFunctions,YAMN_PROTOIMPORTFCNVERSION,&POP3MailFunctions,YAMN_MAILIMPORTFCNVERSION))
return 0;
//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
- if(FileName) CallService(MS_YAMN_DELETEFILENAME,(WPARAM)FileName,(LPARAM)0); //shoud not happen (only for secure)
+ if (FileName) CallService(MS_YAMN_DELETEFILENAME,(WPARAM)FileName,(LPARAM)0); //shoud not happen (only for secure)
FileName=(WCHAR *)CallService(MS_YAMN_GETFILENAMEA,(WPARAM)"pop3",(LPARAM)0);
switch(CallService(MS_YAMN_READACCOUNTSW,(WPARAM)POP3Plugin,(LPARAM)FileName))
{
case EACC_FILEVERSION:
- MessageBoxA(NULL,Translate("Found new version of account book, not compatible with this version of YAMN."),Translate(_T("YAMN (internal POP3) read error")),MB_OK);
+ MessageBox(NULL,TranslateT("Found new version of account book, not compatible with this version of YAMN."),TranslateT("YAMN (internal POP3) read error"),MB_OK);
CallService(MS_YAMN_DELETEFILENAME,(WPARAM)FileName,(LPARAM)0);
+ FileName = NULL;
return 0;
case EACC_FILECOMPATIBILITY:
- MessageBoxA(NULL,Translate("Error reading account file. Account file corrupted."),Translate("YAMN (internal POP3) read error"),MB_OK);
+ MessageBox(NULL,TranslateT("Error reading account file. Account file corrupted."),TranslateT("YAMN (internal POP3) read error"),MB_OK);
CallService(MS_YAMN_DELETEFILENAME,(WPARAM)FileName,(LPARAM)0);
+ FileName = NULL;
return 0;
case EACC_ALLOC:
- MessageBoxA(NULL,Translate("Memory allocation error while data reading"),Translate("YAMN (internal POP3) read error"),MB_OK);
+ MessageBox(NULL,TranslateT("Memory allocation error while data reading"),TranslateT("YAMN (internal POP3) read error"),MB_OK);
CallService(MS_YAMN_DELETEFILENAME,(WPARAM)FileName,(LPARAM)0);
+ FileName = NULL;
return 0;
case EACC_SYSTEM:
- if(ERROR_FILE_NOT_FOUND!=GetLastError())
+ if (ERROR_FILE_NOT_FOUND!=GetLastError())
{
- char temp[1024] = {0};
- _snprintf(temp,1024,"%s\n%S",Translate("Reading file error. File already in use?"),FileName);
- MessageBoxA(NULL,temp,Translate("YAMN (internal POP3) read error"),MB_OK);
+ TCHAR temp[1024] = {0};
+ mir_sntprintf(temp, SIZEOF(temp), _T("%s\n%s"),TranslateT("Reading file error. File already in use?"),FileName);
+ MessageBox(NULL,temp,TranslateT("YAMN (internal POP3) read error"),MB_OK);
CallService(MS_YAMN_DELETEFILENAME,(WPARAM)FileName,(LPARAM)0);
+ FileName = NULL;
return 0;
}
break;
@@ -304,33 +304,26 @@ int RegisterPOP3Plugin(WPARAM,LPARAM)
while(hContact)
{
szProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
- if(szProto != NULL && strcmp(szProto, ProtoName)==0)
+ if (szProto != NULL && strcmp(szProto, ProtoName)==0)
{
- if(!DBGetContactSetting(hContact,ProtoName,"Id",&dbv))
- {
-
- if( strcmp((char*)dbv.pszVal, Finder->Name)==0)
- {
+ if (!DBGetContactSettingString(hContact,ProtoName,"Id",&dbv)) {
+ if ( strcmp( dbv.pszVal, Finder->Name) == 0) {
Finder->hContact = hContact;
DBWriteContactSettingWord(Finder->hContact, ProtoName, "Status", ID_STATUS_ONLINE);
DBWriteContactSettingString(Finder->hContact, "CList", "StatusMsg", Translate("No new mail message"));
- if((Finder->Flags & YAMN_ACC_ENA) && (Finder->NewMailN.Flags & YAMN_ACC_CONT))
- {
+ if ((Finder->Flags & YAMN_ACC_ENA) && (Finder->NewMailN.Flags & YAMN_ACC_CONT))
DBDeleteContactSetting(Finder->hContact, "CList", "Hidden");
- }
- if(!(Finder->Flags & YAMN_ACC_ENA) || !(Finder->NewMailN.Flags & YAMN_ACC_CONT))
- {
+
+ if (!(Finder->Flags & YAMN_ACC_ENA) || !(Finder->NewMailN.Flags & YAMN_ACC_CONT))
DBWriteContactSettingByte(Finder->hContact, "CList", "Hidden", 1);
- }
}
DBFreeVariant(&dbv);
}
-
}
hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
}
- if(Finder->hContact == NULL && (Finder->Flags & YAMN_ACC_ENA) && (Finder->NewMailN.Flags & YAMN_ACC_CONT))
- {
+
+ if (Finder->hContact == NULL && (Finder->Flags & YAMN_ACC_ENA) && (Finder->NewMailN.Flags & YAMN_ACC_CONT)) {
//No account contact found, have to create one
Finder->hContact =(HANDLE) CallService(MS_DB_CONTACT_ADD, 0, 0);
CallService(MS_PROTO_ADDTOCONTACT,(WPARAM)Finder->hContact,(LPARAM)ProtoName);
@@ -339,58 +332,23 @@ int RegisterPOP3Plugin(WPARAM,LPARAM)
DBWriteContactSettingString(Finder->hContact,"Protocol","p",ProtoName);
DBWriteContactSettingWord(Finder->hContact, ProtoName, "Status", YAMN_STATUS);
}
-
- /*//this doesn't work. the function doesn't know which contact to check
- //if((Finder->Flags & YAMN_ACC_ENA) && (Finder->NewMailN.Flags & YAMN_ACC_CONT) && DBGetContactSettingByte(NULL, YAMN_DBMODULE, YAMN_SHOWMAINMENU, 1))
- //{
- // mi.cbSize = sizeof(mi);
- // mi.position = 0xb0000000;
- // mi.flags = CMIM_ICON;
- // mi.hIcon = hYamnIcons[1];
- // mi.pszName = Finder->Name;
- // mi.pszPopupName = ProtoName;
- // mi.pszService = MS_YAMN_CLISTCONTEXT;
- // hMenuItemMain = (HANDLE) CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&mi);
- }*/
-
}
return 0;
}
-int UninstallPOP3(PLUGINUNINSTALLPARAMS* ppup) //Usually UninstallEx, but need different name, because it is registered yet in main.cpp
-{
- if(ppup->bDoDeleteSettings)
- {
- char FileNameA[MAX_PATH+1];
-
- PUIRemoveDbModule("YAMN-POP3");
-
- if(FileName==NULL)
- MessageBox(NULL,"Cannot delete book file when YAMN is not loaded. Please do it manually.","YAMN-POP3 uninstalling",MB_OK|MB_ICONWARNING);
- else
- {
- if(!WideCharToMultiByte(CP_ACP,0,FileName,-1,FileNameA,MAX_PATH+1,NULL,NULL))
- MessageBox(NULL,"Cannot delete book file. Please do it manually.","YAMN-POP3 uninstalling",MB_OK|MB_ICONWARNING);
- else
- DeleteFile(FileNameA);
- }
- }
- return 0;
-}
-
DWORD WINAPI UnLoadPOP3(void *)
{
//pYAMNVar is only a pointr, no need delete or free
- if(hNetLib) {
+ if (hNetLib) {
Netlib_CloseHandle(hNetLib); hNetLib = NULL;}
- if(CPOP3Account::AccountWriterSO) {
+ if (CPOP3Account::AccountWriterSO) {
delete CPOP3Account::AccountWriterSO; CPOP3Account::AccountWriterSO = NULL;}
- if(pYAMNMailFcn) {
+ if (pYAMNMailFcn) {
delete pYAMNMailFcn; pYAMNMailFcn = NULL;}
- if(pYAMNFcn) {
+ if (pYAMNFcn) {
delete pYAMNFcn; pYAMNFcn = NULL;}
- if(FileName) {
+ if (FileName) {
CallService(MS_YAMN_DELETEFILENAME,(WPARAM)FileName,(LPARAM)0); FileName = NULL;}
#ifdef DEBUG_SYNCHRO
@@ -408,15 +366,16 @@ DWORD WINAPI WritePOP3Accounts()
{
case EACC_SYSTEM:
{
- char temp[1024] = {0};
- _snprintf(temp,1024,"%s\n%S",Translate("Error while copying data to disk occured. File in use?"),FileName);
- MessageBox(NULL,temp,Translate("POP3 plugin- write file error"),MB_OK);
+ TCHAR temp[1024] = {0};
+ mir_sntprintf(temp, SIZEOF(temp), _T("%s\n%s"), TranslateT("Error while copying data to disk occured. File in use?"), FileName );
+ MessageBox(NULL, temp, TranslateT("POP3 plugin- write file error"), MB_OK );
}
break;
+
case 0:
break;
}
-// CallService(MS_YAMN_DELETEFILENAME,(WPARAM)FileName,(LPARAM)0);
+
return ReturnValue;
}
@@ -425,28 +384,28 @@ DWORD WINAPI WritePOP3Options(HANDLE File,HACCOUNT Which)
DWORD WrittenBytes;
DWORD Ver=POP3_FILEVERSION;
- if((!WriteFile(File,(char *)&Ver,sizeof(DWORD),&WrittenBytes,NULL)) ||
+ if ((!WriteFile(File,(char *)&Ver,sizeof(DWORD),&WrittenBytes,NULL)) ||
(!WriteFile(File,(char *)&((HPOP3ACCOUNT)Which)->CP,sizeof(WORD),&WrittenBytes,NULL)))
return EACC_SYSTEM;
return 0;
}
-DWORD WINAPI ReadPOP3Options(HACCOUNT Which,TCHAR **Parser,TCHAR *End)
+DWORD WINAPI ReadPOP3Options(HACCOUNT Which,char **Parser,char *End)
{
DWORD Ver;
#ifdef DEBUG_FILEREAD
TCHAR Debug[256];
#endif
Ver=*(DWORD *)(*Parser);
- (*Parser)+=sizeof(DWORD)/sizeof(TCHAR);
- if(*Parser>=End)
+ (*Parser)+=sizeof(DWORD);
+ if (*Parser>=End)
return EACC_FILECOMPATIBILITY;
- if(Ver!=POP3_FILEVERSION)
+ if (Ver!=POP3_FILEVERSION)
return EACC_FILECOMPATIBILITY;
((HPOP3ACCOUNT)Which)->CP=*(WORD *)(*Parser);
- (*Parser)+=sizeof(WORD)/sizeof(TCHAR);
- if(*Parser>=End)
+ (*Parser)+=sizeof(WORD);
+ if (*Parser>=End)
return EACC_FILECOMPATIBILITY;
#ifdef DEBUG_FILEREAD
_stprintf(Debug,_T("CodePage: %d, remaining %d chars"),((HPOP3ACCOUNT)Which)->CP,End-*Parser);
@@ -462,13 +421,13 @@ HYAMNMAIL WINAPI CreatePOP3Mail(HACCOUNT Account,DWORD MailDataVersion)
//But this is internal plugin, so YAMN's MAILDATA structure and our MAILDATA structure are
//the same, so we do not need to test version. Otherwise, if MAILDATA version does not match
//in your plugin, you should return NULL, like this:
-// if(MailDataVersion!=YAMN_MAILDATAVERSION) return NULL;
+// if (MailDataVersion!=YAMN_MAILDATAVERSION) return NULL;
//Now it is needed to construct our POP3 account and return its handle
- if(NULL==(NewMail=new YAMNMAIL))
+ if (NULL==(NewMail=new YAMNMAIL))
return NULL;
- if(NULL==(NewMail->MailData=new MAILDATA))
+ if (NULL==(NewMail->MailData=new MAILDATA))
{
delete NewMail;
return NULL;
@@ -493,7 +452,7 @@ static void PostErrorProc(HPOP3ACCOUNT ActualAccount,void *ParamToBadConnection,
PPOP3_ERRORCODE ErrorCode;
//We store status before we do Quit(), because quit can destroy our errorcode status
- if(NULL!=(ErrorCode=new POP3_ERRORCODE))
+ if (NULL!=(ErrorCode=new POP3_ERRORCODE))
{
ErrorCode->SSL=UseSSL;
ErrorCode->AppError=ActualAccount->SystemError;
@@ -502,12 +461,12 @@ static void PostErrorProc(HPOP3ACCOUNT ActualAccount,void *ParamToBadConnection,
ErrorCode->SystemError=ActualAccount->Client.NetClient->SystemError;
}
- if(POP3PluginParam==(DWORD)NULL) //if it was normal YAMN call (force check or so on)
+ if (POP3PluginParam==(DWORD)NULL) //if it was normal YAMN call (force check or so on)
{
try
{
DataRX=ActualAccount->Client.Quit();
- if(DataRX!=NULL)
+ if (DataRX!=NULL)
free(DataRX);
}
catch(...)
@@ -522,26 +481,26 @@ static void PostErrorProc(HPOP3ACCOUNT ActualAccount,void *ParamToBadConnection,
{
}
- SetAccountStatus(ActualAccount,Translate("Disconnected"));
+ SetAccountStatus(ActualAccount,TranslateT("Disconnected"));
//If we cannot allocate memory, do nothing
- if(ErrorCode==NULL)
+ if (ErrorCode==NULL)
{
SetEvent(ActualAccount->UseInternetFree);
return;
}
}
else //else it was called from POP3 plugin, probably error when deleting old mail (POP3 synchro calls POP3 delete)
- if(ErrorCode==NULL)
+ if (ErrorCode==NULL)
return;
- if((ActualAccount->BadConnectN.Flags & YAMN_ACC_MSG) || (ActualAccount->BadConnectN.Flags & YAMN_ACC_ICO) || (ActualAccount->BadConnectN.Flags & YAMN_ACC_POP))
+ if ((ActualAccount->BadConnectN.Flags & YAMN_ACC_MSG) || (ActualAccount->BadConnectN.Flags & YAMN_ACC_ICO) || (ActualAccount->BadConnectN.Flags & YAMN_ACC_POP))
{
YAMN_BADCONNECTIONPARAM cp={(HANDLE)0,ActualAccount,(UINT_PTR)ErrorCode,ParamToBadConnection};
CallService(MS_YAMN_BADCONNECTION,(WPARAM)&cp,(LPARAM)YAMN_BADCONNECTIONVERSION);
}
- if(POP3PluginParam==(DWORD)NULL) //if it was normal YAMN call
+ if (POP3PluginParam==(DWORD)NULL) //if it was normal YAMN call
SetEvent(ActualAccount->UseInternetFree);
}
@@ -569,7 +528,7 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp)
//First, we should compare our version of CheckParam structure, but here it is not needed, because YAMN and internal plugin
//have the same version. But your plugin should do that in this way:
- // if(((struct CheckParam *)WhichTemp)->Ver!=YAMN_CHECKVERSION)
+ // if (((struct CheckParam *)WhichTemp)->Ver!=YAMN_CHECKVERSION)
// {
// SetEvent(((struct CheckParam *)WhichTemp)->ThreadRunningEV); //don't forget to unblock YAMN
// return (DWORD)-1; //ok, but we should return value.
@@ -586,13 +545,13 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp)
#endif
SCInc(ActualAccount->UsingThreads);
//Unblock YAMN, signal that we have copied all parameters from YAMN thread stack
- if(INVALID_HANDLE_VALUE!=WhichTemp->ThreadRunningEV)
+ if (INVALID_HANDLE_VALUE!=WhichTemp->ThreadRunningEV)
SetEvent(WhichTemp->ThreadRunningEV);
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"CheckPOP3:ActualAccountSO-read wait\n");
#endif
- if(WAIT_OBJECT_0!=WaitToRead(ActualAccount))
+ if (WAIT_OBJECT_0!=WaitToRead(ActualAccount))
{
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"CheckPOP3:ActualAccountSO-read wait failed\n");
@@ -608,7 +567,7 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp)
#endif
MyClient=&ActualAccount->Client;
//Now, copy all needed information about account to local variables, so ActualAccount is not blocked in read mode during all connection process, which can last for several minutes.
- ActualCopied.ServerName=_strdup(ActualAccount->Server->Name);
+ ActualCopied.ServerName = _strdup(ActualAccount->Server->Name);
ActualCopied.ServerPort=ActualAccount->Server->Port;
ActualCopied.Flags=ActualAccount->Flags;
ActualCopied.ServerLogin=_strdup(ActualAccount->Server->Login);
@@ -634,7 +593,7 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp)
//OK, we enter the "use internet" section. But after we start communication, we can test if we did not enter the "use internet" section only for the reason,
//that previous thread release the internet section because this account has stop signal (we stop account and there are 2 threads: one communicating,
//the second one waiting for network access- the first one ends because we want to stop account, this one is released, but should be stopped as well).
- if(!ActualAccount->AbleToWork)
+ if (!ActualAccount->AbleToWork)
{
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"CheckPOP3:stop signal-InternetFreeEV-done\n");
@@ -658,20 +617,20 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp)
#endif
// if we are already connected, we have open session (another thread left us open session), so we don't need to login
// note that connected state without logging cannot occur, because if we close session, we always close socket too (we must close socket is the right word :) )
- if((MyClient->NetClient==NULL) || !MyClient->NetClient->Connected())
+ if ((MyClient->NetClient==NULL) || !MyClient->NetClient->Connected())
{
- SetAccountStatus(ActualAccount,Translate("Connecting to server"));
+ SetAccountStatus(ActualAccount,TranslateT("Connecting to server"));
DataRX=MyClient->Connect(ActualCopied.ServerName,ActualCopied.ServerPort,ActualCopied.Flags & YAMN_ACC_SSL23,ActualCopied.Flags & YAMN_ACC_NOTLS);
char *timestamp=NULL;
- if(DataRX!=NULL)
+ if (DataRX!=NULL)
{
- if(ActualCopied.Flags & YAMN_ACC_APOP)
+ if (ActualCopied.Flags & YAMN_ACC_APOP)
{
char *lpos=strchr(DataRX,'<');
char *rpos=strchr(DataRX,'>');
- if(lpos && rpos && rpos>lpos) {
+ if (lpos && rpos && rpos>lpos) {
int sz=(int)(rpos-lpos+2);
timestamp=new char[sz];
memcpy(timestamp, lpos, sz-1);
@@ -682,27 +641,27 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp)
DataRX=NULL;
}
- SetAccountStatus(ActualAccount,Translate("Entering POP3 account"));
+ SetAccountStatus(ActualAccount,TranslateT("Entering POP3 account"));
- if(ActualCopied.Flags & YAMN_ACC_APOP)
+ if (ActualCopied.Flags & YAMN_ACC_APOP)
{
DataRX=MyClient->APOP(ActualCopied.ServerLogin,ActualCopied.ServerPasswd,timestamp);
- if(DataRX!=NULL)
+ if (DataRX!=NULL)
free(DataRX);
DataRX=NULL;
delete[] timestamp;
} else {
DataRX=MyClient->User(ActualCopied.ServerLogin);
- if(DataRX!=NULL)
+ if (DataRX!=NULL)
free(DataRX);
DataRX=NULL;
DataRX=MyClient->Pass(ActualCopied.ServerPasswd);
- if(DataRX!=NULL)
+ if (DataRX!=NULL)
free(DataRX);
DataRX=NULL;
}
}
- SetAccountStatus(ActualAccount,Translate("Searching for new mail message"));
+ SetAccountStatus(ActualAccount,TranslateT("Searching for new mail message"));
DataRX=MyClient->Stat();
@@ -716,26 +675,26 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp)
DebugLog(DecodeFile,"<Msgs>%d</Msgs>\n",msgs);
DebugLog(DecodeFile,"</Extracting stat>\n");
#endif
- if(DataRX!=NULL)
+ if (DataRX!=NULL)
free(DataRX);
DataRX=NULL;
for(i=0;i<msgs;i++)
{
- if(!i)
+ if (!i)
MsgQueuePtr=NewMails=(HYAMNMAIL)CallService(MS_YAMN_CREATEACCOUNTMAIL,(WPARAM)ActualAccount,(LPARAM)YAMN_MAILVERSION);
else
{
MsgQueuePtr->Next=(HYAMNMAIL)CallService(MS_YAMN_CREATEACCOUNTMAIL,(WPARAM)ActualAccount,(LPARAM)YAMN_MAILVERSION);
MsgQueuePtr=MsgQueuePtr->Next;
}
- if(MsgQueuePtr==NULL)
+ if (MsgQueuePtr==NULL)
{
ActualAccount->SystemError=EPOP3_QUEUEALLOC;
throw (DWORD)ActualAccount->SystemError;
}
}
- if(msgs)
+ if (msgs)
{
DataRX=MyClient->List();
#ifdef DEBUG_DECODE
@@ -745,7 +704,7 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp)
#ifdef DEBUG_DECODE
DebugLog(DecodeFile,"</Extracting list>\n");
#endif
- if(DataRX!=NULL)
+ if (DataRX!=NULL)
free(DataRX);
DataRX=NULL;
@@ -757,14 +716,14 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp)
#ifdef DEBUG_DECODE
DebugLog(DecodeFile,"</Extracting UIDL>\n");
#endif
- if(DataRX!=NULL)
+ if (DataRX!=NULL)
free(DataRX);
DataRX=NULL;
}
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"CheckPOP3:ActualAccountMsgsSO-write wait\n");
#endif
- if(WAIT_OBJECT_0!=MsgsWaitToWrite(ActualAccount))
+ if (WAIT_OBJECT_0!=MsgsWaitToWrite(ActualAccount))
{
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"CheckPOP3:ActualAccountMsgsSO-write wait failed\n");
@@ -780,20 +739,20 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp)
HYAMNMAIL NewMsgsPtr=NULL;
for(NewMsgsPtr=(HYAMNMAIL)NewMails;NewMsgsPtr!=NULL;NewMsgsPtr=NewMsgsPtr->Next){
if (!strcmp(MsgQueuePtr->ID,NewMsgsPtr->ID)){
- char accstatus[512];
- sprintf(accstatus,Translate("Reading body %s"),NewMsgsPtr->ID);
+ TCHAR accstatus[512];
+ wsprintf(accstatus,TranslateT("Reading body %s"),NewMsgsPtr->ID);
SetAccountStatus(ActualAccount,accstatus);
DataRX=MyClient->Top(MsgQueuePtr->Number,100);
#ifdef DEBUG_DECODE
DebugLog(DecodeFile,"<Reading body>\n");
DebugLog(DecodeFile,"<Header>%s</Header>\n",DataRX);
#endif
- if(DataRX!=NULL)
+ if (DataRX!=NULL)
{
Temp=DataRX;
while((Temp<DataRX+MyClient->NetClient->Rcv) && (WS(Temp) || ENDLINE(Temp))) Temp++;
- if(OKLINE(DataRX))
+ if (OKLINE(DataRX))
for(Temp=DataRX;(Temp<DataRX+MyClient->NetClient->Rcv) && (!ENDLINE(Temp));Temp++);
while((Temp<DataRX+MyClient->NetClient->Rcv) && ENDLINE(Temp)) Temp++;
}
@@ -804,9 +763,9 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp)
if (TH) for(;MsgQueuePtr->MailData->TranslatedHeader!=NULL;)
{
TH=TH->Next;
- if(MsgQueuePtr->MailData->TranslatedHeader->name!=NULL)
+ if (MsgQueuePtr->MailData->TranslatedHeader->name!=NULL)
delete[] MsgQueuePtr->MailData->TranslatedHeader->name;
- if(MsgQueuePtr->MailData->TranslatedHeader->value!=NULL)
+ if (MsgQueuePtr->MailData->TranslatedHeader->value!=NULL)
delete[] MsgQueuePtr->MailData->TranslatedHeader->value;
delete MsgQueuePtr->MailData->TranslatedHeader;
MsgQueuePtr->MailData->TranslatedHeader=TH;
@@ -820,7 +779,7 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp)
#endif
MsgQueuePtr->Flags|=YAMN_MSG_BODYRECEIVED;
- if(DataRX!=NULL)
+ if (DataRX!=NULL)
free(DataRX);
DataRX=NULL;
break;
@@ -849,25 +808,25 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp)
try
{
- char accstatus[512];
+ TCHAR accstatus[512];
for(i=0,MsgQueuePtr=NewMails;MsgQueuePtr!=NULL;i++)
{
BOOL autoretr = (ActualAccount->Flags & YAMN_ACC_BODY)!=0;
DataRX=MyClient->Top(MsgQueuePtr->Number,autoretr?100:0);
- sprintf(accstatus,Translate("Reading new mail messages (%d%% done)"),100*i/msgs);
+ wsprintf(accstatus,TranslateT("Reading new mail messages (%d%% done)"),100*i/msgs);
SetAccountStatus(ActualAccount,accstatus);
#ifdef DEBUG_DECODE
DebugLog(DecodeFile,"<New mail>\n");
DebugLog(DecodeFile,"<Header>%s</Header>\n",DataRX);
#endif
- if(DataRX!=NULL)
+ if (DataRX!=NULL)
{
Temp=DataRX;
while((Temp<DataRX+MyClient->NetClient->Rcv) && (WS(Temp) || ENDLINE(Temp))) Temp++;
- if(OKLINE(DataRX))
+ if (OKLINE(DataRX))
for(Temp=DataRX;(Temp<DataRX+MyClient->NetClient->Rcv) && (!ENDLINE(Temp));Temp++);
while((Temp<DataRX+MyClient->NetClient->Rcv) && ENDLINE(Temp)) Temp++;
}
@@ -889,7 +848,7 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp)
// CallService(MS_YAMN_FILTERMAIL,(WPARAM)ActualAccount,(LPARAM)MsgQueuePtr);
FilterMailSvc((WPARAM)ActualAccount,(LPARAM)MsgQueuePtr);
- if(DataRX!=NULL)
+ if (DataRX!=NULL)
free(DataRX);
DataRX=NULL;
@@ -905,7 +864,7 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp)
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"CheckPOP3:ActualAccountMsgsSO-write wait\n");
#endif
- if(WAIT_OBJECT_0!=MsgsWaitToWrite(ActualAccount))
+ if (WAIT_OBJECT_0!=MsgsWaitToWrite(ActualAccount))
{
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"CheckPOP3:ActualAccountMsgsSO-write wait failed\n");
@@ -915,7 +874,7 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp)
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"CheckPOP3:ActualAccountMsgsSO-write enter\n");
#endif
- if(ActualAccount->Mails==NULL)
+ if (ActualAccount->Mails==NULL)
ActualAccount->Mails=NewMails;
else
{
@@ -937,15 +896,15 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp)
// if there is no waiting thread for internet connection close it
// else leave connection open
- if(0==SCGetNumber(ActualAccount->InternetQueries))
+ if (0==SCGetNumber(ActualAccount->InternetQueries))
{
DataRX=MyClient->Quit();
- if(DataRX!=NULL)
+ if (DataRX!=NULL)
free(DataRX);
DataRX=NULL;
MyClient->NetClient->Disconnect();
- SetAccountStatus(ActualAccount,Translate("Disconnected"));
+ SetAccountStatus(ActualAccount,TranslateT("Disconnected"));
}
UsingInternet=FALSE;
@@ -965,7 +924,7 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp)
{
YAMN_MAILBROWSERPARAM Param={(HANDLE)0,ActualAccount,ActualCopied.NFlags,ActualCopied.NNFlags,YAMNParam};
- if(CheckFlags & YAMN_FORCECHECK)
+ if (CheckFlags & YAMN_FORCECHECK)
Param.nnflags|=YAMN_ACC_POP; //if force check, show popup anyway and if mailbrowser was opened, do not close
Param.nnflags|= YAMN_ACC_MSGP; //do not close browser if already open
CallService(MS_YAMN_MAILBROWSER,(WPARAM)&Param,(LPARAM)YAMN_MAILBROWSERVERSION);
@@ -978,7 +937,7 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp)
catch(DWORD)
#endif
{
- if(ActualAccount->Client.POP3Error==EPOP3_STOPPED)
+ if (ActualAccount->Client.POP3Error==EPOP3_STOPPED)
ActualAccount->SystemError=EACC_STOPPED;
#ifdef DEBUG_COMM
DebugLog(CommFile,"ERROR: %x\n",ErrorCode);
@@ -986,7 +945,7 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp)
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"CheckPOP3:ActualAccountMsgsSO-write wait\n");
#endif
- if(WAIT_OBJECT_0==MsgsWaitToWrite(ActualAccount))
+ if (WAIT_OBJECT_0==MsgsWaitToWrite(ActualAccount))
{
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"CheckPOP3:ActualAccountMsgsSO-write enter\n");
@@ -1004,7 +963,7 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp)
DeleteMIMEQueue(ActualAccount,NewMails);
- if(DataRX!=NULL)
+ if (DataRX!=NULL)
free(DataRX);
DataRX=NULL;
switch(ActualAccount->SystemError)
@@ -1017,7 +976,7 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp)
PostErrorProc(ActualAccount,YAMNParam,(DWORD)NULL,MyClient->SSL); //it closes internet connection too
}
- if(UsingInternet) //if our thread still uses internet
+ if (UsingInternet) //if our thread still uses internet
{
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"CheckPOP3:InternetFreeEV-done\n");
@@ -1062,7 +1021,7 @@ DWORD WINAPI DeleteMailsPOP3(struct DeleteParam *WhichTemp)
//First, we should compare our version of DeleteParam structure, but here it is not needed, because YAMN and internal plugin
//have the same version. But your plugin should do that in this way:
- // if(((struct DeleteParam *)WhichTemp)->Ver!=YAMN_DELETEVERSION)
+ // if (((struct DeleteParam *)WhichTemp)->Ver!=YAMN_DELETEVERSION)
// {
// SetEvent(((struct DeleteParam *)WhichTemp)->ThreadRunningEV); //don't forget to unblock YAMN
// return (DWORD)-1; //ok, but we should return value.
@@ -1078,13 +1037,13 @@ DWORD WINAPI DeleteMailsPOP3(struct DeleteParam *WhichTemp)
DebugLog(SynchroFile,"DeleteMailsPOP3:Incrementing \"using threads\" %x (account %x)\n",ActualAccount->UsingThreads,ActualAccount);
#endif
SCInc(ActualAccount->UsingThreads);
- if(INVALID_HANDLE_VALUE!=WhichTemp->ThreadRunningEV)
+ if (INVALID_HANDLE_VALUE!=WhichTemp->ThreadRunningEV)
SetEvent(WhichTemp->ThreadRunningEV);
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"DeleteMailsPOP3:ActualAccountSO-read wait\n");
#endif
- if(WAIT_OBJECT_0!=WaitToRead(ActualAccount))
+ if (WAIT_OBJECT_0!=WaitToRead(ActualAccount))
{
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"DeleteMailsPOP3:ActualAccountSO-read wait failed\n");
@@ -1098,9 +1057,9 @@ DWORD WINAPI DeleteMailsPOP3(struct DeleteParam *WhichTemp)
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"DeleteMailsPOP3:ActualAccountSO-read enter\n");
#endif
- if(NULL==(DeleteMails=(HYAMNMAIL)CreateNewDeleteQueue((HYAMNMAIL)ActualAccount->Mails))) //if there's no mail for deleting, return
+ if (NULL==(DeleteMails=(HYAMNMAIL)CreateNewDeleteQueue((HYAMNMAIL)ActualAccount->Mails))) //if there's no mail for deleting, return
{
- if(POP3_DELETEFROMCHECK!=POP3PluginParam) //We do not wait for free internet when calling from SynchroPOP3. It is because UseInternetFree is blocked
+ if (POP3_DELETEFROMCHECK!=POP3PluginParam) //We do not wait for free internet when calling from SynchroPOP3. It is because UseInternetFree is blocked
{
YAMN_MAILBROWSERPARAM Param={(HANDLE)0,ActualAccount,YAMN_ACC_MSGP,YAMN_ACC_MSGP,YAMNParam}; //Just update the window
@@ -1134,7 +1093,7 @@ DWORD WINAPI DeleteMailsPOP3(struct DeleteParam *WhichTemp)
ReadDone(ActualAccount);
SCInc(ActualAccount->InternetQueries); //This is POP3-internal SCOUNTER, we set another thread wait for this account to be connected to inet
- if(POP3_DELETEFROMCHECK!=POP3PluginParam) //We do not wait for free internet when calling from SynchroPOP3. It is because UseInternetFree is blocked
+ if (POP3_DELETEFROMCHECK!=POP3PluginParam) //We do not wait for free internet when calling from SynchroPOP3. It is because UseInternetFree is blocked
{
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"DeleteMailsPOP3:InternetFreeEV-wait\n");
@@ -1153,18 +1112,18 @@ DWORD WINAPI DeleteMailsPOP3(struct DeleteParam *WhichTemp)
#ifdef DEBUG_COMM
DebugLog(CommFile,"<--------Communication-------->\n");
#endif
- if((MyClient->NetClient==NULL) || !MyClient->NetClient->Connected())
+ if ((MyClient->NetClient==NULL) || !MyClient->NetClient->Connected())
{
- SetAccountStatus(ActualAccount,Translate("Connecting to server"));
+ SetAccountStatus(ActualAccount,TranslateT("Connecting to server"));
DataRX=MyClient->Connect(ActualCopied.ServerName,ActualCopied.ServerPort,ActualCopied.Flags & YAMN_ACC_SSL23,ActualCopied.Flags & YAMN_ACC_NOTLS);
char *timestamp=NULL;
- if(DataRX!=NULL) {
- if(ActualAccount->Flags & YAMN_ACC_APOP) {
+ if (DataRX!=NULL) {
+ if (ActualAccount->Flags & YAMN_ACC_APOP) {
char *lpos=strchr(DataRX,'<');
char *rpos=strchr(DataRX,'>');
- if(lpos && rpos && rpos>lpos) {
+ if (lpos && rpos && rpos>lpos) {
int sz=(int)(rpos-lpos+2);
timestamp=new char[sz];
memcpy(timestamp, lpos, sz-1);
@@ -1174,22 +1133,22 @@ DWORD WINAPI DeleteMailsPOP3(struct DeleteParam *WhichTemp)
free(DataRX);
DataRX=NULL;
}
- SetAccountStatus(ActualAccount,Translate("Entering POP3 account"));
+ SetAccountStatus(ActualAccount,TranslateT("Entering POP3 account"));
- if(ActualAccount->Flags & YAMN_ACC_APOP)
+ if (ActualAccount->Flags & YAMN_ACC_APOP)
{
DataRX=MyClient->APOP(ActualCopied.ServerLogin,ActualCopied.ServerPasswd,timestamp);
- if(DataRX!=NULL)
+ if (DataRX!=NULL)
free(DataRX);
DataRX=NULL;
delete[] timestamp;
} else {
DataRX=MyClient->User(ActualCopied.ServerLogin);
- if(DataRX!=NULL)
+ if (DataRX!=NULL)
free(DataRX);
DataRX=NULL;
DataRX=MyClient->Pass(ActualCopied.ServerPasswd);
- if(DataRX!=NULL)
+ if (DataRX!=NULL)
free(DataRX);
DataRX=NULL;
}
@@ -1198,9 +1157,9 @@ DWORD WINAPI DeleteMailsPOP3(struct DeleteParam *WhichTemp)
#ifdef DEBUG_DECODE
DebugLog(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
+ if (POP3_DELETEFROMCHECK!=POP3PluginParam) //We do not need to get mails on server as we have already it from check function
{
- SetAccountStatus(ActualAccount,Translate("Deleting requested mails"));
+ SetAccountStatus(ActualAccount,TranslateT("Deleting requested mails"));
DataRX=MyClient->Stat();
@@ -1213,26 +1172,26 @@ DWORD WINAPI DeleteMailsPOP3(struct DeleteParam *WhichTemp)
DebugLog(DecodeFile,"<Msgs>%d</Msgs>\n",msgs);
DebugLog(DecodeFile,"</Extracting stat>\n");
#endif
- if(DataRX!=NULL)
+ if (DataRX!=NULL)
free(DataRX);
DataRX=NULL;
for(i=0;i<msgs;i++)
{
- if(!i)
+ if (!i)
MsgQueuePtr=NewMails=(HYAMNMAIL)CallService(MS_YAMN_CREATEACCOUNTMAIL,(WPARAM)ActualAccount,(LPARAM)YAMN_MAILVERSION);
else
{
MsgQueuePtr->Next=(HYAMNMAIL)CallService(MS_YAMN_CREATEACCOUNTMAIL,(WPARAM)ActualAccount,(LPARAM)YAMN_MAILVERSION);
MsgQueuePtr=MsgQueuePtr->Next;
}
- if(MsgQueuePtr==NULL)
+ if (MsgQueuePtr==NULL)
{
ActualAccount->SystemError=EPOP3_QUEUEALLOC;
throw (DWORD)ActualAccount->SystemError;
}
}
- if(msgs)
+ if (msgs)
{
#ifdef DEBUG_DECODE
DebugLog(DecodeFile,"<Extracting UIDL>\n");
@@ -1242,7 +1201,7 @@ DWORD WINAPI DeleteMailsPOP3(struct DeleteParam *WhichTemp)
#ifdef DEBUG_DECODE
DebugLog(DecodeFile,"</Extracting UIDL>\n");
#endif
- if(DataRX!=NULL)
+ if (DataRX!=NULL)
free(DataRX);
DataRX=NULL;
// we get "new mails" on server (NewMails will contain all mails on server not found in DeleteMails)
@@ -1251,11 +1210,11 @@ DWORD WINAPI DeleteMailsPOP3(struct DeleteParam *WhichTemp)
}
}
else
- SetAccountStatus(ActualAccount,Translate("Deleting spam"));
+ SetAccountStatus(ActualAccount,TranslateT("Deleting spam"));
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"DeleteMailsPOP3:ActualAccountMsgsSO-write wait\n");
#endif
- if(WAIT_OBJECT_0!=MsgsWaitToWrite(ActualAccount))
+ if (WAIT_OBJECT_0!=MsgsWaitToWrite(ActualAccount))
{
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"DeleteMailsPOP3:ActualAccountMsgsSO-write wait failed\n");
@@ -1265,7 +1224,7 @@ DWORD WINAPI DeleteMailsPOP3(struct DeleteParam *WhichTemp)
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"DeleteMailsPOP3:ActualAccountMsgsSO-write enter\n");
#endif
- if(msgs || POP3_DELETEFROMCHECK==POP3PluginParam)
+ if (msgs || POP3_DELETEFROMCHECK==POP3PluginParam)
{
try
{
@@ -1273,15 +1232,15 @@ DWORD WINAPI DeleteMailsPOP3(struct DeleteParam *WhichTemp)
for(i=0,MsgQueuePtr=DeleteMails;MsgQueuePtr!=NULL;i++)
{
- if(!(MsgQueuePtr->Flags & YAMN_MSG_VIRTUAL)) //of course we can only delete real mails, not virtual
+ if (!(MsgQueuePtr->Flags & YAMN_MSG_VIRTUAL)) //of course we can only delete real mails, not virtual
{
DataRX=MyClient->Dele(MsgQueuePtr->Number);
Temp=MsgQueuePtr->Next;
- if(POP3_FOK==MyClient->AckFlag) //if server answers that mail was deleted
+ if (POP3_FOK==MyClient->AckFlag) //if server answers that mail was deleted
{
DeleteMIMEMessage((HYAMNMAIL *)&DeleteMails,MsgQueuePtr);
HYAMNMAIL DeletedMail=FindMIMEMessageByID((HYAMNMAIL)ActualAccount->Mails,MsgQueuePtr->ID);
- if((MsgQueuePtr->Flags & YAMN_MSG_MEMDELETE)) //if mail should be deleted from memory (or disk)
+ if ((MsgQueuePtr->Flags & YAMN_MSG_MEMDELETE)) //if mail should be deleted from memory (or disk)
{
DeleteMIMEMessage((HYAMNMAIL *)&ActualAccount->Mails,DeletedMail); //remove from queue
CallService(MS_YAMN_DELETEACCOUNTMAIL,(WPARAM)POP3Plugin,(LPARAM)DeletedMail);
@@ -1297,7 +1256,7 @@ DWORD WINAPI DeleteMailsPOP3(struct DeleteParam *WhichTemp)
}
MsgQueuePtr=Temp;
- if(DataRX!=NULL)
+ if (DataRX!=NULL)
free(DataRX);
DataRX=NULL;
}
@@ -1314,7 +1273,7 @@ DWORD WINAPI DeleteMailsPOP3(struct DeleteParam *WhichTemp)
throw; //and go to the main exception handling
}
- if(NewMails!=NULL)
+ if (NewMails!=NULL)
// in ActualAccount->Mails we have all mails stored before calling this function
// in NewMails we have all mails not found in DeleteMails (in other words: we performed new ID checking and we
// stored all mails found on server, then we deleted the ones we wanted to delete in this function
@@ -1323,7 +1282,7 @@ DWORD WINAPI DeleteMailsPOP3(struct DeleteParam *WhichTemp)
SynchroMessages(ActualAccount,(HYAMNMAIL *)&ActualAccount->Mails,NULL,(HYAMNMAIL *)&NewMails,NULL);
// Now ActualAccount->Mails contains all mails when calling this function except the ones, we wanted to delete (these are in DeleteMails)
// And in NewMails we have new mails (if any)
- else if(POP3_DELETEFROMCHECK!=POP3PluginParam)
+ else if (POP3_DELETEFROMCHECK!=POP3PluginParam)
{
DeleteMIMEQueue(ActualAccount,(HYAMNMAIL)ActualAccount->Mails);
ActualAccount->Mails=NULL;
@@ -1348,21 +1307,21 @@ DWORD WINAPI DeleteMailsPOP3(struct DeleteParam *WhichTemp)
// if there is no waiting thread for internet connection close it
// else leave connection open
// if this functin was called from SynchroPOP3, then do not try to disconnect
- if(POP3_DELETEFROMCHECK!=POP3PluginParam)
+ if (POP3_DELETEFROMCHECK!=POP3PluginParam)
{
YAMN_MAILBROWSERPARAM Param={(HANDLE)0,ActualAccount,ActualCopied.NFlags,YAMN_ACC_MSGP,YAMNParam};
CallService(MS_YAMN_MAILBROWSER,(WPARAM)&Param,(LPARAM)YAMN_MAILBROWSERVERSION);
- if(0==SCGetNumber(ActualAccount->InternetQueries))
+ if (0==SCGetNumber(ActualAccount->InternetQueries))
{
DataRX=MyClient->Quit();
- if(DataRX!=NULL)
+ if (DataRX!=NULL)
free(DataRX);
DataRX=NULL;
MyClient->NetClient->Disconnect();
- SetAccountStatus(ActualAccount,Translate("Disconnected"));
+ SetAccountStatus(ActualAccount,TranslateT("Disconnected"));
}
UsingInternet=FALSE;
@@ -1379,12 +1338,12 @@ DWORD WINAPI DeleteMailsPOP3(struct DeleteParam *WhichTemp)
catch(DWORD)
#endif
{
- if(ActualAccount->Client.POP3Error==EPOP3_STOPPED)
+ if (ActualAccount->Client.POP3Error==EPOP3_STOPPED)
ActualAccount->SystemError=EACC_STOPPED;
#ifdef DEBUG_COMM
DebugLog(CommFile,"ERROR %x\n",ErrorCode);
#endif
- if(DataRX!=NULL)
+ if (DataRX!=NULL)
free(DataRX);
switch(ActualAccount->SystemError)
{
@@ -1396,7 +1355,7 @@ DWORD WINAPI DeleteMailsPOP3(struct DeleteParam *WhichTemp)
PostErrorProc(ActualAccount,YAMNParam,POP3PluginParam,MyClient->SSL); //it closes internet connection too
}
- if(UsingInternet && (POP3_DELETEFROMCHECK!=POP3PluginParam)) //if our thread still uses internet and it is needed to release internet
+ if (UsingInternet && (POP3_DELETEFROMCHECK!=POP3PluginParam)) //if our thread still uses internet and it is needed to release internet
{
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"CheckPOP3:InternetFreeEV-done\n");
@@ -1427,16 +1386,16 @@ void ExtractStat(char *stream,int len,int *mboxsize,int *mails)
{
char *finder=stream;
while(WS(finder) || ENDLINE(finder)) finder++;
- if(ACKLINE(finder))
+ if (ACKLINE(finder))
{
while(!WS(finder)) finder++;
while(WS(finder)) finder++;
}
- if(1!=sscanf(finder,"%d",mails))
+ if (1!=sscanf(finder,"%d",mails))
throw (DWORD)EPOP3_STAT;
while(!WS(finder)) finder++;
while(WS(finder)) finder++;
- if(1!=sscanf(finder,"%d",mboxsize))
+ if (1!=sscanf(finder,"%d",mboxsize))
throw (DWORD)EPOP3_STAT;
}
void ExtractMail(char *stream,int len,HYAMNMAIL queue)
@@ -1452,19 +1411,19 @@ void ExtractMail(char *stream,int len,HYAMNMAIL queue)
while(finder<=(stream+len))
{
while(ENDLINE(finder)) finder++; //go to the new line
- if(DOTLINE(finder+1)) //at the end of stream
+ if (DOTLINE(finder+1)) //at the end of stream
break;
#ifdef DEBUG_DECODE
DebugLog(DecodeFile,"<Message>\n");
#endif
while(WS(finder)) finder++; //jump whitespace
- if(1!=sscanf(finder,"%d",&msgnr))
+ if (1!=sscanf(finder,"%d",&msgnr))
throw (DWORD)EPOP3_UIDL;
#ifdef DEBUG_DECODE
DebugLog(DecodeFile,"<Nr>%d</Nr>\n",msgnr);
#endif
// for(i=1,queueptr=queue;(queueptr->Next!=NULL) && (i<msgnr);queueptr=queueptr->Next,i++);
-// if(i!=msgnr)
+// if (i!=msgnr)
// throw (DWORD)EPOP3_UIDL;
while(!WS(finder)) finder++; //jump characters
while(WS(finder)) finder++; //jump whitespace
@@ -1497,19 +1456,19 @@ void ExtractUIDL(char *stream,int len,HYAMNMAIL queue)
while(finder<=(stream+len))
{
while(ENDLINE(finder)) finder++; //go to the new line
- if(DOTLINE(finder+1)) //at the end of stream
+ if (DOTLINE(finder+1)) //at the end of stream
break;
#ifdef DEBUG_DECODE
DebugLog(DecodeFile,"<Message>\n");
#endif
while(WS(finder)) finder++; //jump whitespace
- if(1!=sscanf(finder,"%d",&msgnr))
+ if (1!=sscanf(finder,"%d",&msgnr))
throw (DWORD)EPOP3_UIDL;
#ifdef DEBUG_DECODE
DebugLog(DecodeFile,"<Nr>%d</Nr>\n",msgnr);
#endif
// for(i=1,queueptr=queue;(queueptr->Next!=NULL) && (i<msgnr);queueptr=queueptr->Next,i++);
-// if(i!=msgnr)
+// if (i!=msgnr)
// throw (DWORD)EPOP3_UIDL;
while(!WS(finder)) finder++; //jump characters
while(WS(finder)) finder++; //jump whitespace
@@ -1542,25 +1501,25 @@ void ExtractList(char *stream,int len,HYAMNMAIL queue)
while(finder<=(stream+len))
{
while(ENDLINE(finder)) finder++; //go to the new line
- if(DOTLINE(finder+1)) //at the end of stream
+ if (DOTLINE(finder+1)) //at the end of stream
break;
#ifdef DEBUG_DECODE
DebugLog(DecodeFile,"<Message>\n",NULL,0);
#endif
while(WS(finder)) finder++; //jump whitespace
- if(1!=sscanf(finder,"%d",&msgnr)) //message nr.
+ if (1!=sscanf(finder,"%d",&msgnr)) //message nr.
throw (DWORD)EPOP3_LIST;
#ifdef DEBUG_DECODE
DebugLog(DecodeFile,"<Nr>%d</Nr>\n",msgnr);
#endif
for(i=1,queueptr=queue;(queueptr->Next!=NULL) && (i<msgnr);queueptr=queueptr->Next,i++);
- if(i!=msgnr)
+ if (i!=msgnr)
throw (DWORD)EPOP3_LIST;
while(!WS(finder)) finder++; //jump characters
while(WS(finder)) finder++; //jump whitespace
finderend=finder+1;
- if(1!=sscanf(finder,"%d",&queueptr->MailData->Size))
+ if (1!=sscanf(finder,"%d",&queueptr->MailData->Size))
throw (DWORD)EPOP3_LIST;
#ifdef DEBUG_DECODE
DebugLog(DecodeFile,"<Nr>%d</Nr>\n",queueptr->MailData->Size);
@@ -1613,10 +1572,10 @@ WCHAR* WINAPI GetErrorString(DWORD Code)
POP3_ERRORCODE *ErrorCode=(POP3_ERRORCODE *)(UINT_PTR)Code;
sprintf(ErrorStringA,Translate("Error %d-%d-%d-%d:"),ErrorCode->AppError,ErrorCode->POP3Error,ErrorCode->NetError,ErrorCode->SystemError);
- if(ErrorCode->POP3Error)
+ if (ErrorCode->POP3Error)
sprintf(ErrorStringA,"%s\n%s",ErrorStringA,Translate(POP3Errors[ErrorCode->POP3Error-1]));
- if(ErrorCode->NetError)
- if(ErrorCode->SSL)
+ if (ErrorCode->NetError)
+ if (ErrorCode->SSL)
sprintf(ErrorStringA,"%s\n%s",ErrorStringA,Translate(SSLErrors[ErrorCode->NetError-1]));
else
sprintf(ErrorStringA,"%s\n%s",ErrorStringA,Translate(NetlibErrors[ErrorCode->NetError-4]));
diff --git a/plugins/YAMN/proto/pop3/pop3opt.cpp b/plugins/YAMN/proto/pop3/pop3opt.cpp
index ec748ac6b0..29b613d831 100644
--- a/plugins/YAMN/proto/pop3/pop3opt.cpp
+++ b/plugins/YAMN/proto/pop3/pop3opt.cpp
@@ -4,25 +4,6 @@
* (c) majvan 2002-2003
*/
-/*
-#include <tchar.h>
-#include <stdio.h>
-#include <windows.h>
-#include <winuser.h>
-#include <commctrl.h>
-#include "../../../../../SDK/headers_c/newpluginapi.h"
-//#include "../../../../random/utils/m_utils.h" //for window broadcasting
-#include "../../../../../SDK/headers_c/m_langpack.h"
-#include "../../../../../SDK/headers_c/m_options.h"
-#include "../../../../../SDK/headers_c/m_utils.h"
-#include "../../SDK/import/m_popup.h"
-#include "../../m_protoplugin.h"
-#include "../../m_synchro.h"
-#include "../../m_messages.h"
-#include "../../resources/resource.h"
-#include "../../m_yamn.h"
-#include "../../debug.h"
-*/
#include "../../yamn.h"
#include "../../main.h"
#include "pop3comm.h"
@@ -41,7 +22,7 @@ extern HICON hYamnIcons[];
extern DWORD WINAPI WritePOP3Accounts();
extern DWORD HotKeyThreadID;
-extern LPCRITICAL_SECTION PluginRegCS;
+extern CRITICAL_SECTION PluginRegCS;
//From filterplugin.cpp
extern PYAMN_FILTERPLUGINQUEUE FirstFilterPlugin;
//From protoplugin.cpp
@@ -54,7 +35,7 @@ extern BOOL (WINAPI *MyEnableThemeDialogTexture)(HANDLE, DWORD);
BOOL Check0,Check1,Check2,Check3,Check4,Check5,Check6,Check7,Check8,Check9;
-TCHAR DlgInput[MAX_PATH];
+char DlgInput[MAX_PATH];
//Fuction took from Miranda
void WordToModAndVk(WORD w,UINT *mod,UINT *vk);
@@ -68,10 +49,10 @@ int YAMNOptInitSvc(WPARAM wParam,LPARAM lParam);
void WordToModAndVk(WORD w,UINT *mod,UINT *vk)
{
*mod=0;
- if(HIBYTE(w)&HOTKEYF_CONTROL) *mod|=MOD_CONTROL;
- if(HIBYTE(w)&HOTKEYF_SHIFT) *mod|=MOD_SHIFT;
- if(HIBYTE(w)&HOTKEYF_ALT) *mod|=MOD_ALT;
- if(HIBYTE(w)&HOTKEYF_EXT) *mod|=MOD_WIN;
+ if (HIBYTE(w)&HOTKEYF_CONTROL) *mod|=MOD_CONTROL;
+ if (HIBYTE(w)&HOTKEYF_SHIFT) *mod|=MOD_SHIFT;
+ if (HIBYTE(w)&HOTKEYF_ALT) *mod|=MOD_ALT;
+ if (HIBYTE(w)&HOTKEYF_EXT) *mod|=MOD_WIN;
*vk=LOBYTE(w);
}
@@ -161,45 +142,44 @@ INT_PTR CALLBACK DlgProcPluginOpt(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lParam
switch(LOWORD(wParam))
{
case IDC_COMBOPLUGINS:
- if(wNotifyCode==CBN_SELCHANGE)
+ if (wNotifyCode==CBN_SELCHANGE)
{
HWND hCombo=GetDlgItem(hDlg,IDC_COMBOPLUGINS);
PYAMN_PROTOPLUGINQUEUE PParser;
PYAMN_FILTERPLUGINQUEUE FParser;
int index,id;
- if(CB_ERR==(index=SendMessage(hCombo,CB_GETCURSEL,0,0)))
+ if (CB_ERR==(index=SendMessage(hCombo,CB_GETCURSEL,0,0)))
break;
id=SendMessage(hCombo,CB_GETITEMDATA,(WPARAM)index,(LPARAM)0);
- EnterCriticalSection(PluginRegCS);
+ EnterCriticalSection(&PluginRegCS);
for(PParser=FirstProtoPlugin;PParser!=NULL;PParser=PParser->Next)
- if(id==(INT_PTR)PParser->Plugin)
+ if (id==(INT_PTR)PParser->Plugin)
{
- SetDlgItemText(hDlg,IDC_STVER,PParser->Plugin->PluginInfo->Ver);
- SetDlgItemText(hDlg,IDC_STDESC,PParser->Plugin->PluginInfo->Description == NULL ? "" : PParser->Plugin->PluginInfo->Description);
- SetDlgItemText(hDlg,IDC_STCOPY,PParser->Plugin->PluginInfo->Copyright == NULL ? "" : PParser->Plugin->PluginInfo->Copyright);
- SetDlgItemText(hDlg,IDC_STMAIL,PParser->Plugin->PluginInfo->Email == NULL ? "" : PParser->Plugin->PluginInfo->Email);
- SetDlgItemText(hDlg,IDC_STWWW,PParser->Plugin->PluginInfo->WWW == NULL ? "" : PParser->Plugin->PluginInfo->WWW);
+ SetDlgItemTextA(hDlg,IDC_STVER,PParser->Plugin->PluginInfo->Ver);
+ SetDlgItemTextA(hDlg,IDC_STDESC,PParser->Plugin->PluginInfo->Description == NULL ? "" : PParser->Plugin->PluginInfo->Description);
+ SetDlgItemTextA(hDlg,IDC_STCOPY,PParser->Plugin->PluginInfo->Copyright == NULL ? "" : PParser->Plugin->PluginInfo->Copyright);
+ SetDlgItemTextA(hDlg,IDC_STMAIL,PParser->Plugin->PluginInfo->Email == NULL ? "" : PParser->Plugin->PluginInfo->Email);
+ SetDlgItemTextA(hDlg,IDC_STWWW,PParser->Plugin->PluginInfo->WWW == NULL ? "" : PParser->Plugin->PluginInfo->WWW);
break;
}
for(FParser=FirstFilterPlugin;FParser!=NULL;FParser=FParser->Next)
- if(id==(INT_PTR)FParser->Plugin)
+ if (id==(INT_PTR)FParser->Plugin)
{
- SetDlgItemText(hDlg,IDC_STVER,FParser->Plugin->PluginInfo->Ver);
- SetDlgItemText(hDlg,IDC_STDESC,FParser->Plugin->PluginInfo->Description == NULL ? "" : FParser->Plugin->PluginInfo->Description);
- SetDlgItemText(hDlg,IDC_STCOPY,FParser->Plugin->PluginInfo->Copyright == NULL ? "" : FParser->Plugin->PluginInfo->Copyright);
- SetDlgItemText(hDlg,IDC_STMAIL,FParser->Plugin->PluginInfo->Email == NULL ? "" : FParser->Plugin->PluginInfo->Email);
- SetDlgItemText(hDlg,IDC_STWWW,FParser->Plugin->PluginInfo->WWW == NULL ? "" : FParser->Plugin->PluginInfo->WWW);
+ SetDlgItemTextA(hDlg,IDC_STVER,FParser->Plugin->PluginInfo->Ver);
+ SetDlgItemTextA(hDlg,IDC_STDESC,FParser->Plugin->PluginInfo->Description == NULL ? "" : FParser->Plugin->PluginInfo->Description);
+ SetDlgItemTextA(hDlg,IDC_STCOPY,FParser->Plugin->PluginInfo->Copyright == NULL ? "" : FParser->Plugin->PluginInfo->Copyright);
+ SetDlgItemTextA(hDlg,IDC_STMAIL,FParser->Plugin->PluginInfo->Email == NULL ? "" : FParser->Plugin->PluginInfo->Email);
+ SetDlgItemTextA(hDlg,IDC_STWWW,FParser->Plugin->PluginInfo->WWW == NULL ? "" : FParser->Plugin->PluginInfo->WWW);
break;
}
- LeaveCriticalSection(PluginRegCS);
+ LeaveCriticalSection(&PluginRegCS);
}
break;
case IDC_STWWW:
{
char str[1024];
-
- GetDlgItemText(hDlg,IDC_STWWW,str,sizeof(str));
+ GetDlgItemTextA(hDlg,IDC_STWWW,str,SIZEOF(str));
CallService(MS_UTILS_OPENURL,1,(LPARAM)str);
break;
}
@@ -208,25 +188,25 @@ INT_PTR CALLBACK DlgProcPluginOpt(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lParam
break;
}
case WM_SHOWWINDOW:
- if(TRUE==(BOOL)wParam)
+ if (TRUE==(BOOL)wParam)
{
PYAMN_PROTOPLUGINQUEUE PParser;
PYAMN_FILTERPLUGINQUEUE FParser;
int index;
- EnterCriticalSection(PluginRegCS);
+ EnterCriticalSection(&PluginRegCS);
for(PParser=FirstProtoPlugin;PParser!=NULL;PParser=PParser->Next)
{
- index=SendDlgItemMessage(hDlg,IDC_COMBOPLUGINS,CB_ADDSTRING,0,(LPARAM)PParser->Plugin->PluginInfo->Name);
+ index=SendDlgItemMessageA(hDlg,IDC_COMBOPLUGINS,CB_ADDSTRING,0,(LPARAM)PParser->Plugin->PluginInfo->Name);
index=SendDlgItemMessage(hDlg,IDC_COMBOPLUGINS,CB_SETITEMDATA,(WPARAM)index,(LPARAM)PParser->Plugin);
}
for(FParser=FirstFilterPlugin;FParser!=NULL;FParser=FParser->Next)
{
- index=SendDlgItemMessage(hDlg,IDC_COMBOPLUGINS,CB_ADDSTRING,0,(LPARAM)FParser->Plugin->PluginInfo->Name);
+ index=SendDlgItemMessageA(hDlg,IDC_COMBOPLUGINS,CB_ADDSTRING,0,(LPARAM)FParser->Plugin->PluginInfo->Name);
index=SendDlgItemMessage(hDlg,IDC_COMBOPLUGINS,CB_SETITEMDATA,(WPARAM)index,(LPARAM)FParser->Plugin);
}
- LeaveCriticalSection(PluginRegCS);
+ LeaveCriticalSection(&PluginRegCS);
SendDlgItemMessage(hDlg,IDC_COMBOPLUGINS,CB_SETCURSEL,(WPARAM)0,(LPARAM)0);
SendMessage(hDlg,WM_COMMAND,MAKELONG(IDC_COMBOPLUGINS,CBN_SELCHANGE),(LPARAM)NULL);
break;
@@ -277,7 +257,7 @@ int YAMNOptInitSvc(WPARAM wParam,LPARAM lParam)
odp.pfnDlgProc = DlgProcPluginOpt;
CallService(MS_OPT_ADDPAGE, wParam, (LPARAM) &odp);
- if( ServiceExists(MS_POPUP_ADDPOPUPEX) )
+ if ( ServiceExists(MS_POPUP_ADDPOPUPEX) )
{
odp.pszGroup=LPGEN("PopUps");
odp.pszTab=LPGEN("YAMN");
@@ -381,7 +361,7 @@ BOOL DlgShowAccountStatus(HWND hDlg,WPARAM wParam,LPARAM lParam)
{
HPOP3ACCOUNT ActualAccount=(HPOP3ACCOUNT)lParam;
- if((DWORD)wParam==M_SHOWACTUAL)
+ if ((DWORD)wParam==M_SHOWACTUAL)
{
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"Options:SHOWACCOUNT:ActualAccountSO-read wait\n");
@@ -421,7 +401,7 @@ BOOL DlgShowAccountPopup(HWND hDlg,WPARAM wParam,LPARAM lParam)
{
HPOP3ACCOUNT ActualAccount=(HPOP3ACCOUNT)lParam;
- if((DWORD)wParam==M_SHOWACTUAL)
+ if ((DWORD)wParam==M_SHOWACTUAL)
{
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"Options:SHOWACCOUNT:ActualAccountSO-read wait\n");
@@ -470,7 +450,7 @@ BOOL DlgShowAccount(HWND hDlg,WPARAM wParam,LPARAM lParam)
HPOP3ACCOUNT ActualAccount=(HPOP3ACCOUNT)lParam;
int i;
- if((DWORD)wParam==M_SHOWACTUAL)
+ if ((DWORD)wParam==M_SHOWACTUAL)
{
TCHAR accstatus[256];
#ifdef DEBUG_SYNCHRO
@@ -480,24 +460,24 @@ BOOL DlgShowAccount(HWND hDlg,WPARAM wParam,LPARAM lParam)
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"Options:SHOWACCOUNT:ActualAccountSO-read enter\n");
#endif
- DlgSetItemText(hDlg,(WPARAM)IDC_EDITSERVER,(LPARAM)ActualAccount->Server->Name);
- DlgSetItemText(hDlg,(WPARAM)IDC_EDITNAME,(LPARAM)ActualAccount->Name);
- DlgSetItemText(hDlg,(WPARAM)IDC_EDITLOGIN,(LPARAM)ActualAccount->Server->Login);
- DlgSetItemText(hDlg,(WPARAM)IDC_EDITPASS,(LPARAM)ActualAccount->Server->Passwd);
- DlgSetItemTextW(hDlg,(WPARAM)IDC_EDITAPP,(LPARAM)ActualAccount->NewMailN.App);
- DlgSetItemTextW(hDlg,(WPARAM)IDC_EDITAPPPARAM,(LPARAM)ActualAccount->NewMailN.AppParam);
+ DlgSetItemText(hDlg, IDC_EDITSERVER, ActualAccount->Server->Name);
+ DlgSetItemText(hDlg, IDC_EDITNAME, ActualAccount->Name);
+ DlgSetItemText(hDlg, IDC_EDITLOGIN, ActualAccount->Server->Login);
+ DlgSetItemText(hDlg, IDC_EDITPASS, ActualAccount->Server->Passwd);
+ DlgSetItemTextW(hDlg, IDC_EDITAPP, ActualAccount->NewMailN.App);
+ DlgSetItemTextW(hDlg, IDC_EDITAPPPARAM, ActualAccount->NewMailN.AppParam);
SetDlgItemInt(hDlg,IDC_EDITPORT,ActualAccount->Server->Port,FALSE);
SetDlgItemInt(hDlg,IDC_EDITINTERVAL,ActualAccount->Interval/60,FALSE);
SetDlgItemInt(hDlg,IDC_EDITPOPS,ActualAccount->NewMailN.PopUpTime,FALSE);
SetDlgItemInt(hDlg,IDC_EDITNPOPS,ActualAccount->NoNewMailN.PopUpTime,FALSE);
SetDlgItemInt(hDlg,IDC_EDITFPOPS,ActualAccount->BadConnectN.PopUpTime,FALSE);
for(i=0;i<=CPLENSUPP;i++)
- if((i<CPLENSUPP) && (CodePageNamesSupp[i].CP==ActualAccount->CP))
+ if ((i<CPLENSUPP) && (CodePageNamesSupp[i].CP==ActualAccount->CP))
{
SendMessage(GetDlgItem(hDlg,IDC_COMBOCP),CB_SETCURSEL,(WPARAM)i,(LPARAM)0);
break;
}
- if(i==CPLENSUPP)
+ if (i==CPLENSUPP)
SendMessage(GetDlgItem(hDlg,IDC_COMBOCP),CB_SETCURSEL,(WPARAM)CPDEFINDEX,(LPARAM)0);
CheckDlgButton(hDlg,IDC_CHECK,ActualAccount->Flags & YAMN_ACC_ENA ? BST_CHECKED : BST_UNCHECKED);
@@ -618,7 +598,7 @@ BOOL DlgShowAccountColors(HWND hDlg,WPARAM wParam,LPARAM lParam)
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"Options:SHOWACCOUNTCOLORS:ActualAccountSO-read enter\n");
#endif
- if(ActualAccount->NewMailN.Flags & YAMN_ACC_POPC)
+ if (ActualAccount->NewMailN.Flags & YAMN_ACC_POPC)
{
SendDlgItemMessage(hDlg,IDC_CPB,CPM_SETCOLOUR,0,(LPARAM)ActualAccount->NewMailN.PopUpB);
SendDlgItemMessage(hDlg,IDC_CPT,CPM_SETCOLOUR,0,(LPARAM)ActualAccount->NewMailN.PopUpT);
@@ -628,7 +608,7 @@ BOOL DlgShowAccountColors(HWND hDlg,WPARAM wParam,LPARAM lParam)
SendDlgItemMessage(hDlg,IDC_CPB,CPM_SETCOLOUR,0,(LPARAM)GetSysColor(COLOR_BTNFACE));
SendDlgItemMessage(hDlg,IDC_CPT,CPM_SETCOLOUR,0,(LPARAM)GetSysColor(COLOR_WINDOWTEXT));
}
- if(ActualAccount->BadConnectN.Flags & YAMN_ACC_POPC)
+ if (ActualAccount->BadConnectN.Flags & YAMN_ACC_POPC)
{
SendDlgItemMessage(hDlg,IDC_CPFB,CPM_SETCOLOUR,0,(LPARAM)ActualAccount->BadConnectN.PopUpB);
SendDlgItemMessage(hDlg,IDC_CPFT,CPM_SETCOLOUR,0,(LPARAM)ActualAccount->BadConnectN.PopUpT);
@@ -638,7 +618,7 @@ BOOL DlgShowAccountColors(HWND hDlg,WPARAM wParam,LPARAM lParam)
SendDlgItemMessage(hDlg,IDC_CPFB,CPM_SETCOLOUR,0,(LPARAM)GetSysColor(COLOR_BTNFACE));
SendDlgItemMessage(hDlg,IDC_CPFT,CPM_SETCOLOUR,0,(LPARAM)GetSysColor(COLOR_WINDOWTEXT));
}
- if(ActualAccount->NoNewMailN.Flags & YAMN_ACC_POPC)
+ if (ActualAccount->NoNewMailN.Flags & YAMN_ACC_POPC)
{
SendDlgItemMessage(hDlg,IDC_CPNB,CPM_SETCOLOUR,0,(LPARAM)ActualAccount->NoNewMailN.PopUpB);
SendDlgItemMessage(hDlg,IDC_CPNT,CPM_SETCOLOUR,0,(LPARAM)ActualAccount->NoNewMailN.PopUpT);
@@ -655,21 +635,21 @@ BOOL DlgShowAccountColors(HWND hDlg,WPARAM wParam,LPARAM lParam)
return TRUE;
}
-BOOL DlgSetItemText(HWND hDlg,WPARAM wParam,LPARAM lParam)
+BOOL DlgSetItemText(HWND hDlg, WPARAM wParam,const char* str)
{
- if((TCHAR*)lParam==NULL)
- SetDlgItemText(hDlg,(UINT)wParam,_T(""));
+ if (str == NULL)
+ SetDlgItemTextA(hDlg, wParam, "");
else
- SetDlgItemText(hDlg,(UINT)wParam,(TCHAR *)lParam);
+ SetDlgItemTextA(hDlg, wParam, str);
return TRUE;
}
-BOOL DlgSetItemTextW(HWND hDlg,WPARAM wParam,LPARAM lParam)
+BOOL DlgSetItemTextW(HWND hDlg,WPARAM wParam,const WCHAR* str)
{
- if((WCHAR*)lParam==NULL)
- SetDlgItemTextW(hDlg,(UINT)wParam,(LPWSTR)L"");
+ if (str == NULL)
+ SetDlgItemTextW(hDlg, wParam, L"");
else
- SetDlgItemTextW(hDlg,(UINT)wParam,(LPWSTR)lParam);
+ SetDlgItemTextW(hDlg, wParam, str);
return TRUE;
}
@@ -681,7 +661,7 @@ BOOL CALLBACK DlgProcPOP3AccStatusOpt(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lP
case WM_INITDIALOG:
{
ActualAccount=(HPOP3ACCOUNT)CallService(MS_YAMN_FINDACCOUNTBYNAME,(WPARAM)POP3Plugin,(LPARAM)DlgInput);
- if(ActualAccount != NULL)
+ if (ActualAccount != NULL)
{
DlgShowAccountStatus(hDlg,(WPARAM)M_SHOWACTUAL,(LPARAM)ActualAccount);
DlgEnableAccountStatus(hDlg,(WPARAM)TRUE,(LPARAM)TRUE);
@@ -711,16 +691,16 @@ BOOL CALLBACK DlgProcPOP3AccStatusOpt(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lP
switch(LOWORD(wParam))
{
case IDOK:
- Check0=(IsDlgButtonChecked(hDlg,IDC_CHECKST0)==BST_CHECKED);
- Check1=(IsDlgButtonChecked(hDlg,IDC_CHECKST1)==BST_CHECKED);
- Check2=(IsDlgButtonChecked(hDlg,IDC_CHECKST2)==BST_CHECKED);
- Check3=(IsDlgButtonChecked(hDlg,IDC_CHECKST3)==BST_CHECKED);
- Check4=(IsDlgButtonChecked(hDlg,IDC_CHECKST4)==BST_CHECKED);
- Check5=(IsDlgButtonChecked(hDlg,IDC_CHECKST5)==BST_CHECKED);
- Check6=(IsDlgButtonChecked(hDlg,IDC_CHECKST6)==BST_CHECKED);
- Check7=(IsDlgButtonChecked(hDlg,IDC_CHECKST7)==BST_CHECKED);
- Check8=(IsDlgButtonChecked(hDlg,IDC_CHECKST8)==BST_CHECKED);
- Check9=(IsDlgButtonChecked(hDlg,IDC_CHECKST9)==BST_CHECKED);
+ Check0 = (IsDlgButtonChecked(hDlg,IDC_CHECKST0)==BST_CHECKED);
+ Check1 = (IsDlgButtonChecked(hDlg,IDC_CHECKST1)==BST_CHECKED);
+ Check2 = (IsDlgButtonChecked(hDlg,IDC_CHECKST2)==BST_CHECKED);
+ Check3 = (IsDlgButtonChecked(hDlg,IDC_CHECKST3)==BST_CHECKED);
+ Check4 = (IsDlgButtonChecked(hDlg,IDC_CHECKST4)==BST_CHECKED);
+ Check5 = (IsDlgButtonChecked(hDlg,IDC_CHECKST5)==BST_CHECKED);
+ Check6 = (IsDlgButtonChecked(hDlg,IDC_CHECKST6)==BST_CHECKED);
+ Check7 = (IsDlgButtonChecked(hDlg,IDC_CHECKST7)==BST_CHECKED);
+ Check8 = (IsDlgButtonChecked(hDlg,IDC_CHECKST8)==BST_CHECKED);
+ Check9 = (IsDlgButtonChecked(hDlg,IDC_CHECKST9)==BST_CHECKED);
WindowList_BroadcastAsync(YAMNVar.MessageWnds,WM_YAMN_CHANGESTATUSOPTION,(WPARAM)0,(LPARAM)0);
EndDialog(hDlg,0);
DestroyWindow(hDlg);
@@ -768,21 +748,21 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPara
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"Options:INITDIALOG:AccountBrowserSO-read enter\n");
#endif
- //SendDlgItemMessage(hDlg,IDC_COMBOACCOUNT,CB_ADDSTRING,0,(LPARAM)""); //this was in YAMN.rc initialisation but seems to be useless
- if(POP3Plugin->FirstAccount!=NULL)
+
+ if (POP3Plugin->FirstAccount!=NULL)
for(ActualAccount=(HPOP3ACCOUNT)POP3Plugin->FirstAccount;ActualAccount!=NULL;ActualAccount=(HPOP3ACCOUNT)ActualAccount->Next)
- if(ActualAccount->Name!=NULL)
- SendDlgItemMessage(hDlg,IDC_COMBOACCOUNT,CB_ADDSTRING,0,(LPARAM)ActualAccount->Name);
+ if (ActualAccount->Name!=NULL)
+ SendDlgItemMessageA(hDlg,IDC_COMBOACCOUNT,CB_ADDSTRING,0,(LPARAM)ActualAccount->Name);
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"Options:INITDIALOG:AccountBrowserSO-read done\n");
#endif
ReadDoneSO(POP3Plugin->AccountBrowserSO);
- SendDlgItemMessage(hDlg,IDC_COMBOCP,CB_ADDSTRING,0,(LPARAM)TranslateT("Default"));
+ SendDlgItemMessage(hDlg, IDC_COMBOCP, CB_ADDSTRING, 0, (LPARAM)TranslateT("Default"));
for(i=1;i<CPLENSUPP;i++){
CPINFOEX info; GetCPInfoEx(CodePageNamesSupp[i].CP,0,&info);
- size_t len = strlen(info.CodePageName+7);
+ size_t len = lstrlen(info.CodePageName+7);
info.CodePageName[len+6]=0;
- SendDlgItemMessage(hDlg,IDC_COMBOCP,CB_ADDSTRING,0,(LPARAM)info.CodePageName+7);
+ SendDlgItemMessage(hDlg,IDC_COMBOCP,CB_ADDSTRING,0,(LPARAM)(info.CodePageName+7));
}
SendMessage(GetDlgItem(hDlg,IDC_COMBOCP),CB_SETCURSEL,(WPARAM)CPDEFINDEX,(LPARAM)0);
@@ -793,7 +773,7 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPara
}
case WM_SHOWWINDOW:
- if((BOOL)wParam==FALSE)
+ if ((BOOL)wParam==FALSE)
{
WindowList_Remove(pYAMNVar->MessageWnds,hDlg);
SendMessage(GetParent(hDlg),PSM_UNCHANGED,(WPARAM)hDlg,(LPARAM)0);
@@ -803,12 +783,12 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPara
return TRUE;
case WM_YAMN_CHANGESTATUS:
{
- char accstatus[256];
-
- if((HPOP3ACCOUNT)wParam!=ActualAccount)
+ if ((HPOP3ACCOUNT)wParam!=ActualAccount)
break;
+
+ TCHAR accstatus[256];
GetAccountStatus(ActualAccount,accstatus);
- SetDlgItemTextA(hDlg,IDC_STSTATUS,accstatus);
+ SetDlgItemText(hDlg,IDC_STSTATUS,accstatus);
return TRUE;
}
@@ -820,10 +800,10 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPara
}
case WM_YAMN_CHANGETIME:
- if((HPOP3ACCOUNT)wParam==ActualAccount)
+ if ((HPOP3ACCOUNT)wParam==ActualAccount)
{
TCHAR Text[256];
- _stprintf(Text,Translate("Time left to next check [s]: %d"),(DWORD)lParam);
+ mir_sntprintf(Text,SIZEOF(Text),TranslateT("Time left to next check [s]: %d"),(DWORD)lParam);
SetDlgItemText(hDlg,IDC_STTIMELEFT,Text);
}
return TRUE;
@@ -840,18 +820,18 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPara
ActualAccount=NULL;
DlgSetItemText(hDlg,(WPARAM)IDC_STTIMELEFT,(LPARAM)NULL);
- if(GetDlgItemText(hDlg,IDC_COMBOACCOUNT,DlgInput,sizeof(DlgInput)/sizeof(TCHAR)))
+ if (GetDlgItemTextA(hDlg,IDC_COMBOACCOUNT,DlgInput,sizeof(DlgInput)))
DlgEnableAccount(hDlg,(WPARAM)TRUE,(LPARAM)FALSE);
else
DlgEnableAccount(hDlg,(WPARAM)FALSE,(LPARAM)FALSE);
break;
case CBN_KILLFOCUS:
- GetDlgItemText(hDlg,IDC_COMBOACCOUNT,DlgInput,sizeof(DlgInput)/sizeof(TCHAR));
- if(NULL==(ActualAccount=(HPOP3ACCOUNT)CallService(MS_YAMN_FINDACCOUNTBYNAME,(WPARAM)POP3Plugin,(LPARAM)DlgInput)))
+ GetDlgItemTextA(hDlg,IDC_COMBOACCOUNT,DlgInput,sizeof(DlgInput));
+ if (NULL==(ActualAccount=(HPOP3ACCOUNT)CallService(MS_YAMN_FINDACCOUNTBYNAME,(WPARAM)POP3Plugin,(LPARAM)DlgInput)))
{
DlgSetItemText(hDlg,(WPARAM)IDC_STTIMELEFT,(LPARAM)NULL);
EnableWindow(GetDlgItem(hDlg,IDC_BTNDEL),FALSE);
- if(lstrlen(DlgInput))
+ if (lstrlenA(DlgInput))
DlgEnableAccount(hDlg,(WPARAM)TRUE,(LPARAM)TRUE);
else
DlgEnableAccount(hDlg,(WPARAM)FALSE,(LPARAM)FALSE);
@@ -864,10 +844,10 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPara
}
break;
case CBN_SELCHANGE:
- if(CB_ERR!=(Result=SendDlgItemMessage(hDlg,IDC_COMBOACCOUNT,CB_GETCURSEL,0,0)))
- SendDlgItemMessage(hDlg,IDC_COMBOACCOUNT,CB_GETLBTEXT,(WPARAM)Result,(LPARAM)DlgInput);
+ if (CB_ERR!=(Result=SendDlgItemMessage(hDlg,IDC_COMBOACCOUNT,CB_GETCURSEL,0,0)))
+ SendDlgItemMessageA(hDlg,IDC_COMBOACCOUNT,CB_GETLBTEXT,(WPARAM)Result,(LPARAM)DlgInput);
- if((Result==CB_ERR) || (NULL==(ActualAccount=(HPOP3ACCOUNT)CallService(MS_YAMN_FINDACCOUNTBYNAME,(WPARAM)POP3Plugin,(LPARAM)DlgInput))))
+ if ((Result==CB_ERR) || (NULL==(ActualAccount=(HPOP3ACCOUNT)CallService(MS_YAMN_FINDACCOUNTBYNAME,(WPARAM)POP3Plugin,(LPARAM)DlgInput))))
{
DlgSetItemText(hDlg,(WPARAM)IDC_STTIMELEFT,(LPARAM)NULL);
EnableWindow(GetDlgItem(hDlg,IDC_BTNDEL),FALSE);
@@ -885,7 +865,7 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPara
{
int sel = SendDlgItemMessage(hDlg,IDC_COMBOCP,CB_GETCURSEL,0,0);
CPINFOEX info; GetCPInfoEx(CodePageNamesSupp[sel].CP,0,&info);
- DlgSetItemText(hDlg,(WPARAM)IDC_STSTATUS,(LPARAM)info.CodePageName);
+ DlgSetItemTextT(hDlg, IDC_STSTATUS, info.CodePageName);
}
case IDC_CHECK:
case IDC_CHECKSND:
@@ -922,7 +902,7 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPara
break;
case IDC_CHECKSSL:
{
- BOOL SSLC=(IsDlgButtonChecked(hDlg,IDC_CHECKSSL)==BST_CHECKED);
+ BOOL SSLC = (IsDlgButtonChecked(hDlg,IDC_CHECKSSL)==BST_CHECKED);
SetDlgItemInt(hDlg,IDC_EDITPORT,SSLC ? 995 : 110,FALSE);
EnableWindow(GetDlgItem(hDlg,IDC_CHECKNOTLS),SSLC?0:1);
}
@@ -934,7 +914,7 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPara
case IDC_CPFT:
case IDC_CPNB:
case IDC_CPNT:
- if(HIWORD(wParam)!=CPN_COLOURCHANGED)
+ if (HIWORD(wParam)!=CPN_COLOURCHANGED)
break;
case IDC_CHECKKBN:
Changed=TRUE;
@@ -958,10 +938,10 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPara
DlgShowAccount(hDlg,(WPARAM)M_SHOWDEFAULT,0);
DlgEnableAccount(hDlg,(WPARAM)TRUE,(LPARAM)TRUE);
EnableWindow(GetDlgItem(hDlg,IDC_BTNDEL),FALSE);
- DlgSetItemText(hDlg,(WPARAM)IDC_EDITNAME,(LPARAM)TranslateT("New Account"));
+ DlgSetItemTextT(hDlg, IDC_EDITNAME, TranslateT("New Account"));
index=SendDlgItemMessage(hDlg,IDC_COMBOACCOUNT,CB_ADDSTRING,0,(LPARAM)TranslateT("New Account"));
- if((index==CB_ERR) || (index==CB_ERRSPACE))
+ if ((index==CB_ERR) || (index==CB_ERRSPACE))
break;
SendDlgItemMessage(hDlg,IDC_COMBOACCOUNT,CB_SETCURSEL,(WPARAM)index,(LPARAM)TranslateT("New Account"));
break;
@@ -981,15 +961,15 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPara
OFNStruct.nMaxFile=MAX_PATH;
OFNStruct.lpstrFile=new TCHAR[MAX_PATH];
OFNStruct.lpstrFile[0]=(TCHAR)0;
- OFNStruct.lpstrTitle=Translate("Select executable used for notification");
+ OFNStruct.lpstrTitle=TranslateT("Select executable used for notification");
OFNStruct.Flags=OFN_FILEMUSTEXIST | OFN_NONETWORKBUTTON | OFN_PATHMUSTEXIST | OFN_NOCHANGEDIR;
- if(!GetOpenFileName(&OFNStruct))
+ if (!GetOpenFileName(&OFNStruct))
{
- if(CommDlgExtendedError())
+ if (CommDlgExtendedError())
MessageBox(hDlg,_T("Dialog box error"),_T("Failed"),MB_OK);
}
else
- DlgSetItemText(hDlg,(WPARAM)IDC_EDITAPP,(LPARAM)OFNStruct.lpstrFile);
+ DlgSetItemTextT(hDlg, IDC_EDITAPP, OFNStruct.lpstrFile);
delete[] OFNStruct.lpstrFile;
break;
}
@@ -998,18 +978,18 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPara
// DlgShowAccountColors(hDlg,0,(LPARAM)ActualAccount);
break;
case IDC_BTNDEL:
- GetDlgItemText(hDlg,IDC_COMBOACCOUNT,DlgInput,sizeof(DlgInput)/sizeof(TCHAR));
+ GetDlgItemTextA(hDlg,IDC_COMBOACCOUNT,DlgInput,sizeof(DlgInput));
EnableWindow(GetDlgItem(hDlg,IDC_BTNDEL),FALSE);
- if((CB_ERR==(Result=SendDlgItemMessage(hDlg,IDC_COMBOACCOUNT,CB_GETCURSEL,0,0)))
+ if ((CB_ERR==(Result=SendDlgItemMessage(hDlg,IDC_COMBOACCOUNT,CB_GETCURSEL,0,0)))
|| (NULL==(ActualAccount=(HPOP3ACCOUNT)CallService(MS_YAMN_FINDACCOUNTBYNAME,(WPARAM)POP3Plugin,(LPARAM)DlgInput))))
return TRUE;
- if(IDOK!=MessageBox(hDlg,Translate("Do you really want to delete this account?"),Translate("Delete account confirmation"),MB_OKCANCEL | MB_ICONWARNING))
+ if (IDOK!=MessageBox(hDlg,TranslateT("Do you really want to delete this account?"),TranslateT("Delete account confirmation"),MB_OKCANCEL | MB_ICONWARNING))
return TRUE;
- DlgSetItemText(hDlg,(WPARAM)IDC_STTIMELEFT,(LPARAM)Translate("Please wait while no account is in use."));
+ DlgSetItemTextT(hDlg, IDC_STTIMELEFT, TranslateT("Please wait while no account is in use."));
- if(ActualAccount->hContact != NULL)
+ if (ActualAccount->hContact != NULL)
CallService(MS_DB_CONTACT_DELETE,(WPARAM)(HANDLE) ActualAccount->hContact, 0);
CallService(MS_YAMN_DELETEACCOUNT,(WPARAM)POP3Plugin,(LPARAM)ActualAccount);
@@ -1023,285 +1003,261 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPara
// Beep(100,50);
break;
case IDC_BTNRESET:
- if(ActualAccount!=NULL)
+ if (ActualAccount!=NULL)
ActualAccount->TimeLeft=ActualAccount->Interval;
return 1;
}
- if(HIWORD(wParam)==EN_CHANGE)
+ if (HIWORD(wParam)==EN_CHANGE)
Changed=TRUE;
break;
}
case WM_NOTIFY:
- switch(((LPNMHDR)lParam)->idFrom)
- {
- case 0:
- switch(((LPNMHDR)lParam)->code)
- {
- case PSN_APPLY:
- {
- TCHAR Text[MAX_PATH];
- WCHAR TextW[MAX_PATH];
- BOOL Translated,NewAcc=FALSE,Check,CheckMsg,CheckSnd,CheckIco,CheckApp, CheckAPOP;
- BOOL CheckNMsgP,CheckFMsg,CheckFSnd,CheckFIco;
- BOOL CheckKBN, CheckContact,CheckContactNick,CheckContactNoEvent;
- BOOL CheckSSL, CheckABody, CheckNoTLS;
- //BOOL Check0,Check1,Check2,Check3,Check4,Check5,Check6,Check7,Check8,Check9,
- BOOL CheckStart,CheckForce;
- size_t Length,index;
- UINT Port,Interval;
-
- if(GetDlgItemText(hDlg,IDC_COMBOACCOUNT,Text,sizeof(Text)/sizeof(TCHAR)))
- {
- Check=(IsDlgButtonChecked(hDlg,IDC_CHECK)==BST_CHECKED);
- CheckSSL=(IsDlgButtonChecked(hDlg,IDC_CHECKSSL)==BST_CHECKED);
- CheckNoTLS=(IsDlgButtonChecked(hDlg,IDC_CHECKNOTLS)==BST_CHECKED);
- CheckAPOP=(IsDlgButtonChecked(hDlg,IDC_CHECKAPOP)==BST_CHECKED);
-
- CheckABody=(IsDlgButtonChecked(hDlg,IDC_AUTOBODY)==BST_CHECKED);
- CheckMsg=(IsDlgButtonChecked(hDlg,IDC_CHECKMSG)==BST_CHECKED);
- CheckSnd=(IsDlgButtonChecked(hDlg,IDC_CHECKSND)==BST_CHECKED);
- CheckIco=(IsDlgButtonChecked(hDlg,IDC_CHECKICO)==BST_CHECKED);
-
- CheckApp=(IsDlgButtonChecked(hDlg,IDC_CHECKAPP)==BST_CHECKED);
- CheckKBN=(IsDlgButtonChecked(hDlg,IDC_CHECKKBN)==BST_CHECKED);
- CheckContact=(IsDlgButtonChecked(hDlg,IDC_CHECKCONTACT)==BST_CHECKED);
- CheckContactNick=(IsDlgButtonChecked(hDlg,IDC_CHECKCONTACTNICK)==BST_CHECKED);
- CheckContactNoEvent=(IsDlgButtonChecked(hDlg,IDC_CHECKCONTACTNOEVENT)==BST_CHECKED);
-
- CheckFSnd=(IsDlgButtonChecked(hDlg,IDC_CHECKFSND)==BST_CHECKED);
- CheckFMsg=(IsDlgButtonChecked(hDlg,IDC_CHECKFMSG)==BST_CHECKED);
- CheckFIco=(IsDlgButtonChecked(hDlg,IDC_CHECKFICO)==BST_CHECKED);
-
- CheckNMsgP=(IsDlgButtonChecked(hDlg,IDC_CHECKNMSGP)==BST_CHECKED);
-
- Port=GetDlgItemInt(hDlg,IDC_EDITPORT,&Translated,FALSE);
- if(!Translated)
- {
- MessageBox(hDlg,Translate("This is not a valid number value"),Translate("Input error"),MB_OK);
- SetFocus(GetDlgItem(hDlg,IDC_EDITPORT));
- break;
- }
- Interval=GetDlgItemInt(hDlg,IDC_EDITINTERVAL,&Translated,FALSE);
- if(!Translated)
- {
- MessageBox(hDlg,Translate("This is not a valid number value"),Translate("Input error"),MB_OK);
- SetFocus(GetDlgItem(hDlg,IDC_EDITINTERVAL));
- break;
- }
-
- GetDlgItemText(hDlg,IDC_EDITAPP,Text,sizeof(Text)/sizeof(TCHAR));
- if(CheckApp && !(Length=_tcslen(Text)))
- {
- MessageBox(hDlg,TranslateT("Please select application to run"),TranslateT("Input error"),MB_OK);
- break;
- }
+ if (((LPNMHDR)lParam)->idFrom == 0 && ((LPNMHDR)lParam)->code == PSN_APPLY ) {
+ char Text[MAX_PATH];
+ WCHAR TextW[MAX_PATH];
+ #ifdef _UNICODE
+ #define TextT TextW
+ #else
+ #define TextT Text
+ #endif
+ BOOL Translated,NewAcc=FALSE,Check,CheckMsg,CheckSnd,CheckIco,CheckApp, CheckAPOP;
+ BOOL CheckNMsgP,CheckFMsg,CheckFSnd,CheckFIco;
+ BOOL CheckKBN, CheckContact,CheckContactNick,CheckContactNoEvent;
+ BOOL CheckSSL, CheckABody, CheckNoTLS;
+ //BOOL Check0,Check1,Check2,Check3,Check4,Check5,Check6,Check7,Check8,Check9,
+ BOOL CheckStart,CheckForce;
+ size_t Length,index;
+ UINT Port,Interval;
+
+ if ( GetDlgItemTextA(hDlg,IDC_COMBOACCOUNT, Text, sizeof(Text))) {
+ Check = (IsDlgButtonChecked(hDlg,IDC_CHECK)==BST_CHECKED);
+ CheckSSL = (IsDlgButtonChecked(hDlg,IDC_CHECKSSL)==BST_CHECKED);
+ CheckNoTLS = (IsDlgButtonChecked(hDlg,IDC_CHECKNOTLS)==BST_CHECKED);
+ CheckAPOP = (IsDlgButtonChecked(hDlg,IDC_CHECKAPOP)==BST_CHECKED);
+
+ CheckABody = (IsDlgButtonChecked(hDlg,IDC_AUTOBODY)==BST_CHECKED);
+ CheckMsg = (IsDlgButtonChecked(hDlg,IDC_CHECKMSG)==BST_CHECKED);
+ CheckSnd = (IsDlgButtonChecked(hDlg,IDC_CHECKSND)==BST_CHECKED);
+ CheckIco = (IsDlgButtonChecked(hDlg,IDC_CHECKICO)==BST_CHECKED);
+
+ CheckApp = (IsDlgButtonChecked(hDlg,IDC_CHECKAPP)==BST_CHECKED);
+ CheckKBN = (IsDlgButtonChecked(hDlg,IDC_CHECKKBN)==BST_CHECKED);
+ CheckContact = (IsDlgButtonChecked(hDlg,IDC_CHECKCONTACT)==BST_CHECKED);
+ CheckContactNick = (IsDlgButtonChecked(hDlg,IDC_CHECKCONTACTNICK)==BST_CHECKED);
+ CheckContactNoEvent = (IsDlgButtonChecked(hDlg,IDC_CHECKCONTACTNOEVENT)==BST_CHECKED);
+
+ CheckFSnd = (IsDlgButtonChecked(hDlg,IDC_CHECKFSND)==BST_CHECKED);
+ CheckFMsg = (IsDlgButtonChecked(hDlg,IDC_CHECKFMSG)==BST_CHECKED);
+ CheckFIco = (IsDlgButtonChecked(hDlg,IDC_CHECKFICO)==BST_CHECKED);
+
+ CheckNMsgP = (IsDlgButtonChecked(hDlg,IDC_CHECKNMSGP)==BST_CHECKED);
+
+ Port = GetDlgItemInt(hDlg, IDC_EDITPORT, &Translated, FALSE);
+ if ( !Translated ) {
+ MessageBox(hDlg,TranslateT("This is not a valid number value"),TranslateT("Input error"),MB_OK);
+ SetFocus(GetDlgItem(hDlg,IDC_EDITPORT));
+ break;
+ }
+ Interval = GetDlgItemInt(hDlg,IDC_EDITINTERVAL,&Translated,FALSE);
+ if ( !Translated ) {
+ MessageBox(hDlg,TranslateT("This is not a valid number value"),TranslateT("Input error"),MB_OK);
+ SetFocus(GetDlgItem(hDlg,IDC_EDITINTERVAL));
+ break;
+ }
- GetDlgItemText(hDlg,IDC_COMBOACCOUNT,Text,sizeof(Text)/sizeof(TCHAR));
- if(!(Length=_tcslen(Text)))
- GetDlgItemText(hDlg,IDC_EDITNAME,Text,sizeof(Text)/sizeof(TCHAR));
- if(!(Length=_tcslen(Text)))
- break;
+ GetDlgItemTextA(hDlg, IDC_EDITAPP, Text, sizeof(Text));
+ if (CheckApp && !(Length = strlen(Text))) {
+ MessageBox(hDlg,TranslateT("Please select application to run"),TranslateT("Input error"),MB_OK);
+ break;
+ }
- DlgSetItemText(hDlg,(WPARAM)IDC_STTIMELEFT,(LPARAM)TranslateT("Please wait while no account is in use."));
+ GetDlgItemTextA(hDlg, IDC_COMBOACCOUNT, Text, sizeof(Text));
+ if ( !( Length = strlen(Text))) {
+ GetDlgItemTextA(hDlg,IDC_EDITNAME, Text, sizeof(Text));
+ if ( !(Length = strlen( Text )))
+ break;
+ }
- if(NULL==(ActualAccount=(HPOP3ACCOUNT)CallService(MS_YAMN_FINDACCOUNTBYNAME,(WPARAM)POP3Plugin,(LPARAM)Text)))
- {
- NewAcc=TRUE;
- #ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile,"Options:APPLY:AccountBrowserSO-write wait\n");
- #endif
- WaitToWriteSO(POP3Plugin->AccountBrowserSO);
- #ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile,"Options:APPLY:AccountBrowserSO-write enter\n");
- #endif
- if(NULL==(ActualAccount=(HPOP3ACCOUNT)CallService(MS_YAMN_GETNEXTFREEACCOUNT,(WPARAM)POP3Plugin,(LPARAM)YAMN_ACCOUNTVERSION)))
- {
- #ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile,"Options:APPLY:AccountBrowserSO-write done\n");
- #endif
- WriteDoneSO(POP3Plugin->AccountBrowserSO);
- MessageBox(hDlg,Translate("Cannot allocate memory space for new account"),Translate("Memory error"),MB_OK);
- break;
- }
- }
- else
- {
- #ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile,"Options:APPLY:AccountBrowserSO-write wait\n");
- #endif
- //We have to get full access to AccountBrowser, so other iterating thrads cannot get new account until new account is right set
- WaitToWriteSO(POP3Plugin->AccountBrowserSO);
- #ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile,"Options:APPLY:AccountBrowserSO-write enter\n");
- #endif
- }
- #ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile,"Options:APPLY:ActualAccountSO-write wait\n");
- #endif
- if(WAIT_OBJECT_0!=WaitToWrite(ActualAccount))
- {
- #ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile,"Options:APPLY:ActualAccountSO-write wait failed\n");
- #endif
- #ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile,"Options:APPLY:ActualBrowserSO-write done\n");
- #endif
- WriteDoneSO(POP3Plugin->AccountBrowserSO);
+ DlgSetItemTextT(hDlg, IDC_STTIMELEFT, TranslateT("Please wait while no account is in use."));
+
+ if (NULL==(ActualAccount=(HPOP3ACCOUNT)CallService(MS_YAMN_FINDACCOUNTBYNAME,(WPARAM)POP3Plugin,(LPARAM)Text))) {
+ NewAcc=TRUE;
+ #ifdef DEBUG_SYNCHRO
+ DebugLog(SynchroFile,"Options:APPLY:AccountBrowserSO-write wait\n");
+ #endif
+ WaitToWriteSO(POP3Plugin->AccountBrowserSO);
+ #ifdef DEBUG_SYNCHRO
+ DebugLog(SynchroFile,"Options:APPLY:AccountBrowserSO-write enter\n");
+ #endif
+ if (NULL==(ActualAccount=(HPOP3ACCOUNT)CallService(MS_YAMN_GETNEXTFREEACCOUNT,(WPARAM)POP3Plugin,(LPARAM)YAMN_ACCOUNTVERSION))) {
+ #ifdef DEBUG_SYNCHRO
+ DebugLog(SynchroFile,"Options:APPLY:AccountBrowserSO-write done\n");
+ #endif
+ WriteDoneSO(POP3Plugin->AccountBrowserSO);
+ MessageBox(hDlg,TranslateT("Cannot allocate memory space for new account"),TranslateT("Memory error"),MB_OK);
+ break;
+ }
+ }
+ else {
+ #ifdef DEBUG_SYNCHRO
+ DebugLog(SynchroFile,"Options:APPLY:AccountBrowserSO-write wait\n");
+ #endif
+ //We have to get full access to AccountBrowser, so other iterating thrads cannot get new account until new account is right set
+ WaitToWriteSO(POP3Plugin->AccountBrowserSO);
+ #ifdef DEBUG_SYNCHRO
+ DebugLog(SynchroFile,"Options:APPLY:AccountBrowserSO-write enter\n");
+ #endif
+ }
+ #ifdef DEBUG_SYNCHRO
+ DebugLog(SynchroFile,"Options:APPLY:ActualAccountSO-write wait\n");
+ #endif
+ if (WAIT_OBJECT_0!=WaitToWrite(ActualAccount))
+ {
+ #ifdef DEBUG_SYNCHRO
+ DebugLog(SynchroFile,"Options:APPLY:ActualAccountSO-write wait failed\n");
+ #endif
+ #ifdef DEBUG_SYNCHRO
+ DebugLog(SynchroFile,"Options:APPLY:ActualBrowserSO-write done\n");
+ #endif
+ WriteDoneSO(POP3Plugin->AccountBrowserSO);
- }
- #ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile,"Options:APPLY:ActualAccountSO-write enter\n");
- #endif
+ }
+ #ifdef DEBUG_SYNCHRO
+ DebugLog(SynchroFile,"Options:APPLY:ActualAccountSO-write enter\n");
+ #endif
-// Beep(1000,100);Sleep(200);
- GetDlgItemText(hDlg,IDC_EDITNAME,Text,sizeof(Text)/sizeof(TCHAR));
- if(!(Length=_tcslen(Text)))
- break;
- if(NULL==ActualAccount->Name)
- ActualAccount->Name=new TCHAR[Length+1];
- _tcscpy(ActualAccount->Name,Text);
-
-
+ GetDlgItemTextA(hDlg, IDC_EDITNAME, Text, sizeof(Text));
+ if ( !(Length = strlen( Text )))
+ break;
+ if (NULL != ActualAccount->Name)
+ delete[] ActualAccount->Name;
+ ActualAccount->Name = new char[ strlen(Text)+1];
+ strcpy(ActualAccount->Name,Text);
-// Beep(1000,100);Sleep(200);
- GetDlgItemText(hDlg,IDC_EDITSERVER,Text,sizeof(Text)/sizeof(TCHAR));
- if(NULL!=ActualAccount->Server->Name)
- delete[] ActualAccount->Server->Name;
- ActualAccount->Server->Name=new TCHAR[_tcslen(Text)+1];
- _tcscpy(ActualAccount->Server->Name,Text);
+ GetDlgItemTextA(hDlg,IDC_EDITSERVER,Text,sizeof(Text));
+ if (NULL!=ActualAccount->Server->Name)
+ delete[] ActualAccount->Server->Name;
+ ActualAccount->Server->Name=new char[ strlen(Text)+1];
+ strcpy(ActualAccount->Server->Name,Text);
-// Beep(1000,100);Sleep(200);
- GetDlgItemText(hDlg,IDC_EDITLOGIN,Text,sizeof(Text)/sizeof(TCHAR));
- if(NULL!=ActualAccount->Server->Login)
- delete[] ActualAccount->Server->Login;
- ActualAccount->Server->Login=new TCHAR[_tcslen(Text)+1];
- _tcscpy(ActualAccount->Server->Login,Text);
+ GetDlgItemTextA(hDlg,IDC_EDITLOGIN,Text,sizeof(Text));
+ if (NULL!=ActualAccount->Server->Login)
+ delete[] ActualAccount->Server->Login;
+ ActualAccount->Server->Login=new char[ strlen(Text)+1];
+ strcpy(ActualAccount->Server->Login,Text);
-// Beep(1000,100);Sleep(200);
- GetDlgItemText(hDlg,IDC_EDITPASS,Text,sizeof(Text)/sizeof(TCHAR));
- if(NULL!=ActualAccount->Server->Passwd)
- delete[] ActualAccount->Server->Passwd;
- ActualAccount->Server->Passwd=new TCHAR[_tcslen(Text)+1];
- _tcscpy(ActualAccount->Server->Passwd,Text);
+ GetDlgItemTextA(hDlg,IDC_EDITPASS,Text,sizeof(Text));
+ if (NULL!=ActualAccount->Server->Passwd)
+ delete[] ActualAccount->Server->Passwd;
+ ActualAccount->Server->Passwd=new char[ strlen(Text)+1];
+ strcpy(ActualAccount->Server->Passwd,Text);
-// Beep(1000,100);Sleep(200);
- GetDlgItemTextW(hDlg,IDC_EDITAPP,TextW,sizeof(TextW)/sizeof(WCHAR));
- if(NULL!=ActualAccount->NewMailN.App)
- delete[] ActualAccount->NewMailN.App;
- ActualAccount->NewMailN.App=new WCHAR[wcslen(TextW)+1];
- wcscpy(ActualAccount->NewMailN.App,TextW);
+ GetDlgItemTextW(hDlg,IDC_EDITAPP,TextW,sizeof(TextW)/sizeof(WCHAR));
+ if (NULL!=ActualAccount->NewMailN.App)
+ delete[] ActualAccount->NewMailN.App;
+ ActualAccount->NewMailN.App=new WCHAR[wcslen(TextW)+1];
+ wcscpy(ActualAccount->NewMailN.App,TextW);
-// Beep(1000,100);Sleep(200);
- GetDlgItemTextW(hDlg,IDC_EDITAPPPARAM,TextW,sizeof(TextW)/sizeof(WCHAR));
- if(NULL!=ActualAccount->NewMailN.AppParam)
- delete[] ActualAccount->NewMailN.AppParam;
- ActualAccount->NewMailN.AppParam=new WCHAR[wcslen(TextW)+1];
- wcscpy(ActualAccount->NewMailN.AppParam,TextW);
+ GetDlgItemTextW(hDlg,IDC_EDITAPPPARAM,TextW,sizeof(TextW)/sizeof(WCHAR));
+ if (NULL!=ActualAccount->NewMailN.AppParam)
+ delete[] ActualAccount->NewMailN.AppParam;
+ ActualAccount->NewMailN.AppParam=new WCHAR[wcslen(TextW)+1];
+ wcscpy(ActualAccount->NewMailN.AppParam,TextW);
- ActualAccount->Server->Port=Port;
- ActualAccount->Interval=Interval*60;
+ ActualAccount->Server->Port=Port;
+ ActualAccount->Interval=Interval*60;
-// Beep(1000,100);Sleep(200);
- if(CB_ERR==(index=SendDlgItemMessage(hDlg,IDC_COMBOCP,CB_GETCURSEL,0,0)))
- index=CPDEFINDEX;
- ActualAccount->CP=CodePageNamesSupp[index].CP;
+ if (CB_ERR==(index=SendDlgItemMessage(hDlg,IDC_COMBOCP,CB_GETCURSEL,0,0)))
+ index = CPDEFINDEX;
+ ActualAccount->CP = CodePageNamesSupp[index].CP;
-// Beep(1000,100);Sleep(200);
- if(NewAcc)
- ActualAccount->TimeLeft=Interval*60;
+ if (NewAcc)
+ ActualAccount->TimeLeft=Interval*60;
- CheckStart=(IsDlgButtonChecked(hDlg,IDC_CHECKSTART)==BST_CHECKED);
- CheckForce=(IsDlgButtonChecked(hDlg,IDC_CHECKFORCE)==BST_CHECKED);
-
- ActualAccount->Flags=
- (Check ? YAMN_ACC_ENA : 0) |
- (CheckSSL ? YAMN_ACC_SSL23 : 0) |
- (CheckNoTLS ? YAMN_ACC_NOTLS : 0) |
- (CheckAPOP ? YAMN_ACC_APOP : 0) |
- (CheckABody ? YAMN_ACC_BODY : 0) |
- (ActualAccount->Flags & YAMN_ACC_POPN);
+ CheckStart = (IsDlgButtonChecked(hDlg,IDC_CHECKSTART)==BST_CHECKED);
+ CheckForce = (IsDlgButtonChecked(hDlg,IDC_CHECKFORCE)==BST_CHECKED);
+
+ ActualAccount->Flags=
+ (Check ? YAMN_ACC_ENA : 0) |
+ (CheckSSL ? YAMN_ACC_SSL23 : 0) |
+ (CheckNoTLS ? YAMN_ACC_NOTLS : 0) |
+ (CheckAPOP ? YAMN_ACC_APOP : 0) |
+ (CheckABody ? YAMN_ACC_BODY : 0) |
+ (ActualAccount->Flags & YAMN_ACC_POPN);
- ActualAccount->StatusFlags=
- (Check0 ? YAMN_ACC_ST0 : 0) |
- (Check1 ? YAMN_ACC_ST1 : 0) |
- (Check2 ? YAMN_ACC_ST2 : 0) |
- (Check3 ? YAMN_ACC_ST3 : 0) |
- (Check4 ? YAMN_ACC_ST4 : 0) |
- (Check5 ? YAMN_ACC_ST5 : 0) |
- (Check6 ? YAMN_ACC_ST6 : 0) |
- (Check7 ? YAMN_ACC_ST7 : 0) |
- (Check8 ? YAMN_ACC_ST8 : 0) |
- (Check9 ? YAMN_ACC_ST9 : 0) |
- (CheckStart ? YAMN_ACC_STARTS : 0) |
- (CheckForce ? YAMN_ACC_FORCE : 0);
-
- ActualAccount->NewMailN.Flags=
- (CheckSnd ? YAMN_ACC_SND : 0) |
- (CheckMsg ? YAMN_ACC_MSG : 0) |
- (CheckIco ? YAMN_ACC_ICO : 0) |
- (ActualAccount->NewMailN.Flags & YAMN_ACC_POP) |
- (ActualAccount->NewMailN.Flags & YAMN_ACC_POPC) |
- (CheckApp ? YAMN_ACC_APP : 0) |
- (CheckKBN ? YAMN_ACC_KBN : 0) |
- (CheckContact ? YAMN_ACC_CONT : 0) |
- (CheckContactNick ? YAMN_ACC_CONTNICK : 0) |
- (CheckContactNoEvent ? YAMN_ACC_CONTNOEVENT : 0) |
- YAMN_ACC_MSGP; //this is default: when new mail arrives and window was displayed, leave it displayed.
-
- ActualAccount->NoNewMailN.Flags=
- (ActualAccount->NoNewMailN.Flags & YAMN_ACC_POP) |
- (ActualAccount->NoNewMailN.Flags & YAMN_ACC_POPC) |
- (CheckNMsgP ? YAMN_ACC_MSGP : 0);
-
- ActualAccount->BadConnectN.Flags=
- (CheckFSnd ? YAMN_ACC_SND : 0) |
- (CheckFMsg ? YAMN_ACC_MSG : 0) |
- (CheckFIco ? YAMN_ACC_ICO : 0) |
- (ActualAccount->BadConnectN.Flags & YAMN_ACC_POP) |
- (ActualAccount->BadConnectN.Flags & YAMN_ACC_POPC);
-
- #ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile,"Options:APPLY:ActualAccountSO-write done\n");
- #endif
- WriteDone(ActualAccount);
- #ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile,"Options:APPLY:AccountBrowserSO-write done\n");
- #endif
- WriteDoneSO(POP3Plugin->AccountBrowserSO);
+ ActualAccount->StatusFlags=
+ (Check0 ? YAMN_ACC_ST0 : 0) |
+ (Check1 ? YAMN_ACC_ST1 : 0) |
+ (Check2 ? YAMN_ACC_ST2 : 0) |
+ (Check3 ? YAMN_ACC_ST3 : 0) |
+ (Check4 ? YAMN_ACC_ST4 : 0) |
+ (Check5 ? YAMN_ACC_ST5 : 0) |
+ (Check6 ? YAMN_ACC_ST6 : 0) |
+ (Check7 ? YAMN_ACC_ST7 : 0) |
+ (Check8 ? YAMN_ACC_ST8 : 0) |
+ (Check9 ? YAMN_ACC_ST9 : 0) |
+ (CheckStart ? YAMN_ACC_STARTS : 0) |
+ (CheckForce ? YAMN_ACC_FORCE : 0);
+
+ ActualAccount->NewMailN.Flags=
+ (CheckSnd ? YAMN_ACC_SND : 0) |
+ (CheckMsg ? YAMN_ACC_MSG : 0) |
+ (CheckIco ? YAMN_ACC_ICO : 0) |
+ (ActualAccount->NewMailN.Flags & YAMN_ACC_POP) |
+ (ActualAccount->NewMailN.Flags & YAMN_ACC_POPC) |
+ (CheckApp ? YAMN_ACC_APP : 0) |
+ (CheckKBN ? YAMN_ACC_KBN : 0) |
+ (CheckContact ? YAMN_ACC_CONT : 0) |
+ (CheckContactNick ? YAMN_ACC_CONTNICK : 0) |
+ (CheckContactNoEvent ? YAMN_ACC_CONTNOEVENT : 0) |
+ YAMN_ACC_MSGP; //this is default: when new mail arrives and window was displayed, leave it displayed.
+
+ ActualAccount->NoNewMailN.Flags=
+ (ActualAccount->NoNewMailN.Flags & YAMN_ACC_POP) |
+ (ActualAccount->NoNewMailN.Flags & YAMN_ACC_POPC) |
+ (CheckNMsgP ? YAMN_ACC_MSGP : 0);
+
+ ActualAccount->BadConnectN.Flags=
+ (CheckFSnd ? YAMN_ACC_SND : 0) |
+ (CheckFMsg ? YAMN_ACC_MSG : 0) |
+ (CheckFIco ? YAMN_ACC_ICO : 0) |
+ (ActualAccount->BadConnectN.Flags & YAMN_ACC_POP) |
+ (ActualAccount->BadConnectN.Flags & YAMN_ACC_POPC);
+
+ #ifdef DEBUG_SYNCHRO
+ DebugLog(SynchroFile,"Options:APPLY:ActualAccountSO-write done\n");
+ #endif
+ WriteDone(ActualAccount);
+ #ifdef DEBUG_SYNCHRO
+ DebugLog(SynchroFile,"Options:APPLY:AccountBrowserSO-write done\n");
+ #endif
+ WriteDoneSO(POP3Plugin->AccountBrowserSO);
- EnableWindow(GetDlgItem(hDlg,IDC_BTNDEL),TRUE);
+ EnableWindow(GetDlgItem(hDlg,IDC_BTNDEL),TRUE);
- DlgSetItemText(hDlg,(WPARAM)IDC_STTIMELEFT,(LPARAM)NULL);
+ DlgSetItemText(hDlg,(WPARAM)IDC_STTIMELEFT,(LPARAM)NULL);
-
- index = SendDlgItemMessage(hDlg,IDC_COMBOACCOUNT,CB_GETCURSEL,(WPARAM)0,(LPARAM)0);
-
+ index = SendDlgItemMessage(hDlg,IDC_COMBOACCOUNT,CB_GETCURSEL,(WPARAM)0,(LPARAM)0);
- HPOP3ACCOUNT temp = ActualAccount;
+ HPOP3ACCOUNT temp = ActualAccount;
- SendDlgItemMessage(hDlg,IDC_COMBOACCOUNT,CB_RESETCONTENT,0,(LPARAM)0);
- if(POP3Plugin->FirstAccount!=NULL)
- for(ActualAccount=(HPOP3ACCOUNT)POP3Plugin->FirstAccount;ActualAccount!=NULL;ActualAccount=(HPOP3ACCOUNT)ActualAccount->Next)
- if(ActualAccount->Name!=NULL)
- SendDlgItemMessage(hDlg,IDC_COMBOACCOUNT,CB_ADDSTRING,0,(LPARAM)ActualAccount->Name);
+ SendDlgItemMessage(hDlg,IDC_COMBOACCOUNT,CB_RESETCONTENT,0,(LPARAM)0);
+ if (POP3Plugin->FirstAccount!=NULL)
+ for(ActualAccount=(HPOP3ACCOUNT)POP3Plugin->FirstAccount;ActualAccount!=NULL;ActualAccount=(HPOP3ACCOUNT)ActualAccount->Next)
+ if (ActualAccount->Name!=NULL)
+ SendDlgItemMessageA(hDlg,IDC_COMBOACCOUNT,CB_ADDSTRING,0,(LPARAM)ActualAccount->Name);
- ActualAccount = temp;
- SendDlgItemMessage(hDlg,IDC_COMBOACCOUNT,CB_SETCURSEL,(WPARAM)index,(LPARAM)ActualAccount->Name);
+ ActualAccount = temp;
+ SendDlgItemMessage(hDlg,IDC_COMBOACCOUNT,CB_SETCURSEL,(WPARAM)index,(LPARAM)ActualAccount->Name);
-// if(0==WritePOP3Accounts())
-// Beep(500,100);
- WritePOP3Accounts();
- RefreshContact();
- return TRUE;
- }
- }
- break;
- }
- break;
+ WritePOP3Accounts();
+ RefreshContact();
+ return TRUE;
+ }
}
break;
}
- if(Changed)
+ if (Changed)
SendMessage(GetParent(hDlg),PSM_CHANGED,0,0);
return FALSE;
}
@@ -1328,10 +1284,10 @@ INT_PTR CALLBACK DlgProcPOP3AccPopup(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"Options:INITDIALOG:AccountBrowserSO-read enter\n");
#endif
- if(POP3Plugin->FirstAccount!=NULL)
+ if (POP3Plugin->FirstAccount!=NULL)
for(ActualAccount=(HPOP3ACCOUNT)POP3Plugin->FirstAccount;ActualAccount!=NULL;ActualAccount=(HPOP3ACCOUNT)ActualAccount->Next)
- if(ActualAccount->Name!=NULL)
- SendDlgItemMessage(hDlg,IDC_COMBOACCOUNT,CB_ADDSTRING,0,(LPARAM)ActualAccount->Name);
+ if (ActualAccount->Name!=NULL)
+ SendDlgItemMessageA(hDlg,IDC_COMBOACCOUNT,CB_ADDSTRING,0,(LPARAM)ActualAccount->Name);
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"Options:INITDIALOG:AccountBrowserSO-read done\n");
#endif
@@ -1345,7 +1301,7 @@ INT_PTR CALLBACK DlgProcPOP3AccPopup(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa
}
case WM_SHOWWINDOW:
- if((BOOL)wParam==FALSE)
+ if ((BOOL)wParam==FALSE)
{
WindowList_Remove(pYAMNVar->MessageWnds,hDlg);
SendMessage(GetParent(hDlg),PSM_UNCHANGED,(WPARAM)hDlg,(LPARAM)0);
@@ -1358,14 +1314,14 @@ INT_PTR CALLBACK DlgProcPOP3AccPopup(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa
HPOP3ACCOUNT temp = ActualAccount;
SendDlgItemMessage(hDlg,IDC_COMBOACCOUNT,CB_RESETCONTENT,0,(LPARAM)0);
- if(POP3Plugin->FirstAccount!=NULL)
+ if (POP3Plugin->FirstAccount!=NULL)
for(ActualAccount=(HPOP3ACCOUNT)POP3Plugin->FirstAccount;ActualAccount!=NULL;ActualAccount=(HPOP3ACCOUNT)ActualAccount->Next)
- if(ActualAccount->Name!=NULL)
- SendDlgItemMessage(hDlg,IDC_COMBOACCOUNT,CB_ADDSTRING,0,(LPARAM)ActualAccount->Name);
+ if (ActualAccount->Name!=NULL)
+ SendDlgItemMessageA(hDlg,IDC_COMBOACCOUNT,CB_ADDSTRING,0,(LPARAM)ActualAccount->Name);
ActualAccount = temp;
- if(ActualAccount != NULL)
+ if (ActualAccount != NULL)
{
SendDlgItemMessage(hDlg,IDC_COMBOACCOUNT,CB_SETCURSEL,(WPARAM)index,(LPARAM)ActualAccount->Name);
DlgShowAccount(hDlg,(WPARAM)M_SHOWACTUAL,(LPARAM)ActualAccount);
@@ -1392,11 +1348,11 @@ INT_PTR CALLBACK DlgProcPOP3AccPopup(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa
{
case CBN_KILLFOCUS:
- GetDlgItemText(hDlg,IDC_COMBOACCOUNT,DlgInput,sizeof(DlgInput)/sizeof(TCHAR));
- if(NULL==(ActualAccount=(HPOP3ACCOUNT)CallService(MS_YAMN_FINDACCOUNTBYNAME,(WPARAM)POP3Plugin,(LPARAM)DlgInput)))
+ GetDlgItemTextA(hDlg,IDC_COMBOACCOUNT,DlgInput,sizeof(DlgInput));
+ if (NULL==(ActualAccount=(HPOP3ACCOUNT)CallService(MS_YAMN_FINDACCOUNTBYNAME,(WPARAM)POP3Plugin,(LPARAM)DlgInput)))
{
DlgSetItemText(hDlg,(WPARAM)IDC_STTIMELEFT,(LPARAM)NULL);
- if(lstrlen(DlgInput))
+ if (lstrlenA(DlgInput))
DlgEnableAccountPopup(hDlg,(WPARAM)TRUE,(LPARAM)TRUE);
else
DlgEnableAccountPopup(hDlg,(WPARAM)FALSE,(LPARAM)FALSE);
@@ -1409,9 +1365,9 @@ INT_PTR CALLBACK DlgProcPOP3AccPopup(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa
}
break;
case CBN_SELCHANGE:
- if(CB_ERR!=(Result=SendDlgItemMessage(hDlg,IDC_COMBOACCOUNT,CB_GETCURSEL,0,0)))
- SendDlgItemMessage(hDlg,IDC_COMBOACCOUNT,CB_GETLBTEXT,(WPARAM)Result,(LPARAM)DlgInput);
- if((Result==CB_ERR) || (NULL==(ActualAccount=(HPOP3ACCOUNT)CallService(MS_YAMN_FINDACCOUNTBYNAME,(WPARAM)POP3Plugin,(LPARAM)DlgInput))))
+ if (CB_ERR!=(Result=SendDlgItemMessage(hDlg,IDC_COMBOACCOUNT,CB_GETCURSEL,0,0)))
+ SendDlgItemMessageA(hDlg,IDC_COMBOACCOUNT,CB_GETLBTEXT,(WPARAM)Result,(LPARAM)DlgInput);
+ if ((Result==CB_ERR) || (NULL==(ActualAccount=(HPOP3ACCOUNT)CallService(MS_YAMN_FINDACCOUNTBYNAME,(WPARAM)POP3Plugin,(LPARAM)DlgInput))))
{
DlgSetItemText(hDlg,(WPARAM)IDC_STTIMELEFT,(LPARAM)NULL);
}
@@ -1428,7 +1384,7 @@ INT_PTR CALLBACK DlgProcPOP3AccPopup(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa
{
int sel = SendDlgItemMessage(hDlg,IDC_COMBOCP,CB_GETCURSEL,0,0);
CPINFOEX info; GetCPInfoEx(CodePageNamesSupp[sel].CP,0,&info);
- DlgSetItemText(hDlg,(WPARAM)IDC_STSTATUS,(LPARAM)info.CodePageName);
+ DlgSetItemTextT(hDlg, IDC_STSTATUS, info.CodePageName);
}
case IDC_RADIOPOPN:
case IDC_RADIOPOP1:
@@ -1440,7 +1396,7 @@ INT_PTR CALLBACK DlgProcPOP3AccPopup(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa
case IDC_CPFT:
case IDC_CPNB:
case IDC_CPNT:
- if(HIWORD(wParam)!=CPN_COLOURCHANGED)
+ if (HIWORD(wParam)!=CPN_COLOURCHANGED)
break;
case IDC_CHECKCOL:
case IDC_CHECKFCOL:
@@ -1456,12 +1412,12 @@ INT_PTR CALLBACK DlgProcPOP3AccPopup(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa
case IDC_PREVIEW:
{
- POPUPDATA Tester;
- POPUPDATA TesterF;
- POPUPDATA TesterN;
- BOOL TesterC=(IsDlgButtonChecked(hDlg,IDC_CHECKCOL)==BST_CHECKED);
- BOOL TesterFC=(IsDlgButtonChecked(hDlg,IDC_CHECKFCOL)==BST_CHECKED);
- BOOL TesterNC=(IsDlgButtonChecked(hDlg,IDC_CHECKNCOL)==BST_CHECKED);
+ POPUPDATAT Tester;
+ POPUPDATAT TesterF;
+ POPUPDATAT TesterN;
+ BOOL TesterC = (IsDlgButtonChecked(hDlg,IDC_CHECKCOL)==BST_CHECKED);
+ BOOL TesterFC = (IsDlgButtonChecked(hDlg,IDC_CHECKFCOL)==BST_CHECKED);
+ BOOL TesterNC = (IsDlgButtonChecked(hDlg,IDC_CHECKNCOL)==BST_CHECKED);
ZeroMemory(&Tester,sizeof(Tester));
ZeroMemory(&TesterF,sizeof(TesterF));
@@ -1473,13 +1429,13 @@ INT_PTR CALLBACK DlgProcPOP3AccPopup(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa
TesterF.lchIcon=hYamnIcons[3];
TesterN.lchIcon=hYamnIcons[1];
- lstrcpy(Tester.lpzContactName,Translate("Account Test"));
- lstrcpy(TesterF.lpzContactName,Translate("Account Test (failed)"));
- lstrcpy(TesterN.lpzContactName,Translate("Account Test"));
- lstrcpy(Tester.lpzText,Translate("You have N new mail messages"));
- lstrcpy(TesterF.lpzText,Translate("Connection failed message"));
- lstrcpy(TesterN.lpzText,Translate("No new mail message"));
- if(TesterC)
+ lstrcpy(Tester.lptzContactName,TranslateT("Account Test"));
+ lstrcpy(TesterF.lptzContactName,TranslateT("Account Test (failed)"));
+ lstrcpy(TesterN.lptzContactName,TranslateT("Account Test"));
+ lstrcpy(Tester.lptzText,TranslateT("You have N new mail messages"));
+ lstrcpy(TesterF.lptzText,TranslateT("Connection failed message"));
+ lstrcpy(TesterN.lptzText,TranslateT("No new mail message"));
+ if (TesterC)
{
Tester.colorBack=SendDlgItemMessage(hDlg,IDC_CPB,CPM_GETCOLOUR,0,0);
Tester.colorText=SendDlgItemMessage(hDlg,IDC_CPT,CPM_GETCOLOUR,0,0);
@@ -1489,7 +1445,7 @@ INT_PTR CALLBACK DlgProcPOP3AccPopup(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa
Tester.colorBack=GetSysColor(COLOR_BTNFACE);
Tester.colorText=GetSysColor(COLOR_WINDOWTEXT);
}
- if(TesterFC)
+ if (TesterFC)
{
TesterF.colorBack=SendDlgItemMessage(hDlg,IDC_CPFB,CPM_GETCOLOUR,0,0);
TesterF.colorText=SendDlgItemMessage(hDlg,IDC_CPFT,CPM_GETCOLOUR,0,0);
@@ -1499,7 +1455,7 @@ INT_PTR CALLBACK DlgProcPOP3AccPopup(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa
TesterF.colorBack=GetSysColor(COLOR_BTNFACE);
TesterF.colorText=GetSysColor(COLOR_WINDOWTEXT);
}
- if(TesterNC)
+ if (TesterNC)
{
TesterN.colorBack=SendDlgItemMessage(hDlg,IDC_CPNB,CPM_GETCOLOUR,0,0);
TesterN.colorText=SendDlgItemMessage(hDlg,IDC_CPNT,CPM_GETCOLOUR,0,0);
@@ -1516,11 +1472,11 @@ INT_PTR CALLBACK DlgProcPOP3AccPopup(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa
TesterF.PluginData=NULL;
TesterN.PluginData=NULL;
- if(IsDlgButtonChecked(hDlg,IDC_CHECKPOP)==BST_CHECKED)
+ if (IsDlgButtonChecked(hDlg,IDC_CHECKPOP)==BST_CHECKED)
CallService(MS_POPUP_ADDPOPUP,(WPARAM)&Tester,0);
- if(IsDlgButtonChecked(hDlg,IDC_CHECKFPOP)==BST_CHECKED)
+ if (IsDlgButtonChecked(hDlg,IDC_CHECKFPOP)==BST_CHECKED)
CallService(MS_POPUP_ADDPOPUP,(WPARAM)&TesterF,0);
- if(IsDlgButtonChecked(hDlg,IDC_CHECKNPOP)==BST_CHECKED)
+ if (IsDlgButtonChecked(hDlg,IDC_CHECKNPOP)==BST_CHECKED)
CallService(MS_POPUP_ADDPOPUP,(WPARAM)&TesterN,0);
Changed=TRUE;
}
@@ -1553,7 +1509,7 @@ INT_PTR CALLBACK DlgProcPOP3AccPopup(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa
break;
}
- if(HIWORD(wParam)==EN_CHANGE)
+ if (HIWORD(wParam)==EN_CHANGE)
Changed=TRUE;
break;
}
@@ -1571,44 +1527,44 @@ INT_PTR CALLBACK DlgProcPOP3AccPopup(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa
BOOL CheckPopN;
UINT Time,TimeN,TimeF;
- if(GetDlgItemText(hDlg,IDC_COMBOACCOUNT,Text,sizeof(Text)/sizeof(TCHAR)))
+ if (GetDlgItemText(hDlg,IDC_COMBOACCOUNT,Text,sizeof(Text)/sizeof(TCHAR)))
{
- CheckPopup=(IsDlgButtonChecked(hDlg,IDC_CHECKPOP)==BST_CHECKED);
- CheckPopupW=(IsDlgButtonChecked(hDlg,IDC_CHECKCOL)==BST_CHECKED);
+ CheckPopup = (IsDlgButtonChecked(hDlg,IDC_CHECKPOP)==BST_CHECKED);
+ CheckPopupW = (IsDlgButtonChecked(hDlg,IDC_CHECKCOL)==BST_CHECKED);
- CheckFPopup=(IsDlgButtonChecked(hDlg,IDC_CHECKFPOP)==BST_CHECKED);
- CheckFPopupW=(IsDlgButtonChecked(hDlg,IDC_CHECKFCOL)==BST_CHECKED);
+ CheckFPopup = (IsDlgButtonChecked(hDlg,IDC_CHECKFPOP)==BST_CHECKED);
+ CheckFPopupW = (IsDlgButtonChecked(hDlg,IDC_CHECKFCOL)==BST_CHECKED);
- CheckNPopup=(IsDlgButtonChecked(hDlg,IDC_CHECKNPOP)==BST_CHECKED);
- CheckNPopupW=(IsDlgButtonChecked(hDlg,IDC_CHECKNCOL)==BST_CHECKED);
+ CheckNPopup = (IsDlgButtonChecked(hDlg,IDC_CHECKNPOP)==BST_CHECKED);
+ CheckNPopupW = (IsDlgButtonChecked(hDlg,IDC_CHECKNCOL)==BST_CHECKED);
- CheckPopN=(IsDlgButtonChecked(hDlg,IDC_RADIOPOPN)==BST_CHECKED);
+ CheckPopN = (IsDlgButtonChecked(hDlg,IDC_RADIOPOPN)==BST_CHECKED);
Time=GetDlgItemInt(hDlg,IDC_EDITPOPS,&Translated,FALSE);
- if(!Translated)
+ if (!Translated)
{
- MessageBox(hDlg,Translate("This is not a valid number value"),Translate("Input error"),MB_OK);
+ MessageBox(hDlg,TranslateT("This is not a valid number value"),TranslateT("Input error"),MB_OK);
SetFocus(GetDlgItem(hDlg,IDC_EDITPOPS));
break;
}
TimeN=GetDlgItemInt(hDlg,IDC_EDITNPOPS,&Translated,FALSE);
- if(!Translated)
+ if (!Translated)
{
- MessageBox(hDlg,Translate("This is not a valid number value"),Translate("Input error"),MB_OK);
+ MessageBox(hDlg,TranslateT("This is not a valid number value"),TranslateT("Input error"),MB_OK);
SetFocus(GetDlgItem(hDlg,IDC_EDITNPOPS));
break;
}
TimeF=GetDlgItemInt(hDlg,IDC_EDITFPOPS,&Translated,FALSE);
- if(!Translated)
+ if (!Translated)
{
- MessageBox(hDlg,Translate("This is not a valid number value"),Translate("Input error"),MB_OK);
+ MessageBox(hDlg,TranslateT("This is not a valid number value"),TranslateT("Input error"),MB_OK);
SetFocus(GetDlgItem(hDlg,IDC_EDITFPOPS));
break;
}
- DlgSetItemText(hDlg,(WPARAM)IDC_STTIMELEFT,(LPARAM)Translate("Please wait while no account is in use."));
+ DlgSetItemTextT(hDlg, IDC_STTIMELEFT, TranslateT("Please wait while no account is in use."));
ActualAccount->Flags=
(ActualAccount->Flags & YAMN_ACC_ENA) |
@@ -1666,7 +1622,7 @@ INT_PTR CALLBACK DlgProcPOP3AccPopup(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa
#endif
WriteDoneSO(POP3Plugin->AccountBrowserSO);
-// if(0==WritePOP3Accounts())
+// if (0==WritePOP3Accounts())
// Beep(500,100);
WritePOP3Accounts();
RefreshContact();
@@ -1679,7 +1635,7 @@ INT_PTR CALLBACK DlgProcPOP3AccPopup(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa
}
break;
}
- if(Changed)
+ if (Changed)
SendMessage(GetParent(hDlg),PSM_CHANGED,0,0);
return FALSE;
}
diff --git a/plugins/YAMN/proto/pop3/pop3opt.h b/plugins/YAMN/proto/pop3/pop3opt.h
index 291ff03efd..c828c221e0 100644
--- a/plugins/YAMN/proto/pop3/pop3opt.h
+++ b/plugins/YAMN/proto/pop3/pop3opt.h
@@ -14,12 +14,6 @@ BOOL DlgShowAccount(HWND hDlg,WPARAM wParam,LPARAM lParam);
//Sets colors to match colors of actual account
BOOL DlgShowAccountColors(HWND hDlg,WPARAM wParam,LPARAM lParam);
-//Sets dialog item text
-BOOL DlgSetItemText(HWND hDlg,WPARAM wParam,LPARAM lParam);
-
-//Sets dialog item text in Unicode
-BOOL DlgSetItemTextW(HWND hDlg,WPARAM wParam,LPARAM lParam);
-
//Options dialog procedure
INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
@@ -35,4 +29,14 @@ INT_PTR CALLBACK DlgProcPOP3AccPopup(HWND hDlg, UINT msg, WPARAM wParam, LPARAM
//Initializes POP3 options for Miranda
int POP3OptInit(WPARAM wParam,LPARAM lParam);
+//Sets dialog item text
+BOOL DlgSetItemText(HWND hDlg,WPARAM wParam,const char*);
+BOOL DlgSetItemTextW(HWND hDlg,WPARAM wParam,const WCHAR*);
+
+#if defined( _UNICODE )
+ #define DlgSetItemTextT DlgSetItemTextW
+#else
+ #define DlgSetItemTextT DlgSetItemText
+#endif
+
#endif
diff --git a/plugins/YAMN/protoplugin.cpp b/plugins/YAMN/protoplugin.cpp
index e89b8790ab..9e721b2b31 100644
--- a/plugins/YAMN/protoplugin.cpp
+++ b/plugins/YAMN/protoplugin.cpp
@@ -4,38 +4,7 @@
* (c) majvan 2002-2004
*/
-#if !defined(_WIN64)
- #include "filter/simple/AggressiveOptimize.h"
-#endif
-#include <windows.h>
-#include <tchar.h>
-#include <stdio.h>
-#include <newpluginapi.h>
-#include <m_database.h>
-#include "m_yamn.h"
-#include "m_protoplugin.h"
-#include "m_synchro.h"
-#include "debug.h"
-
-//- imported ---------------------------------------------------------------------------------------
-//--------------------------------------------------------------------------------------------------
-
-extern WCHAR *UserDirectory; //e.g. "F:\WINNT\Profiles\UserXYZ"
-extern WCHAR *ProfileName; //e.g. "majvan"
-extern SWMRG *AccountBrowserSO;
-extern LPCRITICAL_SECTION PluginRegCS;
-extern YAMN_VARIABLES YAMNVar;
-//From synchro.cpp
-extern BOOL WINAPI SWMRGInitialize(PSWMRG,TCHAR *);
-extern void WINAPI SWMRGDelete(PSWMRG);
-extern DWORD WINAPI SWMRGWaitToWrite(PSWMRG pSWMRG,DWORD dwTimeout);
-extern void WINAPI SWMRGDoneWriting(PSWMRG pSWMRG);
-extern DWORD WINAPI SWMRGWaitToRead(PSWMRG pSWMRG, DWORD dwTimeout);
-extern void WINAPI SWMRGDoneReading(PSWMRG pSWMRG);
-//From account.cpp
-extern int StopAccounts(HYAMNPROTOPLUGIN Plugin);
-extern int DeleteAccounts(HYAMNPROTOPLUGIN Plugin);
-extern int WaitForAllAccounts(HYAMNPROTOPLUGIN Plugin,BOOL GetAccountBrowserAccess);
+#include "yamn.h"
//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
@@ -88,11 +57,11 @@ INT_PTR RegisterProtocolPluginSvc(WPARAM wParam,LPARAM lParam)
PYAMN_PROTOREGISTRATION Registration=(PYAMN_PROTOREGISTRATION)wParam;
HYAMNPROTOPLUGIN Plugin;
- if(lParam!=YAMN_PROTOREGISTRATIONVERSION)
+ if (lParam!=YAMN_PROTOREGISTRATIONVERSION)
return 0;
- if((Registration->Name==NULL) || (Registration->Ver==NULL))
+ if ((Registration->Name==NULL) || (Registration->Ver==NULL))
return (INT_PTR)NULL;
- if(NULL==(Plugin=new YAMN_PROTOPLUGIN))
+ if (NULL==(Plugin=new YAMN_PROTOPLUGIN))
return (INT_PTR)NULL;
Plugin->PluginInfo=Registration;
@@ -115,13 +84,13 @@ int WINAPI SetProtocolPluginFcnImportFcn(HYAMNPROTOPLUGIN Plugin,PYAMN_PROTOIMPO
{
PYAMN_PROTOPLUGINQUEUE Parser;
- if(YAMNFcnVer!=YAMN_PROTOIMPORTFCNVERSION)
+ if (YAMNFcnVer!=YAMN_PROTOIMPORTFCNVERSION)
return 0;
- if(YAMNMailFcnVer!=YAMN_MAILIMPORTFCNVERSION)
+ if (YAMNMailFcnVer!=YAMN_MAILIMPORTFCNVERSION)
return 0;
- if(YAMNFcn==NULL)
+ if (YAMNFcn==NULL)
return 0;
- if(YAMNMailFcn==NULL)
+ if (YAMNMailFcn==NULL)
return 0;
#ifdef DEBUG_SYNCHRO
@@ -130,10 +99,10 @@ int WINAPI SetProtocolPluginFcnImportFcn(HYAMNPROTOPLUGIN Plugin,PYAMN_PROTOIMPO
Plugin->Fcn=YAMNFcn;
Plugin->MailFcn=YAMNMailFcn;
- EnterCriticalSection(PluginRegCS);
+ EnterCriticalSection(&PluginRegCS);
//We add protocol to the protocol list
for(Parser=FirstProtoPlugin;Parser!=NULL && Parser->Next!=NULL;Parser=Parser->Next);
- if(Parser==NULL)
+ if (Parser==NULL)
{
FirstProtoPlugin=new YAMN_PROTOPLUGINQUEUE;
Parser=FirstProtoPlugin;
@@ -147,7 +116,7 @@ int WINAPI SetProtocolPluginFcnImportFcn(HYAMNPROTOPLUGIN Plugin,PYAMN_PROTOIMPO
Parser->Plugin=Plugin;
Parser->Next=NULL;
- LeaveCriticalSection(PluginRegCS);
+ LeaveCriticalSection(&PluginRegCS);
return 1;
}
@@ -158,7 +127,7 @@ INT_PTR UnregisterProtocolPlugin(HYAMNPROTOPLUGIN Plugin)
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"Entering UnregisterProtocolPlugin\n");
#endif
- if(FirstProtoPlugin->Plugin==Plugin)
+ if (FirstProtoPlugin->Plugin==Plugin)
{
Found=FirstProtoPlugin;
FirstProtoPlugin=FirstProtoPlugin->Next;
@@ -166,7 +135,7 @@ INT_PTR UnregisterProtocolPlugin(HYAMNPROTOPLUGIN Plugin)
else
{
for(Parser=FirstProtoPlugin;(Parser->Next!=NULL) && (Plugin!=Parser->Next->Plugin);Parser=Parser->Next);
- if(Parser->Next!=NULL)
+ if (Parser->Next!=NULL)
{
Found=Parser->Next;
Parser->Next=Parser->Next->Next;
@@ -174,11 +143,11 @@ INT_PTR UnregisterProtocolPlugin(HYAMNPROTOPLUGIN Plugin)
else
Found=NULL;
}
- if(Found!=NULL)
+ if (Found!=NULL)
{
StopAccounts(Plugin);
DeleteAccounts(Plugin);
- if(Plugin->Fcn->UnLoadFcn!=NULL)
+ if (Plugin->Fcn->UnLoadFcn!=NULL)
Plugin->Fcn->UnLoadFcn((void *)0);
delete Found->Plugin->AccountBrowserSO;
@@ -198,20 +167,20 @@ INT_PTR UnregisterProtocolPluginSvc(WPARAM wParam,LPARAM lParam)
{
HYAMNPROTOPLUGIN Plugin=(HYAMNPROTOPLUGIN)wParam;
- EnterCriticalSection(PluginRegCS);
+ EnterCriticalSection(&PluginRegCS);
UnregisterProtocolPlugin(Plugin);
- LeaveCriticalSection(PluginRegCS);
+ LeaveCriticalSection(&PluginRegCS);
return 1;
}
INT_PTR UnregisterProtoPlugins()
{
- EnterCriticalSection(PluginRegCS);
+ EnterCriticalSection(&PluginRegCS);
//We remove protocols from the protocol list
while(FirstProtoPlugin!=NULL)
UnregisterProtocolPlugin(FirstProtoPlugin->Plugin);
- LeaveCriticalSection(PluginRegCS);
+ LeaveCriticalSection(&PluginRegCS);
return 1;
}
@@ -219,7 +188,7 @@ INT_PTR GetFileNameWSvc(WPARAM wParam,LPARAM)
{
WCHAR *FileName;
- if(NULL==(FileName=new WCHAR[MAX_PATH]))
+ if (NULL==(FileName=new WCHAR[MAX_PATH]))
return NULL;
swprintf(FileName,FileName2,UserDirectory,(WCHAR *)wParam,ProfileName);
// MessageBoxW(NULL,FileName,L"GetFileNameW",MB_OK);
@@ -228,30 +197,23 @@ INT_PTR GetFileNameWSvc(WPARAM wParam,LPARAM)
INT_PTR GetFileNameASvc(WPARAM wParam,LPARAM)
{
- WCHAR *ConvertedInput;
WCHAR *FileName;
-
- if(NULL==(FileName=new WCHAR[MAX_PATH]))
+ if (NULL==(FileName=new WCHAR[MAX_PATH]))
return NULL;
- if(NULL==(ConvertedInput=new WCHAR[MAX_PATH]))
- {
- delete[] FileName;
- return NULL;
- }
-// Convert input string to unicode
- MultiByteToWideChar(CP_ACP,MB_USEGLYPHCHARS,(char *)wParam,-1,ConvertedInput,(int)strlen((char *)wParam)+1);
+ WCHAR ConvertedInput[ MAX_PATH ];
+ char* szSrc = (char *)wParam;
- swprintf(FileName,FileName2,UserDirectory,ConvertedInput,ProfileName);
-// MessageBoxW(NULL,FileName,L"GetFileNameA",MB_OK);
- delete[] ConvertedInput;
+ // Convert input string to unicode
+ MultiByteToWideChar(CP_ACP,MB_USEGLYPHCHARS,szSrc,-1,ConvertedInput,strlen(szSrc)+1);
+ mir_sntprintf(FileName,MAX_PATH, FileName2,UserDirectory,ConvertedInput,ProfileName);
return (INT_PTR)FileName;
}
INT_PTR DeleteFileNameSvc(WPARAM wParam,LPARAM)
{
- if((WCHAR *)wParam!=NULL)
+ if ((WCHAR *)wParam!=NULL)
delete[] (WCHAR *)wParam;
return 0;
diff --git a/plugins/YAMN/services.cpp b/plugins/YAMN/services.cpp
index 60b24c2816..120726d041 100644
--- a/plugins/YAMN/services.cpp
+++ b/plugins/YAMN/services.cpp
@@ -1,17 +1,11 @@
-#include "main.h"
#include "yamn.h"
+#include "main.h"
// External icon var for icolib support
-
-//MessageWndCS
-//We want to send messages to all windows in the queue
-//When we send messages, no other window can register itself to the queue for receiving messages
-extern LPCRITICAL_SECTION MessageWndCS;
-
//Plugin registration CS
//Used if we add (register) plugin to YAMN plugins and when we browse through registered plugins
-extern LPCRITICAL_SECTION PluginRegCS;
+extern CRITICAL_SECTION PluginRegCS;
//AccountWriterCS
//We want to store number of writers of Accounts (number of Accounts used for writing)
@@ -42,18 +36,18 @@ extern HYAMNPROTOPLUGIN POP3Plugin;
static INT_PTR Service_GetCaps(WPARAM wParam, LPARAM lParam)
{
- if(wParam==PFLAGNUM_4)
+ if (wParam==PFLAGNUM_4)
return PF4_NOCUSTOMAUTH;
- if(wParam==PFLAG_UNIQUEIDTEXT)
+ if (wParam==PFLAG_UNIQUEIDTEXT)
return (INT_PTR) Translate("Nick");
- if(wParam==PFLAG_MAXLENOFMESSAGE)
+ if (wParam==PFLAG_MAXLENOFMESSAGE)
return 400;
- if(wParam==PFLAG_UNIQUEIDSETTING)
+ if (wParam==PFLAG_UNIQUEIDSETTING)
return (INT_PTR) "Id";
- if(wParam==PFLAGNUM_2)
+ if (wParam==PFLAGNUM_2)
return PF2_ONLINE | PF2_SHORTAWAY | PF2_LONGAWAY | PF2_LIGHTDND;
- if(wParam==PFLAGNUM_5)
- if(DBGetContactSettingByte(NULL, YAMN_DBMODULE, YAMN_SHOWASPROTO, 1))
+ if (wParam==PFLAGNUM_5)
+ if (DBGetContactSettingByte(NULL, YAMN_DBMODULE, YAMN_SHOWASPROTO, 1))
return PF2_SHORTAWAY | PF2_LONGAWAY | PF2_LIGHTDND;
else
return PF2_ONLINE | PF2_SHORTAWAY | PF2_LONGAWAY | PF2_LIGHTDND;
@@ -79,7 +73,7 @@ static INT_PTR Service_SetStatus(WPARAM wParam,LPARAM lParam)
static INT_PTR Service_GetName(WPARAM wParam, LPARAM lParam)
{
- lstrcpyn((char *) lParam, ProtoName, wParam);;
+ lstrcpynA((char *) lParam, ProtoName, wParam);;
return 0;
}
@@ -111,12 +105,12 @@ static INT_PTR ContactApplication(WPARAM wParam, LPARAM lParam)
HACCOUNT ActualAccount;
szProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0);
- if(szProto != NULL && strcmp(szProto, ProtoName)==0)
+ if (szProto != NULL && strcmp(szProto, ProtoName)==0)
{
- if(!DBGetContactSetting((HANDLE) wParam,ProtoName,"Id",&dbv))
+ if (!DBGetContactSetting((HANDLE) wParam,ProtoName,"Id",&dbv))
{
ActualAccount=(HACCOUNT) CallService(MS_YAMN_FINDACCOUNTBYNAME,(WPARAM)POP3Plugin,(LPARAM)dbv.pszVal);
- if(ActualAccount != NULL)
+ if (ActualAccount != NULL)
{
PROCESS_INFORMATION pi;
STARTUPINFOW si;
@@ -127,25 +121,25 @@ static INT_PTR ContactApplication(WPARAM wParam, LPARAM lParam)
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"ContactApplication:ActualAccountSO-read wait\n");
#endif
- if(WAIT_OBJECT_0==WaitToReadFcn(ActualAccount->AccountAccessSO))
+ if (WAIT_OBJECT_0==WaitToReadFcn(ActualAccount->AccountAccessSO))
{
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"ContactApplication:ualAccountSO-read enter\n");
#endif
- if(ActualAccount->NewMailN.App!=NULL)
+ if (ActualAccount->NewMailN.App!=NULL)
{
WCHAR *Command;
- if(ActualAccount->NewMailN.AppParam!=NULL)
+ if (ActualAccount->NewMailN.AppParam!=NULL)
Command=new WCHAR[wcslen(ActualAccount->NewMailN.App)+wcslen(ActualAccount->NewMailN.AppParam)+6];
else
Command=new WCHAR[wcslen(ActualAccount->NewMailN.App)+6];
- if(Command!=NULL)
+ if (Command!=NULL)
{
lstrcpyW(Command,L"\"");
lstrcatW(Command,ActualAccount->NewMailN.App);
lstrcatW(Command,L"\" ");
- if(ActualAccount->NewMailN.AppParam!=NULL)
+ if (ActualAccount->NewMailN.AppParam!=NULL)
lstrcatW(Command,ActualAccount->NewMailN.AppParam);
CreateProcessW(NULL,Command,NULL,NULL,FALSE,NORMAL_PRIORITY_CLASS,NULL,NULL,&si,&pi);
delete[] Command;
@@ -175,19 +169,19 @@ static INT_PTR AccountMailCheck(WPARAM wParam, LPARAM lParam){
HANDLE ThreadRunningEV;
DWORD tid;
// copy/paste make mistakes
- if(ActualAccount != NULL)
+ if (ActualAccount != NULL)
{
//we use event to signal, that running thread has all needed stack parameters copied
- if(NULL==(ThreadRunningEV=CreateEvent(NULL,FALSE,FALSE,NULL)))
+ if (NULL==(ThreadRunningEV=CreateEvent(NULL,FALSE,FALSE,NULL)))
return 0;
//if we want to close miranda, we get event and do not run pop3 checking anymore
- if(WAIT_OBJECT_0==WaitForSingleObject(ExitEV,0))
+ if (WAIT_OBJECT_0==WaitForSingleObject(ExitEV,0))
return 0;
- EnterCriticalSection(PluginRegCS);
+ EnterCriticalSection(&PluginRegCS);
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"AccountCheck:ActualAccountSO-read wait\n");
#endif
- if(WAIT_OBJECT_0!=SWMRGWaitToRead(ActualAccount->AccountAccessSO,0))
+ if (WAIT_OBJECT_0!=SWMRGWaitToRead(ActualAccount->AccountAccessSO,0))
{
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"ForceCheck:ActualAccountSO-read wait failed\n");
@@ -198,13 +192,13 @@ static INT_PTR AccountMailCheck(WPARAM wParam, LPARAM lParam){
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"ForceCheck:ActualAccountSO-read enter\n");
#endif
- if((ActualAccount->Flags & YAMN_ACC_ENA) && ActualAccount->Plugin->Fcn->SynchroFcnPtr)
+ if ((ActualAccount->Flags & YAMN_ACC_ENA) && ActualAccount->Plugin->Fcn->SynchroFcnPtr)
{
struct CheckParam ParamToPlugin={YAMN_CHECKVERSION,ThreadRunningEV,ActualAccount,lParam?YAMN_FORCECHECK:YAMN_NORMALCHECK,(void *)0,NULL};
HANDLE NewThread;
ActualAccount->TimeLeft=ActualAccount->Interval;
- if(NewThread=CreateThread(NULL,0,(YAMN_STANDARDFCN)ActualAccount->Plugin->Fcn->SynchroFcnPtr,&ParamToPlugin,0,&tid))
+ if (NewThread=CreateThread(NULL,0,(YAMN_STANDARDFCN)ActualAccount->Plugin->Fcn->SynchroFcnPtr,&ParamToPlugin,0,&tid))
{
WaitForSingleObject(ThreadRunningEV,INFINITE);
CloseHandle(NewThread);
@@ -217,7 +211,7 @@ static INT_PTR AccountMailCheck(WPARAM wParam, LPARAM lParam){
}
ReadDoneFcn(ActualAccount->AccountAccessSO);
}
- LeaveCriticalSection(PluginRegCS);
+ LeaveCriticalSection(&PluginRegCS);
CloseHandle(ThreadRunningEV);
}
return 0;
@@ -233,24 +227,24 @@ static INT_PTR ContactMailCheck(WPARAM wParam, LPARAM lParam)
DWORD tid;
szProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0);
- if(szProto != NULL && strcmp(szProto, ProtoName)==0)
+ if (szProto != NULL && strcmp(szProto, ProtoName)==0)
{
- if(!DBGetContactSetting((HANDLE) wParam,ProtoName,"Id",&dbv))
+ if (!DBGetContactSetting((HANDLE) wParam,ProtoName,"Id",&dbv))
{
ActualAccount=(HACCOUNT) CallService(MS_YAMN_FINDACCOUNTBYNAME,(WPARAM)POP3Plugin,(LPARAM)dbv.pszVal);
- if(ActualAccount != NULL)
+ if (ActualAccount != NULL)
{
//we use event to signal, that running thread has all needed stack parameters copied
- if(NULL==(ThreadRunningEV=CreateEvent(NULL,FALSE,FALSE,NULL)))
+ if (NULL==(ThreadRunningEV=CreateEvent(NULL,FALSE,FALSE,NULL)))
return 0;
//if we want to close miranda, we get event and do not run pop3 checking anymore
- if(WAIT_OBJECT_0==WaitForSingleObject(ExitEV,0))
+ if (WAIT_OBJECT_0==WaitForSingleObject(ExitEV,0))
return 0;
- EnterCriticalSection(PluginRegCS);
+ EnterCriticalSection(&PluginRegCS);
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"ForceCheck:ActualAccountSO-read wait\n");
#endif
- if(WAIT_OBJECT_0!=WaitToReadFcn(ActualAccount->AccountAccessSO))
+ if (WAIT_OBJECT_0!=WaitToReadFcn(ActualAccount->AccountAccessSO))
{
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"ForceCheck:ActualAccountSO-read wait failed\n");
@@ -261,15 +255,15 @@ static INT_PTR ContactMailCheck(WPARAM wParam, LPARAM lParam)
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"ForceCheck:ActualAccountSO-read enter\n");
#endif
- if((ActualAccount->Flags & YAMN_ACC_ENA) && (ActualAccount->StatusFlags & YAMN_ACC_FORCE)) //account cannot be forced to check
+ if ((ActualAccount->Flags & YAMN_ACC_ENA) && (ActualAccount->StatusFlags & YAMN_ACC_FORCE)) //account cannot be forced to check
{
- if(ActualAccount->Plugin->Fcn->ForceCheckFcnPtr==NULL)
+ if (ActualAccount->Plugin->Fcn->ForceCheckFcnPtr==NULL)
{
ReadDoneFcn(ActualAccount->AccountAccessSO);
}
struct CheckParam ParamToPlugin={YAMN_CHECKVERSION,ThreadRunningEV,ActualAccount,YAMN_FORCECHECK,(void *)0,NULL};
- if(NULL==CreateThread(NULL,0,(YAMN_STANDARDFCN)ActualAccount->Plugin->Fcn->ForceCheckFcnPtr,&ParamToPlugin,0,&tid))
+ if (NULL==CreateThread(NULL,0,(YAMN_STANDARDFCN)ActualAccount->Plugin->Fcn->ForceCheckFcnPtr,&ParamToPlugin,0,&tid))
{
ReadDoneFcn(ActualAccount->AccountAccessSO);
}
@@ -278,7 +272,7 @@ static INT_PTR ContactMailCheck(WPARAM wParam, LPARAM lParam)
}
ReadDoneFcn(ActualAccount->AccountAccessSO);
}
- LeaveCriticalSection(PluginRegCS);
+ LeaveCriticalSection(&PluginRegCS);
CloseHandle(ThreadRunningEV);
}
DBFreeVariant(&dbv);
@@ -301,17 +295,17 @@ void MainMenuAccountClicked(WPARAM wParam, LPARAM lParam)
HACCOUNT ActualAccount;
szProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0);
- if(szProto != NULL && strcmp(szProto, ProtoName)==0)
+ if (szProto != NULL && strcmp(szProto, ProtoName)==0)
{
- if(!DBGetContactSetting((HANDLE) wParam,ProtoName,"Id",&dbv))
+ if (!DBGetContactSetting((HANDLE) wParam,ProtoName,"Id",&dbv))
{
ActualAccount=(HACCOUNT) CallService(MS_YAMN_FINDACCOUNTBYNAME,(WPARAM)POP3Plugin,(LPARAM)dbv.pszVal);
- if(ActualAccount != NULL)
+ if (ActualAccount != NULL)
{
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"Service_ContactDoubleclicked:ActualAccountSO-read wait\n");
#endif
- if(WAIT_OBJECT_0==WaitToReadFcn(ActualAccount->AccountAccessSO))
+ if (WAIT_OBJECT_0==WaitToReadFcn(ActualAccount->AccountAccessSO))
{
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"Service_ContactDoubleclicked:ActualAccountSO-read enter\n");
@@ -372,7 +366,6 @@ static HookDataType hookData[]={
{0,ME_TTB_MODULELOADED,AddTopToolbarIcon},
{0,ME_SYSTEM_MODULESLOADED,SystemModulesLoaded}, //pop3 plugin must be included after all miranda modules are loaded
{0,ME_OPT_INITIALISE,YAMNOptInitSvc},
- {0,ME_PLUGINUNINSTALLER_UNINSTALL,UninstallQuestionSvc},
{0,ME_SYSTEM_PRESHUTDOWN,Shutdown},
{0,ME_CLIST_DOUBLECLICKED, Service_ContactDoubleclicked},
{0,ME_SKIN2_ICONSCHANGED, IcoLibIconsChanged},
@@ -511,9 +504,9 @@ void RefreshContact(void)
for(Finder=POP3Plugin->FirstAccount;Finder!=NULL;Finder=Finder->Next)
{
- if(Finder->hContact != NULL)
+ if (Finder->hContact != NULL)
{
- if((Finder->Flags & YAMN_ACC_ENA) && (Finder->NewMailN.Flags & YAMN_ACC_CONT))
+ if ((Finder->Flags & YAMN_ACC_ENA) && (Finder->NewMailN.Flags & YAMN_ACC_CONT))
{
DBDeleteContactSetting(Finder->hContact, "CList", "Hidden");
}
@@ -524,7 +517,7 @@ void RefreshContact(void)
}
else
{
- if((Finder->Flags & YAMN_ACC_ENA) && (Finder->NewMailN.Flags & YAMN_ACC_CONT))
+ if ((Finder->Flags & YAMN_ACC_ENA) && (Finder->NewMailN.Flags & YAMN_ACC_CONT))
{
Finder->hContact =(HANDLE) CallService(MS_DB_CONTACT_ADD, 0, 0);
CallService(MS_PROTO_ADDTOCONTACT,(WPARAM)Finder->hContact,(LPARAM)ProtoName);
diff --git a/plugins/YAMN/synchro.cpp b/plugins/YAMN/synchro.cpp
index e791d5f799..e510d8bac9 100644
--- a/plugins/YAMN/synchro.cpp
+++ b/plugins/YAMN/synchro.cpp
@@ -4,17 +4,8 @@
*
* (c) majvan 2002-2004
*/
-#if !defined(_WIN64)
- #include "filter/simple/AggressiveOptimize.h"
-#endif
-#include <windows.h>
-#include "debug.h"
-#include "m_yamn.h"
-#include "m_synchro.h"
-#ifdef DEBUG_SYNCHRO
-#include <tchar.h>
-#include <stdio.h>
-#endif
+
+#include "yamn.h"
// Initializes a SWMRG structure. This structure must be
// initialized before any writer or reader threads attempt
@@ -51,16 +42,6 @@ DWORD WINAPI SWMRGWaitToRead(PSWMRG pSWMRG, DWORD dwTimeout);
// know when it no longer needs to read the shared data.
void WINAPI SWMRGDoneReading(PSWMRG pSWMRG);
-// WaitToWriteFcn
-// is used to wait for write access with SWMRG SO, but it also increments counter if successfull
-// returns WAIT_FAILED or WAIT_FINISH
-// when WAIT_FAILED, we should not begin to access datas, we are not in write-access mode
-DWORD WINAPI WaitToWriteFcn(PSWMRG SObject,PSCOUNTER SCounter=NULL);
-
-// WriteDoneFcn
-// is used to release write access with SWMRG SO, but it also decrements counter if successfull
-void WINAPI WriteDoneFcn(PSWMRG SObject,PSCOUNTER SCounter=NULL);
-
// WaitToReadFcn
// is used to wait for read access with SWMRG SO, but it also increments counter if successfull
// returns WAIT_FAILED or WAIT_FINISH
@@ -127,31 +108,31 @@ BOOL WINAPI SWMRGInitialize(PSWMRG pSWMRG,TCHAR *Name)
// Creates the automatic-reset event that is signalled when
// no writer threads are writing.
// Initially no reader threads are reading.
- if(Name!=NULL)
+ if (Name!=NULL)
Name[0]=(TCHAR)'W';
pSWMRG->hEventNoWriter=CreateEvent(NULL,FALSE,TRUE,Name);
// Creates the manual-reset event that is signalled when
// no reader threads are reading.
// Initially no reader threads are reading.
- if(Name!=NULL)
+ if (Name!=NULL)
Name[0]=(TCHAR)'R';
pSWMRG->hEventNoReaders=CreateEvent(NULL,TRUE,TRUE,Name);
// Initializes the variable that indicates the number of
// reader threads that are reading.
// Initially no reader threads are reading.
- if(Name!=NULL)
+ if (Name!=NULL)
Name[0]=(TCHAR)'C';
pSWMRG->hSemNumReaders=CreateSemaphore(NULL,0,0x7FFFFFFF,Name);
- if(Name!=NULL)
+ if (Name!=NULL)
Name[0]=(TCHAR)'F';
pSWMRG->hFinishEV=CreateEvent(NULL,TRUE,FALSE,Name);
// If a synchronization object could not be created,
// destroys any created objects and return failure.
- if((NULL==pSWMRG->hEventNoWriter) || (NULL==pSWMRG->hEventNoReaders) || (NULL==pSWMRG->hSemNumReaders) || (NULL==pSWMRG->hFinishEV))
+ if ((NULL==pSWMRG->hEventNoWriter) || (NULL==pSWMRG->hEventNoReaders) || (NULL==pSWMRG->hSemNumReaders) || (NULL==pSWMRG->hFinishEV))
{
SWMRGDelete(pSWMRG);
return FALSE;
@@ -170,13 +151,13 @@ DWORD WINAPI SWMRGWaitToWrite(PSWMRG pSWMRG,DWORD dwTimeout)
// But first we have to know if SWMRG structure is not about to delete
aHandles[0]=pSWMRG->hEventNoWriter;
aHandles[1]=pSWMRG->hEventNoReaders;
- if(WAIT_OBJECT_0==(dw=WaitForSingleObject(pSWMRG->hFinishEV,0)))
+ if (WAIT_OBJECT_0==(dw=WaitForSingleObject(pSWMRG->hFinishEV,0)))
return WAIT_FINISH;
- if(WAIT_FAILED==dw)
+ if (WAIT_FAILED==dw)
return dw;
dw=WaitForMultipleObjects(2,aHandles,TRUE,dwTimeout);
// if a request to delete became later, we should not catch it. Try once more to ask if account is not about to delete
- if((dw!=WAIT_FAILED) && (WAIT_OBJECT_0==(WaitForSingleObject(pSWMRG->hFinishEV,0))))
+ if ((dw!=WAIT_FAILED) && (WAIT_OBJECT_0==(WaitForSingleObject(pSWMRG->hFinishEV,0))))
{
SetEvent(pSWMRG->hEventNoWriter);
return WAIT_FINISH;
@@ -209,26 +190,26 @@ DWORD WINAPI SWMRGWaitToRead(PSWMRG pSWMRG, DWORD dwTimeout)
// We can read if no threads are writing.
// And there's not request to delete structure
- if(WAIT_OBJECT_0==(dw=WaitForSingleObject(pSWMRG->hFinishEV,0)))
+ if (WAIT_OBJECT_0==(dw=WaitForSingleObject(pSWMRG->hFinishEV,0)))
return WAIT_FINISH;
- if(WAIT_FAILED==dw)
+ if (WAIT_FAILED==dw)
return dw;
dw=WaitForSingleObject(pSWMRG->hEventNoWriter, dwTimeout);
// if a request to delete became later, we should not catch it. Try once more to ask if account is not about to delete
- if((dw!=WAIT_FAILED) && (WAIT_OBJECT_0==(WaitForSingleObject(pSWMRG->hFinishEV,0))))
+ if ((dw!=WAIT_FAILED) && (WAIT_OBJECT_0==(WaitForSingleObject(pSWMRG->hFinishEV,0))))
{
SetEvent(pSWMRG->hEventNoWriter);
return WAIT_FINISH;
}
- if(dw==WAIT_OBJECT_0)
+ if (dw==WAIT_OBJECT_0)
{
// This thread can read from the shared data.
// Increment the number of reader threads.
// But there can't be more than one thread incrementing readers,
// so this is why we use semaphore.
ReleaseSemaphore(pSWMRG->hSemNumReaders,1,&lPreviousCount);
- if(lPreviousCount==0)
+ if (lPreviousCount==0)
// If this is the first reader thread,
// set event to reflect this. Other reader threads can read, no writer thread can write.
ResetEvent(pSWMRG->hEventNoReaders);
@@ -262,7 +243,7 @@ void WINAPI SWMRGDoneReading(PSWMRG pSWMRG)
// If there are no remaining readers,
// set the event to relect this.
- if(lNumReaders==0)
+ if (lNumReaders==0)
// If there are no reader threads,
// set our event to reflect this.
SetEvent(pSWMRG->hEventNoReaders);
@@ -279,8 +260,8 @@ DWORD WINAPI WaitToWriteFcn(PSWMRG SObject,PSCOUNTER SCounter)
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"\tSO WaitToWrite: %x\n",SObject);
#endif
- if(WAIT_OBJECT_0==(EnterCode=SWMRGWaitToWrite(SObject,INFINITE)))
- if(SCounter!=NULL)
+ if (WAIT_OBJECT_0==(EnterCode=SWMRGWaitToWrite(SObject,INFINITE)))
+ if (SCounter!=NULL)
SCIncFcn(SCounter);
return EnterCode;
}
@@ -291,7 +272,7 @@ void WINAPI WriteDoneFcn(PSWMRG SObject,PSCOUNTER SCounter)
DebugLog(SynchroFile,"\tSO WriteDone: %x\n",SObject);
#endif
SWMRGDoneWriting(SObject);
- if(SCounter!=NULL)
+ if (SCounter!=NULL)
SCDecFcn(SCounter);
}
@@ -362,7 +343,7 @@ DWORD WINAPI SCDecFcn(PSCOUNTER SCounter)
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"\tDecrementValue-cs enter\n");
#endif
- if(!(Temp=--SCounter->Number))
+ if (!(Temp=--SCounter->Number))
{
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"\tDecrementValue-zero ev set\n");
diff --git a/plugins/YAMN/yamn.cpp b/plugins/YAMN/yamn.cpp
index 467f3d6bba..652ce01712 100644
--- a/plugins/YAMN/yamn.cpp
+++ b/plugins/YAMN/yamn.cpp
@@ -1,17 +1,16 @@
/*
* This code implements miscellaneous usefull functions
- *
+ *
* (c) majvan 2002-2004
*/
+
+#include "yamn.h"
+
#include "m_yamn.h"
#include "m_protoplugin.h"
#include "m_messages.h"
#include "m_synchro.h"
#include "main.h"
-#include "yamn.h"
-#ifdef DEBUG_SYNCHRO
- #include <stdio.h>
-#endif
//- imported ---------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
@@ -47,14 +46,9 @@ extern struct CExportedServices MailExportedSvc[5];
//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
-//MessageWndCS
-//We want to send messages to all windows in the queue
-//When we send messages, no other window can register itself to the queue for receiving messages
-LPCRITICAL_SECTION MessageWndCS;
-
//Plugin registration CS
//Used if we add (register) plugin to YAMN plugins and when we browse through registered plugins
-LPCRITICAL_SECTION PluginRegCS;
+CRITICAL_SECTION PluginRegCS;
//AccountWriterCS
//We want to store number of writers of Accounts (number of Accounts used for writing)
@@ -106,31 +100,31 @@ INT_PTR GetFcnPtrSvc(WPARAM wParam,LPARAM lParam)
register int i;
for(i=0;i<sizeof(ProtoPluginExportedFcn)/sizeof(ProtoPluginExportedFcn[0]);i++)
- if(0==lstrcmp((char *)wParam,ProtoPluginExportedFcn[i].ID))
+ if (0==lstrcmpA((char *)wParam,ProtoPluginExportedFcn[i].ID))
return (INT_PTR)ProtoPluginExportedFcn[i].Ptr;
for(i=0;i<sizeof(ProtoPluginExportedSvc)/sizeof(ProtoPluginExportedSvc[0]);i++)
- if(0==lstrcmp((char *)wParam,ProtoPluginExportedSvc[i].ID))
+ if (0==lstrcmpA((char *)wParam,ProtoPluginExportedSvc[i].ID))
return (INT_PTR)ProtoPluginExportedSvc[i].Ptr;
for(i=0;i<sizeof(SynchroExportedFcn)/sizeof(SynchroExportedFcn[0]);i++)
- if(0==lstrcmp((char *)wParam,SynchroExportedFcn[i].ID))
+ if (0==lstrcmpA((char *)wParam,SynchroExportedFcn[i].ID))
return (INT_PTR)SynchroExportedFcn[i].Ptr;
for(i=0;i<sizeof(AccountExportedFcn)/sizeof(AccountExportedFcn[0]);i++)
- if(0==lstrcmp((char *)wParam,AccountExportedFcn[i].ID))
+ if (0==lstrcmpA((char *)wParam,AccountExportedFcn[i].ID))
return (INT_PTR)AccountExportedFcn[i].Ptr;
for(i=0;i<sizeof(AccountExportedSvc)/sizeof(AccountExportedSvc[0]);i++)
- if(0==lstrcmp((char *)wParam,AccountExportedSvc[i].ID))
+ if (0==lstrcmpA((char *)wParam,AccountExportedSvc[i].ID))
return (INT_PTR)AccountExportedSvc[i].Ptr;
for(i=0;i<sizeof(MailExportedFcn)/sizeof(MailExportedFcn[0]);i++)
- if(0==lstrcmp((char *)wParam,MailExportedFcn[i].ID))
+ if (0==lstrcmpA((char *)wParam,MailExportedFcn[i].ID))
return (INT_PTR)MailExportedFcn[i].Ptr;
for(i=0;i<sizeof(MailExportedSvc)/sizeof(MailExportedSvc[0]);i++)
- if(0==lstrcmp((char *)wParam,MailExportedSvc[i].ID))
+ if (0==lstrcmpA((char *)wParam,MailExportedSvc[i].ID))
return (INT_PTR)MailExportedSvc[i].Ptr;
for(i=0;i<sizeof(FilterPluginExportedFcn)/sizeof(FilterPluginExportedFcn[0]);i++)
- if(0==lstrcmp((char *)wParam,FilterPluginExportedFcn[i].ID))
+ if (0==lstrcmpA((char *)wParam,FilterPluginExportedFcn[i].ID))
return (INT_PTR)FilterPluginExportedFcn[i].Ptr;
for(i=0;i<sizeof(FilterPluginExportedSvc)/sizeof(FilterPluginExportedSvc[0]);i++)
- if(0==lstrcmp((char *)wParam,FilterPluginExportedSvc[i].ID))
+ if (0==lstrcmpA((char *)wParam,FilterPluginExportedSvc[i].ID))
return (INT_PTR)FilterPluginExportedSvc[i].Ptr;
return (INT_PTR)NULL;
}
@@ -146,8 +140,8 @@ DWORD WINAPI YAMNHotKeyThread(LPVOID Param)
WORD HotKey = LOWORD(Param);
int HotKeyID;
-// register hotkey for main YAMN thread first
- if(!(HotKeyID=RegisterHotKey(NULL,(int)GlobalAddAtom(YAMN_HKCHECKMAIL),HIBYTE(HotKey),LOBYTE(HotKey))))
+// register hotkey for main YAMN thread first
+ if (!(HotKeyID=RegisterHotKey(NULL,(int)GlobalAddAtomA(YAMN_HKCHECKMAIL),HIBYTE(HotKey),LOBYTE(HotKey))))
return 0;
while(1)
@@ -155,7 +149,7 @@ DWORD WINAPI YAMNHotKeyThread(LPVOID Param)
GetMessage(&WinMessage,NULL,WM_HOTKEY,WM_YAMN_CHANGEHOTKEY);
// if we want to close miranda, we get event and do not run pop3 checking anymore
- if(WAIT_OBJECT_0==WaitForSingleObject(ExitEV,0))
+ if (WAIT_OBJECT_0==WaitForSingleObject(ExitEV,0))
break;
switch(WinMessage.message)
@@ -167,7 +161,7 @@ DWORD WINAPI YAMNHotKeyThread(LPVOID Param)
// hotkey changed
case WM_YAMN_CHANGEHOTKEY:
UnregisterHotKey(NULL,HotKeyID);
- HotKeyID=RegisterHotKey(NULL,(int)GlobalAddAtom(YAMN_HKCHECKMAIL),WinMessage.wParam,WinMessage.lParam);
+ HotKeyID=RegisterHotKey(NULL,(int)GlobalAddAtomA(YAMN_HKCHECKMAIL),WinMessage.wParam,WinMessage.lParam);
break;
}
}
@@ -182,26 +176,26 @@ void CALLBACK TimerProc(HWND,UINT,UINT,DWORD)
DWORD Status,tid;
// we use event to signal, that running thread has all needed stack parameters copied
- if(NULL==(ThreadRunningEV=CreateEvent(NULL,FALSE,FALSE,NULL)))
+ if (NULL==(ThreadRunningEV=CreateEvent(NULL,FALSE,FALSE,NULL)))
return;
// if we want to close miranda, we get event and do not run checking anymore
- if(WAIT_OBJECT_0==WaitForSingleObject(ExitEV,0))
+ if (WAIT_OBJECT_0==WaitForSingleObject(ExitEV,0))
return;
// Get actual status of current user in Miranda
Status=CallService(MS_CLIST_GETSTATUSMODE,0,0);
- EnterCriticalSection(PluginRegCS);
+ EnterCriticalSection(&PluginRegCS);
for(ActualPlugin=FirstProtoPlugin;ActualPlugin!=NULL;ActualPlugin=ActualPlugin->Next)
{
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"TimerProc:AccountBrowserSO-read wait\n");
#endif
- if(WAIT_OBJECT_0!=SWMRGWaitToRead(ActualPlugin->Plugin->AccountBrowserSO,0)) //we want to access accounts immiadtelly
+ if (WAIT_OBJECT_0!=SWMRGWaitToRead(ActualPlugin->Plugin->AccountBrowserSO,0)) //we want to access accounts immiadtelly
{
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"TimerProc:AccountBrowserSO-read enter failed\n");
#endif
- LeaveCriticalSection(PluginRegCS);
+ LeaveCriticalSection(&PluginRegCS);
return;
}
#ifdef DEBUG_SYNCHRO
@@ -209,12 +203,12 @@ void CALLBACK TimerProc(HWND,UINT,UINT,DWORD)
#endif
for(ActualAccount=ActualPlugin->Plugin->FirstAccount;ActualAccount!=NULL;ActualAccount=ActualAccount->Next)
{
- if(ActualAccount->Plugin==NULL || ActualAccount->Plugin->Fcn==NULL) //account not inited
+ if (ActualAccount->Plugin==NULL || ActualAccount->Plugin->Fcn==NULL) //account not inited
continue;
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"TimerProc:ActualAccountSO-read wait\n");
#endif
- if(WAIT_OBJECT_0!=SWMRGWaitToRead(ActualAccount->AccountAccessSO,0))
+ if (WAIT_OBJECT_0!=SWMRGWaitToRead(ActualAccount->AccountAccessSO,0))
{
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"TimerProc:ActualAccountSO-read wait failed\n");
@@ -222,7 +216,7 @@ void CALLBACK TimerProc(HWND,UINT,UINT,DWORD)
continue;
}
#ifdef DEBUG_SYNCHRO
-
+
switch(Status)
{
case ID_STATUS_OFFLINE:
@@ -261,7 +255,7 @@ void CALLBACK TimerProc(HWND,UINT,UINT,DWORD)
}
#endif
BOOL isAccountCounting = 0;
- if(
+ if (
(ActualAccount->Flags & YAMN_ACC_ENA) &&
(((ActualAccount->StatusFlags & YAMN_ACC_ST0) && (Status<=ID_STATUS_OFFLINE)) ||
((ActualAccount->StatusFlags & YAMN_ACC_ST1) && (Status==ID_STATUS_ONLINE)) ||
@@ -275,11 +269,11 @@ void CALLBACK TimerProc(HWND,UINT,UINT,DWORD)
((ActualAccount->StatusFlags & YAMN_ACC_ST9) && (Status==ID_STATUS_OUTTOLUNCH))))
{
- if((!ActualAccount->Interval && !ActualAccount->TimeLeft) || ActualAccount->Plugin->Fcn->TimeoutFcnPtr==NULL)
+ if ((!ActualAccount->Interval && !ActualAccount->TimeLeft) || ActualAccount->Plugin->Fcn->TimeoutFcnPtr==NULL)
{
goto ChangeIsCountingStatusLabel;
}
- if(ActualAccount->TimeLeft){
+ if (ActualAccount->TimeLeft){
ActualAccount->TimeLeft--;
isAccountCounting = TRUE;
}
@@ -287,13 +281,13 @@ void CALLBACK TimerProc(HWND,UINT,UINT,DWORD)
DebugLog(SynchroFile,"TimerProc:time left : %i\n",ActualAccount->TimeLeft);
#endif
WindowList_BroadcastAsync(YAMNVar.MessageWnds,WM_YAMN_CHANGETIME,(WPARAM)ActualAccount,(LPARAM)ActualAccount->TimeLeft);
- if(!ActualAccount->TimeLeft)
+ if (!ActualAccount->TimeLeft)
{
struct CheckParam ParamToPlugin={YAMN_CHECKVERSION,ThreadRunningEV,ActualAccount,YAMN_NORMALCHECK,(void *)0,NULL};
HANDLE NewThread;
-
+
ActualAccount->TimeLeft=ActualAccount->Interval;
- if(NULL==(NewThread=CreateThread(NULL,0,(YAMN_STANDARDFCN)ActualAccount->Plugin->Fcn->TimeoutFcnPtr,&ParamToPlugin,0,&tid)))
+ if (NULL==(NewThread=CreateThread(NULL,0,(YAMN_STANDARDFCN)ActualAccount->Plugin->Fcn->TimeoutFcnPtr,&ParamToPlugin,0,&tid)))
{
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"TimerProc:ActualAccountSO-read done\n");
@@ -330,7 +324,7 @@ ChangeIsCountingStatusLabel:
#endif
SWMRGDoneReading(ActualPlugin->Plugin->AccountBrowserSO);
}
- LeaveCriticalSection(PluginRegCS);
+ LeaveCriticalSection(&PluginRegCS);
CloseHandle(ThreadRunningEV);
return;
}
@@ -343,29 +337,29 @@ INT_PTR ForceCheckSvc(WPARAM,LPARAM)
DWORD tid;
//we use event to signal, that running thread has all needed stack parameters copied
- if(NULL==(ThreadRunningEV=CreateEvent(NULL,FALSE,FALSE,NULL)))
+ if (NULL==(ThreadRunningEV=CreateEvent(NULL,FALSE,FALSE,NULL)))
return 0;
//if we want to close miranda, we get event and do not run pop3 checking anymore
- if(WAIT_OBJECT_0==WaitForSingleObject(ExitEV,0))
+ if (WAIT_OBJECT_0==WaitForSingleObject(ExitEV,0))
return 0;
- EnterCriticalSection(PluginRegCS);
+ EnterCriticalSection(&PluginRegCS);
for(ActualPlugin=FirstProtoPlugin;ActualPlugin!=NULL;ActualPlugin=ActualPlugin->Next)
{
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"ForceCheck:AccountBrowserSO-read wait\n");
- #endif
+ #endif
SWMRGWaitToRead(ActualPlugin->Plugin->AccountBrowserSO,INFINITE);
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"ForceCheck:AccountBrowserSO-read enter\n");
#endif
for(ActualAccount=ActualPlugin->Plugin->FirstAccount;ActualAccount!=NULL;ActualAccount=ActualAccount->Next)
{
- if(ActualAccount->Plugin->Fcn==NULL) //account not inited
+ if (ActualAccount->Plugin->Fcn==NULL) //account not inited
continue;
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"ForceCheck:ActualAccountSO-read wait\n");
#endif
- if(WAIT_OBJECT_0!=WaitToReadFcn(ActualAccount->AccountAccessSO))
+ if (WAIT_OBJECT_0!=WaitToReadFcn(ActualAccount->AccountAccessSO))
{
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"ForceCheck:ActualAccountSO-read wait failed\n");
@@ -375,16 +369,16 @@ INT_PTR ForceCheckSvc(WPARAM,LPARAM)
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"ForceCheck:ActualAccountSO-read enter\n");
#endif
- if((ActualAccount->Flags & YAMN_ACC_ENA) && (ActualAccount->StatusFlags & YAMN_ACC_FORCE)) //account cannot be forced to check
+ if ((ActualAccount->Flags & YAMN_ACC_ENA) && (ActualAccount->StatusFlags & YAMN_ACC_FORCE)) //account cannot be forced to check
{
- if(ActualAccount->Plugin->Fcn->ForceCheckFcnPtr==NULL)
+ if (ActualAccount->Plugin->Fcn->ForceCheckFcnPtr==NULL)
{
ReadDoneFcn(ActualAccount->AccountAccessSO);
continue;
}
struct CheckParam ParamToPlugin={YAMN_CHECKVERSION,ThreadRunningEV,ActualAccount,YAMN_FORCECHECK,(void *)0,NULL};
- if(NULL==CreateThread(NULL,0,(YAMN_STANDARDFCN)ActualAccount->Plugin->Fcn->ForceCheckFcnPtr,&ParamToPlugin,0,&tid))
+ if (NULL==CreateThread(NULL,0,(YAMN_STANDARDFCN)ActualAccount->Plugin->Fcn->ForceCheckFcnPtr,&ParamToPlugin,0,&tid))
{
ReadDoneFcn(ActualAccount->AccountAccessSO);
continue;
@@ -399,80 +393,8 @@ INT_PTR ForceCheckSvc(WPARAM,LPARAM)
#endif
SWMRGDoneReading(ActualPlugin->Plugin->AccountBrowserSO);
}
- LeaveCriticalSection(PluginRegCS);
+ LeaveCriticalSection(&PluginRegCS);
CloseHandle(ThreadRunningEV);
CallService(MS_TTB_SETBUTTONSTATE,(WPARAM)hTTButton,(LPARAM)TTBST_RELEASED);
return 1;
}
-/*
-int ExitProc(WPARAM wParam,LPARAM lParam)
-{
- THIS WILL BE IMPLEMENTED LATER
-// First, no thread must add or delete accounts. This is achieved by entering browsing through accounts
-// If any thread want to delete or add, it waits for write-access to browse accounts (so it waits infinite time)
-#ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile,"ExitProc:AccountBrowserSO-wait to obtain read access\n"));
-#endif
- if(WAIT_TIMEOUT==SWMRGWaitToRead(AccountBrowserSO,0))
- {
-#ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile,"ExitProc:AccountBrowserSO-read access obtain failed, I'll try later\n"));
-#endif
- return 1;
- }
-#ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile,"ExitProc:AccountBrowserSO-read access obtained\n"));
-#endif
-#ifdef DEBUG_SYNCHRO
- TCHAR Debug[100];
-
- _stprintf(Debug,_T("ExitProc:Writers: %d\n"),AccountWriterSO->GetNumber());
- DEBUG_SYNCHRO2F(Debug);
- DebugLog(SynchroFile,"ExitProc:NoWriterEV-test\n"));
-#endif
-// next, threads must not write to any account. This works like hFinishEV event in AccountAccessSO and MessagesAccessSO.
-// When hFinishEV is set, any beginning with reading and writing to account (messages) is failed.
-// This is similar, but the difference is, that we can finish the whole work (we can decide: if ExitEV is set, should we
-// end immidialtelly or should we continue (to end operation successfully)?
-// E.g. I decided that once we started checking account, we get all new mails and then we can end.
-// The second and more significant difference is, that ExitEV is signal to all accounts and messages, not only to one account.
-
- SetEvent(ExitEV);
- if(WAIT_TIMEOUT==WaitForSingleObject(AccountWriterSO->Event,0))
- {
-// There exists a thread writing to account, so we ca try later to write accounts to file, if no thread is writting
-#ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile,"ExitProc:NoWriterEV-writer(s) exists, I'll try later\n"));
-#endif
- SWMRGDoneReading(AccountBrowserSO);
- return 1;
- }
-
-#ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile,"ExitProc:NoWriterEV-no writer, going to save!\n"));
-#endif
-// Save to file
- WriteAccountsToFile();
- SWMRGDoneReading(AccountBrowserSO);
-// Now, all is saved, we can safe exit from Miranda
- return 0;
-}
-*/
-/*
-DWORD WINAPI FileWritingThread(PVOID)
-{
- HACCOUNT ActualAccount=FirstAccount;
-
- while(1)
- {
- WaitForSingleObject(WriteToFileEV,INFINITE);
-#ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile,"FileWriting:WriteToFileEV-signaled\n"));
-#endif
-// now, write accounts and messages if it is possible. If it is not possible e.g. to read messages from one account,
-// function will wait until messages are not used and then writes messages
- WriteAccountsToFile();
- }
- return 0;
-}
-*/
diff --git a/plugins/YAMN/yamn.h b/plugins/YAMN/yamn.h
index 1a80b5d676..672a617266 100644
--- a/plugins/YAMN/yamn.h
+++ b/plugins/YAMN/yamn.h
@@ -1,3 +1,4 @@
+
#ifndef __YAMN_H
#define __YAMN_H
#ifndef _WIN32_IE
@@ -7,9 +8,6 @@
#define _WIN32_WINNT 0x0501
#endif
-#if !defined(_WIN64)
- #include "filter/simple/AggressiveOptimize.h"
-#endif
#include <wchar.h>
#include <tchar.h>
#include <windows.h>
@@ -33,7 +31,6 @@
#include "m_protocols.h" //protocols
#include "m_protomod.h" //protocols module
#include "m_protosvc.h"
-#include "m_uninstaller.h" //PluginUninstaller structures
#include "m_toptoolbar.h"
#include "m_icolib.h"
#include "m_kbdnotify.h"
@@ -90,19 +87,64 @@ INT_PTR ForceCheckSvc(WPARAM,LPARAM);
// int ExitProc(WPARAM,LPARAM);
//From account.cpp
-//struct CExportedFunctions AccountExported[];
+//--------------------------------------------------------------------------------------------------
+//--------------------------------------------------------------------------------------------------
+
+//From account.cpp
+extern CRITICAL_SECTION AccountStatusCS;
+extern CRITICAL_SECTION FileWritingCS;
+
INT_PTR CreatePluginAccountSvc(WPARAM wParam,LPARAM lParam);
-INT_PTR DeletePluginAccountSvc(WPARAM wParam,LPARAM lParam);
+INT_PTR DeletePluginAccountSvc(WPARAM wParam,LPARAM);
+int InitAccount(HACCOUNT Which);
+void DeInitAccount(HACCOUNT Which);
+void StopSignalFcn(HACCOUNT Which);
+void CodeDecodeString(char *Dest,BOOL Encrypt);
+static DWORD PostFileToMemory(HANDLE File,char **MemFile,char **End);
+DWORD FileToMemoryA(char *FileName,char **MemFile,char **End);
+DWORD FileToMemoryW(WCHAR *FileName,char **MemFile,char **End);
+
+#if defined(DEBUG_FILEREAD) || defined(DEBUG_FILEREADMESSAGES)
+DWORD ReadStringFromMemory(char **Parser,TCHAR *End,char **StoreTo,char *DebugString);
+#endif
+DWORD ReadStringFromMemory(char **Parser,TCHAR *End,char **StoreTo);
+#ifndef UNICODE
+ #if defined(DEBUG_FILEREAD) || defined(DEBUG_FILEREADMESSAGES)
+DWORD ReadStringFromMemoryW(WCHAR **Parser,TCHAR *End,WCHAR **StoreTo,WCHAR *DebugString);
+ #endif //if defined(DEBUG...)
+DWORD ReadStringFromMemoryW(WCHAR **Parser,TCHAR *End,WCHAR **StoreTo);
+#endif //ifdef Unicode
+
+static DWORD ReadNotificationFromMemory(char **Parser,TCHAR *End,YAMN_NOTIFICATION *Which);
+DWORD ReadMessagesFromMemory(HACCOUNT Which,char **Parser,char *End);
+static INT_PTR PerformAccountReading(HYAMNPROTOPLUGIN Plugin,char *MemFile,char *End);
+DWORD ReadAccountFromMemory(HACCOUNT Which,char **Parser,TCHAR *End);
+INT_PTR AddAccountsFromFileASvc(WPARAM wParam,LPARAM lParam);
+INT_PTR AddAccountsFromFileWSvc(WPARAM,LPARAM);
+
+DWORD WriteStringToFile(HANDLE File,char *Source);
+#ifndef UNICODE
+#define WriteStringToFileW WriteStringToFile
+#else
+DWORD WriteStringToFileW(HANDLE File,WCHAR *Source);
+#endif
+
+DWORD WriteMessagesToFile(HANDLE File,HACCOUNT Which);
+static INT_PTR PerformAccountWriting(HYAMNPROTOPLUGIN Plugin,HANDLE File);
INT_PTR WriteAccountsToFileASvc(WPARAM wParam,LPARAM lParam);
INT_PTR WriteAccountsToFileWSvc(WPARAM wParam,LPARAM lParam);
-INT_PTR AddAccountsFromFileASvc(WPARAM,LPARAM);
-INT_PTR AddAccountsFromFileWSvc(WPARAM,LPARAM);
-INT_PTR DeleteAccountSvc(WPARAM,LPARAM);
INT_PTR FindAccountByNameSvc(WPARAM wParam,LPARAM lParam);
INT_PTR GetNextFreeAccountSvc(WPARAM wParam,LPARAM lParam);
-//From protoplugin.cpp
-//struct CExportedFunctions ProtoPluginExported[];
+INT_PTR DeleteAccountSvc(WPARAM wParam,LPARAM);
+DWORD WINAPI DeleteAccountInBackground(LPVOID Which);
+int StopAccounts(HYAMNPROTOPLUGIN Plugin);
+int WaitForAllAccounts(HYAMNPROTOPLUGIN Plugin,BOOL GetAccountBrowserAccess=FALSE);
+int DeleteAccounts(HYAMNPROTOPLUGIN Plugin);
+
+void WINAPI GetStatusFcn(HACCOUNT Which,TCHAR *Value);
+void WINAPI SetStatusFcn(HACCOUNT Which,TCHAR *Value);
+
INT_PTR UnregisterProtoPlugins();
INT_PTR RegisterProtocolPluginSvc(WPARAM,LPARAM);
INT_PTR UnregisterProtocolPluginSvc(WPARAM,LPARAM);
@@ -142,7 +184,6 @@ extern int CPLENSUPP;
//From pop3comm.cpp
int RegisterPOP3Plugin(WPARAM,LPARAM);
-int UninstallPOP3(PLUGINUNINSTALLPARAMS* ppup); //to uninstall POP3 plugin with YAMN
//From mailbrowser.cpp
INT_PTR RunMailBrowserSvc(WPARAM,LPARAM);
@@ -161,19 +202,73 @@ int AddTopToolbarIcon(WPARAM,LPARAM); //Executed when TopToolBar plugin loaded
void LoadPlugins(); //Loads plugins located in MirandaDir/Plugins/YAMN/*.dll
int UninstallQuestionSvc(WPARAM,LPARAM); //Ask information when user wants to uninstall plugin
+extern WCHAR UserDirectory[]; //e.g. "F:\WINNT\Profiles\UserXYZ"
+extern WCHAR ProfileName[]; //e.g. "majvan"
+extern SWMRG *AccountBrowserSO;
+extern CRITICAL_SECTION PluginRegCS;
+extern YAMN_VARIABLES YAMNVar;
+extern HANDLE hNewMailHook;
+extern HANDLE WriteToFileEV;
+extern HICON hYamnIcons[];
+
//From synchro.cpp
+extern void WINAPI DeleteMessagesToEndFcn(HACCOUNT Account,HYAMNMAIL From);
extern DWORD WINAPI WaitToWriteFcn(PSWMRG SObject,PSCOUNTER SCounter=NULL);
extern void WINAPI WriteDoneFcn(PSWMRG SObject,PSCOUNTER SCounter=NULL);
extern DWORD WINAPI WaitToReadFcn(PSWMRG SObject);
extern void WINAPI ReadDoneFcn(PSWMRG SObject);
extern DWORD WINAPI SCIncFcn(PSCOUNTER SCounter);
extern DWORD WINAPI SCDecFcn(PSCOUNTER SCounter);
+extern BOOL WINAPI SWMRGInitialize(PSWMRG,TCHAR *);
+extern void WINAPI SWMRGDelete(PSWMRG);
+extern DWORD WINAPI SWMRGWaitToWrite(PSWMRG pSWMRG,DWORD dwTimeout);
+extern void WINAPI SWMRGDoneWriting(PSWMRG pSWMRG);
+extern DWORD WINAPI SWMRGWaitToRead(PSWMRG pSWMRG, DWORD dwTimeout);
+extern void WINAPI SWMRGDoneReading(PSWMRG pSWMRG);
+
//From mails.cpp
extern void WINAPI DeleteMessageFromQueueFcn(HYAMNMAIL *From,HYAMNMAIL Which,int mode);
extern void WINAPI SetRemoveFlagsInQueueFcn(HYAMNMAIL From,DWORD FlagsSet,DWORD FlagsNotSet,DWORD FlagsToSet,int mode);
+
//From mime.cpp
void ExtractHeader(struct CMimeItem *items,int &CP,struct CHeader *head);
+void ExtractShortHeader(struct CMimeItem *items,struct CShortHeader *head);
void DeleteHeaderContent(struct CHeader *head);
+void DeleteShortHeaderContent(struct CShortHeader *head);
+char *ExtractFromContentType(char *ContentType,char *value);
+WCHAR *ParseMultipartBody(char *src, char *bond);
+
//From account.cpp
-void WINAPI GetStatusFcn(HACCOUNT Which,char *Value);
+void WINAPI GetStatusFcn(HACCOUNT Which,TCHAR *Value);
+extern int StopAccounts(HYAMNPROTOPLUGIN Plugin);
+extern int DeleteAccounts(HYAMNPROTOPLUGIN Plugin);
+extern int WaitForAllAccounts(HYAMNPROTOPLUGIN Plugin,BOOL GetAccountBrowserAccess);
+
+extern char *ProtoName;
+extern HYAMNPROTOPLUGIN POP3Plugin;
+
+//from decode.cpp
+int DecodeQuotedPrintable(char *Src,char *Dst,int DstLen, BOOL isQ);
+int DecodeBase64(char *Src,char *Dst,int DstLen);
+
+//From maild.cpp
+extern INT_PTR LoadMailDataSvc(WPARAM wParam,LPARAM lParam);
+extern INT_PTR UnloadMailDataSvc(WPARAM wParam,LPARAM);
+extern INT_PTR SaveMailDataSvc(WPARAM wParam,LPARAM lParam);
+
+///////////////////////////////////////////////////////////////////////
+class _A2T
+{
+ TCHAR* buf;
+
+public:
+ _A2T( const char* s ) : buf( mir_a2t( s )) {}
+ _A2T( const char* s, int cp ) : buf( mir_a2t_cp( s, cp )) {}
+ ~_A2T() { mir_free(buf); }
+
+ __forceinline operator TCHAR*() const
+ { return buf;
+ }
+};
+
#endif