summaryrefslogtreecommitdiff
path: root/plugins/YAMN/proto
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/YAMN/proto')
-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
6 files changed, 618 insertions, 710 deletions
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