summaryrefslogtreecommitdiff
path: root/plugins/YAMN/proto
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/YAMN/proto')
-rw-r--r--plugins/YAMN/proto/pop3/pop3.cpp4
-rw-r--r--plugins/YAMN/proto/pop3/pop3comm.cpp186
-rw-r--r--plugins/YAMN/proto/pop3/pop3opt.cpp748
3 files changed, 410 insertions, 528 deletions
diff --git a/plugins/YAMN/proto/pop3/pop3.cpp b/plugins/YAMN/proto/pop3/pop3.cpp
index 8186406124..152eda6bb2 100644
--- a/plugins/YAMN/proto/pop3/pop3.cpp
+++ b/plugins/YAMN/proto/pop3/pop3.cpp
@@ -25,7 +25,7 @@
#pragma warning( disable : 4290 )
-#include "..\..\yamn.h"
+#include "..\..\yamn.h"
#include "pop3.h"
extern "C" {
@@ -258,7 +258,7 @@ char* CPop3Client::APOP(char* name, char* pw, char* timestamp)
MD5Update(&ctx,(const unsigned char *)pw,(unsigned int)strlen(pw));
MD5Final(digest,&ctx);
hexdigest[0]='\0';
- for(int i=0; i<16; i++) {
+ for (int i=0; i<16; i++) {
char tmp[4];
sprintf(tmp, "%02x", digest[i]);
strcat(hexdigest, tmp);
diff --git a/plugins/YAMN/proto/pop3/pop3comm.cpp b/plugins/YAMN/proto/pop3/pop3comm.cpp
index 7e38cc94c7..039cc666c7 100644
--- a/plugins/YAMN/proto/pop3/pop3comm.cpp
+++ b/plugins/YAMN/proto/pop3/pop3comm.cpp
@@ -19,23 +19,6 @@
#define ERRORSTR_MAXLEN 1024 //in wide-chars
-//- imported ---------------------------------------------------------------------------------------
-//--------------------------------------------------------------------------------------------------
-
-//From main.cpp
-void SetDefaultProtocolIcons();
-//From pop3opt.cpp
-extern int POP3OptInit(WPARAM wParam,LPARAM lParam);
-//From netlib.cpp
-extern HANDLE RegisterNLClient(const char *name);
-//this is imported because of one bug, should not be imported normally (this POP3 is plugin of YAMN)
-extern INT_PTR FilterMailSvc(WPARAM,LPARAM);
-
-extern char *ProtoName;
-extern INT_PTR YAMN_STATUS;
-extern PLUGININFO pluginInfo;
-
-//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
HANDLE hNetLib = NULL;
@@ -83,7 +66,7 @@ DWORD WINAPI DeleteMailsPOP3(struct DeleteParam *WhichTemp);
//Function makes readable message about error. It sends it back to YAMN, so YAMN then
//can show it to the message window
-WCHAR* WINAPI GetErrorString(DWORD Code);
+TCHAR* WINAPI GetErrorString(DWORD Code);
//Function deletes string allocated in GetErrorString
void WINAPI DeleteErrorString(LPVOID String);
@@ -109,8 +92,8 @@ void ExtractList(char *stream,int len,HYAMNMAIL queue);
void ExtractMail(char *stream,int len,HYAMNMAIL queue);
-struct YAMNExportedFcns *pYAMNFcn = NULL;
-struct MailExportedFcns *pYAMNMailFcn = NULL;
+YAMNExportedFcns *pYAMNFcn = NULL;
+MailExportedFcns *pYAMNMailFcn = NULL;
YAMN_PROTOIMPORTFCN POP3ProtocolFunctions =
{
@@ -152,7 +135,9 @@ YAMN_PROTOREGISTRATION POP3ProtocolRegistration =
"http://forums.miranda-im.org/showthread.php?t=3035",
};
-static WCHAR *FileName = NULL;
+static TCHAR *FileName = NULL;
+
+HANDLE RegisterNLClient(const char *name);
//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
@@ -258,11 +243,10 @@ int RegisterPOP3Plugin(WPARAM,LPARAM)
//Then, we read all mails for accounts.
//You must first register account, before using this function as YAMN must use CreatePOP3Account function to add new accounts
//But if CreatePOP3Account is not implemented (equals to NULL), YAMN creates account as YAMN's standard HACCOUNT
- 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);
+ if (FileName) CallService(MS_YAMN_DELETEFILENAME,(WPARAM)FileName, 0); //shoud not happen (only for secure)
+ FileName = (TCHAR *)CallService(MS_YAMN_GETFILENAME,(WPARAM)_T("pop3"), 0);
- switch(CallService(MS_YAMN_READACCOUNTSW,(WPARAM)POP3Plugin,(LPARAM)FileName))
- {
+ switch(CallService(MS_YAMN_READACCOUNTS,(WPARAM)POP3Plugin,(LPARAM)FileName)) {
case EACC_FILEVERSION:
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);
@@ -297,19 +281,19 @@ int RegisterPOP3Plugin(WPARAM,LPARAM)
DBVARIANT dbv;
char *szProto;
- for(Finder=POP3Plugin->FirstAccount;Finder!=NULL;Finder=Finder->Next)
+ for (Finder=POP3Plugin->FirstAccount;Finder!=NULL;Finder=Finder->Next)
{
Finder->hContact = NULL;
hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
while(hContact)
{
szProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
- if (szProto != NULL && strcmp(szProto, ProtoName)==0)
+ if (szProto != NULL && strcmp(szProto, YAMN_DBMODULE)==0)
{
- if (!DBGetContactSettingString(hContact,ProtoName,"Id",&dbv)) {
+ if (!DBGetContactSettingString(hContact,YAMN_DBMODULE,"Id",&dbv)) {
if ( strcmp( dbv.pszVal, Finder->Name) == 0) {
Finder->hContact = hContact;
- DBWriteContactSettingWord(Finder->hContact, ProtoName, "Status", ID_STATUS_ONLINE);
+ DBWriteContactSettingWord(Finder->hContact, YAMN_DBMODULE, "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))
DBDeleteContactSetting(Finder->hContact, "CList", "Hidden");
@@ -326,11 +310,11 @@ int RegisterPOP3Plugin(WPARAM,LPARAM)
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);
- DBWriteContactSettingString(Finder->hContact,ProtoName,"Id",Finder->Name);
- DBWriteContactSettingString(Finder->hContact,ProtoName,"Nick",Finder->Name);
- DBWriteContactSettingString(Finder->hContact,"Protocol","p",ProtoName);
- DBWriteContactSettingWord(Finder->hContact, ProtoName, "Status", YAMN_STATUS);
+ CallService(MS_PROTO_ADDTOCONTACT,(WPARAM)Finder->hContact,(LPARAM)YAMN_DBMODULE);
+ DBWriteContactSettingString(Finder->hContact,YAMN_DBMODULE,"Id",Finder->Name);
+ DBWriteContactSettingString(Finder->hContact,YAMN_DBMODULE,"Nick",Finder->Name);
+ DBWriteContactSettingString(Finder->hContact,"Protocol","p",YAMN_DBMODULE);
+ DBWriteContactSettingWord(Finder->hContact, YAMN_DBMODULE, "Status", YAMN_STATUS);
}
}
@@ -359,21 +343,11 @@ DWORD WINAPI UnLoadPOP3(void *)
DWORD WINAPI WritePOP3Accounts()
{
-// WCHAR *FileName=(WCHAR *)CallService(MS_YAMN_GETFILENAMEA,(WPARAM)"pop3",(LPARAM)0);
- DWORD ReturnValue=CallService(MS_YAMN_WRITEACCOUNTSW,(WPARAM)POP3Plugin,(LPARAM)FileName);
-
- switch(ReturnValue)
- {
- case EACC_SYSTEM:
- {
- 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;
+ DWORD ReturnValue = CallService(MS_YAMN_WRITEACCOUNTS,(WPARAM)POP3Plugin,(LPARAM)FileName);
+ if (ReturnValue == EACC_SYSTEM) {
+ 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 );
}
return ReturnValue;
@@ -438,7 +412,7 @@ HYAMNMAIL WINAPI CreatePOP3Mail(HACCOUNT Account,DWORD MailDataVersion)
static void SetContactStatus(HACCOUNT account, int status){
if ((account->hContact) && (account->NewMailN.Flags & YAMN_ACC_CONT)){
- DBWriteContactSettingWord(account->hContact, ProtoName, "Status", status);
+ DBWriteContactSettingWord(account->hContact, YAMN_DBMODULE, "Status", status);
}
}
@@ -678,7 +652,7 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp)
if (DataRX!=NULL)
free(DataRX);
DataRX=NULL;
- for(i=0;i<msgs;i++)
+ for (i=0;i<msgs;i++)
{
if (!i)
MsgQueuePtr=NewMails=(HYAMNMAIL)CallService(MS_YAMN_CREATEACCOUNTMAIL,(WPARAM)ActualAccount,(LPARAM)YAMN_MAILVERSION);
@@ -734,10 +708,10 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp)
DebugLog(SynchroFile,"CheckPOP3:ActualAccountMsgsSO-write enter\n");
#endif
ActualAccount->LastChecked=now;
- for(MsgQueuePtr=(HYAMNMAIL)ActualAccount->Mails;MsgQueuePtr!=NULL;MsgQueuePtr=MsgQueuePtr->Next){
+ for (MsgQueuePtr=(HYAMNMAIL)ActualAccount->Mails;MsgQueuePtr!=NULL;MsgQueuePtr=MsgQueuePtr->Next){
if (MsgQueuePtr->Flags&YAMN_MSG_BODYREQUESTED){
HYAMNMAIL NewMsgsPtr=NULL;
- for(NewMsgsPtr=(HYAMNMAIL)NewMails;NewMsgsPtr!=NULL;NewMsgsPtr=NewMsgsPtr->Next){
+ for (NewMsgsPtr=(HYAMNMAIL)NewMails;NewMsgsPtr!=NULL;NewMsgsPtr=NewMsgsPtr->Next){
if (!strcmp(MsgQueuePtr->ID,NewMsgsPtr->ID)){
TCHAR accstatus[512];
wsprintf(accstatus,TranslateT("Reading body %s"),NewMsgsPtr->ID);
@@ -753,14 +727,14 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp)
while((Temp<DataRX+MyClient->NetClient->Rcv) && (WS(Temp) || ENDLINE(Temp))) Temp++;
if (OKLINE(DataRX))
- for(Temp=DataRX;(Temp<DataRX+MyClient->NetClient->Rcv) && (!ENDLINE(Temp));Temp++);
+ for (Temp=DataRX;(Temp<DataRX+MyClient->NetClient->Rcv) && (!ENDLINE(Temp));Temp++);
while((Temp<DataRX+MyClient->NetClient->Rcv) && ENDLINE(Temp)) Temp++;
}
else
continue;
//delete all the headers of the old mail MsgQueuePtr->MailData->TranslatedHeader
struct CMimeItem *TH = MsgQueuePtr->MailData->TranslatedHeader;
- if (TH) for(;MsgQueuePtr->MailData->TranslatedHeader!=NULL;)
+ if (TH) for (;MsgQueuePtr->MailData->TranslatedHeader!=NULL;)
{
TH=TH->Next;
if (MsgQueuePtr->MailData->TranslatedHeader->name!=NULL)
@@ -795,7 +769,7 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp)
DebugLog(SynchroFile,"CheckPOP3:ActualAccountMsgsSO-write done\n");
#endif
MsgsWriteDone(ActualAccount);
- for(MsgQueuePtr=(HYAMNMAIL)ActualAccount->Mails;MsgQueuePtr!=NULL;MsgQueuePtr=MsgQueuePtr->Next){
+ for (MsgQueuePtr=(HYAMNMAIL)ActualAccount->Mails;MsgQueuePtr!=NULL;MsgQueuePtr=MsgQueuePtr->Next){
if ((MsgQueuePtr->Flags&YAMN_MSG_BODYREQUESTED) && (MsgQueuePtr->Flags&YAMN_MSG_BODYRECEIVED)){
MsgQueuePtr->Flags&=~YAMN_MSG_BODYREQUESTED;
if (MsgQueuePtr->MsgWindow){
@@ -804,13 +778,13 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp)
}
}
- for(msgs=0,MsgQueuePtr=NewMails;MsgQueuePtr!=NULL;MsgQueuePtr=MsgQueuePtr->Next,msgs++); //get number of new mails
+ for (msgs=0,MsgQueuePtr=NewMails;MsgQueuePtr!=NULL;MsgQueuePtr=MsgQueuePtr->Next,msgs++); //get number of new mails
try
{
TCHAR accstatus[512];
- for(i=0,MsgQueuePtr=NewMails;MsgQueuePtr!=NULL;i++)
+ for (i=0,MsgQueuePtr=NewMails;MsgQueuePtr!=NULL;i++)
{
BOOL autoretr = (ActualAccount->Flags & YAMN_ACC_BODY)!=0;
DataRX=MyClient->Top(MsgQueuePtr->Number,autoretr?100:0);
@@ -827,7 +801,7 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp)
while((Temp<DataRX+MyClient->NetClient->Rcv) && (WS(Temp) || ENDLINE(Temp))) Temp++;
if (OKLINE(DataRX))
- for(Temp=DataRX;(Temp<DataRX+MyClient->NetClient->Rcv) && (!ENDLINE(Temp));Temp++);
+ for (Temp=DataRX;(Temp<DataRX+MyClient->NetClient->Rcv) && (!ENDLINE(Temp));Temp++);
while((Temp<DataRX+MyClient->NetClient->Rcv) && ENDLINE(Temp)) Temp++;
}
else
@@ -1175,7 +1149,7 @@ DWORD WINAPI DeleteMailsPOP3(struct DeleteParam *WhichTemp)
if (DataRX!=NULL)
free(DataRX);
DataRX=NULL;
- for(i=0;i<msgs;i++)
+ for (i=0;i<msgs;i++)
{
if (!i)
MsgQueuePtr=NewMails=(HYAMNMAIL)CallService(MS_YAMN_CREATEACCOUNTMAIL,(WPARAM)ActualAccount,(LPARAM)YAMN_MAILVERSION);
@@ -1230,7 +1204,7 @@ DWORD WINAPI DeleteMailsPOP3(struct DeleteParam *WhichTemp)
{
HYAMNMAIL Temp;
- for(i=0,MsgQueuePtr=DeleteMails;MsgQueuePtr!=NULL;i++)
+ for (i=0,MsgQueuePtr=DeleteMails;MsgQueuePtr!=NULL;i++)
{
if (!(MsgQueuePtr->Flags & YAMN_MSG_VIRTUAL)) //of course we can only delete real mails, not virtual
{
@@ -1422,7 +1396,7 @@ void ExtractMail(char *stream,int len,HYAMNMAIL queue)
#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++);
+// for (i=1,queueptr=queue;(queueptr->Next!=NULL) && (i<msgnr);queueptr=queueptr->Next,i++);
// if (i!=msgnr)
// throw (DWORD)EPOP3_UIDL;
while(!WS(finder)) finder++; //jump characters
@@ -1430,7 +1404,7 @@ void ExtractMail(char *stream,int len,HYAMNMAIL queue)
finderend=finder+1;
while(!WS(finderend) && !ENDLINE(finderend)) finderend++;
queueptr->ID=new char[finderend-finder+1];
- for(i=0;finder!=finderend;finder++,i++)
+ for (i=0;finder!=finderend;finder++,i++)
queueptr->MailData->Body[i]=*finder;
queueptr->MailData->Body[i]=0; //ends string
queueptr->Number=msgnr;
@@ -1467,7 +1441,7 @@ void ExtractUIDL(char *stream,int len,HYAMNMAIL queue)
#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++);
+// for (i=1,queueptr=queue;(queueptr->Next!=NULL) && (i<msgnr);queueptr=queueptr->Next,i++);
// if (i!=msgnr)
// throw (DWORD)EPOP3_UIDL;
while(!WS(finder)) finder++; //jump characters
@@ -1475,7 +1449,7 @@ void ExtractUIDL(char *stream,int len,HYAMNMAIL queue)
finderend=finder+1;
while(!WS(finderend) && !ENDLINE(finderend)) finderend++;
queueptr->ID=new char[finderend-finder+1];
- for(i=0;finder!=finderend;finder++,i++)
+ for (i=0;finder!=finderend;finder++,i++)
queueptr->ID[i]=*finder;
queueptr->ID[i]=0; //ends string
queueptr->Number=msgnr;
@@ -1513,7 +1487,7 @@ void ExtractList(char *stream,int len,HYAMNMAIL queue)
DebugLog(DecodeFile,"<Nr>%d</Nr>\n",msgnr);
#endif
- for(i=1,queueptr=queue;(queueptr->Next!=NULL) && (i<msgnr);queueptr=queueptr->Next,i++);
+ for (i=1,queueptr=queue;(queueptr->Next!=NULL) && (i<msgnr);queueptr=queueptr->Next,i++);
if (i!=msgnr)
throw (DWORD)EPOP3_LIST;
while(!WS(finder)) finder++; //jump characters
@@ -1528,65 +1502,59 @@ void ExtractList(char *stream,int len,HYAMNMAIL queue)
}
}
-WCHAR* WINAPI GetErrorString(DWORD Code)
+TCHAR* WINAPI GetErrorString(DWORD Code)
{
- static char *POP3Errors[]=
+ static TCHAR *POP3Errors[]=
{
- "Memory allocation error.", //memory allocation
- "Account is about to be stopped.", //stop account
- "Cannot connect to POP3 server.",
- "Cannot allocate memory for received data.",
- "Cannot login to POP3 server.",
- "Bad user or password.",
- "Server does not support APOP authorization.",
- "Error while executing POP3 command.",
- "Error while executing POP3 command.",
- "Error while executing POP3 command.",
+ LPGENT("Memory allocation error."), //memory allocation
+ LPGENT("Account is about to be stopped."), //stop account
+ LPGENT("Cannot connect to POP3 server."),
+ LPGENT("Cannot allocate memory for received data."),
+ LPGENT("Cannot login to POP3 server."),
+ LPGENT("Bad user or password."),
+ LPGENT("Server does not support APOP authorization."),
+ LPGENT("Error while executing POP3 command."),
+ LPGENT("Error while executing POP3 command."),
+ LPGENT("Error while executing POP3 command."),
};
- static char *NetlibErrors[]=
+ static TCHAR *NetlibErrors[]=
{
- "Cannot connect to server with NetLib.",
- "Cannot send data.",
- "Cannot receive data.",
- "Cannot allocate memory for received data.",
+ LPGENT("Cannot connect to server with NetLib."),
+ LPGENT("Cannot send data."),
+ LPGENT("Cannot receive data."),
+ LPGENT("Cannot allocate memory for received data."),
};
- static char *SSLErrors[]=
+ static TCHAR *SSLErrors[]=
{
- "OpenSSL not loaded.",
- "Windows socket 2.0 init failed.",
- "DNS lookup error.",
- "Error while creating base socket.",
- "Error connecting to server with socket.",
- "Error while creating SSL structure.",
- "Error connecting socket with SSL.",
- "Server rejected connection with SSL.",
- "Cannot write SSL data.",
- "Cannot read SSL data.",
- "Cannot allocate memory for received data.",
+ LPGENT("OpenSSL not loaded."),
+ LPGENT("Windows socket 2.0 init failed."),
+ LPGENT("DNS lookup error."),
+ LPGENT("Error while creating base socket."),
+ LPGENT("Error connecting to server with socket."),
+ LPGENT("Error while creating SSL structure."),
+ LPGENT("Error connecting socket with SSL."),
+ LPGENT("Server rejected connection with SSL."),
+ LPGENT("Cannot write SSL data."),
+ LPGENT("Cannot read SSL data."),
+ LPGENT("Cannot allocate memory for received data."),
};
- char *ErrorStringA=new char[ERRORSTR_MAXLEN];
- WCHAR *ErrorStringW=new WCHAR[ERRORSTR_MAXLEN];
+ TCHAR *ErrorString = new TCHAR[ERRORSTR_MAXLEN];
POP3_ERRORCODE *ErrorCode=(POP3_ERRORCODE *)(UINT_PTR)Code;
- sprintf(ErrorStringA,Translate("Error %d-%d-%d-%d:"),ErrorCode->AppError,ErrorCode->POP3Error,ErrorCode->NetError,ErrorCode->SystemError);
+ mir_sntprintf(ErrorString, ERRORSTR_MAXLEN, TranslateT("Error %d-%d-%d-%d:"),ErrorCode->AppError,ErrorCode->POP3Error,ErrorCode->NetError,ErrorCode->SystemError);
if (ErrorCode->POP3Error)
- sprintf(ErrorStringA,"%s\n%s",ErrorStringA,Translate(POP3Errors[ErrorCode->POP3Error-1]));
- if (ErrorCode->NetError)
+ mir_sntprintf(ErrorString, ERRORSTR_MAXLEN, _T("%s\n%s"),ErrorString,TranslateTS(POP3Errors[ErrorCode->POP3Error-1]));
+ if (ErrorCode->NetError) {
if (ErrorCode->SSL)
- sprintf(ErrorStringA,"%s\n%s",ErrorStringA,Translate(SSLErrors[ErrorCode->NetError-1]));
+ mir_sntprintf(ErrorString, ERRORSTR_MAXLEN, _T("%s\n%s"),ErrorString, TranslateTS(SSLErrors[ErrorCode->NetError-1]));
else
- sprintf(ErrorStringA,"%s\n%s",ErrorStringA,Translate(NetlibErrors[ErrorCode->NetError-4]));
+ mir_sntprintf(ErrorString, ERRORSTR_MAXLEN, _T("%s\n%s"),ErrorString, TranslateTS(NetlibErrors[ErrorCode->NetError-4]));
+ }
-#ifdef DEBUG_COMM
- DebugLog(CommFile,"%s\n",ErrorStringA);
-#endif
- MultiByteToWideChar(CP_ACP,MB_USEGLYPHCHARS,ErrorStringA,-1,ErrorStringW,(int)strlen(ErrorStringA)+1);
- delete[] ErrorStringA; //we delete ErrorStringA, used to get error string, because Translate() doesn't works in unicode
- delete ErrorCode; //now we can delete ErrorCode, that will not be used anymore
- return ErrorStringW;
+ return ErrorString;
}
void WINAPI DeleteErrorString(LPVOID String)
diff --git a/plugins/YAMN/proto/pop3/pop3opt.cpp b/plugins/YAMN/proto/pop3/pop3opt.cpp
index 29b613d831..bcbf78e380 100644
--- a/plugins/YAMN/proto/pop3/pop3opt.cpp
+++ b/plugins/YAMN/proto/pop3/pop3opt.cpp
@@ -9,121 +9,64 @@
#include "pop3comm.h"
#include "pop3opt.h"
-//- imported ---------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
-extern PLUGINLINK *pluginLink;
-extern PYAMN_VARIABLES pYAMNVar;
-extern HYAMNPROTOPLUGIN POP3Plugin;
-extern struct YAMNExportedFcns *pYAMNFcn;
-extern YAMN_VARIABLES YAMNVar;
+static BOOL Check0,Check1,Check2,Check3,Check4,Check5,Check6,Check7,Check8,Check9;
+static char DlgInput[MAX_PATH];
-extern HICON hYamnIcons[];
+void CheckMenuItems();
-extern DWORD WINAPI WritePOP3Accounts();
-extern DWORD HotKeyThreadID;
-extern CRITICAL_SECTION PluginRegCS;
-//From filterplugin.cpp
-extern PYAMN_FILTERPLUGINQUEUE FirstFilterPlugin;
-//From protoplugin.cpp
-extern PYAMN_PROTOPLUGINQUEUE FirstProtoPlugin;
-//for XP themes
-extern BOOL (WINAPI *MyEnableThemeDialogTexture)(HANDLE, DWORD);
-
-//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
-
-BOOL Check0,Check1,Check2,Check3,Check4,Check5,Check6,Check7,Check8,Check9;
-char DlgInput[MAX_PATH];
-
-//Fuction took from Miranda
-void WordToModAndVk(WORD w,UINT *mod,UINT *vk);
-
-//Initializes YAMN general options for Miranda
-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;
- *vk=LOBYTE(w);
-}
-
-
INT_PTR CALLBACK DlgProcYAMNOpt(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lParam)
{
- switch(msg)
- {
- case WM_INITDIALOG:
- TranslateDialogDefault(hDlg);
- CheckDlgButton(hDlg,IDC_CHECKTTB,DBGetContactSettingByte(NULL,YAMN_DBMODULE,YAMN_TTBFCHECK,1) ? BST_CHECKED : BST_UNCHECKED);
- SendDlgItemMessage(hDlg,IDC_HKFORCE,HKM_SETHOTKEY,DBGetContactSettingWord(NULL,YAMN_DBMODULE,YAMN_HKCHECKMAIL,YAMN_DEFAULTHK),0);
- CheckDlgButton(hDlg,IDC_LONGDATE,(optDateTime&SHOWDATELONG) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hDlg,IDC_SMARTDATE,(optDateTime&SHOWDATENOTODAY) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hDlg,IDC_NOSECONDS,(optDateTime&SHOWDATENOSECONDS) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hDlg,IDC_MAINMENU,DBGetContactSettingByte(NULL, YAMN_DBMODULE, YAMN_SHOWMAINMENU, 1));
- CheckDlgButton(hDlg,IDC_YAMNASPROTO,DBGetContactSettingByte(NULL, YAMN_DBMODULE, YAMN_SHOWASPROTO, 1));
- CheckDlgButton(hDlg,IDC_CLOSEONDELETE,DBGetContactSettingByte(NULL, YAMN_DBMODULE, YAMN_CLOSEDELETE, 0));
-
- break;
- case WM_COMMAND:
- {
- WORD wNotifyCode = HIWORD(wParam);
- switch(LOWORD(wParam))
- {
- case IDC_YAMNASPROTO:
- case IDC_MAINMENU:
- case IDC_CHECKTTB:
- case IDC_HKFORCE:
- case IDC_CLOSEONDELETE:
- case IDC_LONGDATE:
- case IDC_SMARTDATE:
- case IDC_NOSECONDS:
- SendMessage(GetParent(hDlg),PSM_CHANGED,0,0);
- break;
-
- }
- break;
+ switch(msg) {
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hDlg);
+ CheckDlgButton(hDlg,IDC_CHECKTTB,DBGetContactSettingByte(NULL,YAMN_DBMODULE,YAMN_TTBFCHECK,1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hDlg,IDC_LONGDATE,(optDateTime&SHOWDATELONG) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hDlg,IDC_SMARTDATE,(optDateTime&SHOWDATENOTODAY) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hDlg,IDC_NOSECONDS,(optDateTime&SHOWDATENOSECONDS) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hDlg,IDC_MAINMENU,DBGetContactSettingByte(NULL, YAMN_DBMODULE, YAMN_SHOWMAINMENU, 1));
+ CheckDlgButton(hDlg,IDC_YAMNASPROTO,DBGetContactSettingByte(NULL, YAMN_DBMODULE, YAMN_SHOWASPROTO, 1));
+ CheckDlgButton(hDlg,IDC_CLOSEONDELETE,DBGetContactSettingByte(NULL, YAMN_DBMODULE, YAMN_CLOSEDELETE, 0));
+ break;
+
+ case WM_COMMAND:
+ switch(LOWORD(wParam)) {
+ case IDC_YAMNASPROTO:
+ case IDC_MAINMENU:
+ case IDC_CHECKTTB:
+ case IDC_CLOSEONDELETE:
+ case IDC_LONGDATE:
+ case IDC_SMARTDATE:
+ case IDC_NOSECONDS:
+ SendMessage(GetParent(hDlg),PSM_CHANGED,0,0);
+ break;
}
- case WM_NOTIFY:
- switch(((LPNMHDR)lParam)->idFrom)
- {
- case 0:
- switch(((LPNMHDR)lParam)->code)
- {
- case PSN_APPLY:
- {
- WORD ForceHotKey =(WORD)SendDlgItemMessage(hDlg,IDC_HKFORCE,HKM_GETHOTKEY,0,0);
- BYTE TTBFCheck =(BYTE)IsDlgButtonChecked(hDlg,IDC_CHECKTTB);
- BYTE MainMenu = (BYTE)IsDlgButtonChecked(hDlg,IDC_MAINMENU);
- BYTE CloseDelete = (BYTE)IsDlgButtonChecked(hDlg,IDC_CLOSEONDELETE);
- BYTE ShowAsProto = (BYTE)IsDlgButtonChecked(hDlg,IDC_YAMNASPROTO);
- UINT mod,vk;
-
- DBWriteContactSettingByte(NULL,YAMN_DBMODULE,YAMN_SHOWASPROTO,ShowAsProto);
- DBWriteContactSettingWord(NULL,YAMN_DBMODULE,YAMN_HKCHECKMAIL,ForceHotKey);
- DBWriteContactSettingByte(NULL,YAMN_DBMODULE,YAMN_TTBFCHECK,TTBFCheck);
- DBWriteContactSettingByte(NULL,YAMN_DBMODULE,YAMN_SHOWMAINMENU,MainMenu);
- DBWriteContactSettingByte(NULL,YAMN_DBMODULE,YAMN_CLOSEDELETE,CloseDelete);
- WordToModAndVk(ForceHotKey,&mod,&vk);
- PostThreadMessage(HotKeyThreadID,WM_YAMN_CHANGEHOTKEY,(WPARAM)mod,(LPARAM)vk);
-
- optDateTime = 0;
- if (IsDlgButtonChecked(hDlg,IDC_LONGDATE))optDateTime |= SHOWDATELONG;
- if (IsDlgButtonChecked(hDlg,IDC_SMARTDATE))optDateTime |= SHOWDATENOTODAY;
- if (IsDlgButtonChecked(hDlg,IDC_NOSECONDS))optDateTime |= SHOWDATENOSECONDS;
- DBWriteContactSettingByte(NULL,YAMN_DBMODULE,YAMN_DBTIMEOPTIONS,optDateTime);
- }
- }
+ break;
+
+ case WM_NOTIFY:
+ switch(((LPNMHDR)lParam)->idFrom) {
+ case 0:
+ switch(((LPNMHDR)lParam)->code) {
+ case PSN_APPLY:
+ DBWriteContactSettingByte(NULL, YAMN_DBMODULE, YAMN_SHOWASPROTO, IsDlgButtonChecked(hDlg,IDC_YAMNASPROTO));
+ DBWriteContactSettingByte(NULL, YAMN_DBMODULE, YAMN_SHOWMAINMENU, IsDlgButtonChecked(hDlg,IDC_MAINMENU));
+ DBWriteContactSettingByte(NULL, YAMN_DBMODULE, YAMN_CLOSEDELETE, IsDlgButtonChecked(hDlg,IDC_CLOSEONDELETE));
+ DBWriteContactSettingByte(NULL, YAMN_DBMODULE, YAMN_TTBFCHECK, IsDlgButtonChecked(hDlg,IDC_CHECKTTB));
+
+ AddTopToolbarIcon(0, 0);
+ CheckMenuItems();
+
+ optDateTime = 0;
+ if (IsDlgButtonChecked(hDlg,IDC_LONGDATE))optDateTime |= SHOWDATELONG;
+ if (IsDlgButtonChecked(hDlg,IDC_SMARTDATE))optDateTime |= SHOWDATENOTODAY;
+ if (IsDlgButtonChecked(hDlg,IDC_NOSECONDS))optDateTime |= SHOWDATENOSECONDS;
+ DBWriteContactSettingByte(NULL,YAMN_DBMODULE,YAMN_DBTIMEOPTIONS,optDateTime);
}
- break;
+ }
+ break;
}
return FALSE;
@@ -131,96 +74,89 @@ INT_PTR CALLBACK DlgProcYAMNOpt(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lParam)
INT_PTR CALLBACK DlgProcPluginOpt(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lParam)
{
- switch(msg)
+ switch(msg) {
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hDlg);
+ break;
+
+ case WM_COMMAND:
{
- case WM_INITDIALOG:
- TranslateDialogDefault(hDlg);
- break;
- case WM_COMMAND:
+ WORD wNotifyCode = HIWORD(wParam);
+ switch(LOWORD(wParam))
{
- WORD wNotifyCode = HIWORD(wParam);
- switch(LOWORD(wParam))
- {
- case IDC_COMBOPLUGINS:
- if (wNotifyCode==CBN_SELCHANGE)
- {
- HWND hCombo=GetDlgItem(hDlg,IDC_COMBOPLUGINS);
- PYAMN_PROTOPLUGINQUEUE PParser;
- PYAMN_FILTERPLUGINQUEUE FParser;
- int index,id;
+ case IDC_COMBOPLUGINS:
+ 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);
+ for (PParser=FirstProtoPlugin;PParser!=NULL;PParser=PParser->Next)
+ if (id==(INT_PTR)PParser->Plugin)
+ {
+ 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;
- id=SendMessage(hCombo,CB_GETITEMDATA,(WPARAM)index,(LPARAM)0);
- EnterCriticalSection(&PluginRegCS);
- for(PParser=FirstProtoPlugin;PParser!=NULL;PParser=PParser->Next)
- if (id==(INT_PTR)PParser->Plugin)
- {
- 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)
- {
- 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);
- }
- break;
- case IDC_STWWW:
- {
- char str[1024];
- GetDlgItemTextA(hDlg,IDC_STWWW,str,SIZEOF(str));
- CallService(MS_UTILS_OPENURL,1,(LPARAM)str);
- break;
+ }
+ for (FParser=FirstFilterPlugin;FParser!=NULL;FParser=FParser->Next)
+ if (id==(INT_PTR)FParser->Plugin)
+ {
+ 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);
}
-
- }
- break;
- }
- case WM_SHOWWINDOW:
- if (TRUE==(BOOL)wParam)
+ break;
+ case IDC_STWWW:
{
- PYAMN_PROTOPLUGINQUEUE PParser;
- PYAMN_FILTERPLUGINQUEUE FParser;
- int index;
-
- EnterCriticalSection(&PluginRegCS);
- for(PParser=FirstProtoPlugin;PParser!=NULL;PParser=PParser->Next)
- {
- 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=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);
- SendDlgItemMessage(hDlg,IDC_COMBOPLUGINS,CB_SETCURSEL,(WPARAM)0,(LPARAM)0);
- SendMessage(hDlg,WM_COMMAND,MAKELONG(IDC_COMBOPLUGINS,CBN_SELCHANGE),(LPARAM)NULL);
+ char str[1024];
+ GetDlgItemTextA(hDlg,IDC_STWWW,str,SIZEOF(str));
+ CallService(MS_UTILS_OPENURL,1,(LPARAM)str);
break;
}
- else //delete all items in combobox
- {
- int cbn=SendDlgItemMessage(hDlg,IDC_COMBOPLUGINS,CB_GETCOUNT,(WPARAM)0,(LPARAM)0);
- for(int i=0;i<cbn;i++)
- SendDlgItemMessage(hDlg,IDC_COMBOPLUGINS,CB_DELETESTRING,(WPARAM)0,(LPARAM)0);
- break;
+ }
+ break;
+ }
+ case WM_SHOWWINDOW:
+ if (TRUE==(BOOL)wParam) {
+ PYAMN_PROTOPLUGINQUEUE PParser;
+ PYAMN_FILTERPLUGINQUEUE FParser;
+ int index;
+
+ EnterCriticalSection(&PluginRegCS);
+ for (PParser = FirstProtoPlugin; PParser != NULL; PParser = PParser->Next) {
+ 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);
}
- case WM_NOTIFY:
+ for (FParser = FirstFilterPlugin; FParser != NULL; FParser = FParser->Next) {
+ 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);
+ SendDlgItemMessage(hDlg,IDC_COMBOPLUGINS,CB_SETCURSEL,(WPARAM)0,(LPARAM)0);
+ SendMessage(hDlg,WM_COMMAND,MAKELONG(IDC_COMBOPLUGINS,CBN_SELCHANGE),(LPARAM)NULL);
break;
+ }
+ else { //delete all items in combobox
+ int cbn=SendDlgItemMessage(hDlg,IDC_COMBOPLUGINS,CB_GETCOUNT,(WPARAM)0,(LPARAM)0);
+ for (int i=0;i<cbn;i++)
+ SendDlgItemMessage(hDlg,IDC_COMBOPLUGINS,CB_DELETESTRING,(WPARAM)0,(LPARAM)0);
+ break;
+ }
}
return FALSE;
@@ -230,37 +166,30 @@ INT_PTR CALLBACK DlgProcPluginOpt(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lParam
int YAMNOptInitSvc(WPARAM wParam,LPARAM lParam)
{
OPTIONSDIALOGPAGE odp={0};
-
- odp.cbSize=sizeof(odp);
- odp.position=0x00000000;
- odp.hInstance=YAMNVar.hInst;
- odp.pszGroup=LPGEN("Network");
- odp.pszTitle=LPGEN("YAMN");
- odp.flags=ODPF_BOLDGROUPS;
-//insert YAMN options dialog
- //odp.pszTemplate=MAKEINTRESOURCEA(IDD_OPTIONS);
- //odp.pfnDlgProc=(DLGPROC)DlgOptionsProc;
- //CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&odp);
-
- odp.pszTab = LPGEN("Accounts");
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_POP3ACCOUNTOPT);
- odp.pfnDlgProc = DlgProcPOP3AccOpt;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM) &odp);
-
- odp.pszTab = LPGEN("General");
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_YAMNOPT);
- odp.pfnDlgProc = DlgProcYAMNOpt;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM) &odp);
+ odp.cbSize = sizeof(odp);
+ odp.hInstance = YAMNVar.hInst;
+ odp.pszGroup = LPGEN("Network");
+ odp.pszTitle = LPGEN("YAMN");
+ odp.flags = ODPF_BOLDGROUPS;
+
+ odp.pszTab = LPGEN("Accounts");
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_POP3ACCOUNTOPT);
+ odp.pfnDlgProc = DlgProcPOP3AccOpt;
+ CallService(MS_OPT_ADDPAGE, wParam, (LPARAM) &odp);
+
+ odp.pszTab = LPGEN("General");
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_YAMNOPT);
+ odp.pfnDlgProc = DlgProcYAMNOpt;
+ CallService(MS_OPT_ADDPAGE, wParam, (LPARAM) &odp);
odp.pszTab = LPGEN("Plugins");
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_PLUGINOPT);
- odp.pfnDlgProc = DlgProcPluginOpt;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM) &odp);
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_PLUGINOPT);
+ odp.pfnDlgProc = DlgProcPluginOpt;
+ CallService(MS_OPT_ADDPAGE, wParam, (LPARAM) &odp);
- if ( ServiceExists(MS_POPUP_ADDPOPUPEX) )
- {
- odp.pszGroup=LPGEN("PopUps");
- odp.pszTab=LPGEN("YAMN");
+ if ( ServiceExists(MS_POPUP_ADDPOPUPEX)) {
+ odp.pszGroup = LPGEN("PopUps");
+ odp.pszTab = LPGEN("YAMN");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_POP3ACCOUNTPOPUP);
odp.pfnDlgProc = DlgProcPOP3AccPopup;
CallService(MS_OPT_ADDPAGE, wParam, (LPARAM) &odp);
@@ -268,8 +197,6 @@ int YAMNOptInitSvc(WPARAM wParam,LPARAM lParam)
return 0;
}
-
-
//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
BOOL DlgEnableAccountStatus(HWND hDlg,WPARAM wParam,LPARAM lParam)
@@ -471,7 +398,7 @@ BOOL DlgShowAccount(HWND hDlg,WPARAM wParam,LPARAM lParam)
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++)
+ for (i=0;i<=CPLENSUPP;i++)
if ((i<CPLENSUPP) && (CodePageNamesSupp[i].CP==ActualAccount->CP))
{
SendMessage(GetDlgItem(hDlg,IDC_COMBOCP),CB_SETCURSEL,(WPARAM)i,(LPARAM)0);
@@ -725,6 +652,7 @@ BOOL CALLBACK DlgProcPOP3AccStatusOpt(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lP
INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lParam)
{
BOOL Changed=FALSE;
+ INT_PTR Result;
static BOOL InList=FALSE;
static HPOP3ACCOUNT ActualAccount;
static UCHAR ActualStatus;
@@ -742,23 +670,23 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPara
DlgShowAccount(hDlg,(WPARAM)M_SHOWDEFAULT,0);
#ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile,"Options:INITDIALOG:AccountBrowserSO-read wait\n");
+ DebugLog(SynchroFile,"Options:INITDIALOG:AccountBrowserSO-read wait\n");
#endif
WaitToReadSO(POP3Plugin->AccountBrowserSO);
#ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile,"Options:INITDIALOG:AccountBrowserSO-read enter\n");
+ DebugLog(SynchroFile,"Options:INITDIALOG:AccountBrowserSO-read enter\n");
#endif
- 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);
+ 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);
+
#ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile,"Options:INITDIALOG:AccountBrowserSO-read done\n");
+ DebugLog(SynchroFile,"Options:INITDIALOG:AccountBrowserSO-read done\n");
#endif
ReadDoneSO(POP3Plugin->AccountBrowserSO);
SendDlgItemMessage(hDlg, IDC_COMBOCP, CB_ADDSTRING, 0, (LPARAM)TranslateT("Default"));
- for(i=1;i<CPLENSUPP;i++){
+ for (i=1; i < CPLENSUPP; i++) {
CPINFOEX info; GetCPInfoEx(CodePageNamesSupp[i].CP,0,&info);
size_t len = lstrlen(info.CodePageName+7);
info.CodePageName[len+6]=0;
@@ -773,189 +701,179 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPara
}
case WM_SHOWWINDOW:
- if ((BOOL)wParam==FALSE)
- {
+ if ( wParam == FALSE) {
WindowList_Remove(pYAMNVar->MessageWnds,hDlg);
SendMessage(GetParent(hDlg),PSM_UNCHANGED,(WPARAM)hDlg,(LPARAM)0);
}
- else
- WindowList_Add(pYAMNVar->MessageWnds,hDlg,NULL);
+ else WindowList_Add(pYAMNVar->MessageWnds,hDlg,NULL);
return TRUE;
- case WM_YAMN_CHANGESTATUS:
- {
- if ((HPOP3ACCOUNT)wParam!=ActualAccount)
- break;
- TCHAR accstatus[256];
- GetAccountStatus(ActualAccount,accstatus);
- SetDlgItemText(hDlg,IDC_STSTATUS,accstatus);
- return TRUE;
- }
+ case WM_YAMN_CHANGESTATUS:
+ if ((HPOP3ACCOUNT)wParam == ActualAccount) {
+ TCHAR accstatus[256];
+ GetAccountStatus(ActualAccount,accstatus);
+ SetDlgItemText(hDlg,IDC_STSTATUS,accstatus);
+ return TRUE;
+ }
+ break;
case WM_YAMN_CHANGESTATUSOPTION:
- {
Changed=TRUE;
SendMessage(GetParent(hDlg),PSM_CHANGED,0,0);
return TRUE;
- }
case WM_YAMN_CHANGETIME:
- if ((HPOP3ACCOUNT)wParam==ActualAccount)
- {
+ if ((HPOP3ACCOUNT)wParam == ActualAccount) {
TCHAR Text[256];
mir_sntprintf(Text,SIZEOF(Text),TranslateT("Time left to next check [s]: %d"),(DWORD)lParam);
SetDlgItemText(hDlg,IDC_STTIMELEFT,Text);
}
return TRUE;
+
case WM_COMMAND:
- {
- WORD wNotifyCode = HIWORD(wParam);
- switch(LOWORD(wParam))
- {
- LONG Result;
- case IDC_COMBOACCOUNT:
- switch(wNotifyCode)
- {
- case CBN_EDITCHANGE :
- ActualAccount=NULL;
- DlgSetItemText(hDlg,(WPARAM)IDC_STTIMELEFT,(LPARAM)NULL);
-
- 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:
- 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 (lstrlenA(DlgInput))
- DlgEnableAccount(hDlg,(WPARAM)TRUE,(LPARAM)TRUE);
- else
- DlgEnableAccount(hDlg,(WPARAM)FALSE,(LPARAM)FALSE);
- }
- else
- {
- DlgShowAccount(hDlg,(WPARAM)M_SHOWACTUAL,(LPARAM)ActualAccount);
- DlgEnableAccount(hDlg,(WPARAM)TRUE,(LPARAM)TRUE);
- EnableWindow(GetDlgItem(hDlg,IDC_BTNDEL),TRUE);
- }
- break;
- case CBN_SELCHANGE:
- if (CB_ERR!=(Result=SendDlgItemMessage(hDlg,IDC_COMBOACCOUNT,CB_GETCURSEL,0,0)))
- SendDlgItemMessageA(hDlg,IDC_COMBOACCOUNT,CB_GETLBTEXT,(WPARAM)Result,(LPARAM)DlgInput);
+ switch(LOWORD(wParam)) {
+ case IDC_COMBOACCOUNT:
+ switch( HIWORD(wParam)) {
+ case CBN_EDITCHANGE :
+ ActualAccount=NULL;
+ DlgSetItemText(hDlg,(WPARAM)IDC_STTIMELEFT,(LPARAM)NULL);
- 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);
- }
- else
- {
- DlgShowAccount(hDlg,(WPARAM)M_SHOWACTUAL,(LPARAM)ActualAccount);
- DlgEnableAccount(hDlg,(WPARAM)TRUE,(LPARAM)FALSE);
- EnableWindow(GetDlgItem(hDlg,IDC_BTNDEL),TRUE);
- }
- break;
- }
+ if (GetDlgItemTextA(hDlg,IDC_COMBOACCOUNT,DlgInput,sizeof(DlgInput)))
+ DlgEnableAccount(hDlg,(WPARAM)TRUE,(LPARAM)FALSE);
+ else
+ DlgEnableAccount(hDlg,(WPARAM)FALSE,(LPARAM)FALSE);
break;
- case IDC_COMBOCP:
- {
- int sel = SendDlgItemMessage(hDlg,IDC_COMBOCP,CB_GETCURSEL,0,0);
- CPINFOEX info; GetCPInfoEx(CodePageNamesSupp[sel].CP,0,&info);
- DlgSetItemTextT(hDlg, IDC_STSTATUS, info.CodePageName);
+
+ case CBN_KILLFOCUS:
+ 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 (lstrlenA(DlgInput))
+ DlgEnableAccount(hDlg,(WPARAM)TRUE,(LPARAM)TRUE);
+ else
+ DlgEnableAccount(hDlg,(WPARAM)FALSE,(LPARAM)FALSE);
+ }
+ else {
+ DlgShowAccount(hDlg,(WPARAM)M_SHOWACTUAL,(LPARAM)ActualAccount);
+ DlgEnableAccount(hDlg,(WPARAM)TRUE,(LPARAM)TRUE);
+ EnableWindow(GetDlgItem(hDlg,IDC_BTNDEL),TRUE);
}
- case IDC_CHECK:
- case IDC_CHECKSND:
- case IDC_CHECKMSG:
- case IDC_CHECKICO:
- case IDC_CHECKFSND:
- case IDC_CHECKFMSG:
- case IDC_CHECKFICO:
- case IDC_CHECKST0:
- case IDC_CHECKST1:
- case IDC_CHECKST2:
- case IDC_CHECKST3:
- case IDC_CHECKST4:
- case IDC_CHECKST5:
- case IDC_CHECKST6:
- case IDC_CHECKST7:
- case IDC_CHECKST8:
- case IDC_CHECKST9:
- case IDC_CHECKSTART:
- case IDC_CHECKFORCE:
- case IDC_EDITAPPPARAM:
- case IDC_CHECKAPOP:
- case IDC_AUTOBODY:
- case IDC_CHECKCONTACTNICK:
- case IDC_CHECKCONTACTNOEVENT:
- case IDC_CHECKNOTLS:
- Changed=TRUE;
break;
- case IDC_CHECKCONTACT:
- Changed=IsDlgButtonChecked(hDlg,IDC_CHECKCONTACT)==BST_CHECKED;
- EnableWindow(GetDlgItem(hDlg,IDC_CHECKCONTACTNICK),Changed);
- EnableWindow(GetDlgItem(hDlg,IDC_CHECKCONTACTNOEVENT),Changed);
- Changed=TRUE;
+
+ case CBN_SELCHANGE:
+ 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);
+ EnableWindow(GetDlgItem(hDlg,IDC_BTNDEL),FALSE);
+ }
+ else {
+ DlgShowAccount(hDlg,(WPARAM)M_SHOWACTUAL,(LPARAM)ActualAccount);
+ DlgEnableAccount(hDlg,(WPARAM)TRUE,(LPARAM)FALSE);
+ EnableWindow(GetDlgItem(hDlg,IDC_BTNDEL),TRUE);
+ }
break;
- case IDC_CHECKSSL:
+ }
+ break;
+
+ case IDC_COMBOCP:
+ {
+ int sel = SendDlgItemMessage(hDlg,IDC_COMBOCP,CB_GETCURSEL,0,0);
+ CPINFOEX info; GetCPInfoEx(CodePageNamesSupp[sel].CP,0,&info);
+ DlgSetItemTextT(hDlg, IDC_STSTATUS, info.CodePageName);
+ }
+ case IDC_CHECK:
+ case IDC_CHECKSND:
+ case IDC_CHECKMSG:
+ case IDC_CHECKICO:
+ case IDC_CHECKFSND:
+ case IDC_CHECKFMSG:
+ case IDC_CHECKFICO:
+ case IDC_CHECKST0:
+ case IDC_CHECKST1:
+ case IDC_CHECKST2:
+ case IDC_CHECKST3:
+ case IDC_CHECKST4:
+ case IDC_CHECKST5:
+ case IDC_CHECKST6:
+ case IDC_CHECKST7:
+ case IDC_CHECKST8:
+ case IDC_CHECKST9:
+ case IDC_CHECKSTART:
+ case IDC_CHECKFORCE:
+ case IDC_EDITAPPPARAM:
+ case IDC_CHECKAPOP:
+ case IDC_AUTOBODY:
+ case IDC_CHECKCONTACTNICK:
+ case IDC_CHECKCONTACTNOEVENT:
+ case IDC_CHECKNOTLS:
+ Changed=TRUE;
+ break;
+
+ case IDC_CHECKCONTACT:
+ Changed=IsDlgButtonChecked(hDlg,IDC_CHECKCONTACT)==BST_CHECKED;
+ EnableWindow(GetDlgItem(hDlg,IDC_CHECKCONTACTNICK),Changed);
+ EnableWindow(GetDlgItem(hDlg,IDC_CHECKCONTACTNOEVENT),Changed);
+ Changed=TRUE;
+ break;
+
+ case IDC_CHECKSSL:
{
BOOL SSLC = (IsDlgButtonChecked(hDlg,IDC_CHECKSSL)==BST_CHECKED);
SetDlgItemInt(hDlg,IDC_EDITPORT,SSLC ? 995 : 110,FALSE);
EnableWindow(GetDlgItem(hDlg,IDC_CHECKNOTLS),SSLC?0:1);
}
- Changed=TRUE;
- break;
- case IDC_CPB:
- case IDC_CPT:
- case IDC_CPFB:
- case IDC_CPFT:
- case IDC_CPNB:
- case IDC_CPNT:
- if (HIWORD(wParam)!=CPN_COLOURCHANGED)
- break;
- case IDC_CHECKKBN:
- Changed=TRUE;
- break;
- case IDC_CHECKAPP:
- Changed=TRUE;
- EnableWindow(GetDlgItem(hDlg,IDC_BTNAPP),IsDlgButtonChecked(hDlg,IDC_CHECKAPP)==BST_CHECKED);
- EnableWindow(GetDlgItem(hDlg,IDC_EDITAPP),IsDlgButtonChecked(hDlg,IDC_CHECKAPP)==BST_CHECKED);
- EnableWindow(GetDlgItem(hDlg,IDC_EDITAPPPARAM),IsDlgButtonChecked(hDlg,IDC_CHECKAPP)==BST_CHECKED);
- break;
- case IDC_BTNSTATUS:
- {
- DialogBoxParamW(pYAMNVar->hInst,MAKEINTRESOURCEW(IDD_CHOOSESTATUSMODES),hDlg,(DLGPROC)DlgProcPOP3AccStatusOpt,(LPARAM)NULL);
+ Changed=TRUE;
+ break;
+
+ case IDC_CPB:
+ case IDC_CPT:
+ case IDC_CPFB:
+ case IDC_CPFT:
+ case IDC_CPNB:
+ case IDC_CPNT:
+ if (HIWORD(wParam)!=CPN_COLOURCHANGED)
break;
- }
- case IDC_BTNADD:
+ case IDC_CHECKKBN:
+ Changed=TRUE;
+ break;
+
+ case IDC_CHECKAPP:
+ Changed=TRUE;
+ EnableWindow(GetDlgItem(hDlg,IDC_BTNAPP),IsDlgButtonChecked(hDlg,IDC_CHECKAPP)==BST_CHECKED);
+ EnableWindow(GetDlgItem(hDlg,IDC_EDITAPP),IsDlgButtonChecked(hDlg,IDC_CHECKAPP)==BST_CHECKED);
+ EnableWindow(GetDlgItem(hDlg,IDC_EDITAPPPARAM),IsDlgButtonChecked(hDlg,IDC_CHECKAPP)==BST_CHECKED);
+ break;
+
+ case IDC_BTNSTATUS:
+ DialogBoxParamW(pYAMNVar->hInst,MAKEINTRESOURCEW(IDD_CHOOSESTATUSMODES),hDlg,(DLGPROC)DlgProcPOP3AccStatusOpt,(LPARAM)NULL);
+ break;
+
+ case IDC_BTNADD:
+ DlgSetItemText(hDlg,(WPARAM)IDC_STTIMELEFT,(LPARAM)NULL);
+ DlgShowAccount(hDlg,(WPARAM)M_SHOWDEFAULT,0);
+ DlgEnableAccount(hDlg,(WPARAM)TRUE,(LPARAM)TRUE);
+ EnableWindow(GetDlgItem(hDlg,IDC_BTNDEL),FALSE);
+ DlgSetItemTextT(hDlg, IDC_EDITNAME, TranslateT("New Account"));
{
- int index=0;
- DlgSetItemText(hDlg,(WPARAM)IDC_STTIMELEFT,(LPARAM)NULL);
- DlgShowAccount(hDlg,(WPARAM)M_SHOWDEFAULT,0);
- DlgEnableAccount(hDlg,(WPARAM)TRUE,(LPARAM)TRUE);
- EnableWindow(GetDlgItem(hDlg,IDC_BTNDEL),FALSE);
- 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))
- break;
- SendDlgItemMessage(hDlg,IDC_COMBOACCOUNT,CB_SETCURSEL,(WPARAM)index,(LPARAM)TranslateT("New Account"));
- break;
+ int index = SendDlgItemMessage(hDlg, IDC_COMBOACCOUNT, CB_ADDSTRING, 0, (LPARAM)TranslateT("New Account"));
+ if ( index != CB_ERR && index != CB_ERRSPACE )
+ SendDlgItemMessage(hDlg, IDC_COMBOACCOUNT, CB_SETCURSEL, index, (LPARAM)TranslateT("New Account"));
}
+ break;
- case IDC_BTNAPP:
+ case IDC_BTNAPP:
{
- OPENFILENAME OFNStruct;
-
- memset(&OFNStruct,0,sizeof(OPENFILENAME));
- OFNStruct.lStructSize=sizeof(OPENFILENAME);
- OFNStruct.hwndOwner=hDlg;
TCHAR filter[MAX_PATH];
- mir_sntprintf(filter, SIZEOF(filter), _T("%s (*.exe;*.bat;*.cmd;*.com)%c*.exe;*.bat;*.cmd;*.com%c%s (*.*)%c*.*%c"), TranslateT("Executables"), 0, 0, TranslateT("All Files"), 0, 0);
+ mir_sntprintf(filter, SIZEOF(filter), _T("%s (*.exe;*.bat;*.cmd;*.com)%c*.exe;*.bat;*.cmd;*.com%c%s (*.*)%c*.*%c"),
+ TranslateT("Executables"), 0, 0, TranslateT("All Files"), 0, 0);
+
+ OPENFILENAME OFNStruct = { 0 };
+ OFNStruct.lStructSize = sizeof(OPENFILENAME);
+ OFNStruct.hwndOwner = hDlg;
OFNStruct.lpstrFilter= filter;
OFNStruct.nFilterIndex=1;
OFNStruct.nMaxFile=MAX_PATH;
@@ -968,58 +886,54 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPara
if (CommDlgExtendedError())
MessageBox(hDlg,_T("Dialog box error"),_T("Failed"),MB_OK);
}
- else
- DlgSetItemTextT(hDlg, IDC_EDITAPP, OFNStruct.lpstrFile);
+ else DlgSetItemTextT(hDlg, IDC_EDITAPP, OFNStruct.lpstrFile);
delete[] OFNStruct.lpstrFile;
- break;
}
- case IDC_BTNDEFAULT:
- DlgShowAccount(hDlg,(WPARAM)M_SHOWDEFAULT,0);
-// DlgShowAccountColors(hDlg,0,(LPARAM)ActualAccount);
- break;
- case IDC_BTNDEL:
- 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)))
- || (NULL==(ActualAccount=(HPOP3ACCOUNT)CallService(MS_YAMN_FINDACCOUNTBYNAME,(WPARAM)POP3Plugin,(LPARAM)DlgInput))))
- return TRUE;
+ break;
- if (IDOK!=MessageBox(hDlg,TranslateT("Do you really want to delete this account?"),TranslateT("Delete account confirmation"),MB_OKCANCEL | MB_ICONWARNING))
- return TRUE;
+ case IDC_BTNDEFAULT:
+ DlgShowAccount(hDlg,(WPARAM)M_SHOWDEFAULT,0);
+ break;
- DlgSetItemTextT(hDlg, IDC_STTIMELEFT, TranslateT("Please wait while no account is in use."));
+ case IDC_BTNDEL:
+ 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)))
+ || (NULL==(ActualAccount=(HPOP3ACCOUNT)CallService(MS_YAMN_FINDACCOUNTBYNAME,(WPARAM)POP3Plugin,(LPARAM)DlgInput))))
+ return TRUE;
+
+ if (IDOK!=MessageBox(hDlg,TranslateT("Do you really want to delete this account?"),TranslateT("Delete account confirmation"),MB_OKCANCEL | MB_ICONWARNING))
+ return TRUE;
- if (ActualAccount->hContact != NULL)
- CallService(MS_DB_CONTACT_DELETE,(WPARAM)(HANDLE) ActualAccount->hContact, 0);
+ DlgSetItemTextT(hDlg, IDC_STTIMELEFT, TranslateT("Please wait while no account is in use."));
- CallService(MS_YAMN_DELETEACCOUNT,(WPARAM)POP3Plugin,(LPARAM)ActualAccount);
+ if (ActualAccount->hContact != NULL)
+ CallService(MS_DB_CONTACT_DELETE,(WPARAM)(HANDLE) ActualAccount->hContact, 0);
+
+ CallService(MS_YAMN_DELETEACCOUNT,(WPARAM)POP3Plugin,(LPARAM)ActualAccount);
- //We can consider our account as deleted.
+ //We can consider our account as deleted.
- SendDlgItemMessage(hDlg,IDC_COMBOACCOUNT,CB_DELETESTRING,(WPARAM)Result,0);
- DlgSetItemText(hDlg,(WPARAM)IDC_COMBOACCOUNT,(LPARAM)NULL);
- DlgEnableAccount(hDlg,(WPARAM)FALSE,0);
- DlgShowAccount(hDlg,(WPARAM)M_SHOWDEFAULT,0);
-// Beep(100,50);
- break;
- case IDC_BTNRESET:
- if (ActualAccount!=NULL)
- ActualAccount->TimeLeft=ActualAccount->Interval;
- return 1;
+ SendDlgItemMessage(hDlg,IDC_COMBOACCOUNT,CB_DELETESTRING,(WPARAM)Result,0);
+ DlgSetItemText(hDlg,(WPARAM)IDC_COMBOACCOUNT,(LPARAM)NULL);
+ DlgEnableAccount(hDlg,(WPARAM)FALSE,0);
+ DlgShowAccount(hDlg,(WPARAM)M_SHOWDEFAULT,0);
+ break;
+
+ case IDC_BTNRESET:
+ if (ActualAccount != NULL)
+ ActualAccount->TimeLeft=ActualAccount->Interval;
+ return 1;
}
- if (HIWORD(wParam)==EN_CHANGE)
- Changed=TRUE;
+
+ if (HIWORD(wParam) == EN_CHANGE)
+ Changed = TRUE;
break;
- }
+
case WM_NOTIFY:
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;
@@ -1152,13 +1066,13 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPara
ActualAccount->Server->Passwd=new char[ strlen(Text)+1];
strcpy(ActualAccount->Server->Passwd,Text);
- GetDlgItemTextW(hDlg,IDC_EDITAPP,TextW,sizeof(TextW)/sizeof(WCHAR));
+ GetDlgItemTextW(hDlg,IDC_EDITAPP,TextW,SIZEOF(TextW));
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_EDITAPPPARAM,TextW,sizeof(TextW)/sizeof(WCHAR));
+ GetDlgItemTextW(hDlg,IDC_EDITAPPPARAM,TextW,SIZEOF(TextW));
if (NULL!=ActualAccount->NewMailN.AppParam)
delete[] ActualAccount->NewMailN.AppParam;
ActualAccount->NewMailN.AppParam=new WCHAR[wcslen(TextW)+1];
@@ -1243,7 +1157,7 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPara
SendDlgItemMessage(hDlg,IDC_COMBOACCOUNT,CB_RESETCONTENT,0,(LPARAM)0);
if (POP3Plugin->FirstAccount!=NULL)
- for(ActualAccount=(HPOP3ACCOUNT)POP3Plugin->FirstAccount;ActualAccount!=NULL;ActualAccount=(HPOP3ACCOUNT)ActualAccount->Next)
+ 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);
@@ -1285,7 +1199,7 @@ INT_PTR CALLBACK DlgProcPOP3AccPopup(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa
DebugLog(SynchroFile,"Options:INITDIALOG:AccountBrowserSO-read enter\n");
#endif
if (POP3Plugin->FirstAccount!=NULL)
- for(ActualAccount=(HPOP3ACCOUNT)POP3Plugin->FirstAccount;ActualAccount!=NULL;ActualAccount=(HPOP3ACCOUNT)ActualAccount->Next)
+ 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);
#ifdef DEBUG_SYNCHRO
@@ -1315,7 +1229,7 @@ INT_PTR CALLBACK DlgProcPOP3AccPopup(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa
SendDlgItemMessage(hDlg,IDC_COMBOACCOUNT,CB_RESETCONTENT,0,(LPARAM)0);
if (POP3Plugin->FirstAccount!=NULL)
- for(ActualAccount=(HPOP3ACCOUNT)POP3Plugin->FirstAccount;ActualAccount!=NULL;ActualAccount=(HPOP3ACCOUNT)ActualAccount->Next)
+ 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);
@@ -1425,9 +1339,9 @@ INT_PTR CALLBACK DlgProcPOP3AccPopup(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa
Tester.lchContact=NULL;
TesterF.lchContact=NULL;
TesterN.lchContact=NULL;
- Tester.lchIcon=hYamnIcons[2];
- TesterF.lchIcon=hYamnIcons[3];
- TesterN.lchIcon=hYamnIcons[1];
+ Tester.lchIcon=g_LoadIconEx(2);
+ TesterF.lchIcon=g_LoadIconEx(3);
+ TesterN.lchIcon=g_LoadIconEx(1);
lstrcpy(Tester.lptzContactName,TranslateT("Account Test"));
lstrcpy(TesterF.lptzContactName,TranslateT("Account Test (failed)"));