summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-05-27 16:05:18 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-05-27 16:05:18 +0000
commitc5e9ee462edc701924e0b378df1404759f9ee0fb (patch)
tree714ea38805adcef600ac02f021a726169ff31718
parent5c64f7b180825e9fa39a394a713de13765e50291 (diff)
YAMN adaptation for the modern Miranda
git-svn-id: http://svn.miranda-ng.org/main/trunk@198 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--plugins/YAMN/YAMN_10.vcxproj1
-rw-r--r--plugins/YAMN/YAMN_10.vcxproj.filters3
-rw-r--r--plugins/YAMN/account.cpp128
-rw-r--r--plugins/YAMN/browser/badconnect.cpp49
-rw-r--r--plugins/YAMN/browser/mailbrowser.cpp132
-rw-r--r--plugins/YAMN/filterplugin.cpp6
-rw-r--r--plugins/YAMN/mails/decode.cpp8
-rw-r--r--plugins/YAMN/mails/mails.cpp18
-rw-r--r--plugins/YAMN/mails/mime.cpp12
-rw-r--r--plugins/YAMN/main.cpp781
-rw-r--r--plugins/YAMN/main.h5
-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
-rw-r--r--plugins/YAMN/protoplugin.cpp41
-rw-r--r--plugins/YAMN/resources/YAMN.rc91
-rw-r--r--plugins/YAMN/resources/resource.h1
-rw-r--r--plugins/YAMN/services.cpp613
-rw-r--r--plugins/YAMN/yamn.cpp222
-rw-r--r--plugins/YAMN/yamn.h126
20 files changed, 1335 insertions, 1840 deletions
diff --git a/plugins/YAMN/YAMN_10.vcxproj b/plugins/YAMN/YAMN_10.vcxproj
index 2f0b2f0a35..5d7c1cc48f 100644
--- a/plugins/YAMN/YAMN_10.vcxproj
+++ b/plugins/YAMN/YAMN_10.vcxproj
@@ -255,6 +255,7 @@
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="resources\YAMN.rc" />
+ <ResourceCompile Include="resources\yamn_ver.rc" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
diff --git a/plugins/YAMN/YAMN_10.vcxproj.filters b/plugins/YAMN/YAMN_10.vcxproj.filters
index 7d835ef06f..9ad0a75aab 100644
--- a/plugins/YAMN/YAMN_10.vcxproj.filters
+++ b/plugins/YAMN/YAMN_10.vcxproj.filters
@@ -124,5 +124,8 @@
<ResourceCompile Include="resources\YAMN.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
+ <ResourceCompile Include="resources\yamn_ver.rc">
+ <Filter>Resource Files</Filter>
+ </ResourceCompile>
</ItemGroup>
</Project> \ No newline at end of file
diff --git a/plugins/YAMN/account.cpp b/plugins/YAMN/account.cpp
index 532640c15b..983bab21f7 100644
--- a/plugins/YAMN/account.cpp
+++ b/plugins/YAMN/account.cpp
@@ -34,10 +34,8 @@ struct CExportedServices AccountExportedSvc[]=
{MS_YAMN_FINDACCOUNTBYNAME,FindAccountByNameSvc},
{MS_YAMN_GETNEXTFREEACCOUNT,GetNextFreeAccountSvc},
{MS_YAMN_DELETEACCOUNT,DeletePluginAccountSvc},
- {MS_YAMN_READACCOUNTSA,AddAccountsFromFileASvc},
- {MS_YAMN_READACCOUNTSW,AddAccountsFromFileWSvc},
- {MS_YAMN_WRITEACCOUNTSA,WriteAccountsToFileASvc},
- {MS_YAMN_WRITEACCOUNTSW,WriteAccountsToFileWSvc},
+ {MS_YAMN_READACCOUNTS,AddAccountsFromFileSvc},
+ {MS_YAMN_WRITEACCOUNTS,WriteAccountsToFileSvc},
};
//--------------------------------------------------------------------------------------------------
@@ -175,7 +173,7 @@ void CodeDecodeString(char *Dest,BOOL Encrypt)
if (Dest==NULL)
return;
- for(;*Dest!=(TCHAR)0;Dest++)
+ for (;*Dest!=(TCHAR)0;Dest++)
{
if (Encrypt)
*Dest=*Dest+Code;
@@ -212,24 +210,13 @@ static DWORD PostFileToMemory(HANDLE File,char **MemFile,char **End)
return 0;
}
-DWORD FileToMemoryA(char *FileName,char **MemFile,char **End)
+DWORD FileToMemory(TCHAR *FileName,char **MemFile,char **End)
{
- HANDLE File;
-
- if (INVALID_HANDLE_VALUE==(File=CreateFileA(FileName,GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL)))
- return EACC_SYSTEM;
-
- return PostFileToMemory(File,MemFile,End);
-}
-
-DWORD FileToMemoryW(WCHAR *FileName,char **MemFile,char **End)
-{
- HANDLE File;
-
- if (INVALID_HANDLE_VALUE==(File=CreateFileW(FileName,GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL)))
+ HANDLE hFile = CreateFile(FileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ if (hFile == INVALID_HANDLE_VALUE)
return EACC_SYSTEM;
- return PostFileToMemory(File,MemFile,End);
+ return PostFileToMemory(hFile, MemFile, End);
}
#if defined(DEBUG_FILEREAD) || defined(DEBUG_FILEREADMESSAGES)
@@ -251,7 +238,7 @@ DWORD ReadStringFromMemory(char **Parser,TCHAR *End,char **StoreTo,TCHAR *DebugS
{
if (NULL==(Dest=*StoreTo=new TCHAR[Size+1]))
return EACC_ALLOC;
- for(;*Parser<=Finder;(*Parser)++,Dest++)
+ for (;*Parser<=Finder;(*Parser)++,Dest++)
*Dest=**Parser;
}
else
@@ -276,7 +263,7 @@ DWORD ReadStringFromMemory(char **Parser,char *End,char **StoreTo)
{
if (NULL==(Dest=*StoreTo=new char[Size+1]))
return EACC_ALLOC;
- for(;*Parser<=Finder;(*Parser)++,Dest++)
+ for (;*Parser<=Finder;(*Parser)++,Dest++)
*Dest=**Parser;
}
else
@@ -306,7 +293,7 @@ DWORD ReadStringFromMemoryW(WCHAR **Parser,TCHAR *End,WCHAR **StoreTo,WCHAR *Deb
{
if (NULL==(Dest=*StoreTo=new WCHAR[Size+1]))
return EACC_ALLOC;
- for(;*Parser<=Finder;(*Parser)++,Dest++)
+ for (;*Parser<=Finder;(*Parser)++,Dest++)
*Dest=**Parser;
}
else
@@ -318,7 +305,7 @@ DWORD ReadStringFromMemoryW(WCHAR **Parser,TCHAR *End,WCHAR **StoreTo,WCHAR *Deb
}
#endif //if defined(DEBUG...)
-DWORD ReadStringFromMemoryW(WCHAR **Parser,TCHAR *End,WCHAR **StoreTo)
+DWORD ReadStringFromMemoryW(WCHAR **Parser,WCHAR *End,WCHAR **StoreTo)
{
WCHAR *Dest,*Finder;
DWORD Size;
@@ -331,7 +318,7 @@ DWORD ReadStringFromMemoryW(WCHAR **Parser,TCHAR *End,WCHAR **StoreTo)
{
if (NULL==(Dest=*StoreTo=new WCHAR[Size+1]))
return EACC_ALLOC;
- for(;*Parser<=Finder;(*Parser)++,Dest++)
+ for (;*Parser<=Finder;(*Parser)++,Dest++)
*Dest=**Parser;
}
else
@@ -703,7 +690,7 @@ static INT_PTR PerformAccountReading(HYAMNPROTOPLUGIN Plugin,char *MemFile,char
if (Stat && (Stat!=EACC_ENDOFFILE))
{
- for(ActualAccount=FirstAllocatedAccount;ActualAccount!=NULL;ActualAccount=Temp)
+ for (ActualAccount=FirstAllocatedAccount;ActualAccount!=NULL;ActualAccount=Temp)
{
Temp=ActualAccount->Next;
delete ActualAccount;
@@ -725,7 +712,7 @@ static INT_PTR PerformAccountReading(HYAMNPROTOPLUGIN Plugin,char *MemFile,char
if ((Stat!=EACC_ENDOFFILE) && (NULL==(ActualAccount=(HACCOUNT)CallService(MS_YAMN_GETNEXTFREEACCOUNT,(WPARAM)Plugin,(LPARAM)YAMN_ACCOUNTVERSION))))
{
- for(ActualAccount=FirstAllocatedAccount;ActualAccount!=NULL;ActualAccount=Temp)
+ for (ActualAccount=FirstAllocatedAccount;ActualAccount!=NULL;ActualAccount=Temp)
{
Temp=ActualAccount->Next;
delete ActualAccount;
@@ -751,24 +738,11 @@ static INT_PTR PerformAccountReading(HYAMNPROTOPLUGIN Plugin,char *MemFile,char
}
// Add accounts from file to memory
-INT_PTR AddAccountsFromFileASvc(WPARAM wParam,LPARAM lParam)
+INT_PTR AddAccountsFromFileSvc(WPARAM wParam,LPARAM lParam)
{
- DWORD Stat;
char *MemFile,*End;
-
- if (Stat=FileToMemoryA((char *)lParam,&MemFile,&End))
- return (INT_PTR)Stat;
-
- return PerformAccountReading((HYAMNPROTOPLUGIN)wParam,MemFile,End);
-}
-
-INT_PTR AddAccountsFromFileWSvc(WPARAM wParam,LPARAM lParam)
-//Add accounts from file to memory
-{
- DWORD Stat;
- char *MemFile,*End;
-
- if (Stat=FileToMemoryW((WCHAR *)lParam,&MemFile,&End))
+ DWORD Stat = FileToMemory(( TCHAR* )lParam, &MemFile, &End);
+ if ( Stat != NO_ERROR )
return (INT_PTR)Stat;
return PerformAccountReading((HYAMNPROTOPLUGIN)wParam,MemFile,End);
@@ -779,16 +753,13 @@ DWORD WriteStringToFile(HANDLE File,char *Source)
DWORD Length,WrittenBytes;
char null = 0;
- if ((Source==NULL) || !(Length=(DWORD)strlen(Source)))
- {
- if (!WriteFile(File,&null,1,&WrittenBytes,NULL))
- {
+ if ((Source==NULL) || !(Length=(DWORD)strlen(Source))) {
+ if (!WriteFile(File,&null,1,&WrittenBytes,NULL)) {
CloseHandle(File);
return EACC_SYSTEM;
}
}
- else if (!WriteFile(File,Source,(Length+1),&WrittenBytes,NULL))
- {
+ else if (!WriteFile(File,Source,(Length+1),&WrittenBytes,NULL)) {
CloseHandle(File);
return EACC_SYSTEM;
}
@@ -829,7 +800,7 @@ DWORD WriteMessagesToFile(HANDLE File,HACCOUNT Which)
return EACC_SYSTEM;
if ((NULL!=Which->Plugin->MailFcn) && (NULL!=Which->Plugin->MailFcn->WriteMailOptsFcnPtr))
Which->Plugin->MailFcn->WriteMailOptsFcnPtr(File,ActualMail); //write plugin mail options to file
- for(items=ActualMail->MailData->TranslatedHeader;items!=NULL;items=items->Next)
+ for (items=ActualMail->MailData->TranslatedHeader;items!=NULL;items=items->Next)
{
if (Stat=WriteStringToFile(File,items->name))
return Stat;
@@ -862,7 +833,7 @@ static INT_PTR PerformAccountWriting(HYAMNPROTOPLUGIN Plugin,HANDLE File)
#endif
try
{
- for(ActualAccount=Plugin->FirstAccount;ActualAccount!=NULL;ActualAccount=ActualAccount->Next)
+ for (ActualAccount=Plugin->FirstAccount;ActualAccount!=NULL;ActualAccount=ActualAccount->Next)
{
/* TCHAR DEBUG[100];
Beep(3000,100);Sleep(200);
@@ -1010,43 +981,20 @@ static INT_PTR PerformAccountWriting(HYAMNPROTOPLUGIN Plugin,HANDLE File)
return 0;
}
-INT_PTR WriteAccountsToFileASvc(WPARAM wParam,LPARAM lParam)
//Writes accounts to file
+INT_PTR WriteAccountsToFileSvc(WPARAM wParam,LPARAM lParam)
{
- HYAMNPROTOPLUGIN Plugin=(HYAMNPROTOPLUGIN)wParam;
- char *FileName=(char *)lParam;
+ HYAMNPROTOPLUGIN Plugin = ( HYAMNPROTOPLUGIN )wParam;
+ TCHAR* tszFileName = ( TCHAR* )lParam;
- HANDLE File;
-
- EnterCriticalSection(&FileWritingCS);
- if (INVALID_HANDLE_VALUE==(File=CreateFileA(FileName,GENERIC_WRITE,FILE_SHARE_WRITE,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL)))
- {
+ EnterCriticalSection( &FileWritingCS );
+ HANDLE hFile = CreateFile(tszFileName, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL );
+ if ( hFile == INVALID_HANDLE_VALUE ) {
LeaveCriticalSection(&FileWritingCS);
return EACC_SYSTEM;
}
- LeaveCriticalSection(&FileWritingCS);
-
- return PerformAccountWriting(Plugin,File);
-}
-
-INT_PTR WriteAccountsToFileWSvc(WPARAM wParam,LPARAM lParam)
-//Writes accounts to file
-{
- HYAMNPROTOPLUGIN Plugin=(HYAMNPROTOPLUGIN)wParam;
- WCHAR *FileName=(WCHAR *)lParam;
- INT_PTR rv;
-
- HANDLE File;
-
- EnterCriticalSection(&FileWritingCS);
- if (INVALID_HANDLE_VALUE==(File=CreateFileW(FileName,GENERIC_WRITE,FILE_SHARE_WRITE,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL)))
- {
- LeaveCriticalSection(&FileWritingCS);
- return EACC_SYSTEM;
- }
-
- rv=PerformAccountWriting(Plugin,File);
+ INT_PTR rv = PerformAccountWriting(Plugin, hFile);
LeaveCriticalSection(&FileWritingCS);
return rv;
@@ -1065,7 +1013,7 @@ INT_PTR FindAccountByNameSvc(WPARAM wParam,LPARAM lParam)
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"FindAccountByName:AccountBrowserSO-read enter\n");
#endif
- for(Finder=Plugin->FirstAccount;Finder!=NULL;Finder=Finder->Next)
+ for (Finder=Plugin->FirstAccount;Finder!=NULL;Finder=Finder->Next)
if ((Finder->Name!=NULL) && (0 == strcmp(SearchedAccount,Finder->Name)))
break;
#ifdef DEBUG_SYNCHRO
@@ -1085,7 +1033,7 @@ INT_PTR GetNextFreeAccountSvc(WPARAM wParam,LPARAM lParam)
Plugin->FirstAccount=(HACCOUNT)CallService(MS_YAMN_CREATEPLUGINACCOUNT,wParam,lParam);
return (INT_PTR)Plugin->FirstAccount;
}
- for(Finder=Plugin->FirstAccount;Finder->Next!=NULL;Finder=Finder->Next);
+ for (Finder=Plugin->FirstAccount;Finder->Next!=NULL;Finder=Finder->Next);
Finder->Next=(HACCOUNT)CallService(MS_YAMN_CREATEPLUGINACCOUNT,wParam,lParam);
return (INT_PTR)Finder->Next;
}
@@ -1098,7 +1046,7 @@ int FindPluginAccount(WPARAM wParam,LPARAM lParam)
if (Finder=NULL) Finder=Plugin->FirstAccount;
-// for(;Finder!=NULL && Finder->PluginID!=Plugin->PluginInfo->PluginID;Finder=(HACCOUNT)Finder->Next);
+// for (;Finder!=NULL && Finder->PluginID!=Plugin->PluginInfo->PluginID;Finder=(HACCOUNT)Finder->Next);
return (int)Finder;
}
*/
@@ -1165,7 +1113,7 @@ INT_PTR DeleteAccountSvc(WPARAM wParam,LPARAM lParam)
}
else
{
- for(Finder=Plugin->FirstAccount;Which!=Finder->Next;Finder=Finder->Next);
+ for (Finder=Plugin->FirstAccount;Which!=Finder->Next;Finder=Finder->Next);
Finder->Next=Finder->Next->Next;
}
//leave write access
@@ -1209,7 +1157,7 @@ int StopAccounts(HYAMNPROTOPLUGIN Plugin)
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"StopAccounts:AccountBrowserSO-write enter\n");
#endif
- for(Finder=Plugin->FirstAccount;Finder!=NULL;Finder=Finder->Next)
+ for (Finder=Plugin->FirstAccount;Finder!=NULL;Finder=Finder->Next)
{
//2. set stop signal
StopSignalFcn(Finder);
@@ -1243,7 +1191,7 @@ int WaitForAllAccounts(HYAMNPROTOPLUGIN Plugin,BOOL GetAccountBrowserAccess)
DebugLog(SynchroFile,"WaitForAllAccounts:AccountBrowserSO-write enter\n");
#endif
}
- for(Finder=Plugin->FirstAccount;Finder!=NULL;Finder=Finder->Next)
+ for (Finder=Plugin->FirstAccount;Finder!=NULL;Finder=Finder->Next)
{
//2. wait for signal that account is not in use
#ifdef DEBUG_SYNCHRO
@@ -1282,7 +1230,7 @@ int DeleteAccounts(HYAMNPROTOPLUGIN Plugin)
WaitForAllAccounts(Plugin,FALSE);
- for(Finder=Plugin->FirstAccount;Finder!=NULL;)
+ for (Finder=Plugin->FirstAccount;Finder!=NULL;)
{
HACCOUNT Next = Finder->Next;
DeletePluginAccountSvc((WPARAM)Finder,(LPARAM)0);
@@ -1345,7 +1293,7 @@ int GetAccounts()
HACCOUNT Finder;
int cnt=0;
- for(Finder=Account;Finder!=NULL;Finder=Finder->Next)
+ for (Finder=Account;Finder!=NULL;Finder=Finder->Next)
cnt++;
return cnt;
}
@@ -1354,7 +1302,7 @@ void WriteAccounts()
{
HACCOUNT Finder;
- for(Finder=Account;Finder!=NULL;Finder=Finder->Next)
+ for (Finder=Account;Finder!=NULL;Finder=Finder->Next)
MessageBoxA(NULL,Finder->Name,"Browsing account",MB_OK);
}
#endif
diff --git a/plugins/YAMN/browser/badconnect.cpp b/plugins/YAMN/browser/badconnect.cpp
index a6c1518339..cb3de50c5d 100644
--- a/plugins/YAMN/browser/badconnect.cpp
+++ b/plugins/YAMN/browser/badconnect.cpp
@@ -10,35 +10,6 @@
#define BADCONNECTTITLE "%s - connection error"
#define BADCONNECTMSG "An error occured. Error code: %d"
-//- imported ---------------------------------------------------------------------------------------
-//--------------------------------------------------------------------------------------------------
-
-extern YAMN_VARIABLES YAMNVar;
-
-//From synchro.cpp
-extern DWORD WINAPI WaitToReadFcn(PSWMRG SObject);
-extern void WINAPI ReadDoneFcn(PSWMRG SObject);
-extern DWORD WINAPI SCIncFcn(PSCOUNTER SCounter);
-extern DWORD WINAPI SCDecFcn(PSCOUNTER SCounter);
-
-
-extern HICON hYamnIcons[];
-
-//--------------------------------------------------------------------------------------------------
-//--------------------------------------------------------------------------------------------------
-
-//Window callback procedure for popup window (created by popup plugin)
-LRESULT CALLBACK BadConnectPopUpProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam) ;
-
-//Dialog callback procedure for bad connection message
-LRESULT CALLBACK DlgProcYAMNBadConnection(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lParam);
-
-//BadConnection thread function creates window for BadConnection message
-DWORD WINAPI BadConnection(LPVOID Param);
-
-INT_PTR RunBadConnectionSvc(WPARAM wParam,LPARAM lParam);
-
-//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
LRESULT CALLBACK BadConnectPopUpProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
@@ -129,7 +100,7 @@ LRESULT CALLBACK DlgProcYAMNBadConnection(HWND hDlg,UINT msg,WPARAM wParam,LPARA
DWORD ErrorCode;
char* TitleStrA;
char *Message1A=NULL;
- WCHAR *Message1W=NULL;
+ TCHAR *Message1W=NULL;
POPUPDATAT BadConnectPopUp;
ActualAccount=((struct BadConnectionParam *)lParam)->account;
@@ -157,7 +128,7 @@ LRESULT CALLBACK DlgProcYAMNBadConnection(HWND hDlg,UINT msg,WPARAM wParam,LPARA
if (ShowPopUp)
{
BadConnectPopUp.lchContact=ActualAccount;
- BadConnectPopUp.lchIcon=hYamnIcons[3];
+ BadConnectPopUp.lchIcon=g_LoadIconEx(3);
BadConnectPopUp.colorBack=ActualAccount->BadConnectN.Flags & YAMN_ACC_POPC ? ActualAccount->BadConnectN.PopUpB : GetSysColor(COLOR_BTNFACE);
BadConnectPopUp.colorText=ActualAccount->BadConnectN.Flags & YAMN_ACC_POPC ? ActualAccount->BadConnectN.PopUpT : GetSysColor(COLOR_WINDOWTEXT);
BadConnectPopUp.iSeconds=ActualAccount->BadConnectN.PopUpTime;
@@ -170,7 +141,7 @@ LRESULT CALLBACK DlgProcYAMNBadConnection(HWND hDlg,UINT msg,WPARAM wParam,LPARA
if (ActualAccount->Plugin->Fcn!=NULL && ActualAccount->Plugin->Fcn->GetErrorStringWFcnPtr!=NULL)
{
Message1W=ActualAccount->Plugin->Fcn->GetErrorStringWFcnPtr(ErrorCode);
- SendMessageW(GetDlgItem(hDlg,IDC_STATICMSG),WM_SETTEXT,(WPARAM)0,(LPARAM)Message1W);
+ SetDlgItemText(hDlg,IDC_STATICMSG,Message1W);
lstrcpyn(BadConnectPopUp.lptzText,Message1W,sizeof(BadConnectPopUp.lptzText));
if (ShowPopUp)
PUAddPopUpT(&BadConnectPopUp);
@@ -178,7 +149,7 @@ LRESULT CALLBACK DlgProcYAMNBadConnection(HWND hDlg,UINT msg,WPARAM wParam,LPARA
else if (ActualAccount->Plugin->Fcn!=NULL && ActualAccount->Plugin->Fcn->GetErrorStringAFcnPtr!=NULL)
{
Message1W=ActualAccount->Plugin->Fcn->GetErrorStringWFcnPtr(ErrorCode);
- SendMessageW(GetDlgItem(hDlg,IDC_STATICMSG),WM_SETTEXT,(WPARAM)0,(LPARAM)Message1A);
+ SetDlgItemText(hDlg,IDC_STATICMSG,Message1W);
lstrcpyn(BadConnectPopUp.lptzText,Message1W,sizeof(BadConnectPopUp.lptzText));
if (ShowPopUp)
PUAddPopUpT(&BadConnectPopUp);
@@ -186,7 +157,7 @@ LRESULT CALLBACK DlgProcYAMNBadConnection(HWND hDlg,UINT msg,WPARAM wParam,LPARA
else
{
Message1W=TranslateT("Unknown error");
- SendMessageW(GetDlgItem(hDlg,IDC_STATICMSG),WM_SETTEXT,(WPARAM)0,(LPARAM)Message1A);
+ SetDlgItemText(hDlg,IDC_STATICMSG,Message1W);
lstrcpyn(BadConnectPopUp.lptzText,Message1W,sizeof(BadConnectPopUp.lptzText));
if (ShowPopUp)
PUAddPopUpT(&BadConnectPopUp);
@@ -285,13 +256,13 @@ DWORD WINAPI BadConnection(LPVOID Param)
__try
{
hBadConnect=CreateDialogParam(YAMNVar.hInst,MAKEINTRESOURCE(IDD_DLGBADCONNECT),NULL,(DLGPROC)DlgProcYAMNBadConnection,(LPARAM)&MyParam);
- SendMessage(hBadConnect,WM_SETICON,ICON_BIG,(LPARAM)hYamnIcons[3]);
- SendMessage(hBadConnect,WM_SETICON,ICON_SMALL,(LPARAM)hYamnIcons[3]);
+ SendMessage(hBadConnect,WM_SETICON,ICON_BIG,(LPARAM)g_LoadIconEx(3));
+ SendMessage(hBadConnect,WM_SETICON,ICON_SMALL,(LPARAM)g_LoadIconEx(3));
ZeroMemory(&nid,sizeof(nid));
nid.cbSize=sizeof(NOTIFYICONDATA);
nid.hWnd=hBadConnect;
- nid.hIcon=hYamnIcons[3];
+ nid.hIcon=g_LoadIconEx(3);
nid.uID=0;
nid.uFlags=NIF_ICON | NIF_MESSAGE | NIF_TIP;
nid.uCallbackMessage=WM_YAMN_NOTIFYICON;
@@ -309,8 +280,8 @@ DWORD WINAPI BadConnection(LPVOID Param)
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"BadConnect:ActualAccountSO-read enter\n");
#endif
- for(src=ActualAccount->Name,dest=nid.szTip,i=0;(*src!=(TCHAR)0) && (i+1<sizeof(nid.szTip));*dest++=*src++);
- for(src=NotIconText;(*src!=(TCHAR)0) && (i+1<sizeof(nid.szTip));*dest++=*src++);
+ for (src=ActualAccount->Name,dest=nid.szTip,i=0;(*src!=(TCHAR)0) && (i+1<sizeof(nid.szTip));*dest++=*src++);
+ for (src=NotIconText;(*src!=(TCHAR)0) && (i+1<sizeof(nid.szTip));*dest++=*src++);
*dest=(TCHAR)0;
if (ActualAccount->BadConnectN.Flags & YAMN_ACC_SND)
diff --git a/plugins/YAMN/browser/mailbrowser.cpp b/plugins/YAMN/browser/mailbrowser.cpp
index 96d47d7962..7af83115b4 100644
--- a/plugins/YAMN/browser/mailbrowser.cpp
+++ b/plugins/YAMN/browser/mailbrowser.cpp
@@ -368,7 +368,7 @@ int UpdateMails(HWND hDlg,HACCOUNT ActualAccount,DWORD nflags,DWORD nnflags)
ZeroMemory(&MN,sizeof(MN));
- for(msgq=(HYAMNMAIL)ActualAccount->Mails;msgq!=NULL;msgq=msgq->Next)
+ for (msgq=(HYAMNMAIL)ActualAccount->Mails;msgq!=NULL;msgq=msgq->Next)
{
if (!LoadedMailData(msgq)) //check if mail is already in memory
{
@@ -470,7 +470,7 @@ int ChangeExistingMailStatus(HWND hListView,HACCOUNT ActualAccount,struct CMailN
in=ListView_GetItemCount(hListView);
item.mask=LVIF_PARAM;
- for(i=0;i<in;i++)
+ for (i=0;i<in;i++)
{
item.iItem=i;
item.iSubItem=0;
@@ -478,7 +478,7 @@ int ChangeExistingMailStatus(HWND hListView,HACCOUNT ActualAccount,struct CMailN
mail=(HYAMNMAIL)item.lParam;
else
continue;
- for(msgq=(HYAMNMAIL)ActualAccount->Mails;(msgq!=NULL)&&(msgq!=mail);msgq=msgq->Next); //found the same mail in account queue
+ for (msgq=(HYAMNMAIL)ActualAccount->Mails;(msgq!=NULL)&&(msgq!=mail);msgq=msgq->Next); //found the same mail in account queue
if (msgq==NULL) //if mail was not found
if (TRUE==ListView_DeleteItem(hListView,i))
{
@@ -520,7 +520,7 @@ int AddNewMailsToListView(HWND hListView,HACCOUNT ActualAccount,struct CMailNumb
}
NewMailPopUp.lchContact=(ActualAccount->hContact != NULL) ? ActualAccount->hContact : ActualAccount;
- NewMailPopUp.lchIcon=hYamnIcons[2];
+ NewMailPopUp.lchIcon=g_LoadIconEx(2);
NewMailPopUp.colorBack=nflags & YAMN_ACC_POPC ? ActualAccount->NewMailN.PopUpB : GetSysColor(COLOR_BTNFACE);
NewMailPopUp.colorText=nflags & YAMN_ACC_POPC ? ActualAccount->NewMailN.PopUpT : GetSysColor(COLOR_WINDOWTEXT);
NewMailPopUp.iSeconds=ActualAccount->NewMailN.PopUpTime;
@@ -528,7 +528,7 @@ int AddNewMailsToListView(HWND hListView,HACCOUNT ActualAccount,struct CMailNumb
NewMailPopUp.PluginWindowProc=(WNDPROC)NewMailPopUpProc;
NewMailPopUp.PluginData=(void *)0; //it's new mail popup
- for(msgq=(HYAMNMAIL)ActualAccount->Mails;msgq!=NULL;msgq=msgq->Next,lfoundi++)
+ for (msgq=(HYAMNMAIL)ActualAccount->Mails;msgq!=NULL;msgq=msgq->Next,lfoundi++)
{
// now we hide mail pointer to item's lParam member. We can later use it to retrieve mail datas
@@ -602,7 +602,7 @@ int AddNewMailsToListView(HWND hListView,HACCOUNT ActualAccount,struct CMailNumb
item.iSubItem=3;
item.pszText=L"";
{ CMimeItem *heads;
- for(heads=msgq->MailData->TranslatedHeader;heads!=NULL;heads=heads->Next) {
+ for (heads=msgq->MailData->TranslatedHeader;heads!=NULL;heads=heads->Next) {
if (!_stricmp(heads->name,"Date")){
MimeDateToLocalizedDateTime(heads->value,LocalDateStr,128);
item.pszText=LocalDateStr;
@@ -671,7 +671,7 @@ void DoMailActions(HWND hDlg,HACCOUNT ActualAccount,struct CMailNumbers *MN,DWOR
CLISTEVENT cEvent;
cEvent.cbSize = sizeof(CLISTEVENT);
cEvent.hContact = ActualAccount->hContact;
- cEvent.hIcon = hYamnIcons[2];
+ cEvent.hIcon = g_LoadIconEx(2);
cEvent.hDbEvent = (HANDLE)ActualAccount->hContact;
cEvent.lParam = (LPARAM) ActualAccount->hContact;
cEvent.pszService = MS_YAMN_CLISTDBLCLICK;
@@ -683,7 +683,7 @@ void DoMailActions(HWND hDlg,HACCOUNT ActualAccount,struct CMailNumbers *MN,DWOR
if (nflags & YAMN_ACC_CONTNICK)
{
- DBWriteContactSettingString(ActualAccount->hContact, ProtoName, "Nick",sMsg);
+ DBWriteContactSettingString(ActualAccount->hContact, YAMN_DBMODULE, "Nick",sMsg);
}
}
@@ -694,7 +694,7 @@ void DoMailActions(HWND hDlg,HACCOUNT ActualAccount,struct CMailNumbers *MN,DWOR
POPUPDATAT NewMailPopUp ={0};
NewMailPopUp.lchContact=(ActualAccount->hContact != NULL) ? ActualAccount->hContact : ActualAccount;
- NewMailPopUp.lchIcon=hYamnIcons[2];
+ NewMailPopUp.lchIcon=g_LoadIconEx(2);
NewMailPopUp.colorBack=nflags & YAMN_ACC_POPC ? ActualAccount->NewMailN.PopUpB : GetSysColor(COLOR_BTNFACE);
NewMailPopUp.colorText=nflags & YAMN_ACC_POPC ? ActualAccount->NewMailN.PopUpT : GetSysColor(COLOR_WINDOWTEXT);
NewMailPopUp.iSeconds=ActualAccount->NewMailN.PopUpTime;
@@ -741,12 +741,12 @@ void DoMailActions(HWND hDlg,HACCOUNT ActualAccount,struct CMailNumbers *MN,DWOR
TCHAR *dest;
int i;
- for(src=ActualAccount->Name,dest=nid.szTip,i=0;(*src!=(TCHAR)0) && (i+1<sizeof(nid.szTip));*dest++=*src++);
- for(src=NotIconText;(*src!=(TCHAR)0) && (i+1<sizeof(nid.szTip));*dest++=*src++);
+ for (src=ActualAccount->Name,dest=nid.szTip,i=0;(*src!=(TCHAR)0) && (i+1<sizeof(nid.szTip));*dest++=*src++);
+ for (src=NotIconText;(*src!=(TCHAR)0) && (i+1<sizeof(nid.szTip));*dest++=*src++);
*dest=(TCHAR)0;
nid.cbSize=sizeof(NOTIFYICONDATA);
nid.hWnd=hDlg;
- nid.hIcon=hYamnIcons[2];
+ nid.hIcon=g_LoadIconEx(2);
nid.uID=0;
nid.uFlags=NIF_ICON | NIF_MESSAGE | NIF_TIP;
nid.uCallbackMessage=WM_YAMN_NOTIFYICON;
@@ -797,7 +797,7 @@ void DoMailActions(HWND hDlg,HACCOUNT ActualAccount,struct CMailNumbers *MN,DWOR
POPUPDATAT NoNewMailPopUp;
NoNewMailPopUp.lchContact=(ActualAccount->hContact != NULL) ? ActualAccount->hContact : ActualAccount;
- NoNewMailPopUp.lchIcon=hYamnIcons[1];
+ NoNewMailPopUp.lchIcon=g_LoadIconEx(1);
NoNewMailPopUp.colorBack=ActualAccount->NoNewMailN.Flags & YAMN_ACC_POPC ? ActualAccount->NoNewMailN.PopUpB : GetSysColor(COLOR_BTNFACE);
NoNewMailPopUp.colorText=ActualAccount->NoNewMailN.Flags & YAMN_ACC_POPC ? ActualAccount->NoNewMailN.PopUpT : GetSysColor(COLOR_WINDOWTEXT);
NoNewMailPopUp.iSeconds=ActualAccount->NoNewMailN.PopUpTime;
@@ -828,7 +828,7 @@ void DoMailActions(HWND hDlg,HACCOUNT ActualAccount,struct CMailNumbers *MN,DWOR
if (nflags & YAMN_ACC_CONTNICK)
{
- DBWriteContactSettingString(ActualAccount->hContact, ProtoName, "Nick", ActualAccount->Name);
+ DBWriteContactSettingString(ActualAccount->hContact, YAMN_DBMODULE, "Nick", ActualAccount->Name);
}
}
}
@@ -866,7 +866,7 @@ LRESULT CALLBACK NewMailPopUpProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam
hContact=(HANDLE)CallService(MS_POPUP_GETCONTACT,(WPARAM)hWnd,(LPARAM)0);
- if (!DBGetContactSetting((HANDLE) hContact,ProtoName,"Id",&dbv))
+ if (!DBGetContactSetting((HANDLE) hContact,YAMN_DBMODULE,"Id",&dbv))
{
Account=(HACCOUNT) CallService(MS_YAMN_FINDACCOUNTBYNAME,(WPARAM)POP3Plugin,(LPARAM)dbv.pszVal);
DBFreeVariant(&dbv);
@@ -934,7 +934,7 @@ LRESULT CALLBACK NewMailPopUpProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam
hContact=(HANDLE)CallService(MS_POPUP_GETCONTACT,(WPARAM)hWnd,(LPARAM)0);
- if (!DBGetContactSetting((HANDLE) hContact,ProtoName,"Id",&dbv))
+ if (!DBGetContactSetting((HANDLE) hContact,YAMN_DBMODULE,"Id",&dbv))
{
ActualAccount=(HACCOUNT) CallService(MS_YAMN_FINDACCOUNTBYNAME,(WPARAM)POP3Plugin,(LPARAM)dbv.pszVal);
DBFreeVariant(&dbv);
@@ -967,7 +967,7 @@ LRESULT CALLBACK NoNewMailPopUpProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lPar
hContact=(HANDLE)CallService(MS_POPUP_GETCONTACT,(WPARAM)hWnd,(LPARAM)0);
- if (!DBGetContactSetting((HANDLE) hContact,ProtoName,"Id",&dbv))
+ if (!DBGetContactSetting((HANDLE) hContact,YAMN_DBMODULE,"Id",&dbv))
{
ActualAccount=(HACCOUNT) CallService(MS_YAMN_FINDACCOUNTBYNAME,(WPARAM)POP3Plugin,(LPARAM)dbv.pszVal);
DBFreeVariant(&dbv);
@@ -1034,7 +1034,7 @@ LRESULT CALLBACK NoNewMailPopUpProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lPar
hContact=(HANDLE)CallService(MS_POPUP_GETCONTACT,(WPARAM)hWnd,(LPARAM)0);
- if (!DBGetContactSetting((HANDLE) hContact,ProtoName,"Id",&dbv))
+ if (!DBGetContactSetting((HANDLE) hContact,YAMN_DBMODULE,"Id",&dbv))
{
ActualAccount=(HACCOUNT) CallService(MS_YAMN_FINDACCOUNTBYNAME,(WPARAM)POP3Plugin,(LPARAM)dbv.pszVal);
DBFreeVariant(&dbv);
@@ -1103,7 +1103,7 @@ ULONGLONG MimeDateToFileTime(char *datein)
st.wYear = atoi(year);
if (strlen(year)<4) if (st.wYear<70)st.wYear += 2000; else st.wYear += 1900;
};
- if (month) for(int i=0;i<12;i++) if (strncmp(month,s_MonthNames[i],3)==0) {st.wMonth = i + 1; break;}
+ if (month) for (int i=0;i<12;i++) if (strncmp(month,s_MonthNames[i],3)==0) {st.wMonth = i + 1; break;}
if (day) st.wDay = atoi(day);
if (time) {
char *h, *m, *s;
@@ -1327,8 +1327,8 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg,UINT msg,WPARAM wParam,LPARAM
HWND hListView = GetDlgItem(hDlg,IDC_LISTHEADERS);
OldSplitterProc = (WNDPROC) SetWindowLongPtr(GetDlgItem(hDlg, IDC_SPLITTER), GWLP_WNDPROC, (LONG_PTR) SplitterSubclassProc);
SetWindowLongPtr(hDlg,DWLP_USER,(LONG_PTR)MailParam);
- SendMessageW(hDlg,WM_SETICON,(WPARAM)ICON_BIG,(LPARAM)hYamnIcons[2]);
- SendMessageW(hDlg,WM_SETICON,(WPARAM)ICON_SMALL,(LPARAM)hYamnIcons[2]);
+ SendMessageW(hDlg,WM_SETICON,(WPARAM)ICON_BIG,(LPARAM)g_LoadIconEx(2, true));
+ SendMessageW(hDlg,WM_SETICON,(WPARAM)ICON_SMALL,(LPARAM)g_LoadIconEx(2));
ListView_SetUnicodeFormat(hListView,TRUE);
ListView_SetExtendedListViewStyle(hListView,LVS_EX_FULLROWSELECT);
@@ -1367,11 +1367,11 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg,UINT msg,WPARAM wParam,LPARAM
SendMessage(hListView, WM_SETREDRAW, 0, 0);
ListView_DeleteAllItems(hListView);
struct CMimeItem *Header;
- LVITEM item;
+ LVITEMW item;
item.mask=LVIF_TEXT | LVIF_PARAM;
WCHAR *From=0,*Subj=0;
char *contentType=0, *transEncoding=0, *body=0; //should not be delete[]-ed
- for(Header=MailParam->mail->MailData->TranslatedHeader;Header!=NULL;Header=Header->Next)
+ for (Header=MailParam->mail->MailData->TranslatedHeader;Header!=NULL;Header=Header->Next)
{
WCHAR *str1 = 0;
WCHAR *str2 = 0;
@@ -1424,9 +1424,9 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg,UINT msg,WPARAM wParam,LPARAM
item.iItem = 999;
for (int i=0;i<=count;i++){
item.iSubItem=0;
- if (i==0){
+ if (i==0)
item.pszText=str1;
- } else {
+ else {
item.iItem++;
item.pszText=0;
}
@@ -1534,20 +1534,6 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg,UINT msg,WPARAM wParam,LPARAM
HeadSizeY=coord.bottom-coord.top;
}
- //if (!YAMNVar.Shutdown && GetWindowRect(hDlg,&coord)) //the YAMNVar.Shutdown testing is because M<iranda strange functionality at shutdown phase, when call to DBWriteContactSetting freezes calling thread
- //{
- // //HeadPosX=coord.left;
- // //HeadSizeX=coord.right-coord.left;
- // //HeadPosY=coord.top;
- // //HeadSizeY=coord.bottom-coord.top;
- // DBWriteContactSettingDword(NULL,YAMN_DBMODULE,YAMN_DBMSGPOSX,HeadPosX);
- // DBWriteContactSettingDword(NULL,YAMN_DBMODULE,YAMN_DBMSGPOSY,HeadPosY);
- // DBWriteContactSettingDword(NULL,YAMN_DBMODULE,YAMN_DBMSGSIZEX,HeadSizeX);
- // DBWriteContactSettingDword(NULL,YAMN_DBMODULE,YAMN_DBMSGSIZEY,HeadSizeY);
- // DBWriteContactSettingWord(NULL,YAMN_DBMODULE,YAMN_DBMSGPOSSPLIT,HeadSplitPos);
- //}
- //PYAMN_MAILSHOWPARAM MailParam = (PYAMN_MAILSHOWPARAM)(GetWindowLongPtr(hDlg,DWLP_USER));
- //MailParam->mail->MsgWindow = NULL;
PostQuitMessage(1);
}
break;
@@ -1624,33 +1610,33 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg,UINT msg,WPARAM wParam,LPARAM
if (nReturnCmd>0){
int courRow=0;
size_t sizeNeeded = 0;
- WCHAR headname[64]={0}, headvalue[256]={0};
- for (courRow=0;courRow<numRows;courRow++){
+ TCHAR headname[64]={0}, headvalue[256]={0};
+ for (courRow=0; courRow < numRows; courRow++) {
if ((nReturnCmd==1) && (ListView_GetItemState(hList, courRow, LVIS_SELECTED)==0)) continue;
ListView_GetItemText(hList, courRow, 0, headname, SIZEOF(headname));
ListView_GetItemText(hList, courRow, 1, headvalue, SIZEOF(headvalue));
- size_t headnamelen=wcslen(headname);
+ size_t headnamelen = _tcslen(headname);
if (headnamelen) sizeNeeded += 1 + headnamelen;
- sizeNeeded += 3+wcslen(headvalue);
+ sizeNeeded += 3 + _tcslen(headvalue);
}
- if (!sizeNeeded) {
-#ifdef _DEBUG
- MessageBoxA(hDlg,"Nothing To Copy","Debug ShowHeaders",0);
-#endif
- } else if (OpenClipboard(hDlg)){
+ if (sizeNeeded && OpenClipboard(hDlg)) {
EmptyClipboard();
- HGLOBAL hData=GlobalAlloc(GMEM_MOVEABLE,(sizeNeeded+1)*sizeof(WCHAR));
- WCHAR *buff = (WCHAR *)GlobalLock(hData);
+ HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE,(sizeNeeded+1)*sizeof(TCHAR));
+ TCHAR *buff = ( TCHAR* )GlobalLock(hData);
int courPos = 0;
for (courRow=0;courRow<numRows;courRow++){
if ((nReturnCmd==1) && (ListView_GetItemState(hList, courRow, LVIS_SELECTED)==0)) continue;
ListView_GetItemText(hList, courRow, 0, headname, SIZEOF(headname));
ListView_GetItemText(hList, courRow, 1, headvalue, SIZEOF(headvalue));
- if (wcslen(headname)) courPos += swprintf(&buff[courPos],L"%s:\t%s\r\n",headname,headvalue);
- else courPos += swprintf(&buff[courPos],L"\t%s\r\n",headvalue);
+ if ( _tcslen(headname)) courPos += _stprintf(&buff[courPos], _T("%s:\t%s\r\n"), headname, headvalue);
+ else courPos += _stprintf( &buff[courPos], _T("\t%s\r\n"), headvalue);
}
GlobalUnlock(hData);
- SetClipboardData(CF_UNICODETEXT,hData);
+ #if defined( _UNICODE )
+ SetClipboardData(CF_UNICODETEXT,hData);
+ #else
+ SetClipboardData(CF_TEXT,hData);
+ #endif
CloseClipboard();
}
}
@@ -1804,7 +1790,7 @@ BOOL CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa
SizeDate=ColInfo.cx;
#ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile,"MailBrowser:DESTROY:save window position\n");
+ DebugLog(SynchroFile,"MailBrowser:DESTROY:save window position\n");
#endif
if (!YAMNVar.Shutdown && GetWindowRect(hDlg,&coord)) //the YAMNVar.Shutdown testing is because M<iranda strange functionality at shutdown phase, when call to DBWriteContactSetting freezes calling thread
{
@@ -1839,7 +1825,7 @@ BOOL CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa
DebugLog(SynchroFile,"MailBrowser:DESTROY:ActualAccountMsgsSO-write enter\n");
#endif
//delete mails from queue, which are deleted from server (spam level 3 mails e.g.)
- for(Parser=(HYAMNMAIL)ActualAccount->Mails;Parser!=NULL;Parser=Parser->Next)
+ for (Parser=(HYAMNMAIL)ActualAccount->Mails;Parser!=NULL;Parser=Parser->Next)
{
if ((Parser->Flags & YAMN_MSG_DELETED) && YAMN_MSG_SPAML(Parser->Flags,YAMN_MSG_SPAML3) && mwui->Seen) //if spaml3 was already deleted and user knows about it
{
@@ -2149,7 +2135,7 @@ BOOL CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"MailBrowser:BTNDEL:ActualAccountMsgsSO-write enter\n");
#endif
- for(int i=0;i<Items;i++)
+ for (int i=0;i<Items;i++)
{
item.iItem=i;
item.iSubItem=0;
@@ -2190,7 +2176,7 @@ BOOL CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"MailBrowser:BTNDEL:ActualAccountMsgsSO-write enter\n");
#endif
- for(ActualMail=(HYAMNMAIL)ActualAccount->Mails;ActualMail!=NULL;ActualMail=ActualMail->Next)
+ for (ActualMail=(HYAMNMAIL)ActualAccount->Mails;ActualMail!=NULL;ActualMail=ActualMail->Next)
{
if ((ActualMail->Flags & YAMN_MSG_DELETED) && ((ActualMail->Flags & YAMN_MSG_USERDELETE))) //if selected mail was already deleted
{
@@ -2259,9 +2245,9 @@ BOOL CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa
nid.uID=0;
nid.uFlags=NIF_ICON;
if (mwui->TrayIconState==0)
- nid.hIcon=hYamnIcons[0];
+ nid.hIcon=g_LoadIconEx(0);
else
- nid.hIcon=hYamnIcons[2];
+ nid.hIcon=g_LoadIconEx(2);
Shell_NotifyIcon(NIM_MODIFY,&nid);
mwui->TrayIconState=!mwui->TrayIconState;
// UpdateWindow(hDlg);
@@ -2418,34 +2404,34 @@ BOOL CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa
if (nReturnCmd>0){
int courRow=0;
size_t sizeNeeded = 0;
- WCHAR from[128]={0}, subject[256]={0}, size[16]={0}, date[64]={0};
+ TCHAR from[128]={0}, subject[256]={0}, size[16]={0}, date[64]={0};
for (courRow=0;courRow<numRows;courRow++){
if ((nReturnCmd==1) && (ListView_GetItemState(hList, courRow, LVIS_SELECTED)==0)) continue;
ListView_GetItemText(hList, courRow, 0, from, SIZEOF(from));
ListView_GetItemText(hList, courRow, 1, subject, SIZEOF(subject));
ListView_GetItemText(hList, courRow, 2, size, SIZEOF(size));
ListView_GetItemText(hList, courRow, 3, date, SIZEOF(date));
- sizeNeeded += 5+wcslen(from)+wcslen(subject)+wcslen(size)+wcslen(date);
+ sizeNeeded += 5+_tcslen(from)+_tcslen(subject)+_tcslen(size)+_tcslen(date);
}
- if (!sizeNeeded) {
-#ifdef _DEBUG
- MessageBoxA(hDlg,"Nothing To Copy","Debug MailBrowser",0);
-#endif
- } else if (OpenClipboard(hDlg)){
+ if (sizeNeeded && OpenClipboard(hDlg)) {
EmptyClipboard();
- HGLOBAL hData=GlobalAlloc(GMEM_MOVEABLE,(sizeNeeded+1)*sizeof(WCHAR));
- WCHAR *buff = (WCHAR *)GlobalLock(hData);
+ HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE,(sizeNeeded+1)*sizeof(TCHAR));
+ TCHAR *buff = (TCHAR *)GlobalLock(hData);
int courPos = 0;
- for (courRow=0;courRow<numRows;courRow++){
+ for (courRow=0; courRow < numRows; courRow++) {
if ((nReturnCmd==1) && (ListView_GetItemState(hList, courRow, LVIS_SELECTED)==0)) continue;
ListView_GetItemText(hList, courRow, 0, from, SIZEOF(from));
ListView_GetItemText(hList, courRow, 1, subject, SIZEOF(subject));
ListView_GetItemText(hList, courRow, 2, size, SIZEOF(size));
ListView_GetItemText(hList, courRow, 3, date, SIZEOF(date));
- courPos += swprintf(&buff[courPos],L"%s\t%s\t%s\t%s\r\n",from,subject,size,date);
+ courPos += _stprintf(&buff[courPos], _T("%s\t%s\t%s\t%s\r\n"), from, subject, size, date);
}
GlobalUnlock(hData);
- SetClipboardData(CF_UNICODETEXT,hData);
+ #if defined( _UNICODE )
+ SetClipboardData(CF_UNICODETEXT,hData);
+ #else
+ SetClipboardData(CF_TEXT,hData);
+ #endif
CloseClipboard();
}
}
@@ -2553,8 +2539,8 @@ DWORD WINAPI MailBrowser(LPVOID Param)
if ((hMailBrowser==NULL) && ((MyParam.nflags & YAMN_ACC_MSG) || (MyParam.nflags & YAMN_ACC_ICO) || (MyParam.nnflags & YAMN_ACC_MSG)))
{
hMailBrowser=CreateDialogParamW(YAMNVar.hInst,MAKEINTRESOURCEW(IDD_DLGVIEWMESSAGES),NULL,(DLGPROC)DlgProcYAMNMailBrowser,(LPARAM)&MyParam);
- SendMessageW(hMailBrowser,WM_SETICON,(WPARAM)ICON_BIG,(LPARAM)hYamnIcons[2]);
- SendMessageW(hMailBrowser,WM_SETICON,(WPARAM)ICON_SMALL,(LPARAM)hYamnIcons[2]);
+ SendMessageW(hMailBrowser,WM_SETICON,(WPARAM)ICON_BIG,(LPARAM)g_LoadIconEx(2,true));
+ SendMessageW(hMailBrowser,WM_SETICON,(WPARAM)ICON_SMALL,(LPARAM)g_LoadIconEx(2));
MoveWindow(hMailBrowser,PosX,PosY,SizeX,SizeY,TRUE);
}
diff --git a/plugins/YAMN/filterplugin.cpp b/plugins/YAMN/filterplugin.cpp
index 88d18cb260..8f61003293 100644
--- a/plugins/YAMN/filterplugin.cpp
+++ b/plugins/YAMN/filterplugin.cpp
@@ -78,7 +78,7 @@ INT_PTR UnregisterFilterPlugin(HYAMNFILTERPLUGIN Plugin)
}
else
{
- for(Parser=FirstFilterPlugin;(Parser->Next!=NULL) && (Plugin!=Parser->Next->Plugin);Parser=Parser->Next);
+ for (Parser=FirstFilterPlugin;(Parser->Next!=NULL) && (Plugin!=Parser->Next->Plugin);Parser=Parser->Next);
if (Parser->Next!=NULL)
{
Found=Parser->Next;
@@ -140,7 +140,7 @@ int WINAPI SetFilterPluginFcnImportFcn(HYAMNFILTERPLUGIN Plugin,DWORD Importance
EnterCriticalSection(&PluginRegCS);
//We add protocol to the protocol list
- for(Previous=NULL,Parser=FirstFilterPlugin;Parser!=NULL && Parser->Next!=NULL && Parser->Plugin->Importance<=Importance;Previous=Parser,Parser=Parser->Next);
+ for (Previous=NULL,Parser=FirstFilterPlugin;Parser!=NULL && Parser->Next!=NULL && Parser->Plugin->Importance<=Importance;Previous=Parser,Parser=Parser->Next);
if (Previous==NULL) //insert to the beginnig of queue
{
FirstFilterPlugin=new YAMN_FILTERPLUGINQUEUE;
@@ -173,7 +173,7 @@ INT_PTR FilterMailSvc(WPARAM wParam,LPARAM lParam)
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"FilterMail:ActualAccountMsgsSO-write enter\n");
#endif
- for(ActualPlugin=FirstFilterPlugin;ActualPlugin!=NULL;ActualPlugin=ActualPlugin->Next)
+ for (ActualPlugin=FirstFilterPlugin;ActualPlugin!=NULL;ActualPlugin=ActualPlugin->Next)
{
if (ActualPlugin->Plugin->FilterFcn->FilterMailFcnPtr!=NULL)
{
diff --git a/plugins/YAMN/mails/decode.cpp b/plugins/YAMN/mails/decode.cpp
index 704b61c7d3..4eeb5b6b76 100644
--- a/plugins/YAMN/mails/decode.cpp
+++ b/plugins/YAMN/mails/decode.cpp
@@ -226,7 +226,7 @@ int GetCharsetFromString(char *input,size_t size)
#ifdef DEBUG_DECODECODEPAGE
DebugLog(DecodeFile,"<CodePage>%s</CodePage>",pout);
#endif
- for(int i=0;i<CPLENALL;i++){
+ for (int i=0;i<CPLENALL;i++){
size_t len = strlen(CodePageNamesAll[i].NameBase);
if (0==strncmp(pout,CodePageNamesAll[i].NameBase,len)){
if (0==strcmp(pout+len,CodePageNamesAll[i].NameSub)){
@@ -300,7 +300,7 @@ int DecodeQuotedPrintable(char *Src,char *Dst,int DstLen, BOOL isQ)
char *DstTemp=Dst;
DebugLog(DecodeFile,"<Decode Quoted><Input>%s</Input>",Src);
#endif
- for(int Counter=0;((char)*Src!=0) && DstLen && (Counter++<DstLen);Src++,Dst++)
+ for (int Counter=0;((char)*Src!=0) && DstLen && (Counter++<DstLen);Src++,Dst++)
if (*Src=='=')
{
if (!isQ){
@@ -398,7 +398,7 @@ int ConvertStringToUnicode(char *stream,unsigned int cp,WCHAR **out)
DebugLog(DecodeFile,"<CodePage #>%d</CodePage #>",cp);
#endif
- for(Index=0;Index<sizeof(CodePagesZeroFlags)/sizeof(CodePagesZeroFlags[0]);Index++)
+ for (Index=0;Index<sizeof(CodePagesZeroFlags)/sizeof(CodePagesZeroFlags[0]);Index++)
if (CodePagesZeroFlags[Index]==cp)
{
Index=-1;
@@ -417,7 +417,7 @@ int ConvertStringToUnicode(char *stream,unsigned int cp,WCHAR **out)
if (*out!=NULL)
{
- for(dest=temp;*src!=(WCHAR)0;src++,dest++) //copy old string from *out to temp
+ for (dest=temp;*src!=(WCHAR)0;src++,dest++) //copy old string from *out to temp
*dest=*src;
// *dest++=L' '; //add space?
delete[] *out;
diff --git a/plugins/YAMN/mails/mails.cpp b/plugins/YAMN/mails/mails.cpp
index 5d3c0e9284..af0f3d2329 100644
--- a/plugins/YAMN/mails/mails.cpp
+++ b/plugins/YAMN/mails/mails.cpp
@@ -166,7 +166,7 @@ INT_PTR DeleteAccountMailSvc(WPARAM wParam,LPARAM lParam)
if (OldMail->MailData->Body!=NULL)
delete[] OldMail->MailData->Body;
if ((TH=OldMail->MailData->TranslatedHeader)!=NULL)
- for(;OldMail->MailData->TranslatedHeader!=NULL;) {
+ for (;OldMail->MailData->TranslatedHeader!=NULL;) {
TH=TH->Next;
if (OldMail->MailData->TranslatedHeader->name!=NULL)
delete[] OldMail->MailData->TranslatedHeader->name;
@@ -237,7 +237,7 @@ void WINAPI SynchroMessagesFcn(HACCOUNT Account,HYAMNMAIL *OldQueue,HYAMNMAIL *R
if (RemovedOld!=NULL) *RemovedOld=NULL;
if (RemovedNew!=NULL) *RemovedNew=NULL;
- for(FinderPrev=NULL,Finder=*OldQueue;Finder!=NULL;)
+ for (FinderPrev=NULL,Finder=*OldQueue;Finder!=NULL;)
{
if (Finder->Flags & YAMN_MSG_DELETED) //if old queue contains deleted mail
{
@@ -245,7 +245,7 @@ void WINAPI SynchroMessagesFcn(HACCOUNT Account,HYAMNMAIL *OldQueue,HYAMNMAIL *R
Finder=Finder->Next; //get next message in old queue for testing
continue;
}
- for(ParserPrev=NULL,Parser=*NewQueue;Parser!=NULL;ParserPrev=Parser,Parser=Parser->Next)
+ for (ParserPrev=NULL,Parser=*NewQueue;Parser!=NULL;ParserPrev=Parser,Parser=Parser->Next)
{
if (Parser->Flags & YAMN_MSG_DELETED)
continue;
@@ -339,14 +339,14 @@ void WINAPI DeleteMessageFromQueueFcn(HYAMNMAIL *From,HYAMNMAIL Which,int mode=0
}
else
{
- for(Parser=*From;Which!=Parser->Next;Parser=Parser->Next)
+ for (Parser=*From;Which!=Parser->Next;Parser=Parser->Next)
if (mode && (Parser->Number>Number)) Parser->Number--;
if (mode && (Parser->Number>Number)) Parser->Number--;
Parser->Next=Parser->Next->Next;
Parser=Which->Next;
}
if (mode)
- for(;Parser!=NULL;Parser=Parser->Next)
+ for (;Parser!=NULL;Parser=Parser->Next)
if (Parser->Number>Number) Parser->Number--;
}
@@ -354,7 +354,7 @@ void DeleteMessagesFromQueue(HYAMNMAIL *From,HYAMNMAIL Which,int mode=0)
{
HYAMNMAIL Parser;
- for(Parser=Which;Parser!=NULL;Parser=Parser->Next)
+ for (Parser=Which;Parser!=NULL;Parser=Parser->Next)
DeleteMessageFromQueueFcn(From,Parser,mode);
}
@@ -362,7 +362,7 @@ HYAMNMAIL WINAPI FindMessageByIDFcn(HYAMNMAIL From,char *ID)
{
HYAMNMAIL Browser;
- for(Browser=From;Browser!=NULL;Browser=Browser->Next)
+ for (Browser=From;Browser!=NULL;Browser=Browser->Next)
if (0==lstrcmpA(Browser->ID,ID))
break;
return Browser;
@@ -458,7 +458,7 @@ HYAMNMAIL WINAPI CreateNewDeleteQueueFcn(HYAMNMAIL From)
{
HYAMNMAIL FirstMail,Browser;
- for(FirstMail=NULL;From!=NULL;From=From->Next)
+ for (FirstMail=NULL;From!=NULL;From=From->Next)
{
if ((From->Flags & (YAMN_MSG_USERDELETE | YAMN_MSG_AUTODELETE)) && !(From->Flags & YAMN_MSG_DELETED))
{
@@ -486,7 +486,7 @@ void WINAPI SetRemoveFlagsInQueueFcn(HYAMNMAIL From,DWORD FlagsSet,DWORD FlagsNo
{
HYAMNMAIL msgq;
- for(msgq=(HYAMNMAIL)From;msgq!=NULL;msgq=msgq->Next)
+ for (msgq=(HYAMNMAIL)From;msgq!=NULL;msgq=msgq->Next)
{
if ((FlagsSet==(msgq->Flags & FlagsSet)) && (0==(msgq->Flags & FlagsNotSet)))
{
diff --git a/plugins/YAMN/mails/mime.cpp b/plugins/YAMN/mails/mime.cpp
index 294206c7ad..d1e1dd7db2 100644
--- a/plugins/YAMN/mails/mime.cpp
+++ b/plugins/YAMN/mails/mime.cpp
@@ -105,7 +105,7 @@ void CopyToHeader(char *srcstart,char *srcend,char **dest,int mode)
dst=*dest;
- for(;srcstart<srcend;dst++,srcstart++)
+ for (;srcstart<srcend;dst++,srcstart++)
{
if (ENDLINE(srcstart))
{
@@ -228,7 +228,7 @@ char *ExtractFromContentType(char *ContentType,char *value)
}
if (NULL==(CopiedString=new char[++temp-finder+1]))
return NULL;
- for(copier=CopiedString;finder!=temp;*copier++=*finder++); //copy string
+ for (copier=CopiedString;finder!=temp;*copier++=*finder++); //copy string
*copier=0; //and end it with zero character
return CopiedString;
@@ -236,7 +236,7 @@ char *ExtractFromContentType(char *ContentType,char *value)
void ExtractShortHeader(struct CMimeItem *items,struct CShortHeader *head)
{
- for(;items!=NULL;items=items->Next)
+ for (;items!=NULL;items=items->Next)
{
//at the start of line
//MessageBox(NULL,items->value,items->name,0);
@@ -468,7 +468,7 @@ void DeleteHeaderContent(struct CHeader *head)
void DeleteNames(PYAMN_MIMENAMES Names)
{
PYAMN_MIMENAMES Parser=Names,Old;
- for(;Parser!=NULL;Parser=Parser->Next)
+ for (;Parser!=NULL;Parser=Parser->Next)
{
if (Parser->Value!=NULL)
delete[] Parser->Value;
@@ -483,7 +483,7 @@ void DeleteNames(PYAMN_MIMENAMES Names)
void DeleteShortNames(PYAMN_MIMESHORTNAMES Names)
{
PYAMN_MIMESHORTNAMES Parser=Names,Old;
- for(;Parser!=NULL;Parser=Parser->Next)
+ for (;Parser!=NULL;Parser=Parser->Next)
{
if (Parser->Value!=NULL)
delete[] Parser->Value;
@@ -498,7 +498,7 @@ void DeleteShortNames(PYAMN_MIMESHORTNAMES Names)
void inline ToLower(char *string)
{
- for(;*string!=0;string++)
+ for (;*string!=0;string++)
if (*string>='A' && *string<='Z') *string=*string-'A'+'a';
}
diff --git a/plugins/YAMN/main.cpp b/plugins/YAMN/main.cpp
index b800fb24f1..d2ccb6769c 100644
--- a/plugins/YAMN/main.cpp
+++ b/plugins/YAMN/main.cpp
@@ -13,100 +13,77 @@
#include "main.h"
#include "resources/resource.h"
#include <io.h>
-//- imported ---------------------------------------------------------------------------------------
-//--------------------------------------------------------------------------------------------------
-
-//CRITICAL_SECTION MWCS;
-//CRITICAL_SECTION ASCS;
-//CRITICAL_SECTION PRCS;
-extern CRITICAL_SECTION PluginRegCS;
-extern HANDLE ExitEV;
-extern HANDLE WriteToFileEV;
+#include "m_hotkeys.h"
-extern int PosX,PosY,SizeX,SizeY;
-extern int HeadPosX,HeadPosY,HeadSizeX,HeadSizeY,HeadSplitPos;
-
-//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
-TCHAR ProfileName[MAX_PATH]; //e.g. "majvan"
-TCHAR UserDirectory[MAX_PATH]; //e.g. "F:\WINNT\Profiles\UserXYZ"
-char *ProtoName = YAMN_DBMODULE;
-//char *AltProtoName;
+TCHAR ProfileName[MAX_PATH];
+TCHAR UserDirectory[MAX_PATH];
+
TCHAR szMirandaDir[MAX_PATH];
TCHAR szProfileDir[MAX_PATH];
-INT_PTR YAMN_STATUS;
+int YAMN_STATUS;
BOOL UninstallPlugins;
HANDLE hAccountFolder;
HINSTANCE *hDllPlugins;
-static int iDllPlugins=0;
+static int iDllPlugins = 0;
PLUGINLINK *pluginLink;
YAMN_VARIABLES YAMNVar;
int hLangpack;
-struct MM_INTERFACE mmi;
-
-static const MUUID interfaces[] = {MUUID_YAMN_FORCECHECK, MIID_LAST};
-
-PLUGININFOEX pluginInfo={
- sizeof(PLUGININFOEX),
- YAMN_SHORTNAME,
- YAMN_VERSION,
- "Mail notifier and browser for Miranda IM. Included POP3 protocol.",
- "y_b tweety (majvan)",
- "francois.mean@skynet.be",
- "© (2002-2004 majvan) 2005-2007 tweety y_b Miranda community",
- "http://www.miranda-im.org/download/details.php?action=viewfile&id=3411", //"http://www.majvan.host.sk/Projekty/YAMN?fm=soft",
- UNICODE_AWARE,
- 0, //doesn't replace anything built-in
+MM_INTERFACE mmi;
+
+PLUGININFOEX pluginInfo = {
+ sizeof(PLUGININFOEX),
+ YAMN_SHORTNAME,
+ YAMN_VERSION,
+ "Mail notifier and browser for Miranda IM. Included POP3 protocol.",
+ "y_b tweety (majvan)",
+ "francois.mean@skynet.be",
+ "© (2002-2004 majvan) 2005-2007 tweety y_b Miranda community",
+ "http://www.miranda-im.org/download/details.php?action = viewfile&id = 3411", //"http://www.majvan.host.sk/Projekty/YAMN?fm = soft",
+ UNICODE_AWARE,
+ 0, //doesn't replace anything built-in
{ 0xb047a7e5, 0x27a, 0x4cfc, { 0x8b, 0x18, 0xed, 0xa8, 0x34, 0x5d, 0x27, 0x90 } } // {B047A7E5-027A-4cfc-8B18-EDA8345D2790}
};
-SKINSOUNDDESC NewMailSound={
- sizeof(SKINSOUNDDESC),
- YAMN_NEWMAILSOUND, //name to refer to sound when playing and in db
- YAMN_NEWMAILSNDDESC, //description for options dialog
- "", //default sound file to use, without path
+SKINSOUNDDESC NewMailSound =
+{
+ sizeof(SKINSOUNDDESC),
+ YAMN_NEWMAILSOUND, //name to refer to sound when playing and in db
+ YAMN_NEWMAILSNDDESC, //description for options dialog
+ "", //default sound file to use, without path
};
-SKINSOUNDDESC ConnectFailureSound={
- sizeof(SKINSOUNDDESC),
- YAMN_CONNECTFAILSOUND, //name to refer to sound when playing and in db
- YAMN_CONNECTFAILSNDDESC,//description for options dialog
- "", //default sound file to use, without path
+SKINSOUNDDESC ConnectFailureSound =
+{
+ sizeof(SKINSOUNDDESC),
+ YAMN_CONNECTFAILSOUND, //name to refer to sound when playing and in db
+ YAMN_CONNECTFAILSNDDESC, //description for options dialog
+ "", //default sound file to use, without path
};
HANDLE hNewMailHook;
-//HANDLE hUninstallPluginsHook;
-
HANDLE NoWriterEV;
-
-HANDLE hTTButton; //TopToolBar button
-
-DWORD HotKeyThreadID;
+HANDLE hTTButton, hTButton;
UINT SecTimer;
BOOL bIcolibEmbededInCore = FALSE;
-HICON hYamnIcons[ICONSNUMBER];
-char *iconDescs[ICONSNUMBER]={ICONSDESCS};
-char *iconNames[ICONSNUMBER]={ICONSNAMES};
- int iconIndexes[ICONSNUMBER]={ICONSINDS};
-
HANDLE hMenuItemMain = 0;
HANDLE hMenuItemCont = 0;
HANDLE hMenuItemContApp = 0;
-BOOL (WINAPI *MyEnableThemeDialogTexture)(HANDLE, DWORD) = 0;
HMODULE hUxTheme = 0;
+BOOL (WINAPI *MyEnableThemeDialogTexture)(HANDLE, DWORD) = 0;
// function pointers, use typedefs for casting to shut up the compiler when using GetProcAddress()
@@ -131,20 +108,20 @@ PDTT pfnDrawThemeText = 0;
int InitVSApi()
{
- if ((hUxTheme = LoadLibraryA("uxtheme.dll")) == 0)
- return 0;
-
- pfnIsThemeActive = (PITA)GetProcAddress(hUxTheme, "IsThemeActive");
- pfnOpenThemeData = (POTD)GetProcAddress(hUxTheme, "OpenThemeData");
- pfnDrawThemeBackground = (PDTB)GetProcAddress(hUxTheme, "DrawThemeBackground");
- pfnCloseThemeData = (PCTD)GetProcAddress(hUxTheme, "CloseThemeData");
- pfnDrawThemeText = (PDTT)GetProcAddress(hUxTheme, "DrawThemeText");
-
- MyEnableThemeDialogTexture = (BOOL (WINAPI *)(HANDLE, DWORD))GetProcAddress(hUxTheme, "EnableThemeDialogTexture");
- if (pfnIsThemeActive != 0 && pfnOpenThemeData != 0 && pfnDrawThemeBackground != 0 && pfnCloseThemeData != 0 && pfnDrawThemeText != 0) {
- return 1;
- }
- return 0;
+ if ((hUxTheme = LoadLibraryA("uxtheme.dll")) == 0)
+ return 0;
+
+ pfnIsThemeActive = (PITA)GetProcAddress(hUxTheme, "IsThemeActive");
+ pfnOpenThemeData = (POTD)GetProcAddress(hUxTheme, "OpenThemeData");
+ pfnDrawThemeBackground = (PDTB)GetProcAddress(hUxTheme, "DrawThemeBackground");
+ pfnCloseThemeData = (PCTD)GetProcAddress(hUxTheme, "CloseThemeData");
+ pfnDrawThemeText = (PDTT)GetProcAddress(hUxTheme, "DrawThemeText");
+
+ MyEnableThemeDialogTexture = (BOOL (WINAPI *)(HANDLE, DWORD))GetProcAddress(hUxTheme, "EnableThemeDialogTexture");
+ if (pfnIsThemeActive != 0 && pfnOpenThemeData != 0 && pfnDrawThemeBackground != 0 && pfnCloseThemeData != 0 && pfnDrawThemeText != 0)
+ return 1;
+
+ return 0;
}
/*
@@ -153,79 +130,47 @@ int InitVSApi()
int FreeVSApi()
{
- if (hUxTheme != 0)
- FreeLibrary(hUxTheme);
- return 0;
+ if (hUxTheme != 0)
+ FreeLibrary(hUxTheme);
+ return 0;
}
-
-//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
-static void GetProfileDirectory(TCHAR *szPath,int cbPath)
+static void GetProfileDirectory(TCHAR *szPath, int cbPath)
//This is copied from Miranda's sources. In 0.2.1.0 it is needed, in newer vesions of Miranda use MS_DB_GETPROFILEPATH service
{
if (ServiceExists(MS_DB_GETPROFILEPATH))
- if (!CallService(MS_DB_GETPROFILEPATHT,(WPARAM)cbPath,(LPARAM)szPath)) {
- lstrcpy(szProfileDir,szPath);
+ if (!CallService(MS_DB_GETPROFILEPATHT, (WPARAM)cbPath, (LPARAM)szPath)) {
+ lstrcpy(szProfileDir, szPath);
return; //success
}
- TCHAR szMirandaIni[MAX_PATH],szExpandedProfileDir[MAX_PATH];
+ TCHAR szMirandaIni[MAX_PATH], szExpandedProfileDir[MAX_PATH];
DWORD dwAttributes;
- lstrcpy(szMirandaIni,szMirandaDir);
+ lstrcpy(szMirandaIni, szMirandaDir);
lstrcat(szMirandaIni, _T("\\mirandaboot.ini"));
- GetPrivateProfileString( _T("Database"),_T("ProfileDir"),_T("."),szProfileDir,sizeof(szProfileDir),szMirandaIni);
- ExpandEnvironmentStrings(szProfileDir,szExpandedProfileDir,sizeof(szExpandedProfileDir));
+ GetPrivateProfileString( _T("Database"), _T("ProfileDir"), _T("."), szProfileDir, sizeof(szProfileDir), szMirandaIni);
+ ExpandEnvironmentStrings(szProfileDir, szExpandedProfileDir, sizeof(szExpandedProfileDir));
_tchdir(szMirandaDir);
- if (!_tfullpath(szPath,szExpandedProfileDir,cbPath))
- lstrcpyn(szPath,szMirandaDir,cbPath);
- if (szPath[lstrlen(szPath)-1]=='\\') szPath[lstrlen(szPath)-1]='\0';
- if ((dwAttributes=GetFileAttributes(szPath))!=0xffffffff&&dwAttributes&FILE_ATTRIBUTE_DIRECTORY) return;
- CreateDirectory(szPath,NULL);
+ if (!_tfullpath(szPath, szExpandedProfileDir, cbPath))
+ lstrcpyn(szPath, szMirandaDir, cbPath);
+ if (szPath[lstrlen(szPath)-1] == '\\') szPath[lstrlen(szPath)-1] = '\0';
+ if ((dwAttributes = GetFileAttributes(szPath))!=0xffffffff&&dwAttributes&FILE_ATTRIBUTE_DIRECTORY) return;
+ CreateDirectory(szPath, NULL);
}
-void SetDefaultProtocolIcons()
-{
- TCHAR szFileName[MAX_PATH+1];
- char oldname[] = YAMN_DBMODULE"4007_"; // the deprecated one
- char dllname[] = "plugins\\"YAMN_DBMODULE".dll,-xxxxx";
-
- // determine whether external icon file exists
- lstrcpy(szFileName, szMirandaDir);
- lstrcat(szFileName, _T("\\icons\\proto_") _T(YAMN_DBMODULE) _T(".dll"));
- BOOL isDllPresent = (_taccess(szFileName, 0) == 0);
-
- WORD statuses[4] = {ID_STATUS_OFFLINE,ID_STATUS_ONLINE,ID_STATUS_NA,ID_STATUS_OCCUPIED};
- BYTE indices[4] = {7, 0, 3, 4};
- //From skinicons.c skinIconStatusToIdStatus[]
- BYTE protoStatusInd[4] = {0,1,4,5};
-
- for (int i=0;i<4;i++){
- oldname[sizeof(oldname)-2]=protoStatusInd[i]+'1'; // "Out for lunch will not work here"
- if (isDllPresent){ // use the icons in proto_YAMN.dll and delete any user settings
- DBDeleteContactSetting(NULL, "Icons", oldname);
- } else {
- DBVARIANT dbv;
- if (!DBGetContactSetting(NULL,"SkinIcons",iconNames[indices[i]],&dbv))
- {// user won't be able to set status icons different from those in YAMN section
- DBWriteContactSettingString(NULL, "Icons", oldname, (char *)dbv.pszVal);
- DBFreeVariant(&dbv);
- } else {
- _snprintf(&dllname[sizeof(dllname)-6],5,"%d",iconIndexes[indices[i]]);
- DBWriteContactSettingString(NULL, "Icons", oldname, dllname);
- }
- }
- }
-}
+/////////////////////////////////////////////////////////////////////////////////////////
-extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved)
+extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
YAMNVar.hInst = hinstDLL;
return TRUE;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" __declspec(dllexport) PLUGININFO* MirandaPluginInfo(DWORD mirandaVersion)
{
if (mirandaVersion >= PLUGIN_MAKE_VERSION(0, 7, 0, 3))
@@ -234,6 +179,8 @@ extern "C" __declspec(dllexport) PLUGININFO* MirandaPluginInfo(DWORD mirandaVers
return (PLUGININFO *) &pluginInfo;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
{
if (mirandaVersion >= PLUGIN_MAKE_VERSION(0, 7, 0, 3))
@@ -242,13 +189,19 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda
return &pluginInfo;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
+static const MUUID interfaces[] = {MUUID_YAMN_FORCECHECK, MIID_LAST};
+
extern "C" __declspec(dllexport) const MUUID * MirandaPluginInterfaces(void)
{
return interfaces;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
#ifdef YAMN_DEBUG
-static char unknownCP[1500]={0};
+static char unknownCP[1500] = {0};
#endif
// The callback function
BOOL CALLBACK EnumSystemCodePagesProc(LPTSTR cpStr)
@@ -260,11 +213,11 @@ BOOL CALLBACK EnumSystemCodePagesProc(LPTSTR cpStr)
//Get Code Page name
CPINFOEX info;
- if (GetCPInfoEx(cp,0,&info)){
+ if (GetCPInfoEx(cp, 0, &info)){
#ifdef YAMN_DEBUG
BOOLEAN found = FALSE;
#endif
- for (int i=1;i<CPLENALL;i++) if (CodePageNamesAll[i].CP==cp) {
+ for (int i = 1;i<CPLENALL;i++) if (CodePageNamesAll[i].CP == cp) {
CodePageNamesAll[i].isValid = TRUE;
CPLENSUPP++;
#ifdef YAMN_DEBUG
@@ -274,114 +227,214 @@ BOOL CALLBACK EnumSystemCodePagesProc(LPTSTR cpStr)
}
#ifdef YAMN_DEBUG
if (!found) {
- strcat(unknownCP,info.CodePageName);
- strcat(unknownCP,"\n");
+ strcat(unknownCP, info.CodePageName);
+ strcat(unknownCP, "\n");
}
#endif
}
return TRUE;
}
-int SystemModulesLoaded(WPARAM,LPARAM){
- if (ServiceExists(MS_SKIN2_ADDICON))
- {
- //MessageBox(NULL,"Icolib present","test",0);
- SKINICONDESC sid = {0};
- HICON temp;
- sid.cbSize = SKINICONDESC_SIZE;
- sid.pszSection = "YAMN";
- sid.pszDefaultFile = NULL;
- for (int i=0; i<ICONSNUMBER; i++){
- sid.iDefaultIndex = -iconIndexes[i];
- sid.pszName = iconNames[i];
- sid.pszDescription = iconDescs[i];
- sid.hDefaultIcon = hYamnIcons[i];
- CallService(MS_SKIN2_ADDICON, 0, (LPARAM)&sid);
- if (temp = (HICON) CallService(MS_SKIN2_GETICON, 0, (LPARAM) iconNames[i]))hYamnIcons[i]=temp;
- }
- }
+void CheckMenuItems()
+{
+ CLISTMENUITEM clmi = {0};
+ clmi.cbSize = sizeof( CLISTMENUITEM );
+ clmi.flags = CMIM_FLAGS;
+ if ( !DBGetContactSettingByte(NULL, YAMN_DBMODULE, YAMN_SHOWMAINMENU, 1))
+ clmi.flags |= CMIF_HIDDEN;
- CLISTMENUITEM mi;
+ CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hMenuItemMain, ( LPARAM )&clmi );
+}
+int SystemModulesLoaded(WPARAM, LPARAM)
+{
//Insert "Check mail (YAMN)" item to Miranda's menu
- ZeroMemory(&mi,sizeof(mi));
+ CLISTMENUITEM mi = { 0 };
mi.cbSize = sizeof(mi);
mi.position = 0xb0000000;
- mi.flags = 0;
- mi.hIcon = hYamnIcons[5];
+ mi.flags = CMIF_ICONFROMICOLIB;
+ mi.icolibItem = g_GetIconHandle(5);
mi.pszName = "Check &mail (All Account)";
- mi.pszPopupName = NULL;//ProtoName;
+ mi.pszPopupName = NULL;//YAMN_DBMODULE;
mi.pszService = MS_YAMN_FORCECHECK;
- if (DBGetContactSettingByte(NULL, YAMN_DBMODULE, YAMN_SHOWMAINMENU, 1))
- hMenuItemMain = (HANDLE) CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&mi);
+ hMenuItemMain = (HANDLE) CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM)&mi);
mi.pszName = "Check &mail (This Account)";
- mi.pszContactOwner = ProtoName;
+ mi.pszContactOwner = YAMN_DBMODULE;
mi.pszService = MS_YAMN_CLISTCONTEXT;
- hMenuItemCont = (HANDLE) CallService(MS_CLIST_ADDCONTACTMENUITEM,0,(LPARAM)&mi);
+ hMenuItemCont = (HANDLE) CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM)&mi);
- mi.hIcon = hYamnIcons[4];
+ mi.icolibItem = g_GetIconHandle(4);
mi.pszName = "Launch application";
- mi.pszContactOwner = ProtoName;
+ mi.pszContactOwner = YAMN_DBMODULE;
mi.pszService = MS_YAMN_CLISTCONTEXTAPP;
- hMenuItemContApp = (HANDLE) CallService(MS_CLIST_ADDCONTACTMENUITEM,0,(LPARAM)&mi);
+ hMenuItemContApp = (HANDLE) CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM)&mi);
+
+ CheckMenuItems();
//Use for the Updater plugin
- if (ServiceExists(MS_UPDATE_REGISTER))
- {
+ if (ServiceExists(MS_UPDATE_REGISTER)) {
Update update = {0};
- char szVersion[16];
- char szUrl[250];
+ char szVersion[16], szUrl[250];
+ wsprintfA(szUrl, "http://www.miranda-fr.net/tweety/yamn/%s.zip", YAMN_FILENAME);
update.szComponentName = pluginInfo.shortName;
update.pbVersion = (BYTE *)CreateVersionStringPlugin((PLUGININFO *)&pluginInfo, szVersion);
update.cpbVersion = (int)strlen((char *)update.pbVersion);
- /*#ifdef YAMN_9x
- update.szUpdateURL = "http://addons.miranda-im.org/feed.php?dlfile=2166";
- update.szVersionURL = "http://addons.miranda-im.org/details.php?action=viewfile&id=2166";
- update.pbVersionPrefix = (BYTE *)"<span class=\"fileNameHeader\">YAMN tweety win9x ";
- #else
- update.szUpdateURL = "http://addons.miranda-im.org/feed.php?dlfile=2165";
- update.szVersionURL = "http://addons.miranda-im.org/details.php?action=viewfile&id=2165";
- update.pbVersionPrefix = (BYTE *)"<span class=\"fileNameHeader\">YAMN tweety ";
- #endif*/
- update.szUpdateURL = "http://addons.miranda-im.org/feed.php?dlfile=3411";
- update.szVersionURL = "http://addons.miranda-im.org/details.php?action=viewfile&id=3411";
- update.pbVersionPrefix = (BYTE *)"<span class=\"fileNameHeader\">YAMN 2in1 ";
- wsprintfA(szUrl,"http://www.miranda-fr.net/tweety/yamn/%s.zip",YAMN_FILENAME);
- update.szBetaUpdateURL = szUrl;
+ update.szUpdateURL = "http://addons.miranda-im.org/feed.php?dlfile = 3411";
+ update.szVersionURL = "http://addons.miranda-im.org/details.php?action = viewfile&id = 3411";
+ update.pbVersionPrefix = (BYTE *)"<span class = \"fileNameHeader\">YAMN 2in1 ";
+ update.szBetaUpdateURL = szUrl;
update.szBetaVersionURL = "http://www.miranda-fr.net/tweety/yamn/yamn_beta.html";
update.pbBetaVersionPrefix = (BYTE *)"YAMN version ";
update.cpbVersionPrefix = (int)strlen((char *)update.pbVersionPrefix);
update.cpbBetaVersionPrefix = (int)strlen((char *)update.pbBetaVersionPrefix);
-
CallService(MS_UPDATE_REGISTER, 0, (WPARAM)&update);
-
}
- if (ServiceExists(MS_FOLDERS_GET_PATH)){
- //char AccountFolder[MAX_PATH];
- //CallService(MS_DB_GETPROFILEPATH, (WPARAM) MAX_PATH, (LPARAM)AccountFolder);
- //sprintf(AccountFolder,"%s\\%s",AccountFolder,ProtoName);
- hAccountFolder = FoldersRegisterCustomPathT(ProtoName,YAMN_DBMODULE" Account Folder", UserDirectory);
-
+
+ if (ServiceExists(MS_FOLDERS_GET_PATH)) {
+ hAccountFolder = FoldersRegisterCustomPathT(YAMN_DBMODULE, YAMN_DBMODULE" Account Folder", UserDirectory);
FoldersGetCustomPathT(hAccountFolder, UserDirectory, MAX_PATH, UserDirectory);
- //MultiByteToWideChar(CP_ACP,MB_USEGLYPHCHARS,AccountFolder,-1,UserDirectory,strlen(AccountFolder)+1);
}
- RegisterPOP3Plugin(0,0);
-
+ RegisterPOP3Plugin(0, 0);
return 0;
}
-//int IcoLibIconsChanged(WPARAM wParam, LPARAM lParam); // implemented in services.cpp
-extern HCURSOR hCurSplitNS, hCurSplitWE;
+/////////////////////////////////////////////////////////////////////////////////////////
+
+struct TIconListItem
+{
+ char* szDescr;
+ char* szName;
+ int defIconID;
+ HANDLE hIcon;
+};
+
+static TIconListItem iconList[] =
+{
+ { LPGEN("Neutral"), "YAMN_Neutral", IDI_ONLINE, 0 },
+ { LPGEN("YAMN"), "YAMN", IDI_ICOYAMN1, 0 },
+ { LPGEN("New Mail"), "YAMN_NewMail", IDI_ICOYAMN2, 0 },
+ { LPGEN("Connect Fail"), "YAMN_ConnectFail", IDI_NA, 0 },
+ { LPGEN("Launch Application"), "YAMN_ApplExec", IDI_OCCUPIED, 0 },
+ { LPGEN("TopToolBar UP"), "YAMN_TopToolBarUp", IDI_ICOTTBUP, 0 },
+ { LPGEN("TopToolBar Down"), "YAMN_TopToolBarDown", IDI_OCCUPIED, 0 },
+ { LPGEN("Offline"), "YAMN_Offline", IDI_OFFLINE, 0 }
+};
+
+static void LoadIcons()
+{
+ HIMAGELIST CSImages = ImageList_Create(16, 16, ILC_COLOR8|ILC_MASK, 0, 3);
+ {
+ HBITMAP hScrBM = (HBITMAP)LoadImage(YAMNVar.hInst, MAKEINTRESOURCE(IDB_ICONS), IMAGE_BITMAP, 0, 0, LR_SHARED);
+ ImageList_AddMasked(CSImages, hScrBM, RGB( 255, 0, 255 ));
+ DeleteObject(hScrBM);
+ }
+
+ char szFile[MAX_PATH];
+ GetModuleFileNameA(YAMNVar.hInst, szFile, MAX_PATH);
+
+ SKINICONDESC sid = {0};
+ sid.cbSize = sizeof(SKINICONDESC);
+ sid.pszDefaultFile = szFile;
+ sid.pszSection = "YAMN";
+
+ for (int i = 0, k = 0; i < ICONSNUMBER; i++) {
+ switch (i){
+ case 1: case 2: case 5:
+ sid.hDefaultIcon = ImageList_ExtractIcon(NULL, CSImages, k); k++;
+ break;
+ default:
+ sid.hDefaultIcon = LoadIcon(YAMNVar.hInst, MAKEINTRESOURCE(iconList[i].defIconID)); break;
+ }
+ sid.pszName = iconList[i].szName;
+ sid.pszDescription = iconList[i].szDescr;
+ sid.iDefaultIndex = -iconList[i].defIconID;
+ iconList[i].hIcon = ( HANDLE )CallService(MS_SKIN2_ADDICON, 0, (LPARAM)&sid);
+} }
+
+HANDLE WINAPI g_GetIconHandle( int idx )
+{
+ if ( idx >= SIZEOF(iconList))
+ return NULL;
+ return iconList[idx].hIcon;
+}
+
+HICON WINAPI g_LoadIconEx( int idx, bool big )
+{
+ if ( idx >= SIZEOF(iconList))
+ return NULL;
+ return ( HICON )CallService(MS_SKIN2_GETICON, big, (LPARAM)iconList[idx].szName);
+}
+
+void WINAPI g_ReleaseIcon( HICON hIcon )
+{
+ if ( hIcon ) CallService(MS_SKIN2_RELEASEICON, (WPARAM)hIcon, 0);
+}
+
+static void LoadPlugins()
+{
+ HANDLE hFind;
+ WIN32_FIND_DATA fd;
+ TCHAR szSearchPath[MAX_PATH];
+ TCHAR szPluginPath[MAX_PATH];
+ lstrcpy(szSearchPath, szMirandaDir);
+ lstrcat(szSearchPath, _T("\\Plugins\\YAMN\\*.dll"));
+ typedef INT_PTR (*LOADFILTERFCN)(MIRANDASERVICE GetYAMNFcn);
+
+ hDllPlugins = NULL;
+
+ if (INVALID_HANDLE_VALUE!=(hFind = FindFirstFile(szSearchPath, &fd))) {
+ do {
+ //rewritten from Miranda sources... Needed because Win32 API has a bug in FindFirstFile, search is done for *.dlllllll... too
+ TCHAR *dot = _tcsrchr(fd.cFileName, '.');
+ if (dot == NULL )
+ continue;
+
+ // we have a dot
+ int len = (int)lstrlen(fd.cFileName); // find the length of the string
+ TCHAR* end = fd.cFileName+len; // get a pointer to the NULL
+ int safe = (end-dot)-1; // figure out how many chars after the dot are "safe", not including NULL
+
+ if ((safe!=3) || (lstrcmpi(dot+1, _T("dll"))!=0)) //not bound, however the "dll" string should mean only 3 chars are compared
+ continue;
+
+ HINSTANCE hDll;
+ LOADFILTERFCN LoadFilter;
+
+ lstrcpy(szPluginPath, szMirandaDir);
+ lstrcat(szPluginPath, _T("\\Plugins\\YAMN\\"));
+ lstrcat(szPluginPath, fd.cFileName);
+ if ((hDll = LoadLibrary(szPluginPath)) == NULL) continue;
+ LoadFilter = (LOADFILTERFCN)GetProcAddress(hDll, "LoadFilter");
+ if (NULL == LoadFilter) {
+ FreeLibrary(hDll);
+ hDll = NULL;
+ continue;
+ }
+
+ if (!(*LoadFilter)(GetFcnPtrSvc)) {
+ FreeLibrary(hDll);
+ hDll = NULL;
+ }
+
+ if (hDll != NULL) {
+ hDllPlugins = (HINSTANCE *)realloc((void *)hDllPlugins, (iDllPlugins+1)*sizeof(HINSTANCE));
+ hDllPlugins[iDllPlugins++] = hDll;
+ }
+ }
+ while(FindNextFile(hFind, &fd));
+
+ FindClose(hFind);
+ }
+}
+
extern "C" int __declspec(dllexport) Load(PLUGINLINK *link)
{
- UINT mod,vk;
- TCHAR *fc;
- int i,k;
+ int i, k;
- pluginLink=link;
+ pluginLink = link;
mir_getLP(&pluginInfo);
mir_getMMI(&mmi);
@@ -389,95 +442,67 @@ extern "C" int __declspec(dllexport) Load(PLUGINLINK *link)
// we get the Miranda Root Path
if (ServiceExists(MS_UTILS_PATHTOABSOLUTET))
- CallService(MS_UTILS_PATHTOABSOLUTET, (WPARAM)_T("."),(LPARAM)szMirandaDir);
+ CallService(MS_UTILS_PATHTOABSOLUTET, (WPARAM)_T("."), (LPARAM)szMirandaDir);
else {
- GetModuleFileName(GetModuleHandle(NULL),szMirandaDir,MAX_PATH);
- TCHAR* str2 = _tcsrchr(szMirandaDir,'\\');
- if (str2!=NULL) *str2=0;
+ GetModuleFileName(GetModuleHandle(NULL), szMirandaDir, MAX_PATH);
+ TCHAR* str2 = _tcsrchr(szMirandaDir, '\\');
+ if (str2!=NULL) *str2 = 0;
}
// we get the user path where our yamn-account.book.ini is stored from mirandaboot.ini file
- GetProfileDirectory(UserDirectory,SIZEOF(UserDirectory));
+ GetProfileDirectory(UserDirectory, SIZEOF(UserDirectory));
// Enumerate all the code pages available for the System Locale
EnumSystemCodePages(EnumSystemCodePagesProc, CP_INSTALLED);
CodePageNamesSupp = new _tcptable[CPLENSUPP];
- for (i=0,k=0;i<CPLENALL;i++) {
+ for (i = 0, k = 0; i < CPLENALL; i++) {
if (CodePageNamesAll[i].isValid){
- CodePageNamesSupp[k]=CodePageNamesAll[i];
+ CodePageNamesSupp[k] = CodePageNamesAll[i];
k++;
- }
- }
- #ifdef YAMN_DEBUG
-//unknownCP 0x6005a734
-//20127 (US-ASCII)
-//20261 (T.61)
-//28605 (ISO 8859-15 Latin 9)
-//737 (OEM - Greek 437G)
-//874 (ANSI/OEM - Thai)
-//932 (ANSI/OEM - Japanese Shift-JIS)
-//936 (ANSI/OEM - Simplified Chinese GBK)
-//949 (ANSI/OEM - Korean)
- MessageBox( NULL,unknownCP, TEXT("Unkown Code Page"), MB_OK);
- #endif
+ } }
- HIMAGELIST CSImages = ImageList_Create(16, 16, ILC_COLOR8|ILC_MASK, 0, 3);
- {// workarround of 4bit forced images
- HBITMAP hScrBM = (HBITMAP)LoadImage(YAMNVar.hInst,MAKEINTRESOURCE(IDB_ICONS), IMAGE_BITMAP, 0, 0,LR_SHARED);
- ImageList_AddMasked(CSImages, hScrBM, RGB( 255, 0, 255 ));
- DeleteObject(hScrBM);
- }
- for (i=0,k=0; i<ICONSNUMBER; i++){
- switch (i){
- case 0: case 3: case 4: case 7: hYamnIcons[i] = LoadIcon(YAMNVar.hInst,MAKEINTRESOURCE(iconIndexes[i])); break;
- case 6: hYamnIcons[i] = hYamnIcons[4]; break;
- default: hYamnIcons[i] = ImageList_ExtractIcon(NULL, CSImages, k); k++;
- }
- }
-
- //Registering YAMN as protocol
+ // Registering YAMN as protocol
PROTOCOLDESCRIPTOR pd = {0};
- pd.cbSize=PROTOCOLDESCRIPTOR_V3_SIZE;
- pd.szName=ProtoName;
- pd.type=PROTOTYPE_PROTOCOL;
- CallService(MS_PROTO_REGISTERMODULE,0,(LPARAM)&pd);
+ pd.cbSize = PROTOCOLDESCRIPTOR_V3_SIZE;
+ pd.szName = YAMN_DBMODULE;
+ pd.type = PROTOTYPE_PROTOCOL;
+ CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd);
- CallService(MS_DB_GETPROFILENAMET,(WPARAM)SIZEOF(ProfileName),(LPARAM)ProfileName); //not to pass entire array to fcn
- if (NULL!=(fc = _tcsrchr(ProfileName, '.')))
- *fc=0;
+ CallService(MS_DB_GETPROFILENAMET, (WPARAM)SIZEOF(ProfileName), (LPARAM)ProfileName); //not to pass entire array to fcn
+ TCHAR *fc = _tcsrchr(ProfileName, '.');
+ if ( fc != NULL ) *fc = 0;
InitializeCriticalSection(&AccountStatusCS);
InitializeCriticalSection(&FileWritingCS);
InitializeCriticalSection(&PluginRegCS);
- if (NULL==(NoWriterEV=CreateEvent(NULL,TRUE,TRUE,NULL)))
+ if (NULL == (NoWriterEV = CreateEvent(NULL, TRUE, TRUE, NULL)))
return 1;
- if (NULL==(WriteToFileEV=CreateEvent(NULL,FALSE,FALSE,NULL)))
+ if (NULL == (WriteToFileEV = CreateEvent(NULL, FALSE, FALSE, NULL)))
return 1;
- if (NULL==(ExitEV=CreateEvent(NULL,TRUE,FALSE,NULL)))
+ if (NULL == (ExitEV = CreateEvent(NULL, TRUE, FALSE, NULL)))
return 1;
-// AccountWriterSO=new SCOUNTER(NoWriterEV);
- NewMailSound.pszDescription=Translate(YAMN_NEWMAILSNDDESC);
- ConnectFailureSound.pszDescription=Translate(YAMN_CONNECTFAILSNDDESC);
+ NewMailSound.pszDescription = Translate(YAMN_NEWMAILSNDDESC);
+ ConnectFailureSound.pszDescription = Translate(YAMN_CONNECTFAILSNDDESC);
- PosX=DBGetContactSettingDword(NULL,YAMN_DBMODULE,YAMN_DBPOSX,0);
- PosY=DBGetContactSettingDword(NULL,YAMN_DBMODULE,YAMN_DBPOSY,0);
- SizeX=DBGetContactSettingDword(NULL,YAMN_DBMODULE,YAMN_DBSIZEX,800);
- SizeY=DBGetContactSettingDword(NULL,YAMN_DBMODULE,YAMN_DBSIZEY,200);
+ PosX = DBGetContactSettingDword(NULL, YAMN_DBMODULE, YAMN_DBPOSX, 0);
+ PosY = DBGetContactSettingDword(NULL, YAMN_DBMODULE, YAMN_DBPOSY, 0);
+ SizeX = DBGetContactSettingDword(NULL, YAMN_DBMODULE, YAMN_DBSIZEX, 800);
+ SizeY = DBGetContactSettingDword(NULL, YAMN_DBMODULE, YAMN_DBSIZEY, 200);
- HeadPosX=DBGetContactSettingDword(NULL,YAMN_DBMODULE,YAMN_DBMSGPOSX,0);
- HeadPosY=DBGetContactSettingDword(NULL,YAMN_DBMODULE,YAMN_DBMSGPOSY,0);
- HeadSizeX=DBGetContactSettingDword(NULL,YAMN_DBMODULE,YAMN_DBMSGSIZEX,690);
- HeadSizeY=DBGetContactSettingDword(NULL,YAMN_DBMODULE,YAMN_DBMSGSIZEY,300);
- HeadSplitPos=DBGetContactSettingWord(NULL,YAMN_DBMODULE,YAMN_DBMSGPOSSPLIT,250);
+ HeadPosX = DBGetContactSettingDword(NULL, YAMN_DBMODULE, YAMN_DBMSGPOSX, 0);
+ HeadPosY = DBGetContactSettingDword(NULL, YAMN_DBMODULE, YAMN_DBMSGPOSY, 0);
+ HeadSizeX = DBGetContactSettingDword(NULL, YAMN_DBMODULE, YAMN_DBMSGSIZEX, 690);
+ HeadSizeY = DBGetContactSettingDword(NULL, YAMN_DBMODULE, YAMN_DBMSGSIZEY, 300);
+ HeadSplitPos = DBGetContactSettingWord(NULL, YAMN_DBMODULE, YAMN_DBMSGPOSSPLIT, 250);
- optDateTime=DBGetContactSettingByte(NULL,YAMN_DBMODULE,YAMN_DBTIMEOPTIONS,optDateTime);
+ optDateTime = DBGetContactSettingByte(NULL, YAMN_DBMODULE, YAMN_DBTIMEOPTIONS, optDateTime);
-//Create new window queues for broadcast messages
- YAMNVar.MessageWnds=(HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST,0,0);
- YAMNVar.NewMailAccountWnd=(HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST,0,0);
- YAMNVar.Shutdown=FALSE;
+ // Create new window queues for broadcast messages
+ YAMNVar.MessageWnds = (HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0);
+ YAMNVar.NewMailAccountWnd = (HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0);
+ YAMNVar.Shutdown = FALSE;
hCurSplitNS = LoadCursor(NULL, IDC_SIZENS);
hCurSplitWE = LoadCursor(NULL, IDC_SIZEWE);
@@ -486,68 +511,48 @@ extern "C" int __declspec(dllexport) Load(PLUGINLINK *link)
InitDebug();
#endif
-
CreateServiceFunctions();
- CallService(MS_SKIN_ADDNEWSOUND,0,(LPARAM)&NewMailSound);
- CallService(MS_SKIN_ADDNEWSOUND,0,(LPARAM)&ConnectFailureSound);
-
- /*
- // this does nothing - these event are never fired
- hNewMailHook=CreateHookableEvent(ME_YAMN_NEWMAIL);
- hUninstallPluginsHook=CreateHookableEvent(ME_YAMN_UNINSTALLPLUGINS);
- */
+ CallService(MS_SKIN_ADDNEWSOUND, 0, (LPARAM)&NewMailSound);
+ CallService(MS_SKIN_ADDNEWSOUND, 0, (LPARAM)&ConnectFailureSound);
HookEvents();
- if (!bIcolibEmbededInCore)
- SetDefaultProtocolIcons();
-
+ LoadIcons();
LoadPlugins();
-
InitVSApi();
- WordToModAndVk(DBGetContactSettingWord(NULL,YAMN_DBMODULE,YAMN_HKCHECKMAIL,YAMN_DEFAULTHK),&mod,&vk);
-
-//Create thread for hotkey
- WORD HotKey = MAKEWORD((BYTE)vk,(BYTE)mod);
- CloseHandle(CreateThread(NULL,0,YAMNHotKeyThread,(LPVOID)HotKey,0,&HotKeyThreadID));
-//Create thread that will be executed every second
- if (!(SecTimer=SetTimer(NULL,0,1000,(TIMERPROC)TimerProc)))
- return 1;
-
+ HOTKEYDESC hkd = {0};
+ hkd.cbSize = sizeof(hkd);
+ hkd.pszService = MS_YAMN_FORCECHECK;
+ hkd.pszSection = YAMN_DBMODULE;
+ hkd.pszDescription = LPGEN("Check mail");
+ hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL, VK_F11);
+ CallService(MS_HOTKEY_REGISTER, 0, (LPARAM)&hkd);
-#ifdef YAMN_VER_BETA
- #ifdef YAMN_VER_BETA_CRASHONLY
- MessageBox(NULL,"This YAMN beta version is intended for testing. After crash, you should send report to author. Please read included readme when available. Thank you.","YAMN beta",MB_OK);
- #else
- MessageBox(NULL,"This YAMN beta version is intended for testing. You should inform author if it works or when it does not work. Please read included readme when available. Thank you.","YAMN beta",MB_OK);
- #endif
-#endif
-#ifdef YAMN_DEBUG
- MessageBox(NULL,"This YAMN creates extended debug logfiles. It is not intended for general use.","YAMN beta",MB_OK);
-#endif
+ //Create thread that will be executed every second
+ if (!(SecTimer = SetTimer(NULL, 0, 1000, (TIMERPROC)TimerProc)))
+ return 1;
return 0;
}
-int Shutdown(WPARAM,LPARAM)
+/////////////////////////////////////////////////////////////////////////////////////////
+
+static void UnloadPlugins()
{
- DBWriteContactSettingDword(NULL,YAMN_DBMODULE,YAMN_DBMSGPOSX,HeadPosX);
- DBWriteContactSettingDword(NULL,YAMN_DBMODULE,YAMN_DBMSGPOSY,HeadPosY);
- DBWriteContactSettingDword(NULL,YAMN_DBMODULE,YAMN_DBMSGSIZEX,HeadSizeX);
- DBWriteContactSettingDword(NULL,YAMN_DBMODULE,YAMN_DBMSGSIZEY,HeadSizeY);
- DBWriteContactSettingWord(NULL,YAMN_DBMODULE,YAMN_DBMSGPOSSPLIT,HeadSplitPos);
- YAMNVar.Shutdown=TRUE;
-// CallService(MS_TTB_REMOVEBUTTON,(WPARAM)hTTButton,0); //this often leads to deadlock in Miranda (bug in Miranda)
- KillTimer(NULL,SecTimer);
-
- UnregisterProtoPlugins();
- UnregisterFilterPlugins();
- return 0;
+ for (int i = iDllPlugins-1;i>=0;i--) {
+ if (FreeLibrary(hDllPlugins[i])){
+ hDllPlugins[i] = NULL; //for safety
+ iDllPlugins --;
+ }
+ }
+ if (hDllPlugins){
+ free((void *)hDllPlugins);
+ hDllPlugins = NULL;
+ }
}
-//We undo all things from Load()
extern "C" int __declspec(dllexport) Unload(void)
{
#ifdef YAMN_DEBUG
@@ -574,179 +579,3 @@ extern "C" int __declspec(dllexport) Unload(void)
delete [] CodePageNamesSupp;
return 0;
}
-
-void LoadPlugins()
-{
- HANDLE hFind;
- WIN32_FIND_DATA fd;
- TCHAR szSearchPath[MAX_PATH];
- TCHAR szPluginPath[MAX_PATH];
- lstrcpy(szSearchPath,szMirandaDir);
- lstrcat(szSearchPath, _T("\\Plugins\\YAMN\\*.dll"));
- typedef INT_PTR (*LOADFILTERFCN)(MIRANDASERVICE GetYAMNFcn);
-
- hDllPlugins=NULL;
-
- if (INVALID_HANDLE_VALUE!=(hFind=FindFirstFile(szSearchPath,&fd)))
- {
- do
- { //rewritten from Miranda sources... Needed because Win32 API has a bug in FindFirstFile, search is done for *.dlllllll... too
- TCHAR *dot = _tcsrchr(fd.cFileName,'.');
- if (dot)
- { // we have a dot
- int len=(int)lstrlen(fd.cFileName); // find the length of the string
- TCHAR* end = fd.cFileName+len; // get a pointer to the NULL
- int safe=(end-dot)-1; // figure out how many chars after the dot are "safe", not including NULL
-
- if ((safe!=3) || (lstrcmpi(dot+1, _T("dll"))!=0)) //not bound, however the "dll" string should mean only 3 chars are compared
- continue;
- }
- else
- continue;
-
- HINSTANCE hDll;
- LOADFILTERFCN LoadFilter;
-
- lstrcpy(szPluginPath,szMirandaDir);
- lstrcat(szPluginPath, _T("\\Plugins\\YAMN\\"));
- lstrcat(szPluginPath,fd.cFileName);
- if ((hDll=LoadLibrary(szPluginPath))==NULL) continue;
- LoadFilter=(LOADFILTERFCN)GetProcAddress(hDll,"LoadFilter");
- if (NULL==LoadFilter)
- {
- FreeLibrary(hDll);
- hDll=NULL;
- continue;
- }
- if (!(*LoadFilter)(GetFcnPtrSvc))
- {
- FreeLibrary(hDll);
- hDll=NULL;
- }
-
- if (hDll!=NULL)
- {
- hDllPlugins=(HINSTANCE *)realloc((void *)hDllPlugins,(iDllPlugins+1)*sizeof(HINSTANCE));
- hDllPlugins[iDllPlugins++]=hDll;
- }
- } while(FindNextFile(hFind,&fd));
- FindClose(hFind);
- }
-}
-
-void UnloadPlugins()
-{
- for(int i=iDllPlugins-1;i>=0;i--) {
- if (FreeLibrary(hDllPlugins[i])){
- hDllPlugins[i]=NULL; //for safety
- iDllPlugins --;
- }
- }
- if (hDllPlugins){
- free((void *)hDllPlugins);
- hDllPlugins = NULL;
- }
-}
-
-void GetIconSize(HICON hIcon, int* sizeX, int* sizeY)
-{
- ICONINFO ii;
- BITMAP bm;
- GetIconInfo(hIcon, &ii);
- GetObject(ii.hbmColor, sizeof(bm), &bm);
- if (sizeX != NULL) *sizeX = bm.bmWidth;
- if (sizeY != NULL) *sizeY = bm.bmHeight;
- DeleteObject(ii.hbmMask);
- DeleteObject(ii.hbmColor);
-}
-
-HBITMAP LoadBmpFromIcon(HICON hIcon)
-{
- HBITMAP hBmp, hoBmp;
- HDC hdc, hdcMem;
- HBRUSH hBkgBrush;
-
- int IconSizeX = 16;
- int IconSizeY = 16;
-
- //GetIconSize(hIcon, &IconSizeX, &IconSizeY);
-
- //DebugLog(SynchroFile,"Icon size %i %i\n",IconSizeX,IconSizeY);
-
- if ((IconSizeX == 0) || (IconSizeY == 0))
- {
- IconSizeX = 16;
- IconSizeY = 16;
- }
-
- RECT rc;
- BITMAPINFOHEADER bih = {0};
- int widthBytes;
-
- hBkgBrush = CreateSolidBrush(GetSysColor(COLOR_3DFACE));
- bih.biSize = sizeof(bih);
- bih.biBitCount = 24;
- bih.biPlanes = 1;
- bih.biCompression = BI_RGB;
- bih.biHeight = IconSizeY;
- bih.biWidth = IconSizeX;
- widthBytes = ((bih.biWidth*bih.biBitCount + 31) >> 5) * 4;
- rc.top = rc.left = 0;
- rc.right = bih.biWidth;
- rc.bottom = bih.biHeight;
- hdc = GetDC(NULL);
- hBmp = CreateCompatibleBitmap(hdc, bih.biWidth, bih.biHeight);
- hdcMem = CreateCompatibleDC(hdc);
- hoBmp = (HBITMAP)SelectObject(hdcMem, hBmp);
- FillRect(hdcMem, &rc, hBkgBrush);
- DrawIconEx(hdcMem, 0, 0, hIcon, bih.biWidth, bih.biHeight, 0, NULL, DI_NORMAL);
- SelectObject(hdcMem, hoBmp);
-
- return hBmp;
-}
-
-int AddTopToolbarIcon(WPARAM,LPARAM)
-{
- TTBButton Button=
- {
- sizeof(TTBButton),
- NULL,
- NULL,
- NULL,
- MS_YAMN_FORCECHECK,
- TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP, // | TTBBF_DRAWBORDER,
- 0,0,0,0,
- NULL
- };
-
- if (!DBGetContactSettingByte(NULL,YAMN_DBMODULE,YAMN_TTBFCHECK,1))
- return 1;
-
- Button.name=Translate("Check mail");
-
- Button.hbBitmapUp = LoadBmpFromIcon(hYamnIcons[5]);
- Button.hbBitmapDown = LoadBmpFromIcon(hYamnIcons[6]); //LoadBitmap(YAMNVar.hInst,MAKEINTRESOURCE(IDB_BMTTB));
-
- if ((HANDLE)-1==(hTTButton=(HANDLE)CallService(MS_TTB_ADDBUTTON,(WPARAM)&Button,(LPARAM)0)))
- return 1;
- CallService(MS_TTB_SETBUTTONOPTIONS,MAKEWPARAM((WORD)TTBO_TIPNAME,(WORD)hTTButton),(LPARAM)Translate("Check mail"));
- return 0;
-}
-
-int UninstallQuestionSvc(WPARAM wParam,LPARAM)
-{
-// if (strcmp((char *)wParam,Translate("Yet Another Mail Notifier")))
-// return 0;
- switch(MessageBoxA(NULL,Translate("Do you also want to remove native YAMN plugins settings?"),Translate("YAMN uninstalling"),MB_YESNOCANCEL|MB_ICONQUESTION))
- {
- case IDYES:
- UninstallPlugins=TRUE;
- break;
- case IDNO:
- UninstallPlugins=FALSE;
- break;
- case IDCANCEL:
- return 1;
- }
- return 0;
-}
diff --git a/plugins/YAMN/main.h b/plugins/YAMN/main.h
index 56b9d918ce..1ec690873d 100644
--- a/plugins/YAMN/main.h
+++ b/plugins/YAMN/main.h
@@ -40,7 +40,6 @@
#define YAMN_DBMSGSIZEX "MailMessageWinW"
#define YAMN_DBMSGSIZEY "MailMessageWinH"
#define YAMN_DBMSGPOSSPLIT "MailMessageSplitY"
-#define YAMN_HKCHECKMAIL "HKCheckMail"
#define YAMN_TTBFCHECK "ForceCheckTTB"
#define YAMN_SHOWMAINMENU "ShowMainMenu"
#define YAMN_CLOSEDELETE "CloseOnDelete"
@@ -55,12 +54,8 @@
extern unsigned char optDateTime;
-void UnloadPlugins();
-
// Loading Icon and checking for icolib
void LoadIcons();
-extern int iconIndexes[];
-
#endif
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)"));
diff --git a/plugins/YAMN/protoplugin.cpp b/plugins/YAMN/protoplugin.cpp
index 9e721b2b31..479b54ce67 100644
--- a/plugins/YAMN/protoplugin.cpp
+++ b/plugins/YAMN/protoplugin.cpp
@@ -9,7 +9,6 @@
//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
-WCHAR FileName2[]=L"%s\\yamn-accounts.%s.%s.book"; //UserDirectory\\yamn-accounts.PluginName.UserProfileName.book
PYAMN_PROTOPLUGINQUEUE FirstProtoPlugin=NULL;
INT_PTR RegisterProtocolPluginSvc(WPARAM,LPARAM);
@@ -31,10 +30,6 @@ INT_PTR UnregisterProtoPlugins();
// returns nonzero if success
int WINAPI SetProtocolPluginFcnImportFcn(HYAMNPROTOPLUGIN Plugin,PYAMN_PROTOIMPORTFCN YAMNFcn,DWORD YAMNFcnVer,PYAMN_MAILIMPORTFCN YAMNMailFcn,DWORD YAMNMailFcnVer);
-INT_PTR GetFileNameWSvc(WPARAM,LPARAM);
-INT_PTR GetFileNameASvc(WPARAM,LPARAM);
-INT_PTR DeleteFileNameSvc(WPARAM,LPARAM);
-
struct CExportedFunctions ProtoPluginExportedFcn[]=
{
{YAMN_SETPROTOCOLPLUGINFCNIMPORTID,(void *)SetProtocolPluginFcnImportFcn},
@@ -44,8 +39,7 @@ struct CExportedServices ProtoPluginExportedSvc[]=
{
{MS_YAMN_REGISTERPROTOPLUGIN,RegisterProtocolPluginSvc},
{MS_YAMN_UNREGISTERPROTOPLUGIN,UnregisterProtocolPluginSvc},
- {MS_YAMN_GETFILENAMEA,GetFileNameASvc},
- {MS_YAMN_GETFILENAMEW,GetFileNameWSvc},
+ {MS_YAMN_GETFILENAME,GetFileNameSvc},
{MS_YAMN_DELETEFILENAME,DeleteFileNameSvc},
};
@@ -101,7 +95,7 @@ int WINAPI SetProtocolPluginFcnImportFcn(HYAMNPROTOPLUGIN Plugin,PYAMN_PROTOIMPO
EnterCriticalSection(&PluginRegCS);
//We add protocol to the protocol list
- for(Parser=FirstProtoPlugin;Parser!=NULL && Parser->Next!=NULL;Parser=Parser->Next);
+ for (Parser=FirstProtoPlugin;Parser!=NULL && Parser->Next!=NULL;Parser=Parser->Next);
if (Parser==NULL)
{
FirstProtoPlugin=new YAMN_PROTOPLUGINQUEUE;
@@ -134,7 +128,7 @@ INT_PTR UnregisterProtocolPlugin(HYAMNPROTOPLUGIN Plugin)
}
else
{
- for(Parser=FirstProtoPlugin;(Parser->Next!=NULL) && (Plugin!=Parser->Next->Plugin);Parser=Parser->Next);
+ for (Parser=FirstProtoPlugin;(Parser->Next!=NULL) && (Plugin!=Parser->Next->Plugin);Parser=Parser->Next);
if (Parser->Next!=NULL)
{
Found=Parser->Next;
@@ -184,37 +178,20 @@ INT_PTR UnregisterProtoPlugins()
return 1;
}
-INT_PTR GetFileNameWSvc(WPARAM wParam,LPARAM)
+INT_PTR GetFileNameSvc(WPARAM wParam,LPARAM)
{
- WCHAR *FileName;
-
- if (NULL==(FileName=new WCHAR[MAX_PATH]))
+ TCHAR *FileName = new TCHAR[MAX_PATH];
+ if (FileName == NULL)
return NULL;
- swprintf(FileName,FileName2,UserDirectory,(WCHAR *)wParam,ProfileName);
-// MessageBoxW(NULL,FileName,L"GetFileNameW",MB_OK);
- return (INT_PTR)FileName;
-}
-
-INT_PTR GetFileNameASvc(WPARAM wParam,LPARAM)
-{
- WCHAR *FileName;
- if (NULL==(FileName=new WCHAR[MAX_PATH]))
- return NULL;
-
- WCHAR ConvertedInput[ MAX_PATH ];
- char* szSrc = (char *)wParam;
-
- // Convert input string to unicode
- MultiByteToWideChar(CP_ACP,MB_USEGLYPHCHARS,szSrc,-1,ConvertedInput,strlen(szSrc)+1);
- mir_sntprintf(FileName,MAX_PATH, FileName2,UserDirectory,ConvertedInput,ProfileName);
+ mir_sntprintf(FileName, MAX_PATH, _T("%s\\yamn-accounts.%s.%s.book"), UserDirectory, wParam, ProfileName);
return (INT_PTR)FileName;
}
INT_PTR DeleteFileNameSvc(WPARAM wParam,LPARAM)
{
- if ((WCHAR *)wParam!=NULL)
- delete[] (WCHAR *)wParam;
+ if (( TCHAR* )wParam != NULL)
+ delete[] ( TCHAR* ) wParam;
return 0;
}
diff --git a/plugins/YAMN/resources/YAMN.rc b/plugins/YAMN/resources/YAMN.rc
index 9269bf89ce..54320549e4 100644
--- a/plugins/YAMN/resources/YAMN.rc
+++ b/plugins/YAMN/resources/YAMN.rc
@@ -16,10 +16,8 @@
// Neutral resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU)
-#ifdef _WIN32
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
-#pragma code_page(1252)
-#endif //_WIN32
+#pragma code_page(1251)
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
@@ -27,18 +25,18 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
// TEXTINCLUDE
//
-1 TEXTINCLUDE
+1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
-2 TEXTINCLUDE
+2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
-3 TEXTINCLUDE
+3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
@@ -53,7 +51,7 @@ END
//
#ifdef APSTUDIO_INVOKED
-GUIDELINES DESIGNINFO
+GUIDELINES DESIGNINFO
BEGIN
IDD_DLGVIEWMESSAGES, DIALOG
BEGIN
@@ -63,6 +61,10 @@ BEGIN
BOTTOMMARGIN, 105
END
+ IDD_DLGSHOWMESSAGE, DIALOG
+ BEGIN
+ END
+
IDD_DLGBADCONNECT, DIALOG
BEGIN
LEFTMARGIN, 7
@@ -74,7 +76,6 @@ BEGIN
IDD_PLUGINOPT, DIALOG
BEGIN
LEFTMARGIN, 7
- RIGHTMARGIN, 312
VERTGUIDE, 13
VERTGUIDE, 85
VERTGUIDE, 160
@@ -106,6 +107,7 @@ BEGIN
IDD_YAMNOPT, DIALOG
BEGIN
+ RIGHTMARGIN, 310
VERTGUIDE, 8
END
@@ -123,7 +125,7 @@ END
// Dialog
//
-IDD_DLGVIEWMESSAGES DIALOG 50, 200, 460, 110
+IDD_DLGVIEWMESSAGES DIALOG 50, 200, 460, 110
STYLE DS_SETFONT | DS_3DLOOK | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
FONT 8, "MS Shell Dlg"
BEGIN
@@ -144,7 +146,7 @@ BEGIN
EDITTEXT IDC_EDITBODY,3,84,454,45,ES_MULTILINE | ES_READONLY | ES_WANTRETURN | WS_VSCROLL | WS_HSCROLL
END
-IDD_DLGBADCONNECT DIALOG 0, 0, 186, 76
+IDD_DLGBADCONNECT DIALOG 0, 0, 186, 76
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
FONT 8, "MS Shell Dlg"
BEGIN
@@ -228,7 +230,7 @@ BEGIN
GROUPBOX "Errors",IDC_STATIC,161,153,143,44
END
-IDD_CHOOSESTATUSMODES DIALOG 0, 0, 226, 154
+IDD_CHOOSESTATUSMODES DIALOG 0, 0, 226, 154
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Check while ..."
FONT 8, "MS Shell Dlg"
@@ -248,25 +250,24 @@ BEGIN
CONTROL "Out to lunch",IDC_CHECKST9,"Button",BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,134,104,70,9
END
-IDD_YAMNOPT DIALOGEX 0, 0, 310, 216
+IDD_YAMNOPT DIALOGEX 0, 0, 312, 121
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD | WS_VISIBLE | WS_BORDER
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
- CONTROL "HotKey1",IDC_HKFORCE,"msctls_hotkey32",WS_BORDER | WS_TABSTOP,169,15,110,12
- LTEXT "Hotkey for mail check:",IDC_STATIC,7,16,153,10
- CONTROL "TopToolBar button ""Check mail""",IDC_CHECKTTB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,28,160,11
- GROUPBOX "YAMN General Options",IDC_STATIC,3,2,303,80
- CONTROL "Enable YAMN Main Menu (Require Restart)",IDC_MAINMENU,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,46,270,9
- GROUPBOX "MailBrowser Options",IDC_STATIC,3,91,151,61
- CONTROL "Enable Close on Delete Button",IDC_CLOSEONDELETE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,103,143,11
- CONTROL "Show long localised date",IDC_LONGDATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,170,100,144,10
- CONTROL "Don't show today's date",IDC_SMARTDATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,170,112,144,10
- GROUPBOX "Date/Time Representation",IDC_STATIC,166,91,141,61
- CONTROL "Don't show seconds",IDC_NOSECONDS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,170,124,135,8
+ GROUPBOX "YAMN General Options",IDC_STATIC,3,2,303,65
+ CONTROL "TopToolBar button ""Check mail""",IDC_CHECKTTB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,15,294,11
+ CONTROL "Enable YAMN Main Menu",IDC_MAINMENU,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,33,293,9
CONTROL "Show YAMN as a Protocol (Require Restart)",IDC_YAMNASPROTO,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,63,270,9
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,50,293,9
+
+ GROUPBOX "MailBrowser Options",IDC_STATIC,3,68,151,47
+ CONTROL "Enable Close on Delete Button",IDC_CLOSEONDELETE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,80,143,11
+ CONTROL "Show long localised date",IDC_LONGDATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,170,77,130,10
+ CONTROL "Don't show today's date",IDC_SMARTDATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,170,89,131,10
+
+ GROUPBOX "Date/Time Representation",IDC_STATIC,166,68,141,47
+ CONTROL "Don't show seconds",IDC_NOSECONDS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,170,101,129,8
END
IDD_POP3ACCOUNTPOPUP DIALOGEX 0, 0, 315, 230
@@ -327,45 +328,6 @@ IDI_OCCUPIED ICON "iconttbdown.ico"
//
IDB_ICONS BITMAP "yamn.bmp"
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Version
-//
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION 0,1,2,5
- PRODUCTVERSION 0,1,2,5
- FILEFLAGSMASK 0x3fL
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x40004L
- FILETYPE 0x2L
- FILESUBTYPE 0x0L
-BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "000004b0"
- BEGIN
- VALUE "Comments", "Yet Another Mail Notifier"
- VALUE "FileDescription", "Yet Another Mail Notifier"
- VALUE "FileVersion", "0.1.2.5"
- VALUE "InternalName", "YAMN"
- VALUE "LegalCopyright", "Copyright © 2007"
- VALUE "OriginalFilename", "YAMN.dll"
- VALUE "ProductName", "YAMN tweety"
- VALUE "ProductVersion", "0.1.2.5"
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x0, 1200
- END
-END
-
#endif // Neutral resources
/////////////////////////////////////////////////////////////////////////////
@@ -380,4 +342,3 @@ END
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
-
diff --git a/plugins/YAMN/resources/resource.h b/plugins/YAMN/resources/resource.h
index bd9b48b29b..8bfd74c9a3 100644
--- a/plugins/YAMN/resources/resource.h
+++ b/plugins/YAMN/resources/resource.h
@@ -79,7 +79,6 @@
#define IDC_CHECKFCOL 1077
#define IDC_CHECKNCOL 1078
#define IDC_CPNT 1079
-#define IDC_HKFORCE 1081
#define IDC_CHECKPOP 1087
#define IDC_CHECKNPOP 1088
#define IDC_CHECKFPOP 1089
diff --git a/plugins/YAMN/services.cpp b/plugins/YAMN/services.cpp
index 120726d041..975c6627e9 100644
--- a/plugins/YAMN/services.cpp
+++ b/plugins/YAMN/services.cpp
@@ -1,56 +1,26 @@
#include "yamn.h"
#include "main.h"
-// External icon var for icolib support
-//Plugin registration CS
-//Used if we add (register) plugin to YAMN plugins and when we browse through registered plugins
-extern CRITICAL_SECTION PluginRegCS;
-
-//AccountWriterCS
-//We want to store number of writers of Accounts (number of Accounts used for writing)
-//If we want to read all accounts (for saving to file) immidiatelly, we have to wait until no account is changing (no thread writing to account)
-extern SCOUNTER *AccountWriterSO;
-
-//NoExitEV
-//Event that is signaled when there's a request to exit, so no new pop3 check should be performed
-extern HANDLE ExitEV;
-
-//WriteToFileEV
-//If this is signaled, write accounts to file is performed. Set this event if you want to actualize your accounts and messages
-extern HANDLE WriteToFileEV;
-
-//extern HICON hYamnIconsOrg[];
-extern HICON hYamnIcons[];
-extern char *iconDescs[];
-extern char *iconNames[];
-extern HIMAGELIST CSImages;
-
-extern void __stdcall SSL_DebugLog( const char *fmt, ... );
-
-extern char *ProtoName;
-extern INT_PTR YAMN_STATUS;
-
-extern PYAMN_VARIABLES pYAMNVar;
-extern HYAMNPROTOPLUGIN POP3Plugin;
+extern HANDLE hMenuItemMain, hMenuItemCont, hMenuItemContApp;
static INT_PTR Service_GetCaps(WPARAM wParam, LPARAM lParam)
{
- if (wParam==PFLAGNUM_4)
+ if (wParam == PFLAGNUM_4)
return PF4_NOCUSTOMAUTH;
- if (wParam==PFLAG_UNIQUEIDTEXT)
+ if (wParam == PFLAG_UNIQUEIDTEXT)
return (INT_PTR) Translate("Nick");
- if (wParam==PFLAG_MAXLENOFMESSAGE)
+ if (wParam == PFLAG_MAXLENOFMESSAGE)
return 400;
- if (wParam==PFLAG_UNIQUEIDSETTING)
+ if (wParam == PFLAG_UNIQUEIDSETTING)
return (INT_PTR) "Id";
- if (wParam==PFLAGNUM_2)
+ if (wParam == PFLAGNUM_2)
return PF2_ONLINE | PF2_SHORTAWAY | PF2_LONGAWAY | PF2_LIGHTDND;
- if (wParam==PFLAGNUM_5)
+ if (wParam == PFLAGNUM_5) {
if (DBGetContactSettingByte(NULL, YAMN_DBMODULE, YAMN_SHOWASPROTO, 1))
return PF2_SHORTAWAY | PF2_LONGAWAY | PF2_LIGHTDND;
- else
- return PF2_ONLINE | PF2_SHORTAWAY | PF2_LONGAWAY | PF2_LIGHTDND;
+ return PF2_ONLINE | PF2_SHORTAWAY | PF2_LONGAWAY | PF2_LIGHTDND;
+ }
return 0;
}
@@ -59,13 +29,13 @@ static INT_PTR Service_GetStatus(WPARAM wParam, LPARAM lParam)
return YAMN_STATUS;
}
-static INT_PTR Service_SetStatus(WPARAM wParam,LPARAM lParam)
+static INT_PTR Service_SetStatus(WPARAM wParam, LPARAM lParam)
{
- INT_PTR newstatus = (wParam!=ID_STATUS_OFFLINE)?ID_STATUS_ONLINE:ID_STATUS_OFFLINE;
+ int newstatus = (wParam != ID_STATUS_OFFLINE)?ID_STATUS_ONLINE:ID_STATUS_OFFLINE;
if (newstatus != YAMN_STATUS){
- INT_PTR oldstatus = YAMN_STATUS;
- YAMN_STATUS=newstatus;
- ProtoBroadcastAck(ProtoName,NULL,ACKTYPE_STATUS,ACKRESULT_SUCCESS,(HANDLE)oldstatus,newstatus);
+ int oldstatus = YAMN_STATUS;
+ YAMN_STATUS = newstatus;
+ ProtoBroadcastAck(YAMN_DBMODULE, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)oldstatus, newstatus);
}
return 0;
@@ -73,20 +43,19 @@ static INT_PTR Service_SetStatus(WPARAM wParam,LPARAM lParam)
static INT_PTR Service_GetName(WPARAM wParam, LPARAM lParam)
{
- lstrcpynA((char *) lParam, ProtoName, wParam);;
+ lstrcpynA((char *) lParam, YAMN_DBMODULE, wParam);;
return 0;
}
-static INT_PTR Service_LoadIcon(WPARAM wParam,LPARAM lParam)
+static INT_PTR Service_LoadIcon(WPARAM wParam, LPARAM lParam)
{
if ( LOWORD( wParam ) == PLI_PROTOCOL )
- return (INT_PTR)CopyIcon(hYamnIcons[0]); // noone cares about other than PLI_PROTOCOL
+ return (INT_PTR)CopyIcon(g_LoadIconEx(0)); // noone cares about other than PLI_PROTOCOL
return (INT_PTR)(HICON)NULL;
-
}
-/*static*/ INT_PTR ClistContactDoubleclicked(WPARAM wParam, LPARAM lParam)
+INT_PTR ClistContactDoubleclicked(WPARAM wParam, LPARAM lParam)
{
ContactDoubleclicked(((CLISTEVENT*)lParam)->lParam, lParam);
return 0;
@@ -100,65 +69,57 @@ static int Service_ContactDoubleclicked(WPARAM wParam, LPARAM lParam)
static INT_PTR ContactApplication(WPARAM wParam, LPARAM lParam)
{
- DBVARIANT dbv;
- char *szProto;
- HACCOUNT ActualAccount;
+ char *szProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0);
+ if ( lstrcmpA(szProto, YAMN_DBMODULE))
+ return 0;
- szProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0);
- if (szProto != NULL && strcmp(szProto, ProtoName)==0)
- {
- if (!DBGetContactSetting((HANDLE) wParam,ProtoName,"Id",&dbv))
- {
- ActualAccount=(HACCOUNT) CallService(MS_YAMN_FINDACCOUNTBYNAME,(WPARAM)POP3Plugin,(LPARAM)dbv.pszVal);
- if (ActualAccount != NULL)
- {
- PROCESS_INFORMATION pi;
- STARTUPINFOW si;
+ DBVARIANT dbv;
+ if ( DBGetContactSetting((HANDLE) wParam, YAMN_DBMODULE, "Id", &dbv))
+ return 0;
- ZeroMemory(&si,sizeof(si));
- si.cb=sizeof(si);
+ HACCOUNT ActualAccount = (HACCOUNT) CallService(MS_YAMN_FINDACCOUNTBYNAME, (WPARAM)POP3Plugin, (LPARAM)dbv.pszVal);
+ if (ActualAccount != NULL) {
+ STARTUPINFOW si = { 0 };
+ si.cb = sizeof(si);
- #ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile,"ContactApplication:ActualAccountSO-read wait\n");
- #endif
- if (WAIT_OBJECT_0==WaitToReadFcn(ActualAccount->AccountAccessSO))
- {
- #ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile,"ContactApplication:ualAccountSO-read enter\n");
- #endif
- if (ActualAccount->NewMailN.App!=NULL)
- {
- WCHAR *Command;
- if (ActualAccount->NewMailN.AppParam!=NULL)
- Command=new WCHAR[wcslen(ActualAccount->NewMailN.App)+wcslen(ActualAccount->NewMailN.AppParam)+6];
- else
- Command=new WCHAR[wcslen(ActualAccount->NewMailN.App)+6];
+ #ifdef DEBUG_SYNCHRO
+ DebugLog(SynchroFile, "ContactApplication:ActualAccountSO-read wait\n");
+ #endif
+ if (WAIT_OBJECT_0 == WaitToReadFcn(ActualAccount->AccountAccessSO)) {
+ #ifdef DEBUG_SYNCHRO
+ DebugLog(SynchroFile, "ContactApplication:ualAccountSO-read enter\n");
+ #endif
+ if (ActualAccount->NewMailN.App != NULL) {
+ WCHAR *Command;
+ if (ActualAccount->NewMailN.AppParam != NULL)
+ Command = new WCHAR[wcslen(ActualAccount->NewMailN.App)+wcslen(ActualAccount->NewMailN.AppParam)+6];
+ else
+ Command = new WCHAR[wcslen(ActualAccount->NewMailN.App)+6];
- if (Command!=NULL)
- {
- lstrcpyW(Command,L"\"");
- lstrcatW(Command,ActualAccount->NewMailN.App);
- lstrcatW(Command,L"\" ");
- if (ActualAccount->NewMailN.AppParam!=NULL)
- lstrcatW(Command,ActualAccount->NewMailN.AppParam);
- CreateProcessW(NULL,Command,NULL,NULL,FALSE,NORMAL_PRIORITY_CLASS,NULL,NULL,&si,&pi);
- delete[] Command;
- }
- }
-
- #ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile,"ContactApplication:ActualAccountSO-read done\n");
- #endif
- ReadDoneFcn(ActualAccount->AccountAccessSO);
+ if (Command != NULL) {
+ lstrcpyW(Command, L"\"");
+ lstrcatW(Command, ActualAccount->NewMailN.App);
+ lstrcatW(Command, L"\" ");
+ if (ActualAccount->NewMailN.AppParam != NULL)
+ lstrcatW(Command, ActualAccount->NewMailN.AppParam);
+
+ PROCESS_INFORMATION pi;
+ CreateProcessW(NULL, Command, NULL, NULL, FALSE, NORMAL_PRIORITY_CLASS, NULL, NULL, &si, &pi);
+ delete[] Command;
}
- #ifdef DEBUG_SYNCHRO
- else
- DebugLog(SynchroFile,"ContactApplication:ActualAccountSO-read enter failed\n");
- #endif
}
- DBFreeVariant(&dbv);
+
+ #ifdef DEBUG_SYNCHRO
+ DebugLog(SynchroFile, "ContactApplication:ActualAccountSO-read done\n");
+ #endif
+ ReadDoneFcn(ActualAccount->AccountAccessSO);
}
+ #ifdef DEBUG_SYNCHRO
+ else
+ DebugLog(SynchroFile, "ContactApplication:ActualAccountSO-read enter failed\n");
+ #endif
}
+ DBFreeVariant(&dbv);
return 0;
}
@@ -169,45 +130,36 @@ static INT_PTR AccountMailCheck(WPARAM wParam, LPARAM lParam){
HANDLE ThreadRunningEV;
DWORD tid;
// copy/paste make mistakes
- if (ActualAccount != NULL)
- {
+ if (ActualAccount != NULL) {
//we use event to signal, that running thread has all needed stack parameters copied
- if (NULL==(ThreadRunningEV=CreateEvent(NULL,FALSE,FALSE,NULL)))
+ if (NULL == (ThreadRunningEV = CreateEvent(NULL, FALSE, FALSE, NULL)))
return 0;
//if we want to close miranda, we get event and do not run pop3 checking anymore
- if (WAIT_OBJECT_0==WaitForSingleObject(ExitEV,0))
+ if (WAIT_OBJECT_0 == WaitForSingleObject(ExitEV, 0))
return 0;
+
EnterCriticalSection(&PluginRegCS);
#ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile,"AccountCheck:ActualAccountSO-read wait\n");
+ DebugLog(SynchroFile, "AccountCheck:ActualAccountSO-read wait\n");
#endif
- if (WAIT_OBJECT_0!=SWMRGWaitToRead(ActualAccount->AccountAccessSO,0))
- {
+ if (WAIT_OBJECT_0 != SWMRGWaitToRead(ActualAccount->AccountAccessSO, 0)) {
#ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile,"ForceCheck:ActualAccountSO-read wait failed\n");
+ DebugLog(SynchroFile, "ForceCheck:ActualAccountSO-read wait failed\n");
#endif
}
- else
- {
+ else {
#ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile,"ForceCheck:ActualAccountSO-read enter\n");
+ DebugLog(SynchroFile, "ForceCheck:ActualAccountSO-read enter\n");
#endif
- if ((ActualAccount->Flags & YAMN_ACC_ENA) && ActualAccount->Plugin->Fcn->SynchroFcnPtr)
- {
- struct CheckParam ParamToPlugin={YAMN_CHECKVERSION,ThreadRunningEV,ActualAccount,lParam?YAMN_FORCECHECK:YAMN_NORMALCHECK,(void *)0,NULL};
+ if ((ActualAccount->Flags & YAMN_ACC_ENA) && ActualAccount->Plugin->Fcn->SynchroFcnPtr) {
+ struct CheckParam ParamToPlugin = {YAMN_CHECKVERSION, ThreadRunningEV, ActualAccount, lParam?YAMN_FORCECHECK:YAMN_NORMALCHECK, (void *)0, NULL};
HANDLE NewThread;
- ActualAccount->TimeLeft=ActualAccount->Interval;
- if (NewThread=CreateThread(NULL,0,(YAMN_STANDARDFCN)ActualAccount->Plugin->Fcn->SynchroFcnPtr,&ParamToPlugin,0,&tid))
- {
- WaitForSingleObject(ThreadRunningEV,INFINITE);
+ ActualAccount->TimeLeft = ActualAccount->Interval;
+ if (NewThread = CreateThread(NULL, 0, (YAMN_STANDARDFCN)ActualAccount->Plugin->Fcn->SynchroFcnPtr, &ParamToPlugin, 0, &tid)) {
+ WaitForSingleObject(ThreadRunningEV, INFINITE);
CloseHandle(NewThread);
}
- else
- {
- //ReadDoneFcn(ActualAccount->AccountAccessSO);
- }
-
}
ReadDoneFcn(ActualAccount->AccountAccessSO);
}
@@ -219,280 +171,323 @@ static INT_PTR AccountMailCheck(WPARAM wParam, LPARAM lParam){
static INT_PTR ContactMailCheck(WPARAM wParam, LPARAM lParam)
{
+ char *szProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0);
+ if ( lstrcmpA(szProto, YAMN_DBMODULE))
+ return 0;
DBVARIANT dbv;
- char *szProto;
- HACCOUNT ActualAccount;
- HANDLE ThreadRunningEV;
- DWORD tid;
+ if ( DBGetContactSetting((HANDLE) wParam, YAMN_DBMODULE, "Id", &dbv))
+ return 0;
- szProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0);
- if (szProto != NULL && strcmp(szProto, ProtoName)==0)
- {
- if (!DBGetContactSetting((HANDLE) wParam,ProtoName,"Id",&dbv))
+ HACCOUNT ActualAccount = (HACCOUNT) CallService(MS_YAMN_FINDACCOUNTBYNAME, (WPARAM)POP3Plugin, (LPARAM)dbv.pszVal);
+ if (ActualAccount != NULL) {
+ //we use event to signal, that running thread has all needed stack parameters copied
+ HANDLE ThreadRunningEV;
+ if (NULL == (ThreadRunningEV = CreateEvent(NULL, FALSE, FALSE, NULL)))
+ return 0;
+ //if we want to close miranda, we get event and do not run pop3 checking anymore
+ if (WAIT_OBJECT_0 == WaitForSingleObject(ExitEV, 0))
+ return 0;
+ EnterCriticalSection(&PluginRegCS);
+ #ifdef DEBUG_SYNCHRO
+ DebugLog(SynchroFile, "ForceCheck:ActualAccountSO-read wait\n");
+ #endif
+ if (WAIT_OBJECT_0 != WaitToReadFcn(ActualAccount->AccountAccessSO))
{
- ActualAccount=(HACCOUNT) CallService(MS_YAMN_FINDACCOUNTBYNAME,(WPARAM)POP3Plugin,(LPARAM)dbv.pszVal);
- if (ActualAccount != NULL)
+ #ifdef DEBUG_SYNCHRO
+ DebugLog(SynchroFile, "ForceCheck:ActualAccountSO-read wait failed\n");
+ #endif
+ }
+ else
+ {
+ #ifdef DEBUG_SYNCHRO
+ DebugLog(SynchroFile, "ForceCheck:ActualAccountSO-read enter\n");
+ #endif
+ if ((ActualAccount->Flags & YAMN_ACC_ENA) && (ActualAccount->StatusFlags & YAMN_ACC_FORCE)) //account cannot be forced to check
{
- //we use event to signal, that running thread has all needed stack parameters copied
- if (NULL==(ThreadRunningEV=CreateEvent(NULL,FALSE,FALSE,NULL)))
- return 0;
- //if we want to close miranda, we get event and do not run pop3 checking anymore
- if (WAIT_OBJECT_0==WaitForSingleObject(ExitEV,0))
- return 0;
- EnterCriticalSection(&PluginRegCS);
- #ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile,"ForceCheck:ActualAccountSO-read wait\n");
- #endif
- if (WAIT_OBJECT_0!=WaitToReadFcn(ActualAccount->AccountAccessSO))
- {
- #ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile,"ForceCheck:ActualAccountSO-read wait failed\n");
- #endif
- }
- else
- {
- #ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile,"ForceCheck:ActualAccountSO-read enter\n");
- #endif
- if ((ActualAccount->Flags & YAMN_ACC_ENA) && (ActualAccount->StatusFlags & YAMN_ACC_FORCE)) //account cannot be forced to check
- {
- if (ActualAccount->Plugin->Fcn->ForceCheckFcnPtr==NULL)
- {
- ReadDoneFcn(ActualAccount->AccountAccessSO);
- }
- struct CheckParam ParamToPlugin={YAMN_CHECKVERSION,ThreadRunningEV,ActualAccount,YAMN_FORCECHECK,(void *)0,NULL};
-
- if (NULL==CreateThread(NULL,0,(YAMN_STANDARDFCN)ActualAccount->Plugin->Fcn->ForceCheckFcnPtr,&ParamToPlugin,0,&tid))
- {
- ReadDoneFcn(ActualAccount->AccountAccessSO);
- }
- else
- WaitForSingleObject(ThreadRunningEV,INFINITE);
- }
+ if (ActualAccount->Plugin->Fcn->ForceCheckFcnPtr == NULL)
ReadDoneFcn(ActualAccount->AccountAccessSO);
- }
- LeaveCriticalSection(&PluginRegCS);
- CloseHandle(ThreadRunningEV);
+
+ DWORD tid;
+ struct CheckParam ParamToPlugin = {YAMN_CHECKVERSION, ThreadRunningEV, ActualAccount, YAMN_FORCECHECK, (void *)0, NULL};
+ if (NULL == CreateThread(NULL, 0, (YAMN_STANDARDFCN)ActualAccount->Plugin->Fcn->ForceCheckFcnPtr, &ParamToPlugin, 0, &tid))
+ ReadDoneFcn(ActualAccount->AccountAccessSO);
+ else
+ WaitForSingleObject(ThreadRunningEV, INFINITE);
}
- DBFreeVariant(&dbv);
+ ReadDoneFcn(ActualAccount->AccountAccessSO);
}
-
+ LeaveCriticalSection(&PluginRegCS);
+ CloseHandle(ThreadRunningEV);
}
+ DBFreeVariant(&dbv);
return 0;
}
-
void MainMenuAccountClicked(WPARAM wParam, LPARAM lParam)
{
-
}
/*static*/ void ContactDoubleclicked(WPARAM wParam, LPARAM lParam)
{
+ char *szProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0);
+ if ( lstrcmpA(szProto, YAMN_DBMODULE))
+ return;
+
DBVARIANT dbv;
- char *szProto;
- HACCOUNT ActualAccount;
+ if ( DBGetContactSetting(( HANDLE )wParam, YAMN_DBMODULE, "Id", &dbv))
+ return;
- szProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0);
- if (szProto != NULL && strcmp(szProto, ProtoName)==0)
- {
- if (!DBGetContactSetting((HANDLE) wParam,ProtoName,"Id",&dbv))
- {
- ActualAccount=(HACCOUNT) CallService(MS_YAMN_FINDACCOUNTBYNAME,(WPARAM)POP3Plugin,(LPARAM)dbv.pszVal);
- if (ActualAccount != NULL)
- {
- #ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile,"Service_ContactDoubleclicked:ActualAccountSO-read wait\n");
- #endif
- if (WAIT_OBJECT_0==WaitToReadFcn(ActualAccount->AccountAccessSO))
- {
- #ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile,"Service_ContactDoubleclicked:ActualAccountSO-read enter\n");
- #endif
- YAMN_MAILBROWSERPARAM Param={(HANDLE)0,ActualAccount,ActualAccount->NewMailN.Flags,ActualAccount->NoNewMailN.Flags,0};
-
- Param.nnflags=Param.nnflags | YAMN_ACC_MSG; //show mails in account even no new mail in account
- Param.nnflags=Param.nnflags & ~YAMN_ACC_POP;
-
- Param.nflags=Param.nflags | YAMN_ACC_MSG; //show mails in account even no new mail in account
- Param.nflags=Param.nflags & ~YAMN_ACC_POP;
-
- RunMailBrowserSvc((WPARAM)&Param,(LPARAM)YAMN_MAILBROWSERVERSION);
+ HACCOUNT ActualAccount = (HACCOUNT) CallService(MS_YAMN_FINDACCOUNTBYNAME, (WPARAM)POP3Plugin, (LPARAM)dbv.pszVal);
+ if (ActualAccount != NULL) {
+ #ifdef DEBUG_SYNCHRO
+ DebugLog(SynchroFile, "Service_ContactDoubleclicked:ActualAccountSO-read wait\n");
+ #endif
+ if (WAIT_OBJECT_0 == WaitToReadFcn(ActualAccount->AccountAccessSO)) {
+ #ifdef DEBUG_SYNCHRO
+ DebugLog(SynchroFile, "Service_ContactDoubleclicked:ActualAccountSO-read enter\n");
+ #endif
+ YAMN_MAILBROWSERPARAM Param = {(HANDLE)0, ActualAccount, ActualAccount->NewMailN.Flags, ActualAccount->NoNewMailN.Flags, 0};
+
+ Param.nnflags = Param.nnflags | YAMN_ACC_MSG; //show mails in account even no new mail in account
+ Param.nnflags = Param.nnflags & ~YAMN_ACC_POP;
+
+ Param.nflags = Param.nflags | YAMN_ACC_MSG; //show mails in account even no new mail in account
+ Param.nflags = Param.nflags & ~YAMN_ACC_POP;
+
+ RunMailBrowserSvc((WPARAM)&Param, (LPARAM)YAMN_MAILBROWSERVERSION);
- #ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile,"Service_ContactDoubleclicked:ActualAccountSO-read done\n");
- #endif
- ReadDoneFcn(ActualAccount->AccountAccessSO);
- }
- #ifdef DEBUG_SYNCHRO
- else
- DebugLog(SynchroFile,"Service_ContactDoubleclicked:ActualAccountSO-read enter failed\n");
- #endif
-
- }
- DBFreeVariant(&dbv);
+ #ifdef DEBUG_SYNCHRO
+ DebugLog(SynchroFile, "Service_ContactDoubleclicked:ActualAccountSO-read done\n");
+ #endif
+ ReadDoneFcn(ActualAccount->AccountAccessSO);
}
-
+ #ifdef DEBUG_SYNCHRO
+ else
+ DebugLog(SynchroFile, "Service_ContactDoubleclicked:ActualAccountSO-read enter failed\n");
+ #endif
+
}
+ DBFreeVariant(&dbv);
}
-int IcoLibIconsChanged(WPARAM wParam, LPARAM lParam)
+/////////////////////////////////////////////////////////////////////////////////////////
+
+HBITMAP LoadBmpFromIcon(HICON hIcon)
{
- HICON temp;
- for (int i=0;i<ICONSNUMBER;i++){
- if (temp = (HICON) CallService(MS_SKIN2_GETICON, 0, (LPARAM) iconNames[i]))hYamnIcons[i]=temp;
- }
- { CLISTMENUITEM mi = {0};
- extern HANDLE hMenuItemMain;
- extern HANDLE hMenuItemCont;
- extern HANDLE hMenuItemContApp;
-
- mi.cbSize = sizeof(mi);
- mi.flags = CMIM_ICON;
-
- mi.hIcon = hYamnIcons[5];
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuItemMain, (LPARAM)&mi);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuItemCont, (LPARAM)&mi);
- mi.hIcon = hYamnIcons[4];
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuItemContApp, (LPARAM)&mi);
+ int IconSizeX = 16;
+ int IconSizeY = 16;
+
+ HBRUSH hBkgBrush = CreateSolidBrush(GetSysColor(COLOR_3DFACE));
+
+ BITMAPINFOHEADER bih = {0};
+ bih.biSize = sizeof(bih);
+ bih.biBitCount = 24;
+ bih.biPlanes = 1;
+ bih.biCompression = BI_RGB;
+ bih.biHeight = IconSizeY;
+ bih.biWidth = IconSizeX;
+
+ int widthBytes = ((bih.biWidth*bih.biBitCount + 31) >> 5) * 4;
+
+ RECT rc;
+ rc.top = rc.left = 0;
+ rc.right = bih.biWidth;
+ rc.bottom = bih.biHeight;
+
+ HDC hdc = GetDC(NULL);
+ HBITMAP hBmp = CreateCompatibleBitmap(hdc, bih.biWidth, bih.biHeight);
+ HDC hdcMem = CreateCompatibleDC(hdc);
+ HBITMAP hoBmp = (HBITMAP)SelectObject(hdcMem, hBmp);
+ FillRect(hdcMem, &rc, hBkgBrush);
+ DrawIconEx(hdcMem, 0, 0, hIcon, bih.biWidth, bih.biHeight, 0, NULL, DI_NORMAL);
+ SelectObject(hdcMem, hoBmp);
+ return hBmp;
+}
+
+int AddTopToolbarIcon(WPARAM,LPARAM)
+{
+ if ( DBGetContactSettingByte(NULL, YAMN_DBMODULE, YAMN_TTBFCHECK, 1)) {
+ if ( ServiceExists(MS_TTB_ADDBUTTON) && hTTButton == NULL) {
+ TTBButton btn = { 0 };
+ btn.cbSize = sizeof(TTBButton);
+ btn.pszServiceUp = MS_YAMN_FORCECHECK;
+ btn.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP;
+ btn.name = Translate("Check mail");
+ btn.hbBitmapUp = LoadBmpFromIcon(g_LoadIconEx(5));
+ btn.hbBitmapDown = LoadBmpFromIcon(g_LoadIconEx(6));
+ hTTButton = (HANDLE)CallService(MS_TTB_ADDBUTTON, (WPARAM)&btn, 0);
+ CallService(MS_TTB_SETBUTTONOPTIONS, MAKEWPARAM((WORD)TTBO_TIPNAME, (WORD)hTTButton), (LPARAM)Translate("Check mail"));
+ }
+ if ( ServiceExists(MS_TB_ADDBUTTON) && hTButton == NULL) {
+ TBButton btn = { 0 };
+ btn.cbSize = sizeof(TBButton);
+ btn.pszServiceName = MS_YAMN_FORCECHECK;
+ btn.tbbFlags = TBBF_VISIBLE | TBBF_SHOWTOOLTIP;
+ btn.defPos = 10114;
+ btn.pszButtonID = "yamn_btn";
+ btn.pszButtonName = "Check mail";
+ btn.hPrimaryIconHandle = g_GetIconHandle(5);
+ btn.hSecondaryIconHandle = g_GetIconHandle(6);
+ btn.pszTooltipDn = btn.pszTooltipUp = "Check mail";
+ hTButton = (HANDLE)CallService(MS_TB_ADDBUTTON, 0, (WPARAM)&btn);
+ }
}
+ else {
+ if (ServiceExists(MS_TTB_ADDBUTTON) && hTTButton != NULL) {
+ CallService(MS_TTB_REMOVEBUTTON, (WPARAM)hTTButton, 0);
+ hTTButton = NULL;
+ }
+ if (ServiceExists(MS_TB_ADDBUTTON) && hTButton != NULL) {
+ CallService(MS_TB_REMOVEBUTTON, (WPARAM)hTButton, 0);
+ hTButton = NULL;
+ } }
+
+ return 0;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+int Shutdown(WPARAM, LPARAM)
+{
+ CallService(MS_TTB_REMOVEBUTTON, (WPARAM)hTTButton, 0);
+
+ DBWriteContactSettingDword(NULL, YAMN_DBMODULE, YAMN_DBMSGPOSX, HeadPosX);
+ DBWriteContactSettingDword(NULL, YAMN_DBMODULE, YAMN_DBMSGPOSY, HeadPosY);
+ DBWriteContactSettingDword(NULL, YAMN_DBMODULE, YAMN_DBMSGSIZEX, HeadSizeX);
+ DBWriteContactSettingDword(NULL, YAMN_DBMODULE, YAMN_DBMSGSIZEY, HeadSizeY);
+ DBWriteContactSettingWord(NULL, YAMN_DBMODULE, YAMN_DBMSGPOSSPLIT, HeadSplitPos);
+ YAMNVar.Shutdown = TRUE;
+ KillTimer(NULL, SecTimer);
+
+ UnregisterProtoPlugins();
+ UnregisterFilterPlugins();
return 0;
}
-int SystemModulesLoaded(WPARAM,LPARAM); //in main.cpp
+int SystemModulesLoaded(WPARAM, LPARAM); //in main.cpp
typedef struct { HANDLE hookHandle; const char *hookName; MIRANDAHOOK mirandaFunction;} HookDataType;
-static HookDataType hookData[]={
- {0,ME_TTB_MODULELOADED,AddTopToolbarIcon},
- {0,ME_SYSTEM_MODULESLOADED,SystemModulesLoaded}, //pop3 plugin must be included after all miranda modules are loaded
- {0,ME_OPT_INITIALISE,YAMNOptInitSvc},
- {0,ME_SYSTEM_PRESHUTDOWN,Shutdown},
- {0,ME_CLIST_DOUBLECLICKED, Service_ContactDoubleclicked},
- {0,ME_SKIN2_ICONSCHANGED, IcoLibIconsChanged},
- {0,0,0}//end marker
+static HookDataType hookData[] = {
+ {0, ME_SYSTEM_MODULESLOADED, SystemModulesLoaded}, //pop3 plugin must be included after all miranda modules are loaded
+ {0, ME_TB_MODULELOADED, AddTopToolbarIcon},
+ {0, ME_TTB_MODULELOADED, AddTopToolbarIcon},
+ {0, ME_OPT_INITIALISE, YAMNOptInitSvc},
+ {0, ME_SYSTEM_PRESHUTDOWN, Shutdown},
+ {0, ME_CLIST_DOUBLECLICKED, Service_ContactDoubleclicked},
+ {0, 0, 0}//end marker
};
-
void HookEvents(void)
{
//We set function which registers needed POP3 accounts. This is a part of internal POP3 plugin.
//Your plugin should do the same task in your Load fcn. Why we call it in MODULESLOADED? Because netlib
//user can be registered after all modules are loaded (see m_netlib.h in Miranda)
- for (int i=0;hookData[i].hookName;i++){
- hookData[i].hookHandle = HookEvent(hookData[i].hookName,hookData[i].mirandaFunction);
+ for (int i = 0;hookData[i].hookName;i++){
+ hookData[i].hookHandle = HookEvent(hookData[i].hookName, hookData[i].mirandaFunction);
}
}
void UnhookEvents(void){
- for (int i=0;i<(sizeof(hookData)/sizeof(hookData[0]));i++){
+ for (int i = 0;i<(sizeof(hookData)/sizeof(hookData[0]));i++){
if (hookData[i].hookHandle) UnhookEvent(hookData[i].hookHandle);
}
}
typedef struct { HANDLE serviceHandle; const char *serviceName; MIRANDASERVICE serviceFunction;} ServiceDataType;
-static ServiceDataType serviceData[]={
- {0,YAMN_DBMODULE PS_GETCAPS,Service_GetCaps},
- {0,YAMN_DBMODULE PS_GETSTATUS,Service_GetStatus},
- {0,YAMN_DBMODULE PS_SETSTATUS,Service_SetStatus},
- {0,YAMN_DBMODULE PS_GETNAME,Service_GetName},
- {0,YAMN_DBMODULE PS_LOADICON,Service_LoadIcon},
+static ServiceDataType serviceData[] = {
+ {0, YAMN_DBMODULE PS_GETCAPS, Service_GetCaps},
+ {0, YAMN_DBMODULE PS_GETSTATUS, Service_GetStatus},
+ {0, YAMN_DBMODULE PS_SETSTATUS, Service_SetStatus},
+ {0, YAMN_DBMODULE PS_GETNAME, Service_GetName},
+ {0, YAMN_DBMODULE PS_LOADICON, Service_LoadIcon},
//Function with which protocol plugin can register
- {0,MS_YAMN_GETFCNPTR,GetFcnPtrSvc},
+ {0, MS_YAMN_GETFCNPTR, GetFcnPtrSvc},
//Function returns pointer to YAMN variables
- {0,MS_YAMN_GETVARIABLES,GetVariablesSvc},
+ {0, MS_YAMN_GETVARIABLES, GetVariablesSvc},
//Function with which protocol plugin can register
- {0,MS_YAMN_REGISTERPROTOPLUGIN,RegisterProtocolPluginSvc},
+ {0, MS_YAMN_REGISTERPROTOPLUGIN, RegisterProtocolPluginSvc},
//Function with which protocol plugin can unregister
- {0,MS_YAMN_UNREGISTERPROTOPLUGIN,UnregisterProtocolPluginSvc},
+ {0, MS_YAMN_UNREGISTERPROTOPLUGIN, UnregisterProtocolPluginSvc},
//Function creates an account for plugin
- {0,MS_YAMN_CREATEPLUGINACCOUNT,CreatePluginAccountSvc},
+ {0, MS_YAMN_CREATEPLUGINACCOUNT, CreatePluginAccountSvc},
//Function deletes plugin account
- {0,MS_YAMN_DELETEPLUGINACCOUNT,DeletePluginAccountSvc},
+ {0, MS_YAMN_DELETEPLUGINACCOUNT, DeletePluginAccountSvc},
//Finds account for plugin by name
- {0,MS_YAMN_FINDACCOUNTBYNAME,FindAccountByNameSvc},
+ {0, MS_YAMN_FINDACCOUNTBYNAME, FindAccountByNameSvc},
//Creates next account for plugin
- {0,MS_YAMN_GETNEXTFREEACCOUNT,GetNextFreeAccountSvc},
+ {0, MS_YAMN_GETNEXTFREEACCOUNT, GetNextFreeAccountSvc},
//Function removes account from YAMN queue. Does not delete it from memory
- {0,MS_YAMN_DELETEACCOUNT,DeleteAccountSvc},
+ {0, MS_YAMN_DELETEACCOUNT, DeleteAccountSvc},
//Function finds accounts for specified plugin
- {0,MS_YAMN_READACCOUNTSA,AddAccountsFromFileASvc},
-
- //Function that reads all plugin mails from file
- {0,MS_YAMN_READACCOUNTSW,AddAccountsFromFileWSvc},
+ {0, MS_YAMN_READACCOUNTS, AddAccountsFromFileSvc},
//Function that stores all plugin mails to one file
- {0,MS_YAMN_WRITEACCOUNTSA,WriteAccountsToFileASvc},
-
- //Function that stores all plugin mails to one file
- {0,MS_YAMN_WRITEACCOUNTSW,WriteAccountsToFileWSvc},
+ {0, MS_YAMN_WRITEACCOUNTS, WriteAccountsToFileSvc},
//Function that returns user's filename
- {0,MS_YAMN_GETFILENAMEA,GetFileNameASvc},
-
- //Function that returns user's filename (unicode input)
- {0,MS_YAMN_GETFILENAMEW,GetFileNameWSvc},
+ {0, MS_YAMN_GETFILENAME, GetFileNameSvc},
//Releases unicode string from memory
- {0,MS_YAMN_DELETEFILENAME,DeleteFileNameSvc},
+ {0, MS_YAMN_DELETEFILENAME, DeleteFileNameSvc},
//Checks mail
- {0,MS_YAMN_FORCECHECK,ForceCheckSvc},
+ {0, MS_YAMN_FORCECHECK, ForceCheckSvc},
//Runs YAMN's mail browser
- {0,MS_YAMN_MAILBROWSER,RunMailBrowserSvc},
+ {0, MS_YAMN_MAILBROWSER, RunMailBrowserSvc},
//Runs YAMN's bad conenction window
- {0,MS_YAMN_BADCONNECTION,RunBadConnectionSvc},
+ {0, MS_YAMN_BADCONNECTION, RunBadConnectionSvc},
//Function creates new mail for plugin
- {0,MS_YAMN_CREATEACCOUNTMAIL,CreateAccountMailSvc},
+ {0, MS_YAMN_CREATEACCOUNTMAIL, CreateAccountMailSvc},
//Function deletes plugin account
- {0,MS_YAMN_DELETEACCOUNTMAIL,DeleteAccountMailSvc},
+ {0, MS_YAMN_DELETEACCOUNTMAIL, DeleteAccountMailSvc},
//Function with which filter plugin can register
- {0,MS_YAMN_REGISTERFILTERPLUGIN,RegisterFilterPluginSvc},
+ {0, MS_YAMN_REGISTERFILTERPLUGIN, RegisterFilterPluginSvc},
//Function with which filter plugin can unregister
- {0,MS_YAMN_UNREGISTERFILTERPLUGIN,UnregisterFilterPluginSvc},
+ {0, MS_YAMN_UNREGISTERFILTERPLUGIN, UnregisterFilterPluginSvc},
//Function filters mail
- {0,MS_YAMN_FILTERMAIL,FilterMailSvc},
+ {0, MS_YAMN_FILTERMAIL, FilterMailSvc},
//Function contact list double click
- {0,MS_YAMN_CLISTDBLCLICK,ClistContactDoubleclicked},
+ {0, MS_YAMN_CLISTDBLCLICK, ClistContactDoubleclicked},
//Function to check individual account
- {0,MS_YAMN_ACCOUNTCHECK,AccountMailCheck},
+ {0, MS_YAMN_ACCOUNTCHECK, AccountMailCheck},
//Function contact list context menu click
- {0,MS_YAMN_CLISTCONTEXT,ContactMailCheck},
+ {0, MS_YAMN_CLISTCONTEXT, ContactMailCheck},
//Function contact list context menu click
- {0,MS_YAMN_CLISTCONTEXTAPP,ContactApplication},
+ {0, MS_YAMN_CLISTCONTEXTAPP, ContactApplication},
- {0,0,0}//end marker
+ {0, 0, 0}//end marker
};
void CreateServiceFunctions(void)
{
- for (int i=0;serviceData[i].serviceName;i++){
- serviceData[i].serviceHandle = CreateServiceFunction(serviceData[i].serviceName,serviceData[i].serviceFunction);
+ for (int i = 0;serviceData[i].serviceName;i++){
+ serviceData[i].serviceHandle = CreateServiceFunction(serviceData[i].serviceName, serviceData[i].serviceFunction);
}
};
void DestroyServiceFunctions(void)
{
- for (int i=0;serviceData[i].serviceName;i++){
+ for (int i = 0;serviceData[i].serviceName;i++){
if (serviceData[i].serviceHandle) DestroyServiceFunction(serviceData[i].serviceHandle);
}
};
@@ -501,34 +496,20 @@ void DestroyServiceFunctions(void)
void RefreshContact(void)
{
HACCOUNT Finder;
-
- for(Finder=POP3Plugin->FirstAccount;Finder!=NULL;Finder=Finder->Next)
- {
- if (Finder->hContact != NULL)
- {
+ for (Finder = POP3Plugin->FirstAccount;Finder != NULL;Finder = Finder->Next) {
+ if (Finder->hContact != NULL) {
if ((Finder->Flags & YAMN_ACC_ENA) && (Finder->NewMailN.Flags & YAMN_ACC_CONT))
- {
DBDeleteContactSetting(Finder->hContact, "CList", "Hidden");
- }
else
- {
DBWriteContactSettingByte(Finder->hContact, "CList", "Hidden", 1);
- }
}
- else
- {
- if ((Finder->Flags & YAMN_ACC_ENA) && (Finder->NewMailN.Flags & YAMN_ACC_CONT))
- {
- Finder->hContact =(HANDLE) CallService(MS_DB_CONTACT_ADD, 0, 0);
- CallService(MS_PROTO_ADDTOCONTACT,(WPARAM)Finder->hContact,(LPARAM)ProtoName);
- 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", ID_STATUS_ONLINE);
+ else {
+ if ((Finder->Flags & YAMN_ACC_ENA) && (Finder->NewMailN.Flags & YAMN_ACC_CONT)) {
+ Finder->hContact = (HANDLE) CallService(MS_DB_CONTACT_ADD, 0, 0);
+ CallService(MS_PROTO_ADDTOCONTACT, (WPARAM)Finder->hContact, (LPARAM)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", ID_STATUS_ONLINE);
DBWriteContactSettingString(Finder->hContact, "CList", "StatusMsg", Translate("No new mail message"));
- }
-
- }
- }
-
-}
+} } } }
diff --git a/plugins/YAMN/yamn.cpp b/plugins/YAMN/yamn.cpp
index 652ce01712..c1ffda847a 100644
--- a/plugins/YAMN/yamn.cpp
+++ b/plugins/YAMN/yamn.cpp
@@ -12,37 +12,6 @@
#include "m_synchro.h"
#include "main.h"
-//- imported ---------------------------------------------------------------------------------------
-//--------------------------------------------------------------------------------------------------
-
-extern PYAMN_PROTOPLUGINQUEUE FirstProtoPlugin;
-extern YAMN_VARIABLES YAMNVar;
-
-extern char *ProtoName;
-
-extern HANDLE hTTButton; //TopToolBar button
-
-extern DWORD WriteAccountsToFile();
-extern DWORD WINAPI SWMRGWaitToRead(PSWMRG,DWORD);
-extern void WINAPI SWMRGDoneReading(PSWMRG);
-extern DWORD WINAPI WaitToReadFcn(PSWMRG);
-extern void WINAPI ReadDoneFcn(PSWMRG);
-
-//From protoplugin.cpp
-extern struct CExportedFunctions ProtoPluginExportedFcn[1];
-extern struct CExportedServices ProtoPluginExportedSvc[5];
-//From filterplugin.cpp
-extern struct CExportedFunctions FilterPluginExportedFcn[1];
-extern struct CExportedServices FilterPluginExportedSvc[2];
-//From synchro.cpp
-extern struct CExportedFunctions SynchroExportedFcn[7];
-//From account.cpp
-extern struct CExportedFunctions AccountExportedFcn[2];
-extern struct CExportedServices AccountExportedSvc[9];
-//From mails.cpp (MIME)
-extern struct CExportedFunctions MailExportedFcn[8];
-extern struct CExportedServices MailExportedSvc[5];
-
//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
@@ -64,21 +33,18 @@ HANDLE ExitEV;
HANDLE WriteToFileEV;
//Returns pointer to YAMN exported function
-INT_PTR GetFcnPtrSvc(WPARAM wParam,LPARAM lParam);
+INT_PTR GetFcnPtrSvc(WPARAM wParam, LPARAM lParam);
//Returns pointer to YAMN variables
-INT_PTR GetVariablesSvc(WPARAM wParam,LPARAM);
-
-// Thread running only to catch hotkeys
-DWORD WINAPI YAMNHotKeyThread(LPVOID Param);
+INT_PTR GetVariablesSvc(WPARAM wParam, LPARAM);
// Function every seconds decrements account counter of seconds and checks if they are 0
// If yes, creates a POP3 thread to check account
-void CALLBACK TimerProc(HWND,UINT,UINT,DWORD);
+void CALLBACK TimerProc(HWND, UINT, UINT, DWORD);
// Function called to check all accounts immidialtelly
// no params
-INT_PTR ForceCheckSvc(WPARAM,LPARAM);
+INT_PTR ForceCheckSvc(WPARAM, LPARAM);
//thread is running all the time
//waits for WriteToFileEV and then writes all accounts to file
@@ -90,128 +56,94 @@ INT_PTR ForceCheckSvc(WPARAM,LPARAM);
//not used now, perhaps in the future
-//int ExitProc(WPARAM wParam,LPARAM lParam);
+//int ExitProc(WPARAM wParam, LPARAM lParam);
//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
-INT_PTR GetFcnPtrSvc(WPARAM wParam,LPARAM lParam)
+INT_PTR GetFcnPtrSvc(WPARAM wParam, LPARAM lParam)
{
register int i;
- for(i=0;i<sizeof(ProtoPluginExportedFcn)/sizeof(ProtoPluginExportedFcn[0]);i++)
- if (0==lstrcmpA((char *)wParam,ProtoPluginExportedFcn[i].ID))
+ for (i=0;i<sizeof(ProtoPluginExportedFcn)/sizeof(ProtoPluginExportedFcn[0]);i++)
+ if (0==lstrcmpA((char *)wParam, ProtoPluginExportedFcn[i].ID))
return (INT_PTR)ProtoPluginExportedFcn[i].Ptr;
- for(i=0;i<sizeof(ProtoPluginExportedSvc)/sizeof(ProtoPluginExportedSvc[0]);i++)
- if (0==lstrcmpA((char *)wParam,ProtoPluginExportedSvc[i].ID))
+ for (i=0;i<sizeof(ProtoPluginExportedSvc)/sizeof(ProtoPluginExportedSvc[0]);i++)
+ if (0==lstrcmpA((char *)wParam, ProtoPluginExportedSvc[i].ID))
return (INT_PTR)ProtoPluginExportedSvc[i].Ptr;
- for(i=0;i<sizeof(SynchroExportedFcn)/sizeof(SynchroExportedFcn[0]);i++)
- if (0==lstrcmpA((char *)wParam,SynchroExportedFcn[i].ID))
+ for (i=0;i<sizeof(SynchroExportedFcn)/sizeof(SynchroExportedFcn[0]);i++)
+ if (0==lstrcmpA((char *)wParam, SynchroExportedFcn[i].ID))
return (INT_PTR)SynchroExportedFcn[i].Ptr;
- for(i=0;i<sizeof(AccountExportedFcn)/sizeof(AccountExportedFcn[0]);i++)
- if (0==lstrcmpA((char *)wParam,AccountExportedFcn[i].ID))
+ for (i=0;i<sizeof(AccountExportedFcn)/sizeof(AccountExportedFcn[0]);i++)
+ if (0==lstrcmpA((char *)wParam, AccountExportedFcn[i].ID))
return (INT_PTR)AccountExportedFcn[i].Ptr;
- for(i=0;i<sizeof(AccountExportedSvc)/sizeof(AccountExportedSvc[0]);i++)
- if (0==lstrcmpA((char *)wParam,AccountExportedSvc[i].ID))
+ for (i=0;i<sizeof(AccountExportedSvc)/sizeof(AccountExportedSvc[0]);i++)
+ if (0==lstrcmpA((char *)wParam, AccountExportedSvc[i].ID))
return (INT_PTR)AccountExportedSvc[i].Ptr;
- for(i=0;i<sizeof(MailExportedFcn)/sizeof(MailExportedFcn[0]);i++)
- if (0==lstrcmpA((char *)wParam,MailExportedFcn[i].ID))
+ for (i=0;i<sizeof(MailExportedFcn)/sizeof(MailExportedFcn[0]);i++)
+ if (0==lstrcmpA((char *)wParam, MailExportedFcn[i].ID))
return (INT_PTR)MailExportedFcn[i].Ptr;
- for(i=0;i<sizeof(MailExportedSvc)/sizeof(MailExportedSvc[0]);i++)
- if (0==lstrcmpA((char *)wParam,MailExportedSvc[i].ID))
+ for (i=0;i<sizeof(MailExportedSvc)/sizeof(MailExportedSvc[0]);i++)
+ if (0==lstrcmpA((char *)wParam, MailExportedSvc[i].ID))
return (INT_PTR)MailExportedSvc[i].Ptr;
- for(i=0;i<sizeof(FilterPluginExportedFcn)/sizeof(FilterPluginExportedFcn[0]);i++)
- if (0==lstrcmpA((char *)wParam,FilterPluginExportedFcn[i].ID))
+ for (i=0;i<sizeof(FilterPluginExportedFcn)/sizeof(FilterPluginExportedFcn[0]);i++)
+ if (0==lstrcmpA((char *)wParam, FilterPluginExportedFcn[i].ID))
return (INT_PTR)FilterPluginExportedFcn[i].Ptr;
- for(i=0;i<sizeof(FilterPluginExportedSvc)/sizeof(FilterPluginExportedSvc[0]);i++)
- if (0==lstrcmpA((char *)wParam,FilterPluginExportedSvc[i].ID))
+ for (i=0;i<sizeof(FilterPluginExportedSvc)/sizeof(FilterPluginExportedSvc[0]);i++)
+ if (0==lstrcmpA((char *)wParam, FilterPluginExportedSvc[i].ID))
return (INT_PTR)FilterPluginExportedSvc[i].Ptr;
return (INT_PTR)NULL;
}
-INT_PTR GetVariablesSvc(WPARAM wParam,LPARAM)
+INT_PTR GetVariablesSvc(WPARAM wParam, LPARAM)
{
return wParam==YAMN_VARIABLESVERSION ? (INT_PTR)&YAMNVar : (INT_PTR)NULL;
}
-DWORD WINAPI YAMNHotKeyThread(LPVOID Param)
-{
- MSG WinMessage;
- WORD HotKey = LOWORD(Param);
- int HotKeyID;
-
-// register hotkey for main YAMN thread first
- if (!(HotKeyID=RegisterHotKey(NULL,(int)GlobalAddAtomA(YAMN_HKCHECKMAIL),HIBYTE(HotKey),LOBYTE(HotKey))))
- return 0;
-
- while(1)
- {
- GetMessage(&WinMessage,NULL,WM_HOTKEY,WM_YAMN_CHANGEHOTKEY);
-
-// if we want to close miranda, we get event and do not run pop3 checking anymore
- if (WAIT_OBJECT_0==WaitForSingleObject(ExitEV,0))
- break;
-
- switch(WinMessage.message)
- {
-// user pressed hotkey
- case WM_HOTKEY:
- ForceCheckSvc((WPARAM)0,(LPARAM)0);
- break;
-// hotkey changed
- case WM_YAMN_CHANGEHOTKEY:
- UnregisterHotKey(NULL,HotKeyID);
- HotKeyID=RegisterHotKey(NULL,(int)GlobalAddAtomA(YAMN_HKCHECKMAIL),WinMessage.wParam,WinMessage.lParam);
- break;
- }
- }
- return 1;
-}
-
-void CALLBACK TimerProc(HWND,UINT,UINT,DWORD)
+void CALLBACK TimerProc(HWND, UINT, UINT, DWORD)
{
PYAMN_PROTOPLUGINQUEUE ActualPlugin;
HACCOUNT ActualAccount;
HANDLE ThreadRunningEV;
- DWORD Status,tid;
+ DWORD Status, tid;
// we use event to signal, that running thread has all needed stack parameters copied
- if (NULL==(ThreadRunningEV=CreateEvent(NULL,FALSE,FALSE,NULL)))
+ if (NULL==(ThreadRunningEV=CreateEvent(NULL, FALSE, FALSE, NULL)))
return;
// if we want to close miranda, we get event and do not run checking anymore
- if (WAIT_OBJECT_0==WaitForSingleObject(ExitEV,0))
+ if (WAIT_OBJECT_0==WaitForSingleObject(ExitEV, 0))
return;
// Get actual status of current user in Miranda
- Status=CallService(MS_CLIST_GETSTATUSMODE,0,0);
+ Status=CallService(MS_CLIST_GETSTATUSMODE, 0, 0);
EnterCriticalSection(&PluginRegCS);
- for(ActualPlugin=FirstProtoPlugin;ActualPlugin!=NULL;ActualPlugin=ActualPlugin->Next)
+ for (ActualPlugin=FirstProtoPlugin;ActualPlugin!=NULL;ActualPlugin=ActualPlugin->Next)
{
#ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile,"TimerProc:AccountBrowserSO-read wait\n");
+ DebugLog(SynchroFile, "TimerProc:AccountBrowserSO-read wait\n");
#endif
- if (WAIT_OBJECT_0!=SWMRGWaitToRead(ActualPlugin->Plugin->AccountBrowserSO,0)) //we want to access accounts immiadtelly
+ if (WAIT_OBJECT_0!=SWMRGWaitToRead(ActualPlugin->Plugin->AccountBrowserSO, 0)) //we want to access accounts immiadtelly
{
#ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile,"TimerProc:AccountBrowserSO-read enter failed\n");
+ DebugLog(SynchroFile, "TimerProc:AccountBrowserSO-read enter failed\n");
#endif
LeaveCriticalSection(&PluginRegCS);
return;
}
#ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile,"TimerProc:AccountBrowserSO-read enter\n");
+ DebugLog(SynchroFile, "TimerProc:AccountBrowserSO-read enter\n");
#endif
- for(ActualAccount=ActualPlugin->Plugin->FirstAccount;ActualAccount!=NULL;ActualAccount=ActualAccount->Next)
+ for (ActualAccount=ActualPlugin->Plugin->FirstAccount;ActualAccount!=NULL;ActualAccount=ActualAccount->Next)
{
if (ActualAccount->Plugin==NULL || ActualAccount->Plugin->Fcn==NULL) //account not inited
continue;
#ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile,"TimerProc:ActualAccountSO-read wait\n");
+ DebugLog(SynchroFile, "TimerProc:ActualAccountSO-read wait\n");
#endif
- if (WAIT_OBJECT_0!=SWMRGWaitToRead(ActualAccount->AccountAccessSO,0))
+ if (WAIT_OBJECT_0!=SWMRGWaitToRead(ActualAccount->AccountAccessSO, 0))
{
#ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile,"TimerProc:ActualAccountSO-read wait failed\n");
+ DebugLog(SynchroFile, "TimerProc:ActualAccountSO-read wait failed\n");
#endif
continue;
}
@@ -220,37 +152,37 @@ void CALLBACK TimerProc(HWND,UINT,UINT,DWORD)
switch(Status)
{
case ID_STATUS_OFFLINE:
- DebugLog(SynchroFile,"TimerProc:ActualAccountSO-read enter status offline\n");
+ DebugLog(SynchroFile, "TimerProc:ActualAccountSO-read enter status offline\n");
break;
case ID_STATUS_ONLINE:
- DebugLog(SynchroFile,"TimerProc:ActualAccountSO-read enter status online\n");
+ DebugLog(SynchroFile, "TimerProc:ActualAccountSO-read enter status online\n");
break;
case ID_STATUS_AWAY:
- DebugLog(SynchroFile,"TimerProc:ActualAccountSO-read enter status away\n");
+ DebugLog(SynchroFile, "TimerProc:ActualAccountSO-read enter status away\n");
break;
case ID_STATUS_DND:
- DebugLog(SynchroFile,"TimerProc:ActualAccountSO-read enter status dnd\n");
+ DebugLog(SynchroFile, "TimerProc:ActualAccountSO-read enter status dnd\n");
break;
case ID_STATUS_NA:
- DebugLog(SynchroFile,"TimerProc:ActualAccountSO-read enter status na\n");
+ DebugLog(SynchroFile, "TimerProc:ActualAccountSO-read enter status na\n");
break;
case ID_STATUS_OCCUPIED:
- DebugLog(SynchroFile,"TimerProc:ActualAccountSO-read enter status occupied\n");
+ DebugLog(SynchroFile, "TimerProc:ActualAccountSO-read enter status occupied\n");
break;
case ID_STATUS_FREECHAT:
- DebugLog(SynchroFile,"TimerProc:ActualAccountSO-read enter status freechat\n");
+ DebugLog(SynchroFile, "TimerProc:ActualAccountSO-read enter status freechat\n");
break;
case ID_STATUS_INVISIBLE:
- DebugLog(SynchroFile,"TimerProc:ActualAccountSO-read enter status invisible\n");
+ DebugLog(SynchroFile, "TimerProc:ActualAccountSO-read enter status invisible\n");
break;
case ID_STATUS_ONTHEPHONE:
- DebugLog(SynchroFile,"TimerProc:ActualAccountSO-read enter status onthephone\n");
+ DebugLog(SynchroFile, "TimerProc:ActualAccountSO-read enter status onthephone\n");
break;
case ID_STATUS_OUTTOLUNCH:
- DebugLog(SynchroFile,"TimerProc:ActualAccountSO-read enter status outtolunch\n");
+ DebugLog(SynchroFile, "TimerProc:ActualAccountSO-read enter status outtolunch\n");
break;
default:
- DebugLog(SynchroFile,"TimerProc:ActualAccountSO-read enter status unknown\n");
+ DebugLog(SynchroFile, "TimerProc:ActualAccountSO-read enter status unknown\n");
break;
}
#endif
@@ -278,26 +210,26 @@ void CALLBACK TimerProc(HWND,UINT,UINT,DWORD)
isAccountCounting = TRUE;
}
#ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile,"TimerProc:time left : %i\n",ActualAccount->TimeLeft);
+ DebugLog(SynchroFile, "TimerProc:time left : %i\n", ActualAccount->TimeLeft);
#endif
- WindowList_BroadcastAsync(YAMNVar.MessageWnds,WM_YAMN_CHANGETIME,(WPARAM)ActualAccount,(LPARAM)ActualAccount->TimeLeft);
+ WindowList_BroadcastAsync(YAMNVar.MessageWnds, WM_YAMN_CHANGETIME, (WPARAM)ActualAccount, (LPARAM)ActualAccount->TimeLeft);
if (!ActualAccount->TimeLeft)
{
- struct CheckParam ParamToPlugin={YAMN_CHECKVERSION,ThreadRunningEV,ActualAccount,YAMN_NORMALCHECK,(void *)0,NULL};
+ struct CheckParam ParamToPlugin={YAMN_CHECKVERSION, ThreadRunningEV, ActualAccount, YAMN_NORMALCHECK, (void *)0, NULL};
HANDLE NewThread;
ActualAccount->TimeLeft=ActualAccount->Interval;
- if (NULL==(NewThread=CreateThread(NULL,0,(YAMN_STANDARDFCN)ActualAccount->Plugin->Fcn->TimeoutFcnPtr,&ParamToPlugin,0,&tid)))
+ if (NULL==(NewThread=CreateThread(NULL, 0, (YAMN_STANDARDFCN)ActualAccount->Plugin->Fcn->TimeoutFcnPtr, &ParamToPlugin, 0, &tid)))
{
#ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile,"TimerProc:ActualAccountSO-read done\n");
+ DebugLog(SynchroFile, "TimerProc:ActualAccountSO-read done\n");
#endif
ReadDoneFcn(ActualAccount->AccountAccessSO);
continue;
}
else
{
- WaitForSingleObject(ThreadRunningEV,INFINITE);
+ WaitForSingleObject(ThreadRunningEV, INFINITE);
CloseHandle(NewThread);
}
}
@@ -305,22 +237,22 @@ void CALLBACK TimerProc(HWND,UINT,UINT,DWORD)
}
ChangeIsCountingStatusLabel:
#ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile,"TimerProc:ActualAccountSO-read done\n");
+ DebugLog(SynchroFile, "TimerProc:ActualAccountSO-read done\n");
#endif
if (((ActualAccount->isCounting)!=0)!=isAccountCounting){
ActualAccount->isCounting=isAccountCounting;
- WORD cStatus = DBGetContactSettingWord(ActualAccount->hContact,ProtoName,"Status",0);
+ WORD cStatus = DBGetContactSettingWord(ActualAccount->hContact, YAMN_DBMODULE, "Status", 0);
switch (cStatus){
case ID_STATUS_ONLINE:
case ID_STATUS_OFFLINE:
- DBWriteContactSettingWord(ActualAccount->hContact, ProtoName, "Status", isAccountCounting?ID_STATUS_ONLINE:ID_STATUS_OFFLINE);
+ DBWriteContactSettingWord(ActualAccount->hContact, YAMN_DBMODULE, "Status", isAccountCounting?ID_STATUS_ONLINE:ID_STATUS_OFFLINE);
default: break;
}
}
ReadDoneFcn(ActualAccount->AccountAccessSO);
}
#ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile,"TimerProc:AccountBrowserSO-read done\n");
+ DebugLog(SynchroFile, "TimerProc:AccountBrowserSO-read done\n");
#endif
SWMRGDoneReading(ActualPlugin->Plugin->AccountBrowserSO);
}
@@ -329,7 +261,7 @@ ChangeIsCountingStatusLabel:
return;
}
-INT_PTR ForceCheckSvc(WPARAM,LPARAM)
+INT_PTR ForceCheckSvc(WPARAM, LPARAM)
{
PYAMN_PROTOPLUGINQUEUE ActualPlugin;
HACCOUNT ActualAccount;
@@ -337,37 +269,37 @@ INT_PTR ForceCheckSvc(WPARAM,LPARAM)
DWORD tid;
//we use event to signal, that running thread has all needed stack parameters copied
- if (NULL==(ThreadRunningEV=CreateEvent(NULL,FALSE,FALSE,NULL)))
+ if (NULL==(ThreadRunningEV=CreateEvent(NULL, FALSE, FALSE, NULL)))
return 0;
//if we want to close miranda, we get event and do not run pop3 checking anymore
- if (WAIT_OBJECT_0==WaitForSingleObject(ExitEV,0))
+ if (WAIT_OBJECT_0==WaitForSingleObject(ExitEV, 0))
return 0;
EnterCriticalSection(&PluginRegCS);
- for(ActualPlugin=FirstProtoPlugin;ActualPlugin!=NULL;ActualPlugin=ActualPlugin->Next)
+ for (ActualPlugin=FirstProtoPlugin;ActualPlugin!=NULL;ActualPlugin=ActualPlugin->Next)
{
#ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile,"ForceCheck:AccountBrowserSO-read wait\n");
+ DebugLog(SynchroFile, "ForceCheck:AccountBrowserSO-read wait\n");
#endif
- SWMRGWaitToRead(ActualPlugin->Plugin->AccountBrowserSO,INFINITE);
+ SWMRGWaitToRead(ActualPlugin->Plugin->AccountBrowserSO, INFINITE);
#ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile,"ForceCheck:AccountBrowserSO-read enter\n");
+ DebugLog(SynchroFile, "ForceCheck:AccountBrowserSO-read enter\n");
#endif
- for(ActualAccount=ActualPlugin->Plugin->FirstAccount;ActualAccount!=NULL;ActualAccount=ActualAccount->Next)
+ for (ActualAccount=ActualPlugin->Plugin->FirstAccount;ActualAccount!=NULL;ActualAccount=ActualAccount->Next)
{
if (ActualAccount->Plugin->Fcn==NULL) //account not inited
continue;
#ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile,"ForceCheck:ActualAccountSO-read wait\n");
+ DebugLog(SynchroFile, "ForceCheck:ActualAccountSO-read wait\n");
#endif
if (WAIT_OBJECT_0!=WaitToReadFcn(ActualAccount->AccountAccessSO))
{
#ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile,"ForceCheck:ActualAccountSO-read wait failed\n");
+ DebugLog(SynchroFile, "ForceCheck:ActualAccountSO-read wait failed\n");
#endif
continue;
}
#ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile,"ForceCheck:ActualAccountSO-read enter\n");
+ DebugLog(SynchroFile, "ForceCheck:ActualAccountSO-read enter\n");
#endif
if ((ActualAccount->Flags & YAMN_ACC_ENA) && (ActualAccount->StatusFlags & YAMN_ACC_FORCE)) //account cannot be forced to check
{
@@ -376,25 +308,27 @@ INT_PTR ForceCheckSvc(WPARAM,LPARAM)
ReadDoneFcn(ActualAccount->AccountAccessSO);
continue;
}
- struct CheckParam ParamToPlugin={YAMN_CHECKVERSION,ThreadRunningEV,ActualAccount,YAMN_FORCECHECK,(void *)0,NULL};
+ struct CheckParam ParamToPlugin={YAMN_CHECKVERSION, ThreadRunningEV, ActualAccount, YAMN_FORCECHECK, (void *)0, NULL};
- if (NULL==CreateThread(NULL,0,(YAMN_STANDARDFCN)ActualAccount->Plugin->Fcn->ForceCheckFcnPtr,&ParamToPlugin,0,&tid))
+ if (NULL==CreateThread(NULL, 0, (YAMN_STANDARDFCN)ActualAccount->Plugin->Fcn->ForceCheckFcnPtr, &ParamToPlugin, 0, &tid))
{
ReadDoneFcn(ActualAccount->AccountAccessSO);
continue;
}
else
- WaitForSingleObject(ThreadRunningEV,INFINITE);
+ WaitForSingleObject(ThreadRunningEV, INFINITE);
}
ReadDoneFcn(ActualAccount->AccountAccessSO);
}
#ifdef DEBUG_SYNCHRO
- DebugLog(SynchroFile,"ForceCheck:AccountBrowserSO-read done\n");
+ DebugLog(SynchroFile, "ForceCheck:AccountBrowserSO-read done\n");
#endif
SWMRGDoneReading(ActualPlugin->Plugin->AccountBrowserSO);
}
LeaveCriticalSection(&PluginRegCS);
CloseHandle(ThreadRunningEV);
- CallService(MS_TTB_SETBUTTONSTATE,(WPARAM)hTTButton,(LPARAM)TTBST_RELEASED);
+
+ if ( hTTButton ) CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hTTButton, TTBST_RELEASED);
+ if ( hTButton ) CallService(MS_TB_SETBUTTONSTATE, (WPARAM)hTButton, TBST_RELEASED);
return 1;
}
diff --git a/plugins/YAMN/yamn.h b/plugins/YAMN/yamn.h
index 672a617266..7d82d83b82 100644
--- a/plugins/YAMN/yamn.h
+++ b/plugins/YAMN/yamn.h
@@ -32,6 +32,7 @@
#include "m_protomod.h" //protocols module
#include "m_protosvc.h"
#include "m_toptoolbar.h"
+#include "m_toolbar.h"
#include "m_icolib.h"
#include "m_kbdnotify.h"
#include "m_popup.h"
@@ -53,9 +54,6 @@
//icons definitions
#define ICONSNUMBER 8
-#define ICONSDESCS "Neutral","YAMN","New Mail","Connect Fail","Launch Application","TopToolBar UP","TopToolBar Down","Offline"
-#define ICONSNAMES "YAMN_Neutral",iconDescs[1],"YAMN_NewMail","YAMN_ConnectFail","YAMN_ApplExec","YAMN_TopToolBarUp","YAMN_TopToolBarDown","YAMN_Offline"
-#define ICONSINDS IDI_ONLINE,IDI_ICOYAMN1,IDI_ICOYAMN2,IDI_NA,IDI_OCCUPIED,IDI_ICOTTBUP,IDI_OCCUPIED,IDI_OFFLINE
//From services.cpp
void CreateServiceFunctions(void);
@@ -66,6 +64,11 @@ void RefreshContact(void);
void ContactDoubleclicked(WPARAM wParam,LPARAM lParam);
INT_PTR ClistContactDoubleclicked(WPARAM wParam, LPARAM lParam);
+extern CRITICAL_SECTION PluginRegCS;
+extern SCOUNTER *AccountWriterSO;
+extern HANDLE ExitEV;
+extern HANDLE WriteToFileEV;
+
//From debug.cpp
#undef YAMN_DEBUG
#ifdef YAMN_DEBUG
@@ -79,16 +82,10 @@ void UnInitDebug();
//From yamn.cpp
INT_PTR GetFcnPtrSvc(WPARAM wParam,LPARAM lParam);
INT_PTR GetVariablesSvc(WPARAM,LPARAM);
-//INT_PTR AddWndToYAMNWindowsSvc(WPARAM,LPARAM);
-//INT_PTR RemoveWndFromYAMNWindowsSvc(WPARAM,LPARAM);
-DWORD WINAPI YAMNHotKeyThread(LPVOID);
void CALLBACK TimerProc(HWND,UINT,UINT,DWORD);
INT_PTR ForceCheckSvc(WPARAM,LPARAM);
-// int ExitProc(WPARAM,LPARAM);
-//From account.cpp
-//--------------------------------------------------------------------------------------------------
-//--------------------------------------------------------------------------------------------------
+extern struct YAMNExportedFcns *pYAMNFcn;
//From account.cpp
extern CRITICAL_SECTION AccountStatusCS;
@@ -100,27 +97,22 @@ int InitAccount(HACCOUNT Which);
void DeInitAccount(HACCOUNT Which);
void StopSignalFcn(HACCOUNT Which);
void CodeDecodeString(char *Dest,BOOL Encrypt);
-static DWORD PostFileToMemory(HANDLE File,char **MemFile,char **End);
-DWORD FileToMemoryA(char *FileName,char **MemFile,char **End);
-DWORD FileToMemoryW(WCHAR *FileName,char **MemFile,char **End);
+DWORD FileToMemory(TCHAR *FileName,char **MemFile,char **End);
#if defined(DEBUG_FILEREAD) || defined(DEBUG_FILEREADMESSAGES)
-DWORD ReadStringFromMemory(char **Parser,TCHAR *End,char **StoreTo,char *DebugString);
+DWORD ReadStringFromMemory(char **Parser,char *End,char **StoreTo,char *DebugString);
#endif
-DWORD ReadStringFromMemory(char **Parser,TCHAR *End,char **StoreTo);
+DWORD ReadStringFromMemory(char **Parser,char *End,char **StoreTo);
#ifndef UNICODE
#if defined(DEBUG_FILEREAD) || defined(DEBUG_FILEREADMESSAGES)
-DWORD ReadStringFromMemoryW(WCHAR **Parser,TCHAR *End,WCHAR **StoreTo,WCHAR *DebugString);
+DWORD ReadStringFromMemoryW(WCHAR **Parser,WCHAR *End,WCHAR **StoreTo,WCHAR *DebugString);
#endif //if defined(DEBUG...)
-DWORD ReadStringFromMemoryW(WCHAR **Parser,TCHAR *End,WCHAR **StoreTo);
+DWORD ReadStringFromMemoryW(WCHAR **Parser,WCHAR *End,WCHAR **StoreTo);
#endif //ifdef Unicode
-static DWORD ReadNotificationFromMemory(char **Parser,TCHAR *End,YAMN_NOTIFICATION *Which);
DWORD ReadMessagesFromMemory(HACCOUNT Which,char **Parser,char *End);
-static INT_PTR PerformAccountReading(HYAMNPROTOPLUGIN Plugin,char *MemFile,char *End);
DWORD ReadAccountFromMemory(HACCOUNT Which,char **Parser,TCHAR *End);
-INT_PTR AddAccountsFromFileASvc(WPARAM wParam,LPARAM lParam);
-INT_PTR AddAccountsFromFileWSvc(WPARAM,LPARAM);
+INT_PTR AddAccountsFromFileSvc(WPARAM wParam,LPARAM lParam);
DWORD WriteStringToFile(HANDLE File,char *Source);
#ifndef UNICODE
@@ -130,9 +122,8 @@ DWORD WriteStringToFileW(HANDLE File,WCHAR *Source);
#endif
DWORD WriteMessagesToFile(HANDLE File,HACCOUNT Which);
-static INT_PTR PerformAccountWriting(HYAMNPROTOPLUGIN Plugin,HANDLE File);
-INT_PTR WriteAccountsToFileASvc(WPARAM wParam,LPARAM lParam);
-INT_PTR WriteAccountsToFileWSvc(WPARAM wParam,LPARAM lParam);
+DWORD WINAPI WritePOP3Accounts();
+INT_PTR WriteAccountsToFileSvc(WPARAM wParam,LPARAM lParam);
INT_PTR FindAccountByNameSvc(WPARAM wParam,LPARAM lParam);
INT_PTR GetNextFreeAccountSvc(WPARAM wParam,LPARAM lParam);
@@ -148,8 +139,7 @@ void WINAPI SetStatusFcn(HACCOUNT Which,TCHAR *Value);
INT_PTR UnregisterProtoPlugins();
INT_PTR RegisterProtocolPluginSvc(WPARAM,LPARAM);
INT_PTR UnregisterProtocolPluginSvc(WPARAM,LPARAM);
-INT_PTR GetFileNameWSvc(WPARAM,LPARAM);
-INT_PTR GetFileNameASvc(WPARAM,LPARAM);
+INT_PTR GetFileNameSvc(WPARAM,LPARAM);
INT_PTR DeleteFileNameSvc(WPARAM,LPARAM);
//From filterplugin.cpp
@@ -179,6 +169,10 @@ extern struct _tcptable CodePageNamesAll[]; // in mime/decode.cpp
extern int CPLENALL;
extern struct _tcptable *CodePageNamesSupp; // in mime/decode.cpp
extern int CPLENSUPP;
+
+extern int PosX,PosY,SizeX,SizeY;
+extern int HeadPosX,HeadPosY,HeadSizeX,HeadSizeY,HeadSplitPos;
+
//#define CPDEFINDEX 63 //ISO-8859-1
#define CPDEFINDEX 0 //ACP
@@ -192,43 +186,46 @@ INT_PTR RunMailBrowserSvc(WPARAM,LPARAM);
INT_PTR RunBadConnectionSvc(WPARAM,LPARAM);
//From YAMNopts.cpp
-void WordToModAndVk(WORD,UINT *,UINT *);
int YAMNOptInitSvc(WPARAM,LPARAM);
//From main.cpp
int PostLoad(WPARAM,LPARAM); //Executed after all plugins loaded YAMN reads mails from file and notify every protocol it should set its functions
int Shutdown(WPARAM,LPARAM); //Executed before Miranda is going to shutdown
-int AddTopToolbarIcon(WPARAM,LPARAM); //Executed when TopToolBar plugin loaded Adds bitmap to toolbar
-void LoadPlugins(); //Loads plugins located in MirandaDir/Plugins/YAMN/*.dll
-int UninstallQuestionSvc(WPARAM,LPARAM); //Ask information when user wants to uninstall plugin
+int AddTopToolbarIcon(WPARAM,LPARAM); //Executed when TopToolBar plugin loaded Adds bitmap to toolbar
-extern WCHAR UserDirectory[]; //e.g. "F:\WINNT\Profiles\UserXYZ"
-extern WCHAR ProfileName[]; //e.g. "majvan"
+extern TCHAR UserDirectory[]; //e.g. "F:\WINNT\Profiles\UserXYZ"
+extern TCHAR ProfileName[]; //e.g. "majvan"
extern SWMRG *AccountBrowserSO;
extern CRITICAL_SECTION PluginRegCS;
extern YAMN_VARIABLES YAMNVar;
extern HANDLE hNewMailHook;
extern HANDLE WriteToFileEV;
-extern HICON hYamnIcons[];
+extern HANDLE hTTButton, hTButton;
+extern HCURSOR hCurSplitNS, hCurSplitWE;
+extern UINT SecTimer;
+
+HANDLE WINAPI g_GetIconHandle( int idx );
+HICON WINAPI g_LoadIconEx( int idx, bool big = false );
+void WINAPI g_ReleaseIcon( HICON hIcon );
//From synchro.cpp
-extern void WINAPI DeleteMessagesToEndFcn(HACCOUNT Account,HYAMNMAIL From);
-extern DWORD WINAPI WaitToWriteFcn(PSWMRG SObject,PSCOUNTER SCounter=NULL);
-extern void WINAPI WriteDoneFcn(PSWMRG SObject,PSCOUNTER SCounter=NULL);
-extern DWORD WINAPI WaitToReadFcn(PSWMRG SObject);
-extern void WINAPI ReadDoneFcn(PSWMRG SObject);
-extern DWORD WINAPI SCIncFcn(PSCOUNTER SCounter);
-extern DWORD WINAPI SCDecFcn(PSCOUNTER SCounter);
-extern BOOL WINAPI SWMRGInitialize(PSWMRG,TCHAR *);
-extern void WINAPI SWMRGDelete(PSWMRG);
-extern DWORD WINAPI SWMRGWaitToWrite(PSWMRG pSWMRG,DWORD dwTimeout);
-extern void WINAPI SWMRGDoneWriting(PSWMRG pSWMRG);
-extern DWORD WINAPI SWMRGWaitToRead(PSWMRG pSWMRG, DWORD dwTimeout);
-extern void WINAPI SWMRGDoneReading(PSWMRG pSWMRG);
+void WINAPI DeleteMessagesToEndFcn(HACCOUNT Account,HYAMNMAIL From);
+DWORD WINAPI WaitToWriteFcn(PSWMRG SObject,PSCOUNTER SCounter=NULL);
+void WINAPI WriteDoneFcn(PSWMRG SObject,PSCOUNTER SCounter=NULL);
+DWORD WINAPI WaitToReadFcn(PSWMRG SObject);
+void WINAPI ReadDoneFcn(PSWMRG SObject);
+DWORD WINAPI SCIncFcn(PSCOUNTER SCounter);
+DWORD WINAPI SCDecFcn(PSCOUNTER SCounter);
+BOOL WINAPI SWMRGInitialize(PSWMRG,TCHAR *);
+void WINAPI SWMRGDelete(PSWMRG);
+DWORD WINAPI SWMRGWaitToWrite(PSWMRG pSWMRG,DWORD dwTimeout);
+void WINAPI SWMRGDoneWriting(PSWMRG pSWMRG);
+DWORD WINAPI SWMRGWaitToRead(PSWMRG pSWMRG, DWORD dwTimeout);
+void WINAPI SWMRGDoneReading(PSWMRG pSWMRG);
//From mails.cpp
-extern void WINAPI DeleteMessageFromQueueFcn(HYAMNMAIL *From,HYAMNMAIL Which,int mode);
-extern void WINAPI SetRemoveFlagsInQueueFcn(HYAMNMAIL From,DWORD FlagsSet,DWORD FlagsNotSet,DWORD FlagsToSet,int mode);
+void WINAPI DeleteMessageFromQueueFcn(HYAMNMAIL *From,HYAMNMAIL Which,int mode);
+void WINAPI SetRemoveFlagsInQueueFcn(HYAMNMAIL From,DWORD FlagsSet,DWORD FlagsNotSet,DWORD FlagsToSet,int mode);
//From mime.cpp
void ExtractHeader(struct CMimeItem *items,int &CP,struct CHeader *head);
@@ -244,7 +241,6 @@ extern int StopAccounts(HYAMNPROTOPLUGIN Plugin);
extern int DeleteAccounts(HYAMNPROTOPLUGIN Plugin);
extern int WaitForAllAccounts(HYAMNPROTOPLUGIN Plugin,BOOL GetAccountBrowserAccess);
-extern char *ProtoName;
extern HYAMNPROTOPLUGIN POP3Plugin;
//from decode.cpp
@@ -256,7 +252,39 @@ extern INT_PTR LoadMailDataSvc(WPARAM wParam,LPARAM lParam);
extern INT_PTR UnloadMailDataSvc(WPARAM wParam,LPARAM);
extern INT_PTR SaveMailDataSvc(WPARAM wParam,LPARAM lParam);
+//From filterplugin.cpp
+extern PYAMN_FILTERPLUGINQUEUE FirstFilterPlugin;
+
+//From protoplugin.cpp
+extern PYAMN_PROTOPLUGINQUEUE FirstProtoPlugin;
+
+extern struct CExportedFunctions ProtoPluginExportedFcn[1];
+extern struct CExportedServices ProtoPluginExportedSvc[5];
+//From filterplugin.cpp
+extern struct CExportedFunctions FilterPluginExportedFcn[1];
+extern struct CExportedServices FilterPluginExportedSvc[2];
+//From synchro.cpp
+extern struct CExportedFunctions SynchroExportedFcn[7];
+//From account.cpp
+extern struct CExportedFunctions AccountExportedFcn[2];
+extern struct CExportedServices AccountExportedSvc[9];
+//From mails.cpp (MIME)
+extern struct CExportedFunctions MailExportedFcn[8];
+extern struct CExportedServices MailExportedSvc[5];
+
+extern char *iconDescs[];
+extern char *iconNames[];
+extern HIMAGELIST CSImages;
+
+extern void __stdcall SSL_DebugLog( const char *fmt, ... );
+
+extern int YAMN_STATUS;
+
+extern PYAMN_VARIABLES pYAMNVar;
+extern HYAMNPROTOPLUGIN POP3Plugin;
+
///////////////////////////////////////////////////////////////////////
+
class _A2T
{
TCHAR* buf;