summaryrefslogtreecommitdiff
path: root/plugins/Msg_Export/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Msg_Export/src')
-rwxr-xr-xplugins/Msg_Export/src/FileViewer.cpp472
-rwxr-xr-xplugins/Msg_Export/src/FileViewer.h2
-rwxr-xr-xplugins/Msg_Export/src/main.cpp14
-rwxr-xr-xplugins/Msg_Export/src/options.cpp541
-rwxr-xr-xplugins/Msg_Export/src/options.h4
-rwxr-xr-xplugins/Msg_Export/src/utils.cpp771
-rwxr-xr-xplugins/Msg_Export/src/utils.h24
7 files changed, 905 insertions, 923 deletions
diff --git a/plugins/Msg_Export/src/FileViewer.cpp b/plugins/Msg_Export/src/FileViewer.cpp
index cf2cd64374..5de43566b3 100755
--- a/plugins/Msg_Export/src/FileViewer.cpp
+++ b/plugins/Msg_Export/src/FileViewer.cpp
@@ -108,16 +108,16 @@ class CLHistoryDlg
HWND hFindDlg;
FINDREPLACE fr;
- _TCHAR acFindStr[100];
+ TCHAR acFindStr[100];
bool bFirstLoad;
bool bUtf8File;
- CLHistoryDlg( HANDLE hContact ) : hContact( hContact )
+ CLHistoryDlg( HANDLE hContact) : hContact( hContact )
{
hFindDlg = NULL;
acFindStr[0] = 0;
- ZeroMemory( &fr , sizeof( fr ));
+ ZeroMemory( &fr, sizeof( fr ));
fr.lStructSize = sizeof( fr );
fr.hInstance = hInstance;
fr.Flags = FR_NOUPDOWN|FR_HIDEUPDOWN;//|FR_MATCHCASE|FR_WHOLEWORD;
@@ -155,7 +155,7 @@ class CLStreamRTFInfo
int nNickLen;
static int nOptimalReadLen;
- int nWriteHeader( char * pszTarget , int nLen );
+ int nWriteHeader( char *pszTarget, int nLen );
public:
bool bUtf8File;
CLStreamRTFInfo( HANDLE hFile )
@@ -168,7 +168,7 @@ class CLStreamRTFInfo
bUtf8File = false;
nNickLen = 0;
}
- int nLoadFileStream( LPBYTE pbBuff , LONG cb );
+ int nLoadFileStream( LPBYTE pbBuff, LONG cb );
};
int CLStreamRTFInfo::nOptimalReadLen = 3300;
@@ -182,11 +182,11 @@ int CLStreamRTFInfo::nOptimalReadLen = 3300;
//
// References : -
// Remarks : -
-// Created : 030204 , 04 February 2003
+// Created : 030204, 04 February 2003
// Developer : KN
/////////////////////////////////////////////////////////////////////
-int CLStreamRTFInfo::nWriteHeader( char * pszTarget , int nLen )
+int CLStreamRTFInfo::nWriteHeader( char *pszTarget, int nLen )
{
COLORREF cMyText = db_get_dw(NULL,"SRMsg","Font3Col",RGB(64,0,128));
COLORREF cYourText = db_get_dw(NULL,"SRMsg","Font0Col",RGB(240,0,0));
@@ -194,24 +194,24 @@ int CLStreamRTFInfo::nWriteHeader( char * pszTarget , int nLen )
/* original header !!
"{\\rtf1\\ansi\\deff0{\\fonttbl{\\f0\\fnil\\fcharset0 Courier New;}}\r\n"
"{\\colortbl ;\\red%d\\green%d\\blue%d;\\red%d\\green%d\\blue%d;}\r\n"
- "\\viewkind4\\uc1\\pard\\cf2\\lang1033\\f0\\fs16 " ,
+ "\\viewkind4\\uc1\\pard\\cf2\\lang1033\\f0\\fs16 ",
*/
char szRtfHeader[400];
- int nSrcLen = _snprintf( szRtfHeader , sizeof( szRtfHeader ) ,
+ int nSrcLen = _snprintf( szRtfHeader, sizeof( szRtfHeader ),
"{\\rtf1\\ansi\r\n"
"{\\colortbl ;\\red%d\\green%d\\blue%d;\\red%d\\green%d\\blue%d;}\r\n"
- "\\viewkind4\\uc1\\pard\\cf2 " ,
- GetRValue( cMyText ) ,GetGValue( cMyText ) ,GetBValue( cMyText ) ,
- GetRValue( cYourText ) ,GetGValue( cYourText ) ,GetBValue( cYourText ) );
+ "\\viewkind4\\uc1\\pard\\cf2 ",
+ GetRValue( cMyText) ,GetGValue( cMyText) ,GetBValue( cMyText ),
+ GetRValue( cYourText ),GetGValue( cYourText ),GetBValue( cYourText));
- if( nSrcLen > nLen )
+ if (nSrcLen > nLen )
{
- MessageBox( NULL , TranslateT("Failed to write to the RichEdit the buffer was to small."), MSG_BOX_TITEL, MB_OK );
+ MessageBox( NULL, TranslateT("Failed to write to the RichEdit the buffer was to small."), MSG_BOX_TITEL, MB_OK );
return 0; // target buffer to small
}
- memcpy( pszTarget , szRtfHeader , nSrcLen );
+ memcpy( pszTarget, szRtfHeader, nSrcLen );
bHeaderWriten = true;
return nSrcLen;
}
@@ -229,56 +229,56 @@ const char szRtfEnd[] = "\r\n\\par }\r\n\0";
//
// References : -
// Remarks : -
-// Created : 030204 , 04 February 2003
+// Created : 030204, 04 February 2003
// Developer : KN
/////////////////////////////////////////////////////////////////////
-int CLStreamRTFInfo::nLoadFileStream( LPBYTE pbBuff , LONG cb )
+int CLStreamRTFInfo::nLoadFileStream( LPBYTE pbBuff, LONG cb )
{
- if( bTailWriten )
+ if (bTailWriten )
return 0;
- if( nOptimalReadLen < 500 )
+ if (nOptimalReadLen < 500 )
{
- MessageBox( NULL , TranslateT("Error: Optimal buffer size decrecied to a to low size !!"), MSG_BOX_TITEL, MB_OK );
+ MessageBox( NULL, TranslateT("Error: Optimal buffer size decrecied to a to low size !!"), MSG_BOX_TITEL, MB_OK );
return 0;
}
DWORD dwRead;
DWORD dwToRead = nOptimalReadLen;
- if( ! ReadFile(hFile , abBuf, dwToRead , &dwRead, (LPOVERLAPPED)NULL) )
+ if ( !ReadFile(hFile, abBuf, dwToRead, &dwRead, (LPOVERLAPPED)NULL))
return 0;
DWORD dwCurrent = 0;
DWORD n = 0;
- if( ! bHeaderWriten )
+ if ( !bHeaderWriten )
{
- if( dwRead >= 3 )
+ if (dwRead >= 3 )
{
bUtf8File = bIsUtf8Header( abBuf );
- if( bUtf8File )
+ if (bUtf8File )
n = 3;
}
- dwCurrent += nWriteHeader( (char*)pbBuff , cb );
+ dwCurrent += nWriteHeader( (char*)pbBuff, cb );
tstring sMyNick = NickFromHandle(0);
- nNickLen = WideCharToMultiByte(bUtf8File ? CP_UTF8 : CP_ACP , 0, sMyNick.c_str(), (int)sMyNick.length() , szMyNick , sizeof( szMyNick ), NULL , NULL );
+ nNickLen = WideCharToMultiByte(bUtf8File ? CP_UTF8 : CP_ACP, 0, sMyNick.c_str(), (int)sMyNick.length(), szMyNick, sizeof( szMyNick ), NULL, NULL );
}
else
{
- if( bCheckFirstForNick )
+ if (bCheckFirstForNick )
{
// Test against "<<" also
- if( ( (memcmp( abBuf , szMyNick , nNickLen ) == 0) ||
+ if (( (memcmp( abBuf, szMyNick, nNickLen) == 0) ||
(abBuf[0] == '<' && abBuf[1] == '<')
- ) != bLastColorMyNick )
+ ) != bLastColorMyNick )
{
// we shut only get here if we need to change color !!
bLastColorMyNick = !bLastColorMyNick;
// change color
- memcpy( &pbBuff[dwCurrent] , bLastColorMyNick ? "\\cf1 " : "\\cf2 ", 5 );
+ memcpy( &pbBuff[dwCurrent], bLastColorMyNick ? "\\cf1 " : "\\cf2 ", 5 );
}
bCheckFirstForNick = false;
}
@@ -290,38 +290,38 @@ int CLStreamRTFInfo::nLoadFileStream( LPBYTE pbBuff , LONG cb )
{
// worst case is a file ending with \n or a unicode letter. resulting in a big unicode string
// here we need szNewLine and szRtfEnd. the 10 is a small safty margin.
- if( dwCurrent + (sizeof( szNewLine ) + sizeof( szRtfEnd ) + 10 ) > (DWORD)cb )
+ if (dwCurrent + (sizeof( szNewLine) + sizeof( szRtfEnd) + 10) > (DWORD)cb )
{
// oh no !!! we have almost reached the end of the windows supplyed buffer
// we are writing to. we need to abort mision *S*!!
// and rewinde file
// we will adjust the optima buffer size
nOptimalReadLen -= 50;
- SetFilePointer( hFile , n - dwRead , NULL , FILE_CURRENT );
+ SetFilePointer( hFile, n - dwRead, NULL, FILE_CURRENT );
return dwCurrent;
}
- if( abBuf[n] == '\n' )
+ if (abBuf[n] == '\n' )
{
- memcpy( &pbBuff[dwCurrent] , szNewLine , sizeof( szNewLine )-1 );
+ memcpy( &pbBuff[dwCurrent], szNewLine, sizeof( szNewLine )-1 );
dwCurrent += sizeof( szNewLine )-1;
- if( n + 1 >= dwRead )
+ if (n + 1 >= dwRead )
{
// this is an anoing case because here we have read \n as the last char in the file
// this means that the if the next data read from file begins with <UserNick> it has
// to be highlighted
- if( !bIsFileEnd )
+ if (!bIsFileEnd )
bCheckFirstForNick = true;
break;
}
- if( abBuf[n+1] == ' ' || abBuf[n+1] == '\t' || abBuf[n+1] == '\r' )
+ if (abBuf[n+1] == ' ' || abBuf[n+1] == '\t' || abBuf[n+1] == '\r' )
continue;
- if( n + nNickLen >= dwRead )
+ if (n + nNickLen >= dwRead )
{
- if( !bIsFileEnd )
+ if (!bIsFileEnd )
{
// here we have a problem we haven't read this data yet
// the data we need to compare to is still in the file.
@@ -329,14 +329,14 @@ int CLStreamRTFInfo::nLoadFileStream( LPBYTE pbBuff , LONG cb )
// might just move the problem. if file contains \n\n\n\n\n ...
LONG lExtraRead = (n+1) - dwRead;
- if( lExtraRead >= 0 )
- MessageBox( NULL , TranslateT("Internal error !! (lExtraRead >= 0)"), MSG_BOX_TITEL, MB_OK );
- SetFilePointer( hFile , lExtraRead , NULL , FILE_CURRENT );
+ if (lExtraRead >= 0 )
+ MessageBox( NULL, TranslateT("Internal error !! (lExtraRead >= 0)"), MSG_BOX_TITEL, MB_OK );
+ SetFilePointer( hFile, lExtraRead, NULL, FILE_CURRENT );
bCheckFirstForNick = true;
return dwCurrent;
}
- if( ! bLastColorMyNick )
+ if ( !bLastColorMyNick )
continue;
// else the last color user was my nick
// we needd to change color to the other user color.
@@ -344,7 +344,7 @@ int CLStreamRTFInfo::nLoadFileStream( LPBYTE pbBuff , LONG cb )
/* old code !!
DWORD dwAddedToBuf;
- if( ! ReadFile(hFile , &abBuf[dwRead], dwNeeded , &dwAddedToBuf, (LPOVERLAPPED)NULL) )
+ if ( !ReadFile(hFile, &abBuf[dwRead], dwNeeded, &dwAddedToBuf, (LPOVERLAPPED)NULL))
return 0;
dwToRead += dwNeeded;
dwRead += dwAddedToBuf;*/
@@ -352,45 +352,45 @@ int CLStreamRTFInfo::nLoadFileStream( LPBYTE pbBuff , LONG cb )
else
{
// the data we need is here just compare
- if( ( ( memcmp( &abBuf[n+1] , szMyNick , nNickLen ) == 0) ||
+ if (( ( memcmp( &abBuf[n+1], szMyNick, nNickLen) == 0) ||
( abBuf[n+1] == '<' && abBuf[n+2] == '<')
- ) == bLastColorMyNick )
+ ) == bLastColorMyNick )
continue;
}
// we shut only get here if we need to change color !!
bLastColorMyNick = !bLastColorMyNick;
// change color
- memcpy( &pbBuff[dwCurrent] , bLastColorMyNick ? "\\cf1 " : "\\cf2 ", 5 );
+ memcpy( &pbBuff[dwCurrent], bLastColorMyNick ? "\\cf1 " : "\\cf2 ", 5 );
dwCurrent += 5;
continue;
}
- else if( abBuf[n] == '\\' || abBuf[n] == '}' || abBuf[n] == '{')
+ else if (abBuf[n] == '\\' || abBuf[n] == '}' || abBuf[n] == '{')
{
pbBuff[dwCurrent++]='\\';
}
- else if( bUtf8File && (abBuf[n] & 0x80) )
+ else if (bUtf8File && (abBuf[n] & 0x80))
{
int nValue;
- int nLen = __utf8_get_char( (const char *)&abBuf[n] , &nValue );
+ int nLen = __utf8_get_char( (const char *)&abBuf[n], &nValue );
if(nLen+n>dwRead) {
SetFilePointer(hFile,n-dwRead,NULL,FILE_CURRENT);
break;
}
- dwCurrent += sprintf( (char*)&pbBuff[dwCurrent] , "\\u%d?" , nValue );
+ dwCurrent += sprintf( (char*)&pbBuff[dwCurrent], "\\u%d?", nValue );
//continue;
/* // Then we have an extended char in the UTF8 file.
// we need to convert this to UCS-2 and then to \uN in the RTF
int nUtf8Len = 1;
- while( ( (n + nUtf8Len) < dwRead ) && ((abBuf[ n + nUtf8Len ] & 0xC0) == 0x80) )
+ while( ( (n + nUtf8Len) < dwRead) && ((abBuf[ n + nUtf8Len ] & 0xC0) == 0x80))
nUtf8Len++;
wchar_t szWstr[2];
- if( MultiByteToWideChar( CP_UTF8 , 0 , (char*)&abBuf[n] , nUtf8Len , szWstr , 2 ) == 1 )
+ if (MultiByteToWideChar( CP_UTF8, 0, (char*)&abBuf[n], nUtf8Len, szWstr, 2) == 1 )
{
- if( (int)(szWstr[0]) != nValue )
- __utf8_get_char( (const char *)&abBuf[n] , &nValue );
+ if ((int)(szWstr[0]) != nValue )
+ __utf8_get_char( (const char *)&abBuf[n], &nValue );
-// dwCurrent += sprintf( (char*)&pbBuff[dwCurrent] , "\\u%d?" , (int)(szWstr[0]) );
+// dwCurrent += sprintf( (char*)&pbBuff[dwCurrent], "\\u%d?", (int)(szWstr[0]));
// n += nUtf8Len - 1;
// continue;
}*/
@@ -400,13 +400,13 @@ int CLStreamRTFInfo::nLoadFileStream( LPBYTE pbBuff , LONG cb )
pbBuff[dwCurrent++] = abBuf[n];
}
- if( bIsFileEnd )
+ if (bIsFileEnd )
{// write end
- memcpy( &pbBuff[dwCurrent] , szRtfEnd , sizeof( szRtfEnd )-1 );
+ memcpy( &pbBuff[dwCurrent], szRtfEnd, sizeof( szRtfEnd )-1 );
dwCurrent += sizeof( szRtfEnd )-1;
bTailWriten = true;
}
- //memcpy( pbBuff , abBuf , dwRead );
+ //memcpy( pbBuff, abBuf, dwRead );
return dwCurrent;
}
@@ -420,7 +420,7 @@ int CLStreamRTFInfo::nLoadFileStream( LPBYTE pbBuff , LONG cb )
//
// References : -
// Remarks : -
-// Created : 021213 , 13 December 2002
+// Created : 021213, 13 December 2002
// Developer : KN
/////////////////////////////////////////////////////////////////////
@@ -438,7 +438,7 @@ void Initialize()
//
// References : -
// Remarks : -
-// Created : 021213 , 13 December 2002
+// Created : 021213, 13 December 2002
// Developer : KN
/////////////////////////////////////////////////////////////////////
@@ -456,11 +456,11 @@ void Uninitilize()
//
// References : -
// Remarks : -
-// Created : 021213 , 13 December 2002
+// Created : 021213, 13 December 2002
// Developer : KN
/////////////////////////////////////////////////////////////////////
-void UpdateFileViews( const _TCHAR * pszFile )
+void UpdateFileViews( const TCHAR *pszFile )
{
EnterCriticalSection( &csHistoryList );
@@ -468,9 +468,9 @@ void UpdateFileViews( const _TCHAR * pszFile )
for( iterator = clHistoryDlgList.begin() ; iterator != clHistoryDlgList.end() ; ++iterator )
{
CLHistoryDlg* pcl = (*iterator);
- if( pcl->sPath == pszFile )
+ if (pcl->sPath == pszFile )
{
- PostMessage( pcl->hWnd , WM_RELOAD_FILE , 0 , 0 );
+ PostMessage( pcl->hWnd, WM_RELOAD_FILE, 0, 0 );
}
}
LeaveCriticalSection( &csHistoryList );
@@ -485,7 +485,7 @@ void UpdateFileViews( const _TCHAR * pszFile )
//
// References : -
// Remarks : -
-// Created : 021010 , 10 October 2002
+// Created : 021010, 10 October 2002
// Developer : KN
/////////////////////////////////////////////////////////////////////
@@ -493,7 +493,7 @@ bool bOpenExternaly( HANDLE hContact )
{
tstring sPath = GetFilePathFromUser( hContact );
- if( sFileViewerPrg.empty() )
+ if (sFileViewerPrg.empty())
{
SHELLEXECUTEINFO st = {0};
st.cbSize = sizeof(st);
@@ -511,21 +511,21 @@ bool bOpenExternaly( HANDLE hContact )
STARTUPINFO sStartupInfo = { 0 };
GetStartupInfo(&sStartupInfo); // we parse oure owne info on
- sStartupInfo.lpTitle = (_TCHAR*)sFileViewerPrg.c_str();
+ sStartupInfo.lpTitle = (TCHAR*)sFileViewerPrg.c_str();
PROCESS_INFORMATION stProcesses = {0};
- if( ! CreateProcess( NULL,
- (_TCHAR*)sTmp.c_str(),
+ if ( !CreateProcess( NULL,
+ (TCHAR*)sTmp.c_str(),
NULL,
NULL,
FALSE,
- CREATE_DEFAULT_ERROR_MODE | CREATE_NEW_CONSOLE | CREATE_NEW_PROCESS_GROUP ,
+ CREATE_DEFAULT_ERROR_MODE | CREATE_NEW_CONSOLE | CREATE_NEW_PROCESS_GROUP,
NULL,
NULL,
&sStartupInfo,
- &stProcesses ) )
+ &stProcesses))
{
- DisplayLastError( LPGENT("Faile to execute external file view") );
+ DisplayLastError( LPGENT("Faile to execute external file view"));
}
return true;
}
@@ -540,7 +540,7 @@ bool bOpenExternaly( HANDLE hContact )
//
// References : -
// Remarks : -
-// Created : 021016 , 16 October 2002
+// Created : 021016, 16 October 2002
// Developer : KN
/////////////////////////////////////////////////////////////////////
@@ -558,17 +558,17 @@ bool bUseInternalViewer()
//
// References : -
// Remarks : -
-// Created : 021016 , 16 October 2002
+// Created : 021016, 16 October 2002
// Developer : KN
/////////////////////////////////////////////////////////////////////
bool bUseInternalViewer( bool bNew )
{
bUseIntViewer = bNew;
- if( bUseIntViewer && !hRichEditDll )
+ if (bUseIntViewer && !hRichEditDll )
{
hRichEditDll = LoadLibraryA("RICHED32.DLL");
- if( !hRichEditDll )
+ if (!hRichEditDll )
{
DisplayLastError( LPGENT("Failed to load Rich Edit ( RICHED32.DLL )" ));
return false;
@@ -590,27 +590,27 @@ bool bUseInternalViewer( bool bNew )
//
// References : -
// Remarks : -
-// Created : 021010 , 10 October 2002
+// Created : 021010, 10 October 2002
// Developer : KN
/////////////////////////////////////////////////////////////////////
DWORD CALLBACK RichEditStreamLoadFile(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)
{
ReadFile((HANDLE)dwCookie, pbBuff, (DWORD)cb, (DWORD *)pcb, (LPOVERLAPPED)NULL);
- return (DWORD) ( *pcb >= 0 ? NOERROR : ( *pcb = 0, E_FAIL ) );
+ return (DWORD) ( *pcb >= 0 ? NOERROR : ( *pcb = 0, E_FAIL));
}
DWORD CALLBACK RichEditRTFStreamLoadFile(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)
{
*pcb = ((CLStreamRTFInfo *)dwCookie)->nLoadFileStream( pbBuff, cb );
- if( *pcb )
+ if (*pcb )
return NOERROR;
return (DWORD)E_FAIL;
}
DWORD CALLBACK RichEditStreamSaveFile(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)
{
- WriteFile((HANDLE)dwCookie, pbBuff, cb , (DWORD*)pcb, (LPOVERLAPPED)NULL);
+ WriteFile((HANDLE)dwCookie, pbBuff, cb, (DWORD*)pcb, (LPOVERLAPPED)NULL);
return *pcb != cb;
}
@@ -628,7 +628,7 @@ DWORD CALLBACK RichEditStreamLoadFile(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb
dwCurPos++;
(*pcb)++;
}
- return (DWORD) ( *pcb >= 0 ? NOERROR : ( *pcb = 0, E_FAIL ) );
+ return (DWORD) ( *pcb >= 0 ? NOERROR : ( *pcb = 0, E_FAIL));
}
*/
/////////////////////////////////////////////////////////////////////
@@ -641,85 +641,85 @@ DWORD CALLBACK RichEditStreamLoadFile(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb
//
// References : -
// Remarks : -
-// Created : 021010 , 10 October 2002
+// Created : 021010, 10 October 2002
// Developer : KN
/////////////////////////////////////////////////////////////////////
-bool bLoadFile( HWND hwndDlg , CLHistoryDlg * pclDlg )
+bool bLoadFile( HWND hwndDlg, CLHistoryDlg * pclDlg )
{
DWORD dwStart = GetTickCount();
- HWND hRichEdit = GetDlgItem( hwndDlg , IDC_RICHEDIT );
- if( !hRichEdit )
+ HWND hRichEdit = GetDlgItem( hwndDlg, IDC_RICHEDIT );
+ if (!hRichEdit )
{
- MessageBox( hwndDlg , TranslateT("Failed to get handle to RichEdit!"), MSG_BOX_TITEL, MB_OK );
+ MessageBox( hwndDlg, TranslateT("Failed to get handle to RichEdit!"), MSG_BOX_TITEL, MB_OK );
return false;
}
- HANDLE hFile = CreateFile( pclDlg->sPath.c_str() , GENERIC_READ ,
- FILE_SHARE_READ | FILE_SHARE_WRITE , NULL ,
- OPEN_EXISTING , FILE_ATTRIBUTE_NORMAL , NULL );
+ HANDLE hFile = CreateFile( pclDlg->sPath.c_str(), GENERIC_READ,
+ FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
+ OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL );
- if( hFile == INVALID_HANDLE_VALUE )
+ if (hFile == INVALID_HANDLE_VALUE )
{
- int nDBCount = (int)CallService( MS_DB_EVENT_GETCOUNT , (WPARAM)(pclDlg->hContact) ,0 );
- _TCHAR szTmp[1500];
+ int nDBCount = (int)CallService( MS_DB_EVENT_GETCOUNT, (WPARAM)(pclDlg->hContact),0 );
+ TCHAR szTmp[1500];
- if( nDBCount == -1 )
+ if (nDBCount == -1 )
{
- mir_sntprintf(szTmp, 1499, LPGENT("Failed to open file\r\n%s\r\n\r\nContact handle is invalid") , pclDlg->sPath.c_str());
+ mir_sntprintf(szTmp, 1499, LPGENT("Failed to open file\r\n%s\r\n\r\nContact handle is invalid"), pclDlg->sPath.c_str());
}
else
{
- mir_sntprintf( szTmp , 1499, LPGENT("Failed to open file\r\n%s\r\n\r\nMiranda database contains %d events") , pclDlg->sPath.c_str() , nDBCount );
+ mir_sntprintf( szTmp, 1499, LPGENT("Failed to open file\r\n%s\r\n\r\nMiranda database contains %d events"), pclDlg->sPath.c_str(), nDBCount );
}
SETTEXTEX stText = {0};
stText.codepage = CP_ACP;
- SendMessage( hRichEdit , EM_SETTEXTEX, (WPARAM) &stText, (LPARAM) szTmp );
+ SendMessage( hRichEdit, EM_SETTEXTEX, (WPARAM) &stText, (LPARAM) szTmp );
return false;
}
POINT ptOldPos;
- SendMessage( hRichEdit , EM_GETSCROLLPOS , 0 , (LPARAM) &ptOldPos );
+ SendMessage( hRichEdit, EM_GETSCROLLPOS, 0, (LPARAM) &ptOldPos );
bool bScrollToBottom = true;
- if( pclDlg->bFirstLoad )
+ if (pclDlg->bFirstLoad )
pclDlg->bFirstLoad = false;
else
{
SCROLLINFO sScrollInfo = { 0 };
sScrollInfo.cbSize = sizeof( SCROLLINFO );
sScrollInfo.fMask = SIF_POS | SIF_RANGE | SIF_PAGE;
- if( GetScrollInfo( hRichEdit,SB_VERT,&sScrollInfo) )
+ if (GetScrollInfo( hRichEdit,SB_VERT,&sScrollInfo))
bScrollToBottom = sScrollInfo.nPos + (int)sScrollInfo.nPage + 50 > sScrollInfo.nMax;
}
- HMENU hSysMenu = GetSystemMenu( hwndDlg , FALSE );
- bool bUseSyntaxHL = (GetMenuState( hSysMenu , ID_FV_SYNTAX_HL , MF_BYCOMMAND ) & MF_CHECKED)!=0;
+ HMENU hSysMenu = GetSystemMenu( hwndDlg, FALSE );
+ bool bUseSyntaxHL = (GetMenuState( hSysMenu , ID_FV_SYNTAX_HL, MF_BYCOMMAND) & MF_CHECKED)!=0;
/*
- DWORD dwSize = GetFileSize( hFile , NULL );
+ DWORD dwSize = GetFileSize( hFile, NULL );
dwCurPos = 0;
pabFileData = new BYTE[ dwSize ];
- ReadFile( hFile , pabFileData, dwSize , &dwDataRead, (LPOVERLAPPED)NULL);
+ ReadFile( hFile, pabFileData, dwSize , &dwDataRead, (LPOVERLAPPED)NULL);
*/
- // SendMessage( hRichEdit , EM_SETBKGNDCOLOR, 0 , RGB( 0 , 0 , 128 ) );
- // SendMessage( hRichEdit , EM_SETTEXTMODE, TM_RICHTEXT ,0);
+ // SendMessage( hRichEdit, EM_SETBKGNDCOLOR, 0, RGB( 0, 0, 128));
+ // SendMessage( hRichEdit, EM_SETTEXTMODE, TM_RICHTEXT,0);
- // DWORD dw = SendMessage( hRichEdit , EM_GETLIMITTEXT, NULL, NULL);
+ // DWORD dw = SendMessage( hRichEdit, EM_GETLIMITTEXT, NULL, NULL);
EDITSTREAM eds;
eds.dwError = 0;
- if( bUseSyntaxHL )
+ if (bUseSyntaxHL )
{
- SendMessage( hRichEdit , // handle to destination window
+ SendMessage( hRichEdit, // handle to destination window
EM_EXLIMITTEXT, // message to send
0, // not used; must be zero
0x7FFFFFFF );
@@ -728,7 +728,7 @@ bool bLoadFile( HWND hwndDlg , CLHistoryDlg * pclDlg )
eds.dwCookie = (DWORD)&clInfo;
eds.pfnCallback = RichEditRTFStreamLoadFile;
- SendMessage(hRichEdit, EM_STREAMIN, (WPARAM)SF_RTF , (LPARAM)&eds);
+ SendMessage(hRichEdit, EM_STREAMIN, (WPARAM)SF_RTF, (LPARAM)&eds);
pclDlg->bUtf8File = clInfo.bUtf8File;
}
else
@@ -736,14 +736,14 @@ bool bLoadFile( HWND hwndDlg , CLHistoryDlg * pclDlg )
eds.dwCookie = (DWORD )hFile;
eds.pfnCallback = RichEditStreamLoadFile;
- SendMessage(hRichEdit, EM_STREAMIN, (WPARAM)SF_TEXT , (LPARAM)&eds);
+ SendMessage(hRichEdit, EM_STREAMIN, (WPARAM)SF_TEXT, (LPARAM)&eds);
}
CloseHandle( hFile );
//delete [] pabFileData;
- _TCHAR szTmp[100];
- mir_sntprintf( szTmp , 99, _T("File open time %d\n") , GetTickCount() - dwStart );
+ TCHAR szTmp[100];
+ mir_sntprintf( szTmp, 99, _T("File open time %d\n"), GetTickCount() - dwStart );
OutputDebugString( szTmp );
@@ -751,13 +751,13 @@ bool bLoadFile( HWND hwndDlg , CLHistoryDlg * pclDlg )
sData.flags = GTL_NUMCHARS;
sData.flags = GTL_DEFAULT;
- DWORD dwDataRead = (DWORD)SendMessage( hRichEdit , EM_GETTEXTLENGTHEX, (WPARAM)&sData , 0 );
- SendMessage( hRichEdit , EM_SETSEL , dwDataRead - 1, dwDataRead - 1 );
+ DWORD dwDataRead = (DWORD)SendMessage( hRichEdit, EM_GETTEXTLENGTHEX, (WPARAM)&sData, 0 );
+ SendMessage( hRichEdit, EM_SETSEL, dwDataRead - 1, dwDataRead - 1 );
- if( ! bScrollToBottom )
- SendMessage( hRichEdit , EM_SETSCROLLPOS , 0 , (LPARAM) &ptOldPos );
+ if ( !bScrollToBottom )
+ SendMessage( hRichEdit, EM_SETSCROLLPOS, 0, (LPARAM) &ptOldPos );
- mir_sntprintf( szTmp , 99, LPGENT("With scroll to bottom %d\n") , GetTickCount() - dwStart );
+ mir_sntprintf( szTmp, 99, LPGENT("With scroll to bottom %d\n"), GetTickCount() - dwStart );
OutputDebugString( szTmp );
return true;
@@ -772,38 +772,38 @@ bool bLoadFile( HWND hwndDlg , CLHistoryDlg * pclDlg )
//
// References : -
// Remarks : -
-// Created : 030730 , 30 juli 2003
+// Created : 030730, 30 juli 2003
// Developer : KN
/////////////////////////////////////////////////////////////////////
bool bAdvancedCopy(HWND hwnd)
{
CHARRANGE sSelectRange;
- SendMessage( hwnd, EM_EXGETSEL, 0 , (LPARAM)&sSelectRange );
+ SendMessage( hwnd, EM_EXGETSEL, 0, (LPARAM)&sSelectRange );
int nSelLenght = sSelectRange.cpMax - sSelectRange.cpMin + 1; // +1 for null termination
- if( nSelLenght > 1 )
+ if (nSelLenght > 1 )
{
OpenClipboard(NULL);
EmptyClipboard();
- _TCHAR * pszSrcBuf = new _TCHAR[ nSelLenght];
+ TCHAR *pszSrcBuf = new TCHAR[ nSelLenght];
pszSrcBuf[0] = 0;
- SendMessage( hwnd, EM_GETSELTEXT, 0 , (LPARAM)pszSrcBuf );
+ SendMessage( hwnd, EM_GETSELTEXT, 0, (LPARAM)pszSrcBuf );
HANDLE hDecMem = GlobalAlloc(GMEM_MOVEABLE|GMEM_DDESHARE, nSelLenght );
- _TCHAR * pszCurDec = (_TCHAR*)GlobalLock(hDecMem);
+ TCHAR *pszCurDec = (TCHAR*)GlobalLock(hDecMem);
bool bInSpaces = false;
- for( _TCHAR * pszCur = pszSrcBuf ; pszCur[0] ; pszCur++ )
+ for( TCHAR *pszCur = pszSrcBuf ; pszCur[0] ; pszCur++ )
{
- if( bInSpaces )
+ if (bInSpaces )
{
- if( pszCur[0] == ' ' )
+ if (pszCur[0] == ' ' )
continue;
bInSpaces = false;
}
- if( pszCur[0] == '\n' )
+ if (pszCur[0] == '\n' )
{
bInSpaces = true;
}
@@ -833,7 +833,7 @@ bool bAdvancedCopy(HWND hwnd)
//
// References : -
// Remarks : -
-// Created : 021013 , 13 October 2002
+// Created : 021013, 13 October 2002
// Developer : KN
/////////////////////////////////////////////////////////////////////
@@ -844,8 +844,8 @@ LRESULT CALLBACK EditSubclassProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
{
case WM_CONTEXTMENU:
{
- HMENU nMenu = LoadMenu( hInstance, MAKEINTRESOURCE( IDR_FV_EDIT ) );
- HMENU nSubMenu = GetSubMenu( nMenu , 0 );
+ HMENU nMenu = LoadMenu( hInstance, MAKEINTRESOURCE( IDR_FV_EDIT));
+ HMENU nSubMenu = GetSubMenu( nMenu, 0 );
POINT pt;
pt.x=(short)LOWORD(lParam);
pt.y=(short)HIWORD(lParam);
@@ -853,11 +853,11 @@ LRESULT CALLBACK EditSubclassProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
if(pt.x==-1 && pt.y==-1)
{
DWORD dwStart,dwEnd;
- SendMessage( hwnd , EM_GETSEL , (WPARAM)&dwStart, (LPARAM)&dwEnd );
- SendMessage( hwnd , EM_POSFROMCHAR, (WPARAM)&pt, (LPARAM)dwEnd);
- ClientToScreen( hwnd , &pt );
+ SendMessage( hwnd, EM_GETSEL, (WPARAM)&dwStart, (LPARAM)&dwEnd );
+ SendMessage( hwnd, EM_POSFROMCHAR, (WPARAM)&pt, (LPARAM)dwEnd);
+ ClientToScreen( hwnd, &pt );
}
- TrackPopupMenu( nSubMenu , TPM_RIGHTBUTTON , pt.x , pt.y , 0 , hwnd , 0 );
+ TrackPopupMenu( nSubMenu, TPM_RIGHTBUTTON, pt.x, pt.y, 0, hwnd, 0 );
DestroyMenu( nSubMenu );
DestroyMenu( nMenu );
@@ -869,15 +869,15 @@ LRESULT CALLBACK EditSubclassProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
}
case WM_COPY:
{ // not working for "CTRL + C"
- if( bAdvancedCopy( hwnd ) )
+ if (bAdvancedCopy( hwnd))
return TRUE;
break;
}
case WM_KEYDOWN:
{
- if( (wParam == VK_INSERT || wParam == 'C') && (GetKeyState(VK_CONTROL) & 0x80) )
+ if ((wParam == VK_INSERT || wParam == 'C') && (GetKeyState(VK_CONTROL) & 0x80))
{
- if( bAdvancedCopy( hwnd ) )
+ if (bAdvancedCopy( hwnd))
return TRUE;
}
break;
@@ -888,22 +888,22 @@ LRESULT CALLBACK EditSubclassProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
{
case ID_EDIT_COPY:
{
- SendMessage( hwnd , WM_COPY, 0, 0 );
+ SendMessage( hwnd, WM_COPY, 0, 0 );
return TRUE;
}
}
}
}
- if( msg == UM_FIND_CMD )
+ if (msg == UM_FIND_CMD )
{
FINDREPLACE *fr = (FINDREPLACE *)lParam;
- if( fr->Flags & FR_DIALOGTERM )
+ if (fr->Flags & FR_DIALOGTERM )
{
pclDlg->hFindDlg = NULL;
return 0;
}
- if( fr->Flags & FR_FINDNEXT)
+ if (fr->Flags & FR_FINDNEXT)
{
FINDTEXT ft = { 0 };
ft.lpstrText = fr->lpstrFindWhat;
@@ -917,13 +917,13 @@ LRESULT CALLBACK EditSubclassProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
res = (int)SendMessage(hwnd, EM_FINDTEXTW, (WPARAM)fr->Flags,(LPARAM)&ft);
if(res == -1)
{
- MessageBox( hwnd , TranslateT("Search string was not found !"), MSG_BOX_TITEL, MB_OK );
+ MessageBox( hwnd, TranslateT("Search string was not found !"), MSG_BOX_TITEL, MB_OK );
return 0;
}
}
ft.chrg.cpMin = LONG(res);
ft.chrg.cpMax = LONG(res + _tcslen(fr->lpstrFindWhat));
- SendMessage(hwnd , EM_EXSETSEL, 0, (LPARAM)&ft.chrg);
+ SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)&ft.chrg);
return 0;
}
}
@@ -939,27 +939,27 @@ LRESULT CALLBACK EditSubclassProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
//
// References : -
// Remarks : -
-// Created : 021001 , 01 October 2002
+// Created : 021001, 01 October 2002
// Developer : KN
/////////////////////////////////////////////////////////////////////
void SetWindowsCtrls( HWND hwndDlg )
{
RECT rNewSize;
- GetClientRect( hwndDlg , &rNewSize );
+ GetClientRect( hwndDlg, &rNewSize );
RECT rCurSize;
const int nSpacing = 12;
- HWND hButton = GetDlgItem( hwndDlg , IDOK );
- GetWindowRect( hButton , &rCurSize );
+ HWND hButton = GetDlgItem( hwndDlg, IDOK );
+ GetWindowRect( hButton, &rCurSize );
int nButtonHeight = rCurSize.bottom - rCurSize.top;
- SetWindowPos( GetDlgItem( hwndDlg , IDC_RICHEDIT ) , 0 ,
- nSpacing , nSpacing ,
- rNewSize.right - (nSpacing * 2) ,
+ SetWindowPos( GetDlgItem( hwndDlg, IDC_RICHEDIT ), 0,
+ nSpacing, nSpacing,
+ rNewSize.right - (nSpacing * 2),
rNewSize.bottom - ( nSpacing * 3 + nButtonHeight ),
SWP_NOZORDER );
@@ -969,18 +969,18 @@ void SetWindowsCtrls( HWND hwndDlg )
int nButtonTop = rNewSize.bottom - ( nSpacing + nButtonHeight );
int nCurLeft = nButtonSpace;
- SetWindowPos( GetDlgItem( hwndDlg , IDC_FV_FIND ) , 0 ,
- nCurLeft , nButtonTop , 0 , 0 , SWP_NOZORDER | SWP_NOSIZE );
+ SetWindowPos( GetDlgItem( hwndDlg, IDC_FV_FIND ), 0,
+ nCurLeft, nButtonTop, 0, 0, SWP_NOZORDER | SWP_NOSIZE );
nCurLeft += nButtonSpace + nButtonWidth;
- SetWindowPos( GetDlgItem( hwndDlg , IDC_FV_EXTERNAL ) , 0 ,
- nCurLeft , nButtonTop , 0 , 0 , SWP_NOZORDER | SWP_NOSIZE );
+ SetWindowPos( GetDlgItem( hwndDlg, IDC_FV_EXTERNAL ), 0,
+ nCurLeft, nButtonTop, 0, 0, SWP_NOZORDER | SWP_NOSIZE );
nCurLeft += nButtonSpace + nButtonWidth;
- SetWindowPos( hButton , 0 ,
- nCurLeft , nButtonTop , 0 , 0 , SWP_NOZORDER | SWP_NOSIZE );
+ SetWindowPos( hButton, 0,
+ nCurLeft, nButtonTop, 0, 0, SWP_NOZORDER | SWP_NOSIZE );
}
@@ -995,7 +995,7 @@ void SetWindowsCtrls( HWND hwndDlg )
//
// References : -
// Remarks : -
-// Created : 030205 , 05 February 2003
+// Created : 030205, 05 February 2003
// Developer : KN
/////////////////////////////////////////////////////////////////////
@@ -1004,14 +1004,14 @@ void SetRichEditFont(HWND hRichEdit, bool bUseSyntaxHL )
CHARFORMAT ncf = { 0 };
ncf.cbSize = sizeof( CHARFORMAT );
ncf.dwMask = CFM_BOLD | CFM_FACE | CFM_ITALIC | CFM_SIZE | CFM_UNDERLINE;
- ncf.dwEffects = db_get_dw( NULL , MODULE , szFileViewDB "TEffects" , 0 );
- ncf.yHeight = db_get_dw( NULL , MODULE , szFileViewDB "THeight" , 165 );
- _tcscpy( ncf.szFaceName , _DBGetString( NULL , MODULE , szFileViewDB "TFace" , _T("Courier New")).c_str() );
+ ncf.dwEffects = db_get_dw( NULL, MODULE, szFileViewDB "TEffects", 0 );
+ ncf.yHeight = db_get_dw( NULL, MODULE, szFileViewDB "THeight", 165 );
+ _tcscpy( ncf.szFaceName , _DBGetString( NULL, MODULE, szFileViewDB "TFace", _T("Courier New")).c_str());
- if( ! bUseSyntaxHL )
+ if ( !bUseSyntaxHL )
{
ncf.dwMask |= CFM_COLOR;
- ncf.crTextColor = db_get_dw( NULL , MODULE , szFileViewDB "TColor" , 0 );
+ ncf.crTextColor = db_get_dw( NULL, MODULE, szFileViewDB "TColor", 0 );
}
SendMessage(hRichEdit, EM_SETCHARFORMAT, (WPARAM)SCF_ALL, (LPARAM)&ncf);
@@ -1029,7 +1029,7 @@ void SetRichEditFont(HWND hRichEdit, bool bUseSyntaxHL )
//
// References : -
// Remarks : -
-// Created : 020929 , 29 September 2002
+// Created : 020929, 29 September 2002
// Developer : KN
/////////////////////////////////////////////////////////////////////
@@ -1045,34 +1045,34 @@ static INT_PTR CALLBACK DlgProcFileViewer(HWND hwndDlg, UINT msg, WPARAM wParam,
SendMessage(hwndDlg, WM_SETICON, ICON_BIG,
(LPARAM)LoadIcon( hInstance, MAKEINTRESOURCE(IDI_EXPORT_MESSAGE)));
- HWND hRichEdit = GetDlgItem( hwndDlg , IDC_RICHEDIT );
+ HWND hRichEdit = GetDlgItem( hwndDlg, IDC_RICHEDIT );
mir_subclassWindow(hRichEdit, EditSubclassProc);
SetWindowLongPtr( hRichEdit, GWLP_USERDATA, (LONG) pclDlg );
- SendMessage( hRichEdit , EM_SETEVENTMASK , 0 , ENM_LINK);
- SendMessage( hRichEdit , EM_AUTOURLDETECT , TRUE , 0 );
+ SendMessage( hRichEdit, EM_SETEVENTMASK , 0 , ENM_LINK);
+ SendMessage( hRichEdit, EM_AUTOURLDETECT, TRUE, 0 );
- HMENU hSysMenu = GetSystemMenu( hwndDlg , FALSE );
+ HMENU hSysMenu = GetSystemMenu( hwndDlg, FALSE );
- InsertMenu( hSysMenu , 0 , MF_SEPARATOR | MF_BYPOSITION , 0 , 0 );
- InsertMenu( hSysMenu , 0 , MF_STRING | MF_BYPOSITION , ID_FV_SAVE_AS_RTF, LPGENT("Save as RTF") );
+ InsertMenu( hSysMenu, 0, MF_SEPARATOR | MF_BYPOSITION, 0, 0 );
+ InsertMenu( hSysMenu, 0, MF_STRING | MF_BYPOSITION, ID_FV_SAVE_AS_RTF, LPGENT("Save as RTF"));
- InsertMenu( hSysMenu , 0 , MF_SEPARATOR | MF_BYPOSITION , 0 , 0 );
+ InsertMenu( hSysMenu, 0, MF_SEPARATOR | MF_BYPOSITION, 0, 0 );
- BYTE bUseCC = (BYTE)db_get_b( NULL , MODULE , szFileViewDB "UseCC" , 0 );
- InsertMenu( hSysMenu , 0 , MF_STRING | MF_BYPOSITION | ( bUseCC ? MF_CHECKED : 0 ) , ID_FV_COLOR, LPGENT("Color...") );
+ BYTE bUseCC = (BYTE)db_get_b( NULL, MODULE, szFileViewDB "UseCC", 0 );
+ InsertMenu( hSysMenu, 0, MF_STRING | MF_BYPOSITION | ( bUseCC ? MF_CHECKED : 0 ), ID_FV_COLOR, LPGENT("Color..."));
- if( bUseCC )
- SendMessage( hRichEdit , EM_SETBKGNDCOLOR, 0,
- db_get_dw( NULL , MODULE , szFileViewDB "CustomC" , RGB(255,255,255)));
+ if (bUseCC )
+ SendMessage( hRichEdit, EM_SETBKGNDCOLOR, 0,
+ db_get_dw( NULL, MODULE, szFileViewDB "CustomC", RGB(255,255,255)));
- InsertMenu( hSysMenu , 0 , MF_STRING | MF_BYPOSITION , ID_FV_FONT, LPGENT("Font...") );
+ InsertMenu( hSysMenu, 0, MF_STRING | MF_BYPOSITION, ID_FV_FONT, LPGENT("Font..."));
- bool bUseSyntaxHL = db_get_b( NULL , MODULE , szFileViewDB "UseSyntaxHL" , 1 )!=0;
- InsertMenu( hSysMenu , 0 , MF_STRING | MF_BYPOSITION | ( bUseSyntaxHL ? MF_CHECKED : 0 ) , ID_FV_SYNTAX_HL, LPGENT("Syntax highlight") );
+ bool bUseSyntaxHL = db_get_b( NULL, MODULE, szFileViewDB "UseSyntaxHL", 1 )!=0;
+ InsertMenu( hSysMenu, 0, MF_STRING | MF_BYPOSITION | ( bUseSyntaxHL ? MF_CHECKED : 0 ), ID_FV_SYNTAX_HL, LPGENT("Syntax highlight"));
- SetRichEditFont( hRichEdit , bUseSyntaxHL );
+ SetRichEditFont( hRichEdit, bUseSyntaxHL );
TranslateDialogDefault(hwndDlg);
@@ -1083,21 +1083,21 @@ static INT_PTR CALLBACK DlgProcFileViewer(HWND hwndDlg, UINT msg, WPARAM wParam,
SetWindowsCtrls( hwndDlg );
- bLoadFile(hwndDlg , pclDlg );
+ bLoadFile(hwndDlg, pclDlg );
{ // set Title
- _TCHAR szFormat[200];
- _TCHAR szTitle[200];
- if( GetWindowText( hwndDlg , szFormat , sizeof( szFormat ) ) )
+ TCHAR szFormat[200];
+ TCHAR szTitle[200];
+ if (GetWindowText( hwndDlg, szFormat, sizeof( szFormat)) )
{
- const _TCHAR * pszNick = NickFromHandle( pclDlg->hContact );
+ const TCHAR *pszNick = NickFromHandle( pclDlg->hContact );
tstring sPath = pclDlg->sPath;
string::size_type n = sPath.find_last_of( '\\' );
- if( n != sPath.npos )
- sPath.erase( 0 , n + 1 );
+ if (n != sPath.npos )
+ sPath.erase( 0, n + 1 );
- if( _sntprintf( szTitle , sizeof( szTitle ) , szFormat , pszNick , sPath.c_str() , (pclDlg->bUtf8File ? _T("UTF8"):_T("ANSI")) ) > 0 )
- SetWindowText( hwndDlg , szTitle);
+ if (_sntprintf( szTitle, sizeof( szTitle ), szFormat, pszNick, sPath.c_str(), (pclDlg->bUtf8File ? _T("UTF8"):_T("ANSI"))) > 0 )
+ SetWindowText( hwndDlg, szTitle);
}
}
@@ -1107,7 +1107,7 @@ static INT_PTR CALLBACK DlgProcFileViewer(HWND hwndDlg, UINT msg, WPARAM wParam,
return TRUE;
case WM_RELOAD_FILE:
- bLoadFile(hwndDlg , pclDlg );
+ bLoadFile(hwndDlg, pclDlg );
return TRUE;
case WM_SIZE:
@@ -1131,60 +1131,60 @@ static INT_PTR CALLBACK DlgProcFileViewer(HWND hwndDlg, UINT msg, WPARAM wParam,
case WM_SYSCOMMAND:
{
- HMENU hSysMenu = GetSystemMenu( hwndDlg , FALSE );
- bool bUseSyntaxHL = (GetMenuState( hSysMenu , ID_FV_SYNTAX_HL , MF_BYCOMMAND ) & MF_CHECKED)!=0;
- HWND hRichEdit = GetDlgItem( hwndDlg , IDC_RICHEDIT );
+ HMENU hSysMenu = GetSystemMenu( hwndDlg, FALSE );
+ bool bUseSyntaxHL = (GetMenuState( hSysMenu , ID_FV_SYNTAX_HL, MF_BYCOMMAND) & MF_CHECKED)!=0;
+ HWND hRichEdit = GetDlgItem( hwndDlg, IDC_RICHEDIT );
if ((wParam & 0xFFF0) == ID_FV_FONT)
{
LOGFONT lf = { 0 };
lf.lfHeight = 14L;
- { DWORD dwEffects = db_get_dw( NULL , MODULE , szFileViewDB "TEffects" , 0 );
+ { DWORD dwEffects = db_get_dw( NULL, MODULE, szFileViewDB "TEffects", 0 );
lf.lfWeight = (dwEffects & CFE_BOLD) ? FW_BOLD : 0;
lf.lfUnderline = (dwEffects & CFE_UNDERLINE) != 0;
lf.lfStrikeOut = (dwEffects & CFE_STRIKEOUT) != 0;
lf.lfItalic = (dwEffects & CFE_ITALIC) != 0;
}
- _tcscpy(lf.lfFaceName, _DBGetString( NULL , MODULE , szFileViewDB "TFace" , _T("Courier New")).c_str());
+ _tcscpy(lf.lfFaceName, _DBGetString( NULL, MODULE, szFileViewDB "TFace", _T("Courier New")).c_str());
CHOOSEFONT cf = { 0 };
cf.lStructSize = sizeof( cf );
cf.hwndOwner = hwndDlg;
cf.lpLogFont = &lf;
- cf.rgbColors = db_get_dw( NULL , MODULE , szFileViewDB "TColor" , 0 );
+ cf.rgbColors = db_get_dw( NULL, MODULE, szFileViewDB "TColor", 0 );
cf.Flags = CF_EFFECTS | CF_SCREENFONTS | CF_INITTOLOGFONTSTRUCT;
- if( ChooseFont( &cf ) )
+ if (ChooseFont( &cf))
{
DWORD dwEffects = (lf.lfWeight == FW_BOLD ? CFE_BOLD : 0) |
(lf.lfItalic ? CFE_ITALIC : 0) |
(lf.lfStrikeOut ? CFE_STRIKEOUT : 0) |
(lf.lfUnderline ? CFE_UNDERLINE : 0);
- db_set_dw( NULL , MODULE , szFileViewDB "TEffects" , dwEffects );
- db_set_dw( NULL , MODULE , szFileViewDB "THeight" , cf.iPointSize * 2 );
- db_set_dw( NULL , MODULE , szFileViewDB "TColor" , cf.rgbColors );
- db_set_ts( NULL , MODULE , szFileViewDB "TFace" , lf.lfFaceName );
- SetRichEditFont( hRichEdit , bUseSyntaxHL );
+ db_set_dw( NULL, MODULE, szFileViewDB "TEffects", dwEffects );
+ db_set_dw( NULL, MODULE, szFileViewDB "THeight", cf.iPointSize * 2 );
+ db_set_dw( NULL, MODULE, szFileViewDB "TColor", cf.rgbColors );
+ db_set_ts( NULL, MODULE, szFileViewDB "TFace", lf.lfFaceName );
+ SetRichEditFont( hRichEdit, bUseSyntaxHL );
}
return TRUE;
}
else if ((wParam & 0xFFF0) == ID_FV_COLOR)
{
- BYTE bUseCC = ! db_get_b( NULL , MODULE , szFileViewDB "UseCC" , 0 );
- if( bUseCC )
+ BYTE bUseCC = ! db_get_b( NULL, MODULE, szFileViewDB "UseCC", 0 );
+ if (bUseCC )
{
CHOOSECOLOR cc = {0};
cc.lStructSize = sizeof( cc );
cc.hwndOwner = hwndDlg;
- cc.rgbResult = db_get_dw( NULL , MODULE , szFileViewDB "CustomC" , RGB(255,255,255) );
+ cc.rgbResult = db_get_dw( NULL, MODULE, szFileViewDB "CustomC", RGB(255,255,255));
cc.Flags = CC_ANYCOLOR | CC_FULLOPEN | CC_RGBINIT;
static COLORREF MyCustColors[16] = { 0xFFFFFFFF };
cc.lpCustColors = MyCustColors;
- if( ChooseColor( &cc ) )
+ if (ChooseColor( &cc))
{
- SendMessage( hRichEdit , EM_SETBKGNDCOLOR, 0 , cc.rgbResult );
- db_set_dw( NULL , MODULE , szFileViewDB "CustomC" , cc.rgbResult );
+ SendMessage( hRichEdit, EM_SETBKGNDCOLOR, 0, cc.rgbResult );
+ db_set_dw( NULL, MODULE, szFileViewDB "CustomC", cc.rgbResult );
}
else
{
@@ -1194,10 +1194,10 @@ static INT_PTR CALLBACK DlgProcFileViewer(HWND hwndDlg, UINT msg, WPARAM wParam,
}
else
{
- SendMessage( hRichEdit , EM_SETBKGNDCOLOR, TRUE , 0 );
+ SendMessage( hRichEdit, EM_SETBKGNDCOLOR, TRUE, 0 );
}
- CheckMenuItem( hSysMenu , ID_FV_COLOR , MF_BYCOMMAND | (bUseCC ? MF_CHECKED : 0) );
- db_set_b( NULL , MODULE , szFileViewDB "UseCC" , bUseCC );
+ CheckMenuItem( hSysMenu, ID_FV_COLOR, MF_BYCOMMAND | (bUseCC ? MF_CHECKED : 0));
+ db_set_b( NULL, MODULE, szFileViewDB "UseCC", bUseCC );
return TRUE;
}
else if ((wParam & 0xFFF0) == ID_FV_SYNTAX_HL)
@@ -1208,13 +1208,13 @@ static INT_PTR CALLBACK DlgProcFileViewer(HWND hwndDlg, UINT msg, WPARAM wParam,
// so user may open 2 windows, now he can set SyntaxHL in both.
bUseSyntaxHL = !bUseSyntaxHL;
- CheckMenuItem( hSysMenu , ID_FV_SYNTAX_HL , MF_BYCOMMAND | (bUseSyntaxHL ? MF_CHECKED : 0) );
- db_set_b( NULL , MODULE , szFileViewDB "UseSyntaxHL" , bUseSyntaxHL );
+ CheckMenuItem( hSysMenu, ID_FV_SYNTAX_HL, MF_BYCOMMAND | (bUseSyntaxHL ? MF_CHECKED : 0));
+ db_set_b( NULL, MODULE, szFileViewDB "UseSyntaxHL", bUseSyntaxHL );
- if( bUseSyntaxHL )
- bLoadFile(hwndDlg , pclDlg );
+ if (bUseSyntaxHL )
+ bLoadFile(hwndDlg, pclDlg );
else
- SetRichEditFont( hRichEdit , bUseSyntaxHL );
+ SetRichEditFont( hRichEdit, bUseSyntaxHL );
return TRUE;
}
@@ -1222,12 +1222,12 @@ static INT_PTR CALLBACK DlgProcFileViewer(HWND hwndDlg, UINT msg, WPARAM wParam,
{
tstring sFile = pclDlg->sPath;
sFile += _T(".rtf");
- HANDLE hFile = CreateFile( sFile.c_str() , GENERIC_WRITE ,
- FILE_SHARE_READ , NULL , CREATE_ALWAYS , FILE_ATTRIBUTE_NORMAL , NULL );
+ HANDLE hFile = CreateFile( sFile.c_str(), GENERIC_WRITE,
+ FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL );
- if( hFile == INVALID_HANDLE_VALUE )
+ if (hFile == INVALID_HANDLE_VALUE )
{
- DisplayLastError( LPGENT("Failed to create file") );
+ DisplayLastError( LPGENT("Failed to create file"));
return TRUE;
}
@@ -1235,17 +1235,17 @@ static INT_PTR CALLBACK DlgProcFileViewer(HWND hwndDlg, UINT msg, WPARAM wParam,
eds.dwCookie = (DWORD )hFile;
eds.dwError = 0;
eds.pfnCallback = RichEditStreamSaveFile;
- LRESULT nWriteOk = SendMessage(hRichEdit, EM_STREAMOUT, (WPARAM)SF_RTF , (LPARAM)&eds);
- if( nWriteOk <= 0 || eds.dwError != 0 )
+ LRESULT nWriteOk = SendMessage(hRichEdit, EM_STREAMOUT, (WPARAM)SF_RTF, (LPARAM)&eds);
+ if (nWriteOk <= 0 || eds.dwError != 0 )
{
- DisplayLastError( TranslateT("Failed to save file") );
+ DisplayLastError( TranslateT("Failed to save file"));
CloseHandle( hFile );
return TRUE;
}
CloseHandle( hFile );
tstring sReport = TranslateT("History was saved successfully in file\r\n");
sReport += sFile;
- MessageBox( NULL , sReport.c_str() ,MSG_BOX_TITEL ,MB_OK );
+ MessageBox( NULL, sReport.c_str(),MSG_BOX_TITEL,MB_OK );
return TRUE;
}
return FALSE;
@@ -1262,12 +1262,12 @@ static INT_PTR CALLBACK DlgProcFileViewer(HWND hwndDlg, UINT msg, WPARAM wParam,
return TRUE;
case IDC_FV_FIND:
{
- if( pclDlg->hFindDlg )
+ if (pclDlg->hFindDlg )
{
BringWindowToTop( pclDlg->hFindDlg );
return TRUE;
}
- pclDlg->fr.hwndOwner = GetDlgItem( hwndDlg , IDC_RICHEDIT );
+ pclDlg->fr.hwndOwner = GetDlgItem( hwndDlg, IDC_RICHEDIT );
pclDlg->hFindDlg = FindText( &pclDlg->fr );
return TRUE;
}
@@ -1275,21 +1275,21 @@ static INT_PTR CALLBACK DlgProcFileViewer(HWND hwndDlg, UINT msg, WPARAM wParam,
break;
case WM_NOTIFY:
- if( ((NMHDR*)lParam)->idFrom == IDC_RICHEDIT )
+ if (((NMHDR*)lParam)->idFrom == IDC_RICHEDIT )
{
- if( ((NMHDR*)lParam)->code == EN_LINK )
+ if (((NMHDR*)lParam)->code == EN_LINK )
{
ENLINK* pstLink = (ENLINK*)lParam;
- if( pstLink->msg == WM_LBUTTONUP )
+ if (pstLink->msg == WM_LBUTTONUP )
{
- _TCHAR szUrl[ 500 ];
- if( (pstLink->chrg.cpMax - pstLink->chrg.cpMin) > (sizeof( szUrl ) - 2) )
+ TCHAR szUrl[ 500 ];
+ if ((pstLink->chrg.cpMax - pstLink->chrg.cpMin) > (sizeof( szUrl) - 2))
return FALSE;
TEXTRANGE stToGet;
stToGet.chrg = pstLink->chrg;
stToGet.lpstrText = szUrl;
- if( SendMessage( pstLink->nmhdr.hwndFrom , EM_GETTEXTRANGE , 0 , (LPARAM)&stToGet ) > 0 )
+ if (SendMessage( pstLink->nmhdr.hwndFrom, EM_GETTEXTRANGE, 0, (LPARAM)&stToGet) > 0 )
{
CallService(MS_UTILS_OPENURL,1,(LPARAM)szUrl);
}
@@ -1315,7 +1315,7 @@ static INT_PTR CALLBACK DlgProcFileViewer(HWND hwndDlg, UINT msg, WPARAM wParam,
//
// References : -
// Remarks : -
-// Created : 020929 , 29 September 2002
+// Created : 020929, 29 September 2002
// Developer : KN
/////////////////////////////////////////////////////////////////////
@@ -1331,16 +1331,16 @@ bool bShowFileViewer( HANDLE hContact )
CLHistoryDlg * pcl = new CLHistoryDlg( hContact );
pcl->hWnd = CreateDialogParam( hInstance,MAKEINTRESOURCE(IDD_FILE_VIEWER),NULL,DlgProcFileViewer,(LPARAM)pcl);
- if( pcl->hWnd )
+ if (pcl->hWnd )
{
EnterCriticalSection( &csHistoryList );
clHistoryDlgList.push_front( pcl );
LeaveCriticalSection( &csHistoryList );
- ShowWindow( pcl->hWnd , SW_SHOWNORMAL );
+ ShowWindow( pcl->hWnd, SW_SHOWNORMAL );
return true;
}
- DisplayLastError( LPGENT("Failed to create history dialog") );
+ DisplayLastError( LPGENT("Failed to create history dialog"));
delete pcl;
return false;
}
diff --git a/plugins/Msg_Export/src/FileViewer.h b/plugins/Msg_Export/src/FileViewer.h
index 0315201010..d857f060ba 100755
--- a/plugins/Msg_Export/src/FileViewer.h
+++ b/plugins/Msg_Export/src/FileViewer.h
@@ -22,7 +22,7 @@
void Initialize();
void Uninitilize();
-void UpdateFileViews( const _TCHAR * pszFile );
+void UpdateFileViews( const TCHAR *pszFile );
bool bOpenExternaly( HANDLE hContact );
bool bShowFileViewer( HANDLE hContact );
diff --git a/plugins/Msg_Export/src/main.cpp b/plugins/Msg_Export/src/main.cpp
index 83ac2b70ff..bcb4c39430 100755
--- a/plugins/Msg_Export/src/main.cpp
+++ b/plugins/Msg_Export/src/main.cpp
@@ -54,7 +54,7 @@ PLUGININFOEX pluginInfo = {
//
// References : -
// Remarks : -
-// Created : 020422 , 22 April 2002
+// Created : 020422, 22 April 2002
// Developer : KN
/////////////////////////////////////////////////////////////////////
@@ -79,7 +79,7 @@ static INT_PTR ShowExportHistory(WPARAM wParam, LPARAM /*lParam*/)
//
// References : -
// Remarks : -
-// Created : 020428 , 28 April 2002
+// Created : 020428, 28 April 2002
// Developer : KN
/////////////////////////////////////////////////////////////////////
@@ -99,7 +99,7 @@ int nSystemShutdown(WPARAM /*wparam*/, LPARAM /*lparam*/)
//
// References : -
// Remarks : -
-// Created : 020422 , 22 April 2002
+// Created : 020422, 22 April 2002
// Developer : KN
/////////////////////////////////////////////////////////////////////
@@ -146,7 +146,7 @@ int MainInit(WPARAM /*wparam*/, LPARAM /*lparam*/)
//
// References : -
// Remarks : -
-// Created : 020422 , 22 April 2002
+// Created : 020422, 22 April 2002
// Developer : KN
/////////////////////////////////////////////////////////////////////
@@ -166,7 +166,7 @@ BOOL WINAPI DllMain(HINSTANCE hinst, DWORD /*fdwReason*/, LPVOID /*lpvReserved*/
//
// References : -
// Remarks : -
-// Created : 020422 , 22 April 2002
+// Created : 020422, 22 April 2002
// Developer : KN
/////////////////////////////////////////////////////////////////////
@@ -184,7 +184,7 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
//
// References : -
// Remarks : -
-// Created : 020422 , 22 April 2002
+// Created : 020422, 22 April 2002
// Developer : KN
/////////////////////////////////////////////////////////////////////
@@ -236,7 +236,7 @@ extern "C" __declspec(dllexport) int Load()
//
// References : -
// Remarks : -
-// Created : 020422 , 22 April 2002
+// Created : 020422, 22 April 2002
// Developer : KN
/////////////////////////////////////////////////////////////////////
diff --git a/plugins/Msg_Export/src/options.cpp b/plugins/Msg_Export/src/options.cpp
index 55dcb0498a..4dcc59c5e2 100755
--- a/plugins/Msg_Export/src/options.cpp
+++ b/plugins/Msg_Export/src/options.cpp
@@ -22,27 +22,6 @@
#define EVAL_STRINGIZE(x) STRINGIZE(x)
#define __LOC__ __FILE__ "("EVAL_STRINGIZE(__LINE__)") : "
-
-#pragma message ( __LOC__ "My warning: STD list contains a bug when sorting lists of more than 32,768 elements, you need to fix this")
-/* Change code for VC 6.0
- if (_I == _MAXN)
- _A[_I].merge(_X);
- SHOULD BE
- if (_I == _MAXN)
- _A[_I - 1].merge(_X);
-
- - And -
-
- if (_I == _MAXN)
- _A[_I].merge(_X, _Pr);
- SHOULD BE
- if (_I == _MAXN)
- _A[_I - 1].merge(_X, _Pr);
-
-You need to change this in the file <list> function sort() and sort(_Pr3 _Pr)
-*/
-
-
// width in pixels of the UIN column in the List Ctrl
const int nUINColWitdh = 80;
// width in pixels of the UIN column in the List Ctrl
@@ -61,7 +40,7 @@ BOOL bUnaplyedChanges = FALSE;
// Project : Mes_export
// Designer : Kennet Nielsen
// Version : 1.0.0
-// Date : 020422 , 22 April 2002
+// Date : 020422, 22 April 2002
//
//
// Description: This class is used to store one DB event dyring the export
@@ -80,7 +59,7 @@ class CLDBEvent
HANDLE hUser;
HANDLE hDbEvent;
- CLDBEvent( HANDLE hU , HANDLE hDBE )
+ CLDBEvent( HANDLE hU, HANDLE hDBE )
{
hUser = hU;
hDbEvent = hDBE;
@@ -107,39 +86,39 @@ class CLDBEvent
//
// References : -
// Remarks : -
-// Created : 020422 , 22 April 2002
+// Created : 020422, 22 April 2002
// Developer : KN
/////////////////////////////////////////////////////////////////////
int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
{
- if( lParamSort == 1 )
+ if (lParamSort == 1 )
{
- return _tcsicmp( NickFromHandle((HANDLE)lParam1) , NickFromHandle((HANDLE)lParam2) );
+ return _tcsicmp( NickFromHandle((HANDLE)lParam1), NickFromHandle((HANDLE)lParam2));
}
- if( lParamSort == 2 )
+ if (lParamSort == 2 )
{
- return _DBGetString( (HANDLE)lParam1 , "Protocol" , "p" , _T("") ).compare(
- _DBGetString( (HANDLE)lParam2 , "Protocol" , "p" , _T("") )
+ return _DBGetString( (HANDLE)lParam1, "Protocol", "p", _T("")).compare(
+ _DBGetString( (HANDLE)lParam2, "Protocol", "p", _T(""))
);
}
- if( lParamSort == 3 )
+ if (lParamSort == 3 )
{
DWORD dwUin1 = db_get_dw(
(HANDLE)lParam1,
- _DBGetStringA( (HANDLE)lParam1 , "Protocol" , "p" , "" ).c_str(),
+ _DBGetStringA( (HANDLE)lParam1, "Protocol", "p", "" ).c_str(),
"UIN",
0);
DWORD dwUin2 = db_get_dw(
(HANDLE)lParam2,
- _DBGetStringA( (HANDLE)lParam2 , "Protocol" , "p" , "" ).c_str(),
+ _DBGetStringA( (HANDLE)lParam2, "Protocol", "p", "" ).c_str(),
"UIN",
0);
- if( dwUin1 == dwUin2 )
+ if (dwUin1 == dwUin2 )
return 0;
- if( dwUin1 > dwUin2 )
+ if (dwUin1 > dwUin2 )
return -1;
return 1;
}
@@ -159,7 +138,7 @@ int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
//
// References : -
// Remarks : -
-// Created : 020422 , 22 April 2002
+// Created : 020422, 22 April 2002
// Developer : KN
/////////////////////////////////////////////////////////////////////
@@ -191,29 +170,29 @@ INT_PTR CALLBACK __stdcall DialogProc(
//
// References : -
// Remarks : -
-// Created : 020422 , 22 April 2002
+// Created : 020422, 22 April 2002
// Developer : KN
/////////////////////////////////////////////////////////////////////
-int nExportCompleatList(HWND hParent , bool bOnlySelected )
+int nExportCompleatList(HWND hParent, bool bOnlySelected )
{
- HWND hMapUser = GetDlgItem( hParent , IDC_MAP_USER_LIST );
+ HWND hMapUser = GetDlgItem( hParent, IDC_MAP_USER_LIST );
int nTotalContacts = ListView_GetItemCount( hMapUser );
int nContacts;
- if( bOnlySelected )
+ if (bOnlySelected )
nContacts = ListView_GetSelectedCount( hMapUser );
else
nContacts = nTotalContacts;
- if( !hMapUser || nContacts <= 0 )
+ if (!hMapUser || nContacts <= 0 )
{
MessageBox(hParent, TranslateT("No contacts found to export"), MSG_BOX_TITEL, MB_OK);
return 0;
}
- HWND hDlg = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_EXPORT_ALL_DLG), hParent , DialogProc);
+ HWND hDlg = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_EXPORT_ALL_DLG), hParent, DialogProc);
HWND hProg = GetDlgItem(hDlg, IDC_EXPORT_PROGRESS );
HWND hStatus = GetDlgItem(hDlg, IDC_EXP_ALL_STATUS );
@@ -225,14 +204,14 @@ int nExportCompleatList(HWND hParent , bool bOnlySelected )
RECT rParrent;
RECT rDlg;
- if (GetWindowRect( hParent , &rParrent ) && GetWindowRect( hDlg , &rDlg ) )
+ if (GetWindowRect( hParent, &rParrent) && GetWindowRect( hDlg, &rDlg))
{
- int x = ( (rParrent.right + rParrent.left) / 2 ) - ( (rDlg.right - rDlg.left) / 2 );
- int y = ( (rParrent.bottom + rParrent.top) / 2 ) - ( (rDlg.bottom - rDlg.top) / 2 );
- SetWindowPos( hDlg , 0 , x , y , 0 ,0 , SWP_NOSIZE | SWP_NOZORDER | SWP_SHOWWINDOW );
+ int x = ( (rParrent.right + rParrent.left) / 2) - ( (rDlg.right - rDlg.left) / 2 );
+ int y = ( (rParrent.bottom + rParrent.top) / 2) - ( (rDlg.bottom - rDlg.top) / 2 );
+ SetWindowPos( hDlg, 0, x, y, 0,0, SWP_NOSIZE | SWP_NOZORDER | SWP_SHOWWINDOW );
}
else
- ShowWindow( hDlg , SW_SHOWNORMAL );
+ ShowWindow( hDlg, SW_SHOWNORMAL );
}
// map with list to stored all DB history before it is exported
@@ -244,9 +223,9 @@ int nExportCompleatList(HWND hParent , bool bOnlySelected )
for( int nCur = 0 ; nCur < nTotalContacts ; nCur++ )
{
- if( bOnlySelected )
+ if (bOnlySelected )
{
- if( ! (ListView_GetItemState( hMapUser , nCur , LVIS_SELECTED ) & LVIS_SELECTED) )
+ if ( !(ListView_GetItemState( hMapUser, nCur, LVIS_SELECTED) & LVIS_SELECTED))
continue;
}
@@ -259,33 +238,33 @@ int nExportCompleatList(HWND hParent , bool bOnlySelected )
HANDLE hContact = (HANDLE)sItem.lParam;
- list< CLDBEvent > & rclCurList = AllEvents[ GetFilePathFromUser( hContact ) ];
+ list< CLDBEvent > & rclCurList = AllEvents[ GetFilePathFromUser( hContact) ];
HANDLE hDbEvent = (HANDLE) CallService(MS_DB_EVENT_FINDFIRST,(WPARAM)hContact,0);
- while( hDbEvent )
+ while( hDbEvent)
{
- rclCurList.push_back( CLDBEvent( hContact , hDbEvent ) );
+ rclCurList.push_back( CLDBEvent( hContact, hDbEvent));
// Get next event in chain
hDbEvent = (HANDLE) CallService(MS_DB_EVENT_FINDNEXT,(WPARAM)hDbEvent,0);
}
- SendMessage( hProg , PBM_SETPOS , nCur , 0);
- RedrawWindow( hDlg , NULL , NULL , RDW_ALLCHILDREN | RDW_UPDATENOW );
+ SendMessage( hProg, PBM_SETPOS, nCur, 0);
+ RedrawWindow( hDlg, NULL, NULL, RDW_ALLCHILDREN | RDW_UPDATENOW );
}
/*
- if( hContact )
- MessageBox( hParent , LPGENT("Failed to export at least one contact"),MSG_BOX_TITEL,MB_OK );
+ if (hContact )
+ MessageBox( hParent, LPGENT("Failed to export at least one contact"),MSG_BOX_TITEL,MB_OK );
*/
}
{ // window text update
- SetWindowText( hStatus , TranslateT("Sorting and writing database information ( Phase 2 of 2 )") );
- SendMessage( hProg , PBM_SETRANGE , 0 , MAKELPARAM( 0 , AllEvents.size() ) );
- SendMessage( hProg , PBM_SETPOS , 0 , 0);
+ SetWindowText( hStatus, TranslateT("Sorting and writing database information ( Phase 2 of 2 )"));
+ SendMessage( hProg, PBM_SETRANGE, 0, MAKELPARAM( 0, AllEvents.size()));
+ SendMessage( hProg, PBM_SETPOS, 0, 0);
}
{ // time to write to files !!!
@@ -302,10 +281,10 @@ int nExportCompleatList(HWND hParent , bool bOnlySelected )
for( iterator = FileIterator->second.begin() ; iterator != FileIterator->second.end() ; ++iterator )
{
HANDLE hDbEvent = (*iterator).hDbEvent;
- nExportEvent( (WPARAM) (*iterator).hUser , (LPARAM) hDbEvent );
+ nExportEvent( (WPARAM) (*iterator).hUser, (LPARAM) hDbEvent );
}
- SendMessage( hProg , PBM_SETPOS , ++nCur , 0);
- RedrawWindow( hDlg , NULL , NULL , RDW_ALLCHILDREN | RDW_UPDATENOW );
+ SendMessage( hProg, PBM_SETPOS, ++nCur, 0);
+ RedrawWindow( hDlg, NULL, NULL, RDW_ALLCHILDREN | RDW_UPDATENOW );
}
}
@@ -322,46 +301,46 @@ int nExportCompleatList(HWND hParent , bool bOnlySelected )
//
// References : -
// Remarks : -
-// Created : 021228 , 28 December 2002
+// Created : 021228, 28 December 2002
// Developer : KN
/////////////////////////////////////////////////////////////////////
void SetToDefault( HWND hParent )
{
- HWND hMapUser = GetDlgItem( hParent , IDC_MAP_USER_LIST );
+ HWND hMapUser = GetDlgItem( hParent, IDC_MAP_USER_LIST );
int nContacts = ListView_GetItemCount( hMapUser );
- if( !hMapUser || nContacts <= 0 )
+ if (!hMapUser || nContacts <= 0 )
{
return;
}
- _TCHAR szTemp[ 500 ];
- if( ! GetDlgItemText( hParent , IDC_DEFAULT_FILE , szTemp , sizeof( szTemp ) ) )
+ TCHAR szTemp[ 500 ];
+ if ( !GetDlgItemText( hParent, IDC_DEFAULT_FILE, szTemp, sizeof( szTemp)) )
return;
LVITEM sItem = { 0 };
for( int nCur = 0 ; nCur < nContacts ; nCur++ )
{
- if( ! (ListView_GetItemState( hMapUser , nCur , LVIS_SELECTED ) & LVIS_SELECTED) )
+ if ( !(ListView_GetItemState( hMapUser, nCur, LVIS_SELECTED) & LVIS_SELECTED))
continue;
sItem.iItem = nCur;
sItem.mask = LVIF_PARAM;
- if( ! ListView_GetItem( hMapUser, &sItem ) )
+ if ( !ListView_GetItem( hMapUser, &sItem))
continue;
tstring sFileName = szTemp;
- ReplaceDefines( (HANDLE)sItem.lParam , sFileName );
+ ReplaceDefines( (HANDLE)sItem.lParam, sFileName );
ReplaceTimeVariables( sFileName );
sItem.mask = LVIF_TEXT;
- sItem.pszText = (_TCHAR*)sFileName.c_str();
+ sItem.pszText = (TCHAR*)sFileName.c_str();
ListView_SetItem( hMapUser, &sItem );
- if( ! bUnaplyedChanges )
+ if ( !bUnaplyedChanges )
{
bUnaplyedChanges = TRUE;
SendMessage(GetParent(hParent), PSM_CHANGED, 0, 0);
@@ -374,11 +353,11 @@ void SetToDefault( HWND hParent )
// Type : Global
// Parameters : hwndDlg - handle to the parrent, ( Options Dlg )
// Returns : Returns true if the changes was applyed
-// Description : but since we cant abort an apply opperation ,
+// Description : but since we cant abort an apply opperation,
// this can not currently be used
// References : -
// Remarks : -
-// Created : 020422 , 22 April 2002
+// Created : 020422, 22 April 2002
// Developer : KN
/////////////////////////////////////////////////////////////////////
@@ -386,7 +365,7 @@ BOOL bApplyChanges( HWND hwndDlg )
{
BOOL bTrans;
BOOL bRet = true;
- _TCHAR szTemp[500];
+ TCHAR szTemp[500];
int nTmp = GetDlgItemInt(hwndDlg, IDC_MAX_CLOUMN_WIDTH, &bTrans, TRUE );
if ( !bTrans || nTmp < 5 )
@@ -400,34 +379,34 @@ BOOL bApplyChanges( HWND hwndDlg )
nMaxLineWidth = nTmp;
}
- GetDlgItemText( hwndDlg , IDC_EXPORT_TIMEFORMAT , szTemp , sizeof( szTemp ) );
+ GetDlgItemText( hwndDlg, IDC_EXPORT_TIMEFORMAT, szTemp, sizeof( szTemp));
sTimeFormat = szTemp;
- GetDlgItemText( hwndDlg , IDC_EXPORT_DIR , szTemp , sizeof( szTemp ) );
+ GetDlgItemText( hwndDlg, IDC_EXPORT_DIR, szTemp, sizeof( szTemp));
sExportDir = szTemp;
- GetDlgItemText( hwndDlg , IDC_DEFAULT_FILE , szTemp , sizeof( szTemp ) );
+ GetDlgItemText( hwndDlg, IDC_DEFAULT_FILE, szTemp, sizeof( szTemp));
sDefaultFile = szTemp;
- GetDlgItemText( hwndDlg , IDC_FILE_VIEWER , szTemp , sizeof( szTemp ) );
+ GetDlgItemText( hwndDlg, IDC_FILE_VIEWER, szTemp, sizeof( szTemp));
sFileViewerPrg = szTemp;
- bUseInternalViewer( IsDlgButtonChecked( hwndDlg , IDC_USE_INTERNAL_VIEWER ) == BST_CHECKED );
+ bUseInternalViewer( IsDlgButtonChecked( hwndDlg, IDC_USE_INTERNAL_VIEWER ) == BST_CHECKED );
- bool bNewRp = IsDlgButtonChecked( hwndDlg , IDC_REPLACE_MIRANDA_HISTORY ) == BST_CHECKED;
- if( bReplaceHistory != bNewRp )
+ bool bNewRp = IsDlgButtonChecked( hwndDlg, IDC_REPLACE_MIRANDA_HISTORY) == BST_CHECKED;
+ if (bReplaceHistory != bNewRp )
{
bReplaceHistory = bNewRp;
MessageBox(hwndDlg, TranslateT("You need to restart miranda to change the history function"), MSG_BOX_TITEL, MB_OK );
}
- bAppendNewLine = IsDlgButtonChecked( hwndDlg , IDC_APPEND_NEWLINE ) == BST_CHECKED;
- bUseUtf8InNewFiles = IsDlgButtonChecked( hwndDlg , IDC_USE_UTF8_IN_NEW_FILES ) == BST_CHECKED;
+ bAppendNewLine = IsDlgButtonChecked( hwndDlg, IDC_APPEND_NEWLINE) == BST_CHECKED;
+ bUseUtf8InNewFiles = IsDlgButtonChecked( hwndDlg, IDC_USE_UTF8_IN_NEW_FILES) == BST_CHECKED;
- bUseLessAndGreaterInExport = IsDlgButtonChecked( hwndDlg , IDC_USE_LESS_AND_GREATER_IN_EXPORT ) == BST_CHECKED;
+ bUseLessAndGreaterInExport = IsDlgButtonChecked( hwndDlg, IDC_USE_LESS_AND_GREATER_IN_EXPORT) == BST_CHECKED;
- HWND hMapUser = GetDlgItem( hwndDlg , IDC_MAP_USER_LIST );
+ HWND hMapUser = GetDlgItem( hwndDlg, IDC_MAP_USER_LIST );
int nCount = ListView_GetItemCount( hMapUser );
for( int nCur = 0 ; nCur < nCount ; nCur++ )
{
@@ -437,18 +416,18 @@ BOOL bApplyChanges( HWND hwndDlg )
sItem.pszText = szTemp;
sItem.cchTextMax = sizeof( szTemp );
- if( ListView_GetItem( hMapUser, &sItem ) )
+ if (ListView_GetItem( hMapUser, &sItem))
{
HANDLE hUser = (HANDLE)sItem.lParam;
- if( _tcslen( szTemp ) > 0 )
- db_set_ts( hUser , MODULE , "FileName" , szTemp );
+ if (_tcslen( szTemp) > 0 )
+ db_set_ts( hUser, MODULE, "FileName", szTemp );
else
- DBDeleteContactSetting( hUser , MODULE , "FileName" );
+ DBDeleteContactSetting( hUser, MODULE, "FileName" );
- if( sItem.iImage )
- DBDeleteContactSetting( hUser , MODULE , "EnableLog" ); // default is Enabled !!
+ if (sItem.iImage )
+ DBDeleteContactSetting( hUser, MODULE, "EnableLog" ); // default is Enabled !!
else
- db_set_b( hUser , MODULE , "EnableLog",0);
+ db_set_b( hUser, MODULE, "EnableLog",0);
}
}
UpdateFileToColWidth();
@@ -469,7 +448,7 @@ BOOL bApplyChanges( HWND hwndDlg )
//
// References : -
// Remarks : -
-// Created : 020422 , 23 April 2002
+// Created : 020422, 23 April 2002
// Developer : KN
/////////////////////////////////////////////////////////////////////
@@ -479,14 +458,14 @@ void ClearAllFileNames(HWND hwndDlg)
sItem.mask = LVIF_TEXT;
sItem.pszText = _T("");
- HWND hMapUser = GetDlgItem( hwndDlg , IDC_MAP_USER_LIST );
+ HWND hMapUser = GetDlgItem( hwndDlg, IDC_MAP_USER_LIST );
int nCount = ListView_GetItemCount( hMapUser );
for( int nCur = 0 ; nCur < nCount ; nCur++ )
{
sItem.iItem = nCur;
ListView_SetItem( hMapUser, &sItem );
}
- if( ! bUnaplyedChanges )
+ if ( !bUnaplyedChanges )
{
bUnaplyedChanges = TRUE;
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
@@ -502,23 +481,23 @@ void ClearAllFileNames(HWND hwndDlg)
//
// References : -
// Remarks : -
-// Created : 020422 , 23 April 2002
+// Created : 020422, 23 April 2002
// Developer : KN
/////////////////////////////////////////////////////////////////////
void AutoFindeFileNames(HWND hwndDlg)
{
- _TCHAR szDefaultFile[500];
- GetDlgItemText( hwndDlg , IDC_DEFAULT_FILE , szDefaultFile , sizeof( szDefaultFile ) );
+ TCHAR szDefaultFile[500];
+ GetDlgItemText( hwndDlg, IDC_DEFAULT_FILE, szDefaultFile, sizeof( szDefaultFile));
LVITEM sItem = { 0 };
- HWND hMapUser = GetDlgItem( hwndDlg , IDC_MAP_USER_LIST );
+ HWND hMapUser = GetDlgItem( hwndDlg, IDC_MAP_USER_LIST );
int nCount = ListView_GetItemCount( hMapUser );
for( int nCur = 0 ; nCur < nCount ; nCur++ )
{
- _TCHAR szSearch[ 100 ];
+ TCHAR szSearch[ 100 ];
sItem.mask = LVIF_TEXT;
sItem.iItem = nCur;
@@ -526,7 +505,7 @@ void AutoFindeFileNames(HWND hwndDlg)
sItem.pszText = szSearch;
sItem.cchTextMax = sizeof( szSearch );
- if( ! ListView_GetItem( hMapUser, &sItem ) )
+ if ( !ListView_GetItem( hMapUser, &sItem))
{
continue;
}
@@ -536,57 +515,57 @@ void AutoFindeFileNames(HWND hwndDlg)
int nStortestIndex = -1;
for( int nSubCur = 0 ; nSubCur < nCount ; nSubCur++ )
{
- if( nSubCur == nCur )
+ if (nSubCur == nCur )
continue;
- _TCHAR szSubCur[ 100 ];
+ TCHAR szSubCur[ 100 ];
sItem.mask = LVIF_TEXT | LVIF_PARAM;
sItem.iItem = nSubCur;
sItem.iSubItem = 1;
sItem.pszText = szSubCur;
sItem.cchTextMax = sizeof( szSubCur );
- if( ListView_GetItem( hMapUser, &sItem ) )
+ if (ListView_GetItem( hMapUser, &sItem))
{
size_t nLen = _tcslen( szSubCur );
- if( _tcsncicmp( szSubCur , szSearch , nLen ) == 0 )
+ if (_tcsncicmp( szSubCur, szSearch, nLen) == 0 )
{
- if( nLen < (size_t)nShortestMatch )
+ if (nLen < (size_t)nShortestMatch )
{
- nShortestMatch = nLen;
+ nShortestMatch = (int)nLen;
nStortestIndex = nSubCur;
hStortest = (HANDLE)sItem.lParam;
}
}
}
}
- if( nShortestMatch != 0xFFFF )
+ if (nShortestMatch != 0xFFFF )
{
tstring sFileName;
szSearch[0] = 0;
- ListView_GetItemText( hMapUser, nCur , 0 , szSearch , sizeof( szSearch ));
+ ListView_GetItemText( hMapUser, nCur, 0, szSearch, sizeof( szSearch ));
bool bPriHasFileName = szSearch[0] != 0;
- if( bPriHasFileName )
+ if (bPriHasFileName )
sFileName = szSearch;
szSearch[0] = 0;
- ListView_GetItemText( hMapUser, nStortestIndex , 0 , szSearch , sizeof( szSearch ));
+ ListView_GetItemText( hMapUser, nStortestIndex, 0, szSearch, sizeof( szSearch ));
bool bSubHasFileName = szSearch[0] != 0;
- if( bSubHasFileName )
+ if (bSubHasFileName )
sFileName = szSearch;
- if( sFileName.empty() )
+ if (sFileName.empty())
{
sFileName = szDefaultFile;
- ReplaceDefines( hStortest , sFileName );
+ ReplaceDefines( hStortest, sFileName );
ReplaceTimeVariables( sFileName );
}
- if( !bPriHasFileName )
- ListView_SetItemText( hMapUser, nCur , 0 , (_TCHAR*)sFileName.c_str() );
+ if (!bPriHasFileName )
+ ListView_SetItemText( hMapUser, nCur, 0, (TCHAR*)sFileName.c_str());
- if( !bSubHasFileName )
- ListView_SetItemText( hMapUser, nStortestIndex , 0 , (_TCHAR*)sFileName.c_str() );
+ if (!bSubHasFileName )
+ ListView_SetItemText( hMapUser, nStortestIndex, 0, (TCHAR*)sFileName.c_str());
- if( ! bUnaplyedChanges )
+ if ( !bUnaplyedChanges )
{
bUnaplyedChanges = TRUE;
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
@@ -605,17 +584,17 @@ void AutoFindeFileNames(HWND hwndDlg)
//
// References : -
// Remarks : -
-// Created : 020427 , 27 April 2002
+// Created : 020427, 27 April 2002
// Developer : KN
/////////////////////////////////////////////////////////////////////
void OpenHelp(HWND hwndDlg)
{
- _TCHAR szPath[MAX_PATH];
- if( GetModuleFileName( hInstance , szPath , sizeof( szPath ) ) )
+ TCHAR szPath[MAX_PATH];
+ if (GetModuleFileName( hInstance, szPath, sizeof( szPath)) )
{
size_t nLen = _tcslen( szPath );
- if( nLen > 3 )
+ if (nLen > 3 )
{
szPath[nLen-1] = 't';
szPath[nLen-2] = 'x';
@@ -648,7 +627,7 @@ void OpenHelp(HWND hwndDlg)
//
// References : -
// Remarks : -
-// Created : 020422 , 22 April 2002
+// Created : 020422, 22 April 2002
// Developer : KN
/////////////////////////////////////////////////////////////////////
@@ -664,21 +643,21 @@ static INT_PTR CALLBACK DlgProcMsgExportOpts(HWND hwndDlg, UINT msg, WPARAM wPar
{
bWindowTextSet = FALSE;
- HWND hMapUser = GetDlgItem( hwndDlg , IDC_MAP_USER_LIST );
+ HWND hMapUser = GetDlgItem( hwndDlg, IDC_MAP_USER_LIST );
{ // init adv. win styles
DWORD dw = ListView_GetExtendedListViewStyle( hMapUser );
dw |= LVS_EX_HEADERDRAGDROP | LVS_EX_FULLROWSELECT;
- ListView_SetExtendedListViewStyle( hMapUser , dw /*| LVS_EX_LABELTIP*/);
+ ListView_SetExtendedListViewStyle( hMapUser, dw /*| LVS_EX_LABELTIP*/);
}
int nColumnWidth = 100;
RECT rListSize;
- if( GetWindowRect( hMapUser , &rListSize ) )
+ if (GetWindowRect( hMapUser, &rListSize))
{
nColumnWidth = (rListSize.right - rListSize.left- GetSystemMetrics(SM_CXVSCROLL) - 5 - nUINColWitdh - nProtoColWitdh) / 2;
- if( nColumnWidth < 10 )
+ if (nColumnWidth < 10)
nColumnWidth = 10;
}
@@ -688,27 +667,27 @@ static INT_PTR CALLBACK DlgProcMsgExportOpts(HWND hwndDlg, UINT msg, WPARAM wPar
cCol.mask = LVCF_TEXT | LVCF_WIDTH;
cCol.cx = nColumnWidth;
cCol.pszText = TranslateT("File");
- ListView_InsertColumn( hMapUser , 0 , &cCol );
+ ListView_InsertColumn( hMapUser, 0, &cCol );
cCol.pszText = TranslateT("Nick");
- ListView_InsertColumn( hMapUser , 1 , &cCol );
+ ListView_InsertColumn( hMapUser, 1, &cCol );
cCol.cx = nProtoColWitdh;
cCol.pszText = TranslateT("Proto");
- ListView_InsertColumn( hMapUser , 2 , &cCol );
+ ListView_InsertColumn( hMapUser, 2, &cCol );
cCol.cx = nUINColWitdh;
cCol.mask |= LVCF_FMT;
cCol.fmt = LVCFMT_RIGHT;
cCol.pszText = TranslateT("UIN");
- ListView_InsertColumn( hMapUser , 3 , &cCol );
+ ListView_InsertColumn( hMapUser, 3, &cCol );
/*
- int nOrder[3] = { 1 , 2 , 0 };
- ListView_SetColumnOrderArray( hMapUser , 3 , nOrder );*/
+ int nOrder[3] = { 1, 2, 0 };
+ ListView_SetColumnOrderArray( hMapUser, 3, nOrder );*/
}
{
HIMAGELIST hIml;
- hIml = ImageList_Create( GetSystemMetrics(SM_CXSMICON) , GetSystemMetrics(SM_CYSMICON),ILC_COLOR4|ILC_MASK,2,2);
+ hIml = ImageList_Create( GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON),ILC_COLOR4|ILC_MASK,2,2);
ImageList_AddIcon(hIml,LoadIcon(GetModuleHandle(NULL),MAKEINTRESOURCE(IDI_NOTICK)));
ImageList_AddIcon(hIml,LoadIcon(GetModuleHandle(NULL),MAKEINTRESOURCE(IDI_TICK)));
ListView_SetImageList( hMapUser, hIml, LVSIL_SMALL);
@@ -727,97 +706,97 @@ static INT_PTR CALLBACK DlgProcMsgExportOpts(HWND hwndDlg, UINT msg, WPARAM wPar
sItem.lParam = (LPARAM) hContact;
- sTmp = _DBGetString( hContact , MODULE , "FileName" , _T("") );
- sItem.pszText = (_TCHAR*)sTmp.c_str();
+ sTmp = _DBGetString( hContact, MODULE, "FileName", _T(""));
+ sItem.pszText = (TCHAR*)sTmp.c_str();
- ListView_InsertItem( hMapUser , &sItem );
+ ListView_InsertItem( hMapUser, &sItem );
sItem.mask = LVIF_TEXT;
sItem.iSubItem = 1;
- sItem.pszText = (_TCHAR*)NickFromHandle(hContact);
- ListView_SetItem( hMapUser , &sItem );
+ sItem.pszText = (TCHAR*)NickFromHandle(hContact);
+ ListView_SetItem( hMapUser, &sItem );
sItem.iSubItem = 2;
- sTmp = _DBGetString( hContact , "Protocol" , "p" , _T("") );
- string sTmpA = _DBGetStringA( hContact , "Protocol" , "p" , "" );
- sItem.pszText = (_TCHAR*)sTmp.c_str();
- ListView_SetItem( hMapUser , &sItem );
+ sTmp = _DBGetString( hContact, "Protocol", "p", _T(""));
+ string sTmpA = _DBGetStringA( hContact, "Protocol", "p", "" );
+ sItem.pszText = (TCHAR*)sTmp.c_str();
+ ListView_SetItem( hMapUser, &sItem );
DWORD dwUIN = db_get_dw(hContact, sTmpA.c_str(), "UIN", 0);
- _TCHAR szTmp[50];
- _sntprintf( szTmp , sizeof(szTmp) ,_T("%d") , dwUIN );
+ TCHAR szTmp[50];
+ _sntprintf( szTmp, sizeof(szTmp),_T("%d"), dwUIN );
sItem.iSubItem = 3;
sItem.pszText = szTmp;
- ListView_SetItem( hMapUser , &sItem );
+ ListView_SetItem( hMapUser, &sItem );
- if( ! hContact ) // written like this to add the current user ( handle = 0 )
+ if ( !hContact) // written like this to add the current user ( handle = 0 )
break;
hContact = db_find_next(hContact);
}
- ListView_SortItems( hMapUser , CompareFunc , 1 );
+ ListView_SortItems( hMapUser, CompareFunc, 1 );
sItem.mask = LVIF_STATE;
sItem.iItem = 0;
sItem.iSubItem = 0;
sItem.state = LVIS_FOCUSED;
sItem.stateMask = LVIS_FOCUSED;
- ListView_SetItem( hMapUser , &sItem );
+ ListView_SetItem( hMapUser, &sItem );
}
HWND hComboBox;
- SetDlgItemInt( hwndDlg , IDC_MAX_CLOUMN_WIDTH , nMaxLineWidth , TRUE );
+ SetDlgItemInt( hwndDlg, IDC_MAX_CLOUMN_WIDTH, nMaxLineWidth, TRUE );
{// Export dir
- SetDlgItemText( hwndDlg , IDC_EXPORT_DIR , sExportDir.c_str() );
- hComboBox = GetDlgItem( hwndDlg , IDC_EXPORT_DIR );
- SendMessage( hComboBox , CB_ADDSTRING, 0 , (LPARAM)_T("%dbpath%\\MsgExport\\") );
- SendMessage( hComboBox , CB_ADDSTRING, 0 , (LPARAM)_T("C:\\Backup\\MsgExport\\") );
- SendMessage( hComboBox , CB_ADDSTRING, 0 , (LPARAM)_T("%dbpath%\\MsgExport\\%group% - ") );
- SendMessage( hComboBox , CB_ADDSTRING, 0 , (LPARAM)_T("%dbpath%\\MsgExport\\%group%\\") );
+ SetDlgItemText( hwndDlg, IDC_EXPORT_DIR, sExportDir.c_str());
+ hComboBox = GetDlgItem( hwndDlg, IDC_EXPORT_DIR );
+ SendMessage( hComboBox, CB_ADDSTRING, 0, (LPARAM)_T("%dbpath%\\MsgExport\\"));
+ SendMessage( hComboBox, CB_ADDSTRING, 0, (LPARAM)_T("C:\\Backup\\MsgExport\\"));
+ SendMessage( hComboBox, CB_ADDSTRING, 0, (LPARAM)_T("%dbpath%\\MsgExport\\%group% - "));
+ SendMessage( hComboBox, CB_ADDSTRING, 0, (LPARAM)_T("%dbpath%\\MsgExport\\%group%\\"));
}
{// default file
- SetDlgItemText( hwndDlg , IDC_DEFAULT_FILE , sDefaultFile.c_str() );
- hComboBox = GetDlgItem( hwndDlg , IDC_DEFAULT_FILE );
- SendMessage( hComboBox , CB_ADDSTRING, 0 , (LPARAM)_T("%nick%.txt") );
- SendMessage( hComboBox , CB_ADDSTRING, 0 , (LPARAM)_T("%UIN%.txt") );
- SendMessage( hComboBox , CB_ADDSTRING, 0 , (LPARAM)_T("%group%.txt") );
- SendMessage( hComboBox , CB_ADDSTRING, 0 , (LPARAM)_T("%e-mail%.txt") );
- SendMessage( hComboBox , CB_ADDSTRING, 0 , (LPARAM)_T("%identifier%.txt") );
- SendMessage( hComboBox , CB_ADDSTRING, 0 , (LPARAM)_T("%year%-%month%-%day%.txt") );
- SendMessage( hComboBox , CB_ADDSTRING, 0 , (LPARAM)_T("%group%\\%nick%.txt") );
- SendMessage( hComboBox , CB_ADDSTRING, 0 , (LPARAM)_T("%group%\\%UIN%.txt") );
- SendMessage( hComboBox , CB_ADDSTRING, 0 , (LPARAM)_T("%group%\\%identifier%.txt") );
- SendMessage( hComboBox , CB_ADDSTRING, 0 , (LPARAM)_T("%protocol%\\%nick%.txt") );
- SendMessage( hComboBox , CB_ADDSTRING, 0 , (LPARAM)_T("History.txt"));
+ SetDlgItemText( hwndDlg, IDC_DEFAULT_FILE, sDefaultFile.c_str());
+ hComboBox = GetDlgItem( hwndDlg, IDC_DEFAULT_FILE );
+ SendMessage( hComboBox, CB_ADDSTRING, 0, (LPARAM)_T("%nick%.txt"));
+ SendMessage( hComboBox, CB_ADDSTRING, 0, (LPARAM)_T("%UIN%.txt"));
+ SendMessage( hComboBox, CB_ADDSTRING, 0, (LPARAM)_T("%group%.txt"));
+ SendMessage( hComboBox, CB_ADDSTRING, 0, (LPARAM)_T("%e-mail%.txt"));
+ SendMessage( hComboBox, CB_ADDSTRING, 0, (LPARAM)_T("%identifier%.txt"));
+ SendMessage( hComboBox, CB_ADDSTRING, 0, (LPARAM)_T("%year%-%month%-%day%.txt"));
+ SendMessage( hComboBox, CB_ADDSTRING, 0, (LPARAM)_T("%group%\\%nick%.txt"));
+ SendMessage( hComboBox, CB_ADDSTRING, 0, (LPARAM)_T("%group%\\%UIN%.txt"));
+ SendMessage( hComboBox, CB_ADDSTRING, 0, (LPARAM)_T("%group%\\%identifier%.txt"));
+ SendMessage( hComboBox, CB_ADDSTRING, 0, (LPARAM)_T("%protocol%\\%nick%.txt"));
+ SendMessage( hComboBox, CB_ADDSTRING, 0, (LPARAM)_T("History.txt"));
}
{// time format
- SetDlgItemText( hwndDlg , IDC_EXPORT_TIMEFORMAT , sTimeFormat.c_str() );
- hComboBox = GetDlgItem( hwndDlg , IDC_EXPORT_TIMEFORMAT );
- SendMessage( hComboBox , CB_ADDSTRING, 0 , (LPARAM)_T("d t") );
- SendMessage( hComboBox , CB_ADDSTRING, 0 , (LPARAM)_T("d s") );
- SendMessage( hComboBox , CB_ADDSTRING, 0 , (LPARAM)_T("d m") );
- SendMessage( hComboBox , CB_ADDSTRING, 0 , (LPARAM)_T("D s") );
- SendMessage( hComboBox , CB_ADDSTRING, 0 , (LPARAM)_T("D m :"));
+ SetDlgItemText( hwndDlg, IDC_EXPORT_TIMEFORMAT, sTimeFormat.c_str());
+ hComboBox = GetDlgItem( hwndDlg, IDC_EXPORT_TIMEFORMAT );
+ SendMessage( hComboBox, CB_ADDSTRING, 0, (LPARAM)_T("d t") );
+ SendMessage( hComboBox, CB_ADDSTRING, 0, (LPARAM)_T("d s") );
+ SendMessage( hComboBox, CB_ADDSTRING, 0, (LPARAM)_T("d m") );
+ SendMessage( hComboBox, CB_ADDSTRING, 0, (LPARAM)_T("D s") );
+ SendMessage( hComboBox, CB_ADDSTRING, 0, (LPARAM)_T("D m :"));
}
{// File viewer
- SetDlgItemText( hwndDlg , IDC_FILE_VIEWER , sFileViewerPrg.c_str() );
- hComboBox = GetDlgItem( hwndDlg , IDC_FILE_VIEWER );
- SendMessage( hComboBox , CB_ADDSTRING, 0 , (LPARAM)_T("") );
- SendMessage( hComboBox , CB_ADDSTRING, 0 , (LPARAM)_T("C:\\Windows\\Notepad.exe") );
- SendMessage( hComboBox , CB_ADDSTRING, 0 , (LPARAM)_T("C:\\WinNT\\Notepad.exe") );
- //EnableWindow( GetDlgItem( hwndDlg , IDC_FILE_VIEWER ) , ! bUseInternalViewer() );
+ SetDlgItemText( hwndDlg, IDC_FILE_VIEWER, sFileViewerPrg.c_str());
+ hComboBox = GetDlgItem( hwndDlg, IDC_FILE_VIEWER );
+ SendMessage( hComboBox, CB_ADDSTRING, 0, (LPARAM)_T("") );
+ SendMessage( hComboBox, CB_ADDSTRING, 0, (LPARAM)_T("C:\\Windows\\Notepad.exe") );
+ SendMessage( hComboBox, CB_ADDSTRING, 0, (LPARAM)_T("C:\\WinNT\\Notepad.exe") );
+ //EnableWindow( GetDlgItem( hwndDlg, IDC_FILE_VIEWER ), ! bUseInternalViewer());
}
- CheckDlgButton( hwndDlg , IDC_USE_INTERNAL_VIEWER , bUseInternalViewer() ? BST_CHECKED : BST_UNCHECKED );
- CheckDlgButton( hwndDlg , IDC_REPLACE_MIRANDA_HISTORY , bReplaceHistory ? BST_CHECKED : BST_UNCHECKED );
- CheckDlgButton( hwndDlg , IDC_APPEND_NEWLINE , bAppendNewLine ? BST_CHECKED : BST_UNCHECKED );
- CheckDlgButton( hwndDlg , IDC_USE_UTF8_IN_NEW_FILES , bUseUtf8InNewFiles ? BST_CHECKED : BST_UNCHECKED );
- CheckDlgButton( hwndDlg , IDC_USE_LESS_AND_GREATER_IN_EXPORT , bUseLessAndGreaterInExport ? BST_CHECKED : BST_UNCHECKED );
+ CheckDlgButton( hwndDlg, IDC_USE_INTERNAL_VIEWER , bUseInternalViewer() ? BST_CHECKED : BST_UNCHECKED );
+ CheckDlgButton( hwndDlg, IDC_REPLACE_MIRANDA_HISTORY, bReplaceHistory ? BST_CHECKED : BST_UNCHECKED );
+ CheckDlgButton( hwndDlg, IDC_APPEND_NEWLINE, bAppendNewLine ? BST_CHECKED : BST_UNCHECKED );
+ CheckDlgButton( hwndDlg, IDC_USE_UTF8_IN_NEW_FILES, bUseUtf8InNewFiles ? BST_CHECKED : BST_UNCHECKED );
+ CheckDlgButton( hwndDlg, IDC_USE_LESS_AND_GREATER_IN_EXPORT, bUseLessAndGreaterInExport ? BST_CHECKED : BST_UNCHECKED );
TranslateDialogDefault(hwndDlg);
@@ -832,20 +811,20 @@ static INT_PTR CALLBACK DlgProcMsgExportOpts(HWND hwndDlg, UINT msg, WPARAM wPar
case ID_EXPORTSELECTED:
case IDC_EXPORTALL:
{
- if( bUnaplyedChanges )
+ if (bUnaplyedChanges )
{
DWORD res = MessageBox(hwndDlg, TranslateT("You have unapplyed changes do you wish to apply these first ?"), MSG_BOX_TITEL, MB_YESNOCANCEL);
- if( res == IDCANCEL )
+ if (res == IDCANCEL )
return TRUE;
- if( res == IDYES )
+ if (res == IDYES )
{
- if( ! bApplyChanges( hwndDlg ) )
+ if ( !bApplyChanges( hwndDlg))
{
return TRUE;
}
}
}
- nExportCompleatList( hwndDlg , LOWORD(wParam) == ID_EXPORTSELECTED );
+ nExportCompleatList( hwndDlg, LOWORD(wParam) == ID_EXPORTSELECTED );
return TRUE;
}
case IDC_EXPORT_DIR:
@@ -853,10 +832,10 @@ static INT_PTR CALLBACK DlgProcMsgExportOpts(HWND hwndDlg, UINT msg, WPARAM wPar
case IDC_DEFAULT_FILE:
case IDC_FILE_VIEWER:
{
- if( !bWindowTextSet )
+ if (!bWindowTextSet )
return TRUE;
- if( HIWORD(wParam) == CBN_EDITUPDATE || HIWORD(wParam) == CBN_SELCHANGE )
+ if (HIWORD(wParam) == CBN_EDITUPDATE || HIWORD(wParam) == CBN_SELCHANGE )
{
bUnaplyedChanges = TRUE;
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
@@ -865,10 +844,10 @@ static INT_PTR CALLBACK DlgProcMsgExportOpts(HWND hwndDlg, UINT msg, WPARAM wPar
}
case IDC_MAX_CLOUMN_WIDTH:
{
- if( !bWindowTextSet )
+ if (!bWindowTextSet )
return TRUE;
- if( HIWORD(wParam) == EN_CHANGE )
+ if (HIWORD(wParam) == EN_CHANGE )
{
bUnaplyedChanges = TRUE;
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
@@ -878,8 +857,8 @@ static INT_PTR CALLBACK DlgProcMsgExportOpts(HWND hwndDlg, UINT msg, WPARAM wPar
case IDC_USE_INTERNAL_VIEWER:
/* {
EnableWindow(
- GetDlgItem( hwndDlg , IDC_FILE_VIEWER ) ,
- !IsDlgButtonChecked( hwndDlg , IDC_USE_INTERNAL_VIEWER )
+ GetDlgItem( hwndDlg, IDC_FILE_VIEWER ),
+ !IsDlgButtonChecked( hwndDlg, IDC_USE_INTERNAL_VIEWER )
);
}// fall thru here !!*/
case IDC_REPLACE_MIRANDA_HISTORY:
@@ -887,7 +866,7 @@ static INT_PTR CALLBACK DlgProcMsgExportOpts(HWND hwndDlg, UINT msg, WPARAM wPar
case IDC_USE_UTF8_IN_NEW_FILES:
case IDC_USE_LESS_AND_GREATER_IN_EXPORT:
{
- if( HIWORD(wParam) == BN_CLICKED )
+ if (HIWORD(wParam) == BN_CLICKED )
{
bUnaplyedChanges = TRUE;
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
@@ -898,11 +877,11 @@ static INT_PTR CALLBACK DlgProcMsgExportOpts(HWND hwndDlg, UINT msg, WPARAM wPar
{
LVITEM sItem = { 0 };
sItem.mask = LVIF_PARAM;
- HWND hMapUser = GetDlgItem( hwndDlg , IDC_MAP_USER_LIST );
- sItem.iItem = ListView_GetNextItem( hMapUser , -1 , LVIS_SELECTED );
- if( sItem.iItem >= 0 && ListView_GetItem( hMapUser, &sItem ))
+ HWND hMapUser = GetDlgItem( hwndDlg, IDC_MAP_USER_LIST );
+ sItem.iItem = ListView_GetNextItem( hMapUser, -1, LVIS_SELECTED );
+ if (sItem.iItem >= 0 && ListView_GetItem( hMapUser, &sItem ))
{
- CallService(MS_USERINFO_SHOWDIALOG,(WPARAM)sItem.lParam ,0);
+ CallService(MS_USERINFO_SHOWDIALOG,(WPARAM)sItem.lParam,0);
}
return TRUE;
}
@@ -930,9 +909,9 @@ static INT_PTR CALLBACK DlgProcMsgExportOpts(HWND hwndDlg, UINT msg, WPARAM wPar
case IDC_FILE_VIEWER_BROWSE:
{
OPENFILENAME ofn = { 0 }; // common dialog box structure
- _TCHAR szFile[260]; // buffer for file name
+ TCHAR szFile[260]; // buffer for file name
- GetDlgItemText( hwndDlg , IDC_FILE_VIEWER , szFile , sizeof(szFile));
+ GetDlgItemText( hwndDlg, IDC_FILE_VIEWER, szFile, sizeof(szFile));
// Initialize OPENFILENAME
//ZeroMemory(&ofn, sizeof(OPENFILENAME));
ofn.lStructSize = sizeof(OPENFILENAME);
@@ -952,7 +931,7 @@ static INT_PTR CALLBACK DlgProcMsgExportOpts(HWND hwndDlg, UINT msg, WPARAM wPar
if (GetOpenFileName(&ofn))
{
- SetDlgItemText( hwndDlg , IDC_FILE_VIEWER , szFile );
+ SetDlgItemText( hwndDlg, IDC_FILE_VIEWER, szFile );
bUnaplyedChanges = TRUE;
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
@@ -969,15 +948,15 @@ static INT_PTR CALLBACK DlgProcMsgExportOpts(HWND hwndDlg, UINT msg, WPARAM wPar
if (FAILED(SHGetMalloc(&pMalloc))) // we need to use this to support old Windows versions
{
MessageBox(hwndDlg, TranslateT("Failed to get the shells allocator!"), MSG_BOX_TITEL, MB_OK);
- return TRUE; // TRUE because we have handled the message , sort of *S*
+ return TRUE; // TRUE because we have handled the message, sort of *S*
}
// Allocate the Dest Dir buffer to receive browse info
- _TCHAR * lpDestDir = (_TCHAR * ) pMalloc->Alloc(MAX_PATH+100);
+ TCHAR *lpDestDir = (TCHAR *) pMalloc->Alloc(MAX_PATH+100);
if ( ! lpDestDir )
{
pMalloc->Release();
- MessageBox(hwndDlg , TranslateT("Failed to Allocate buffer space"), MSG_BOX_TITEL, MB_OK);
+ MessageBox(hwndDlg, TranslateT("Failed to Allocate buffer space"), MSG_BOX_TITEL, MB_OK);
return TRUE;
}
@@ -992,16 +971,16 @@ static INT_PTR CALLBACK DlgProcMsgExportOpts(HWND hwndDlg, UINT msg, WPARAM wPar
sBrowseInfo.iImage = 0;
LPITEMIDLIST psItemIDList = SHBrowseForFolder(&sBrowseInfo);
- if( psItemIDList )
+ if (psItemIDList )
{
SHGetPathFromIDList(psItemIDList, lpDestDir);
size_t n = _tcslen( lpDestDir );
- if( n > 0 && lpDestDir[n] != '\\' )
+ if (n > 0 && lpDestDir[n] != '\\' )
{
lpDestDir[n] = '\\' ;
lpDestDir[n+1] = 0;
}
- SetDlgItemText( hwndDlg , IDC_EXPORT_DIR , lpDestDir );
+ SetDlgItemText( hwndDlg, IDC_EXPORT_DIR, lpDestDir );
bUnaplyedChanges = TRUE;
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
// Clean up
@@ -1016,33 +995,33 @@ static INT_PTR CALLBACK DlgProcMsgExportOpts(HWND hwndDlg, UINT msg, WPARAM wPar
}
case WM_CONTEXTMENU:
{
- if( wParam != (WPARAM)GetDlgItem( hwndDlg , IDC_MAP_USER_LIST ) )
+ if (wParam != (WPARAM)GetDlgItem( hwndDlg, IDC_MAP_USER_LIST))
return FALSE;
- HMENU hMainMenu = LoadMenu(hInstance ,MAKEINTRESOURCE(IDR_MSG_EXPORT));
- if( hMainMenu )
+ HMENU hMainMenu = LoadMenu(hInstance,MAKEINTRESOURCE(IDR_MSG_EXPORT));
+ if (hMainMenu )
{
HMENU hMenu = GetSubMenu(hMainMenu,0);
POINT pt;
pt.x=(short)LOWORD(lParam);
pt.y=(short)HIWORD(lParam);
- if( pt.x == -1 && pt.y == -1 )
+ if (pt.x == -1 && pt.y == -1 )
{
- HWND hMapUser = GetDlgItem( hwndDlg , IDC_MAP_USER_LIST );
- int nFirst = ListView_GetNextItem( hMapUser , -1 , LVNI_FOCUSED );
- if( nFirst >= 0 )
+ HWND hMapUser = GetDlgItem( hwndDlg, IDC_MAP_USER_LIST );
+ int nFirst = ListView_GetNextItem( hMapUser, -1, LVNI_FOCUSED );
+ if (nFirst >= 0 )
{
- ListView_GetItemPosition( hMapUser , nFirst , &pt );
+ ListView_GetItemPosition( hMapUser, nFirst, &pt );
}
- if( pt.y < 16 )
+ if (pt.y < 16 )
pt.y = 16;
else
{
RECT rUserList;
- GetClientRect( hMapUser , &rUserList );
- if( pt.y > rUserList.bottom - 16 )
+ GetClientRect( hMapUser, &rUserList );
+ if (pt.y > rUserList.bottom - 16 )
pt.y = rUserList.bottom - 16;
else
pt.y += 8;
@@ -1061,7 +1040,7 @@ static INT_PTR CALLBACK DlgProcMsgExportOpts(HWND hwndDlg, UINT msg, WPARAM wPar
case WM_NOTIFY:
{
NMHDR * p = ((LPNMHDR)lParam);
- if( p->idFrom == IDC_MAP_USER_LIST )
+ if (p->idFrom == IDC_MAP_USER_LIST )
{
switch (p->code)
{
@@ -1069,27 +1048,27 @@ static INT_PTR CALLBACK DlgProcMsgExportOpts(HWND hwndDlg, UINT msg, WPARAM wPar
{ LVHITTESTINFO hti;
LVITEM lvi;
hti.pt=((NMLISTVIEW*)lParam)->ptAction;
- ListView_SubItemHitTest( p->hwndFrom ,&hti);
+ ListView_SubItemHitTest( p->hwndFrom,&hti);
- if( hti.flags != LVHT_ONITEMICON )
+ if (hti.flags != LVHT_ONITEMICON)
break;
lvi.mask=LVIF_IMAGE;
lvi.iItem=hti.iItem;
lvi.iSubItem=0;
- ListView_GetItem( p->hwndFrom , &lvi);
+ ListView_GetItem( p->hwndFrom, &lvi);
lvi.iImage^=1;
- ListView_SetItem( p->hwndFrom , &lvi);
+ ListView_SetItem( p->hwndFrom, &lvi);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
}
case LVN_ENDLABELEDIT:
{
NMLVDISPINFO * pdi = (NMLVDISPINFO *) lParam;
- if( pdi->item.mask & LVIF_TEXT )
+ if (pdi->item.mask & LVIF_TEXT )
{
pdi->item.mask &= LVIF_TEXT;
- ListView_SetItem( p->hwndFrom , &pdi->item );
+ ListView_SetItem( p->hwndFrom, &pdi->item );
bUnaplyedChanges = TRUE;
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
@@ -1099,31 +1078,31 @@ static INT_PTR CALLBACK DlgProcMsgExportOpts(HWND hwndDlg, UINT msg, WPARAM wPar
case LVN_KEYDOWN:
{
NMLVKEYDOWN * lpnmk = (NMLVKEYDOWN *) lParam;
- if( lpnmk->wVKey == 'A' && (GetKeyState( VK_CONTROL ) & 0x8000) )
+ if (lpnmk->wVKey == 'A' && (GetKeyState( VK_CONTROL) & 0x8000))
{
// select all
int nCount = ListView_GetItemCount( p->hwndFrom );
for( int nCur = 0 ; nCur < nCount ; nCur++ )
{
- ListView_SetItemState( p->hwndFrom , nCur , LVIS_SELECTED , LVIS_SELECTED );
+ ListView_SetItemState( p->hwndFrom, nCur, LVIS_SELECTED, LVIS_SELECTED );
}
return TRUE;
}
- if( lpnmk->wVKey == VK_F2 ||
+ if (lpnmk->wVKey == VK_F2 ||
( lpnmk->wVKey >= 'A' && lpnmk->wVKey <= 'Z') ||
( lpnmk->wVKey >= '1' && lpnmk->wVKey <= '9') ||
lpnmk->wVKey == VK_BACK
)
{
- HWND hEdit = ListView_EditLabel( p->hwndFrom , ListView_GetSelectionMark(p->hwndFrom) );
- if( hEdit && lpnmk->wVKey != VK_F2 )
+ HWND hEdit = ListView_EditLabel( p->hwndFrom, ListView_GetSelectionMark(p->hwndFrom));
+ if (hEdit && lpnmk->wVKey != VK_F2 )
{
- if( isupper( lpnmk->wVKey ) )
- SendMessage( hEdit , WM_CHAR , tolower( lpnmk->wVKey ) , 0 );
+ if (isupper( lpnmk->wVKey))
+ SendMessage( hEdit, WM_CHAR, tolower( lpnmk->wVKey ), 0 );
else
- SendMessage( hEdit , WM_CHAR , lpnmk->wVKey , 0 );
+ SendMessage( hEdit, WM_CHAR, lpnmk->wVKey, 0 );
}
}
return TRUE;
@@ -1131,9 +1110,9 @@ static INT_PTR CALLBACK DlgProcMsgExportOpts(HWND hwndDlg, UINT msg, WPARAM wPar
case NM_DBLCLK:
{
NMITEMACTIVATE * pdi = (NMITEMACTIVATE *) lParam;
- if( pdi->iItem >= 0 )
+ if (pdi->iItem >= 0 )
{
- ListView_EditLabel( p->hwndFrom , pdi->iItem );
+ ListView_EditLabel( p->hwndFrom, pdi->iItem );
}
return TRUE;
}
@@ -1149,9 +1128,9 @@ static INT_PTR CALLBACK DlgProcMsgExportOpts(HWND hwndDlg, UINT msg, WPARAM wPar
}
case CDDS_ITEMPREPAINT:
{
- if( lplvcd->nmcd.lItemlParam == 0 )
+ if (lplvcd->nmcd.lItemlParam == 0 )
{
- lplvcd->clrText = RGB( 0 , 0 , 255 );
+ lplvcd->clrText = RGB( 0, 0, 255 );
}
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, CDRF_NEWFONT);
return true;
@@ -1173,10 +1152,10 @@ static INT_PTR CALLBACK DlgProcMsgExportOpts(HWND hwndDlg, UINT msg, WPARAM wPar
case HDN_ITEMCLICK:
{
NMHEADER * phdr = (LPNMHEADER) p;
- if( phdr->iButton == 0 )// 0 => Left button
+ if (phdr->iButton == 0 )// 0 => Left button
{
- HWND hMapUser = GetDlgItem( hwndDlg , IDC_MAP_USER_LIST );
- ListView_SortItems( hMapUser , CompareFunc , phdr->iItem );
+ HWND hMapUser = GetDlgItem( hwndDlg, IDC_MAP_USER_LIST );
+ ListView_SortItems( hMapUser, CompareFunc, phdr->iItem );
return TRUE;
}
return FALSE;
@@ -1198,30 +1177,30 @@ static INT_PTR CALLBACK DlgProcMsgExportOpts(HWND hwndDlg, UINT msg, WPARAM wPar
//
// References : -
// Remarks : -
-// Created : 050429 , 29 april 2005
+// Created : 050429, 29 april 2005
// Developer : KN
/////////////////////////////////////////////////////////////////////
BOOL bApplyChanges2( HWND hwndDlg )
{
- if( IsDlgButtonChecked( hwndDlg , IDC_FC_PROMPT ) == BST_CHECKED )
+ if (IsDlgButtonChecked( hwndDlg, IDC_FC_PROMPT) == BST_CHECKED )
enRenameAction = eDAPromptUser;
- else if( IsDlgButtonChecked( hwndDlg , IDC_FC_RENAME ) == BST_CHECKED )
+ else if (IsDlgButtonChecked( hwndDlg, IDC_FC_RENAME) == BST_CHECKED )
enRenameAction = eDAAutomatic;
- else if( IsDlgButtonChecked( hwndDlg , IDC_FC_NOTHING ) == BST_CHECKED )
+ else if (IsDlgButtonChecked( hwndDlg, IDC_FC_NOTHING) == BST_CHECKED )
enRenameAction = eDANothing;
- if( IsDlgButtonChecked( hwndDlg , IDC_FD_PROMPT ) == BST_CHECKED )
+ if (IsDlgButtonChecked( hwndDlg, IDC_FD_PROMPT) == BST_CHECKED )
enDeleteAction = eDAPromptUser;
- else if( IsDlgButtonChecked( hwndDlg , IDC_FD_DELETE ) == BST_CHECKED )
+ else if (IsDlgButtonChecked( hwndDlg, IDC_FD_DELETE) == BST_CHECKED )
enDeleteAction = eDAAutomatic;
- else if( IsDlgButtonChecked( hwndDlg , IDC_FD_NOTHING ) == BST_CHECKED )
+ else if (IsDlgButtonChecked( hwndDlg, IDC_FD_NOTHING) == BST_CHECKED )
enDeleteAction = eDANothing;
char szTemp[ 500 ];
- strcpy( szTemp , "DisableProt_" );
+ strcpy( szTemp, "DisableProt_" );
- HWND hMapUser = GetDlgItem( hwndDlg , IDC_EXPORT_PROTOS );
+ HWND hMapUser = GetDlgItem( hwndDlg, IDC_EXPORT_PROTOS );
int nCount = ListView_GetItemCount( hMapUser );
for( int nCur = 0 ; nCur < nCount ; nCur++ )
{
@@ -1230,12 +1209,12 @@ BOOL bApplyChanges2( HWND hwndDlg )
sItem.mask = LVIF_TEXT | LVIF_IMAGE;
sItem.pszText = &szTemp[12];
sItem.cchTextMax = sizeof( szTemp )-15;
- if( ::SendMessage(hMapUser, LVM_GETITEMA, 0, (LPARAM)&sItem ) )
+ if (::SendMessage(hMapUser, LVM_GETITEMA, 0, (LPARAM)&sItem))
{
- if( sItem.iImage )
- db_unset( NULL , MODULE , szTemp ); // default is Enabled !!
+ if (sItem.iImage )
+ db_unset( NULL, MODULE, szTemp ); // default is Enabled !!
else
- db_set_b( NULL , MODULE , szTemp,0);
+ db_set_b( NULL, MODULE, szTemp,0);
}
}
SaveSettings();
@@ -1254,7 +1233,7 @@ BOOL bApplyChanges2( HWND hwndDlg )
//
// References : -
// Remarks : -
-// Created : 040205 , 05 februar 2004
+// Created : 040205, 05 februar 2004
// Developer : KN
/////////////////////////////////////////////////////////////////////
@@ -1270,41 +1249,41 @@ static INT_PTR CALLBACK DlgProcMsgExportOpts2(HWND hwndDlg, UINT msg, WPARAM wPa
switch( enRenameAction )
{
case eDAPromptUser:
- CheckDlgButton( hwndDlg , IDC_FC_PROMPT , true );
+ CheckDlgButton( hwndDlg, IDC_FC_PROMPT, true );
break;
case eDAAutomatic:
- CheckDlgButton( hwndDlg , IDC_FC_RENAME , true );
+ CheckDlgButton( hwndDlg, IDC_FC_RENAME, true );
break;
case eDANothing:
- CheckDlgButton( hwndDlg , IDC_FC_NOTHING , true );
+ CheckDlgButton( hwndDlg, IDC_FC_NOTHING, true );
break;
}
switch( enDeleteAction )
{
case eDAPromptUser:
- CheckDlgButton( hwndDlg , IDC_FD_PROMPT , true );
+ CheckDlgButton( hwndDlg, IDC_FD_PROMPT, true );
break;
case eDAAutomatic:
- CheckDlgButton( hwndDlg , IDC_FD_DELETE , true );
+ CheckDlgButton( hwndDlg, IDC_FD_DELETE, true );
break;
case eDANothing:
- CheckDlgButton( hwndDlg , IDC_FD_NOTHING , true );
+ CheckDlgButton( hwndDlg, IDC_FD_NOTHING, true );
break;
}
- HWND hMapUser = GetDlgItem( hwndDlg , IDC_EXPORT_PROTOS );
+ HWND hMapUser = GetDlgItem( hwndDlg, IDC_EXPORT_PROTOS );
/*
{ // init adv. win styles
DWORD dw = ListView_GetExtendedListViewStyle( hMapUser );
dw |= LVS_EX_HEADERDRAGDROP | LVS_EX_FULLROWSELECT;
- ListView_SetExtendedListViewStyle( hMapUser , dw /);
+ ListView_SetExtendedListViewStyle( hMapUser, dw /);
}
*/
int nColumnWidth = 100;
RECT rListSize;
- if( GetWindowRect( hMapUser , &rListSize ) )
+ if (GetWindowRect( hMapUser, &rListSize))
{
nColumnWidth = (rListSize.right - rListSize.left- GetSystemMetrics(SM_CXVSCROLL) - 5 );
- if( nColumnWidth < 10 )
+ if (nColumnWidth < 10)
nColumnWidth = 10;
}
@@ -1313,12 +1292,12 @@ static INT_PTR CALLBACK DlgProcMsgExportOpts2(HWND hwndDlg, UINT msg, WPARAM wPa
cCol.mask = LVCF_TEXT | LVCF_WIDTH;
cCol.cx = nColumnWidth;
cCol.pszText = TranslateT("Export Protocols");
- ListView_InsertColumn( hMapUser , 0 , &cCol );
+ ListView_InsertColumn( hMapUser, 0, &cCol );
}
{
HIMAGELIST hIml;
- hIml = ImageList_Create( GetSystemMetrics(SM_CXSMICON) , GetSystemMetrics(SM_CYSMICON),ILC_COLOR4|ILC_MASK,2,2);
+ hIml = ImageList_Create( GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON),ILC_COLOR4|ILC_MASK,2,2);
ImageList_AddIcon(hIml,LoadIcon(GetModuleHandle(NULL),MAKEINTRESOURCE(IDI_NOTICK)));
ImageList_AddIcon(hIml,LoadIcon(GetModuleHandle(NULL),MAKEINTRESOURCE(IDI_TICK)));
ListView_SetImageList( hMapUser, hIml, LVSIL_SMALL);
@@ -1338,7 +1317,7 @@ static INT_PTR CALLBACK DlgProcMsgExportOpts2(HWND hwndDlg, UINT msg, WPARAM wPa
mir_snprintf(szTemp, SIZEOF(szTemp), "DisableProt_%s", proto[i]->szModuleName);
sItem.pszText = proto[i]->szModuleName;
sItem.iImage = db_get_b(NULL,MODULE,szTemp,1);
- ::SendMessage( hMapUser , LVM_INSERTITEMA , 0 ,(LPARAM)&sItem );
+ ::SendMessage( hMapUser, LVM_INSERTITEMA, 0,(LPARAM)&sItem );
sItem.iItem++;
}
}
@@ -1359,10 +1338,10 @@ static INT_PTR CALLBACK DlgProcMsgExportOpts2(HWND hwndDlg, UINT msg, WPARAM wPa
case IDC_FD_DELETE:
case IDC_FD_NOTHING:
{
- if( !bWindowTextSet )
+ if (!bWindowTextSet )
return TRUE;
- if( HIWORD(wParam) == BN_CLICKED )
+ if (HIWORD(wParam) == BN_CLICKED )
{
bUnaplyedChanges = TRUE;
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
@@ -1380,7 +1359,7 @@ static INT_PTR CALLBACK DlgProcMsgExportOpts2(HWND hwndDlg, UINT msg, WPARAM wPa
case WM_NOTIFY:
{
NMHDR * p = ((LPNMHDR)lParam);
- if( p->idFrom == IDC_EXPORT_PROTOS )
+ if (p->idFrom == IDC_EXPORT_PROTOS )
{
switch (p->code)
{
@@ -1388,17 +1367,17 @@ static INT_PTR CALLBACK DlgProcMsgExportOpts2(HWND hwndDlg, UINT msg, WPARAM wPa
{ LVHITTESTINFO hti;
LVITEM lvi;
hti.pt=((NMLISTVIEW*)lParam)->ptAction;
- ListView_SubItemHitTest( p->hwndFrom ,&hti);
+ ListView_SubItemHitTest( p->hwndFrom,&hti);
- if( hti.flags != LVHT_ONITEMICON )
+ if (hti.flags != LVHT_ONITEMICON)
break;
lvi.mask=LVIF_IMAGE;
lvi.iItem=hti.iItem;
lvi.iSubItem=0;
- ListView_GetItem( p->hwndFrom , &lvi);
+ ListView_GetItem( p->hwndFrom, &lvi);
lvi.iImage^=1;
- ListView_SetItem( p->hwndFrom , &lvi);
+ ListView_SetItem( p->hwndFrom, &lvi);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
}
@@ -1435,7 +1414,7 @@ static INT_PTR CALLBACK DlgProcMsgExportOpts2(HWND hwndDlg, UINT msg, WPARAM wPa
// I need to add my options page.
// References : -
// Remarks : -
-// Created : 020422 , 22 April 2002
+// Created : 020422, 22 April 2002
// Developer : KN
/////////////////////////////////////////////////////////////////////
diff --git a/plugins/Msg_Export/src/options.h b/plugins/Msg_Export/src/options.h
index 60debd4b77..e25db6b573 100755
--- a/plugins/Msg_Export/src/options.h
+++ b/plugins/Msg_Export/src/options.h
@@ -20,7 +20,7 @@
#ifndef MSG_EXP_OPTIONS_H
#define MSG_EXP_OPTIONS_H
-int OptionsInitialize( WPARAM , LPARAM );
-int nExportCompleatList(HWND hParent , bool bOnlySelected );
+int OptionsInitialize( WPARAM, LPARAM );
+int nExportCompleatList(HWND hParent, bool bOnlySelected );
#endif \ No newline at end of file
diff --git a/plugins/Msg_Export/src/utils.cpp b/plugins/Msg_Export/src/utils.cpp
index eb7e51567a..b2339b8ec6 100755
--- a/plugins/Msg_Export/src/utils.cpp
+++ b/plugins/Msg_Export/src/utils.cpp
@@ -19,12 +19,12 @@
#include "Glob.h"
// Default error string used upon errors
-const _TCHAR *pszNickError = LPGENT("No_Nick");
-const _TCHAR *pszGroupError = LPGENT("No_Group");
-const _TCHAR *pszDbPathError = _T(".");
+const TCHAR *pszNickError = LPGENT("No_Nick");
+const TCHAR *pszGroupError = LPGENT("No_Group");
+const TCHAR *pszDbPathError = _T(".");
// Replacement for chareteres not alowed in file names.
-const _TCHAR cBadCharReplace = _T('_');
+const TCHAR cBadCharReplace = _T('_');
// sTimeFormat
tstring sTimeFormat;
@@ -45,33 +45,33 @@ tstring sMirandaPath = pszDbPathError;
// if a file contains events from many users the one user name
// may be shorter. so to make all event have the same first
// column width this map contains the largest user name
-map<tstring , string::size_type , less<tstring> > clFileTo1ColWidth;
+map<tstring, string::size_type, less<tstring> > clFileTo1ColWidth;
// default line width
int nMaxLineWidth = 80;
-const _TCHAR *pszReplaceList[] =
+const TCHAR *pszReplaceList[] =
{
- _T("%FirstName%") ,
- _T("%LastName%") ,
- _T("%e-mail%") ,
- _T("%Nick%") ,
- _T("%City%") ,
- _T("%State%") ,
- _T("%Phone%") ,
- _T("%Homepage%") ,
+ _T("%FirstName%") ,
+ _T("%LastName%") ,
+ _T("%e-mail%"),
+ _T("%Nick%"),
+ _T("%City%"),
+ _T("%State%"),
+ _T("%Phone%"),
+ _T("%Homepage%"),
_T("%About%")
};
const char *pszReplaceListA[] =
{
- "FirstName" ,
- "LastName" ,
- "e-mail" ,
- "Nick" ,
- "City" ,
- "State" ,
- "Phone" ,
- "Homepage" ,
+ "FirstName",
+ "LastName",
+ "e-mail",
+ "Nick",
+ "City",
+ "State",
+ "Phone",
+ "Homepage",
"About"
};
@@ -93,7 +93,7 @@ bool bUseUtf8InNewFiles = true;
const char szUtf8ByteOrderHeader[] = "\xEF\xBB\xBF";
bool bIsUtf8Header( BYTE * pucByteOrder )
{
- return memcmp( pucByteOrder , szUtf8ByteOrderHeader , 3 ) == 0;
+ return memcmp( pucByteOrder, szUtf8ByteOrderHeader, 3) == 0;
}
/////////////////////////////////////////////////////////////////////
@@ -105,7 +105,7 @@ bool bIsUtf8Header( BYTE * pucByteOrder )
//
// References : -
// Remarks : -
-// Created : 021228 , 28 December 2002
+// Created : 021228, 28 December 2002
// Developer : KN
/////////////////////////////////////////////////////////////////////
@@ -118,7 +118,7 @@ void ShowDebugInfo()
sDebug += _T("\r\nsDefaultFile :");
sDebug += sDefaultFile;
- sDebug += _T("\r\nGetFilePathFromUser( NULL ) :");
+ sDebug += _T("\r\nGetFilePathFromUser( NULL) :");
sDebug += GetFilePathFromUser( NULL );
MessageBox(NULL, sDebug.c_str(), MSG_BOX_TITEL, MB_OK);
@@ -134,19 +134,19 @@ void ShowDebugInfo()
//
// References : -
// Remarks : -
-// Created : 030107 , 07 January 2003
+// Created : 030107, 07 January 2003
// Developer : KN
/////////////////////////////////////////////////////////////////////
-int nGetFormatCount( const _TCHAR * pszToCheck )
+int nGetFormatCount( const TCHAR *pszToCheck )
{
- if( !pszToCheck || pszToCheck[0] == 0 )
+ if (!pszToCheck || pszToCheck[0] == 0 )
return 0;
int nCount = 0;
for( ; pszToCheck[1] != 0 ; pszToCheck++)
{
- if( pszToCheck[0] == '%' && pszToCheck[1] != '%' )
+ if (pszToCheck[0] == '%' && pszToCheck[1] != '%' )
nCount++;
}
return nCount;
@@ -157,32 +157,32 @@ int nGetFormatCount( const _TCHAR * pszToCheck )
// Type : Global
// Parameters : szEng - ?
// nFormatCount - ?
-// Returns : _TCHAR *
+// Returns : TCHAR *
// Description :
//
// References : -
// Remarks : -
-// Created : 030107 , 07 January 2003
+// Created : 030107, 07 January 2003
// Developer : KN
/////////////////////////////////////////////////////////////////////
/*
-_TCHAR * CheckedTranslate( const _TCHAR *szEng , int nFormatCount )//= -1
+TCHAR *CheckedTranslate( const TCHAR *szEng, int nFormatCount )//= -1
{
- _TCHAR * szRet = TranslateTS( szEng );
- if( szEng == szRet )
- return (_TCHAR*)szEng;
+ TCHAR *szRet = TranslateTS( szEng );
+ if (szEng == szRet )
+ return (TCHAR*)szEng;
- if( nFormatCount == -1 )
+ if (nFormatCount == -1 )
nFormatCount = nGetFormatCount( szEng );
- if( nFormatCount != nGetFormatCount( szRet ) )
+ if (nFormatCount != nGetFormatCount( szRet))
{
tstring sError = _T("The language pack you are using has an error in the transalation of\r\n");
sError += szEng;
sError += _T("\r\n--------------- It was translated to ---------------\r\n");
sError += szRet;
- MessageBox( NULL , sError.c_str() ,MSG_BOX_TITEL ,MB_OK );
- return (_TCHAR*)szEng;
+ MessageBox( NULL, sError.c_str(),MSG_BOX_TITEL,MB_OK );
+ return (TCHAR*)szEng;
}
return szRet;
}
@@ -196,7 +196,7 @@ _TCHAR * CheckedTranslate( const _TCHAR *szEng , int nFormatCount )//= -1
//
// References : -
// Remarks : -
-// Created : 021012 , 12 October 2002
+// Created : 021012, 12 October 2002
// Developer : KN
/////////////////////////////////////////////////////////////////////
@@ -215,9 +215,9 @@ tstring sGetErrorString(DWORD dwError)
// ...
// Display the string.
tstring ret = (LPCTSTR)lpMsgBuf;
- ReplaceAll( ret , _T("\r") , _T(" "));
- ReplaceAll( ret , _T("\n") , _T(" "));
- ReplaceAll( ret , _T(" ") , _T(" "));
+ ReplaceAll( ret, _T("\r"), _T(" "));
+ ReplaceAll( ret, _T("\n"), _T(" "));
+ ReplaceAll( ret, _T(" "), _T(" "));
// Free the buffer.
LocalFree( lpMsgBuf );
@@ -229,12 +229,12 @@ tstring sGetErrorString()
return sGetErrorString(GetLastError());
}
-void DisplayLastError(const _TCHAR * pszError)
+void DisplayLastError(const TCHAR *pszError)
{
tstring sError = pszError;
DWORD error = GetLastError();
- _TCHAR szTemp[50];
+ TCHAR szTemp[50];
_sntprintf(szTemp, sizeof(szTemp), _T("\r\nErrorCode: %d\r\n"), error);
sError += szTemp;
sError += sGetErrorString(error);
@@ -246,19 +246,19 @@ void DisplayLastError(const _TCHAR * pszError)
// Member Function : NickFromHandle
// Type : Global
// Parameters : hContact - ?
-// Returns : _TCHAR*
+// Returns : TCHAR*
// Description : Reads a Nick from the database and returns a
// pointer to this.
// References : -
// Remarks : -
-// Created : 020422 , 22 April 2002
+// Created : 020422, 22 April 2002
// Developer : KN
/////////////////////////////////////////////////////////////////////
-const _TCHAR* NickFromHandle(HANDLE hContact)
+const TCHAR* NickFromHandle(HANDLE hContact)
{
- const _TCHAR * psz = (const _TCHAR *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR );
- if( psz )
+ const TCHAR *psz = (const TCHAR *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR );
+ if (psz )
return psz;
return pszNickError;
}
@@ -275,25 +275,25 @@ const _TCHAR* NickFromHandle(HANDLE hContact)
// Just like those in database.h
// References : -
// Remarks : -
-// Created : 020422 , 22 April 2002
+// Created : 020422, 22 April 2002
// Developer : KN
/////////////////////////////////////////////////////////////////////
-tstring _DBGetStringW(HANDLE hContact,const char *szModule,const char *szSetting , const _TCHAR * pszError )
+tstring _DBGetStringW(HANDLE hContact,const char *szModule,const char *szSetting, const TCHAR *pszError )
{
tstring ret;
DBVARIANT dbv = {0};
//DBGetContactSetting
- if( ! db_get_ws( hContact , szModule , szSetting , &dbv ) )
+ if ( !db_get_ws( hContact, szModule, szSetting, &dbv))
{
- if( dbv.type != DBVT_WCHAR)
+ if (dbv.type != DBVT_WCHAR)
{
MessageBox(NULL, TranslateT("DB: Attempt to get wrong type of value, string"), MSG_BOX_TITEL, MB_OK);
ret = pszError;
}
else
{
- ret = (_TCHAR*)dbv.pszVal;
+ ret = (TCHAR*)dbv.pszVal;
}
}
else
@@ -302,13 +302,13 @@ tstring _DBGetStringW(HANDLE hContact,const char *szModule,const char *szSetting
return ret;
}
-string _DBGetStringA(HANDLE hContact,const char *szModule,const char *szSetting , const char * pszError )
+string _DBGetStringA(HANDLE hContact,const char *szModule,const char *szSetting, const char *pszError )
{
string ret;
DBVARIANT dbv = {0};
- if( ! db_get( hContact , szModule , szSetting , &dbv ) )
+ if ( !db_get( hContact, szModule, szSetting, &dbv))
{
- if( dbv.type != DBVT_ASCIIZ)
+ if (dbv.type != DBVT_ASCIIZ)
{
MessageBox(NULL, TranslateT("DB: Attempt to get wrong type of value, string"), MSG_BOX_TITEL, MB_OK);
ret = pszError;
@@ -332,27 +332,27 @@ string _DBGetStringA(HANDLE hContact,const char *szModule,const char *szSetting
// sNew - the string to insert insted of pszReplace
// Returns : void
// Description : will replace all acurances of a string with another string
-// used to replace %user% , and other user
+// used to replace %user%, and other user
// References : -
// Remarks : -
-// Created : 020422 , 22 April 2002
+// Created : 020422, 22 April 2002
// Developer : KN
/////////////////////////////////////////////////////////////////////
-void ReplaceAll( tstring &sSrc , const _TCHAR * pszReplace , const tstring &sNew)
+void ReplaceAll( tstring &sSrc, const TCHAR *pszReplace, const tstring &sNew)
{
string::size_type nCur = 0;
while( (nCur = sSrc.find(pszReplace,nCur)) != sSrc.npos )
{
- sSrc.replace( nCur , _tcslen( pszReplace ) , sNew );
+ sSrc.replace( nCur, _tcslen( pszReplace ), sNew );
nCur += sNew.size();
}
}
-void ReplaceAll( tstring &sSrc , const _TCHAR * pszReplace , const _TCHAR * pszNew)
+void ReplaceAll( tstring &sSrc, const TCHAR *pszReplace, const TCHAR *pszNew)
{
tstring sNew = pszNew;
- ReplaceAll( sSrc , pszReplace , sNew );
+ ReplaceAll( sSrc, pszReplace, sNew );
}
@@ -365,16 +365,16 @@ void ReplaceAll( tstring &sSrc , const _TCHAR * pszReplace , const _TCHAR * pszN
//
// References : -
// Remarks : -
-// Created : 020525 , 25 May 2002
+// Created : 020525, 25 May 2002
// Developer : KN
/////////////////////////////////////////////////////////////////////
bool bCreatePathToFile( tstring sFilePath )
{
string::size_type nPos = sFilePath.rfind( '\\' );
- if( nPos != string::npos )
+ if ( nPos != string::npos )
{
- if( nPos + 1 < sFilePath.size() )
+ if (nPos + 1 < sFilePath.size())
sFilePath.erase( nPos + 1);
}
else
@@ -384,16 +384,16 @@ bool bCreatePathToFile( tstring sFilePath )
}
// create directory
- if( ! CreateDirectory( sFilePath.c_str() , NULL ) )
+ if ( !CreateDirectory( sFilePath.c_str(), NULL))
{
DWORD dwE = GetLastError();
- if( dwE == 183 ) // Cannot create a file when that file already exists.
+ if (dwE == 183) // Cannot create a file when that file already exists.
return true;
- if( ! bCreatePathToFile( sFilePath.substr( 0 , nPos ) ) )
+ if ( !bCreatePathToFile( sFilePath.substr( 0, nPos)) )
return false;
// try again
- if( ! CreateDirectory( sFilePath.c_str() , NULL ) )
+ if ( !CreateDirectory( sFilePath.c_str(), NULL))
{
return false;
}
@@ -412,16 +412,17 @@ bool bCreatePathToFile( tstring sFilePath )
//
// References : -
// Remarks : -
-// Created : 020629 , 29 June 2002
+// Created : 020629, 29 June 2002
// Developer : KN
/////////////////////////////////////////////////////////////////////
-bool bWriteToFile( HANDLE hFile , const char * pszSrc , int nLen = -1 )
+bool bWriteToFile(HANDLE hFile, const char *pszSrc, int nLen = -1)
{
- if( nLen < 0 )
- nLen = (int)strlen( pszSrc );
+ if (nLen < 0)
+ nLen = (int)strlen(pszSrc);
+
DWORD dwBytesWritten;
- return WriteFile( hFile , pszSrc , nLen , &dwBytesWritten , NULL ) && (dwBytesWritten == (DWORD)nLen);
+ return WriteFile( hFile, pszSrc, nLen, &dwBytesWritten, NULL) && (dwBytesWritten == (DWORD)nLen);
}
@@ -436,42 +437,44 @@ bool bWriteToFile( HANDLE hFile , const char * pszSrc , int nLen = -1 )
//
// References : -
// Remarks : -
-// Created : 060130 , 30 januar 2006
+// Created : 060130, 30 januar 2006
// Developer : KN
/////////////////////////////////////////////////////////////////////
-bool bWriteTextToFile( HANDLE hFile , const _TCHAR * pszSrc , bool bUtf8File ,int nLen = -1 )
+static bool bWriteTextToFile(HANDLE hFile, const TCHAR *pszSrc, bool bUtf8File, int nLen = -1)
{
- if( nLen < 0 )
- nLen = (int)_tcslen( pszSrc );
- if( ! bUtf8File )
- {
-// We need to downgrade text to ansi
- char * pszAstr = new char[nLen];
- int nAnsiLen = WideCharToMultiByte(CP_ACP, 0, pszSrc, nLen, pszAstr , nLen , NULL , NULL );
- bool bRet = bWriteToFile( hFile , pszAstr , nAnsiLen );
- delete [] pszAstr;
- return bRet;
+ if (nLen != -1) {
+ TCHAR *tmp = (TCHAR*)alloca(sizeof(TCHAR)*(nLen+1));
+ _tcsncpy(tmp, pszSrc, nLen);
+ tmp[nLen] = 0;
+ pszSrc = tmp;
}
- char * pszUtf8 = new char[nLen*3];// UCS-2 can't generate more then this.
- int nUtf8Len = WideCharToMultiByte(CP_UTF8, 0, pszSrc, nLen, pszUtf8 , nLen * 3 , NULL , NULL );
- bool bRet = bWriteToFile( hFile , pszUtf8 , nUtf8Len );
- return bRet;
+ if ( !bUtf8File) {
+ // We need to downgrade text to ansi
+ mir_ptr<char> pszAstr( mir_t2a(pszSrc));
+ return bWriteToFile(hFile, pszAstr, -1);
+ }
+
+ mir_ptr<char> pszUtf8( mir_utf8encodeT(pszSrc));
+ return bWriteToFile(hFile, pszUtf8, -1);
}
-bool bWriteTextToFile( HANDLE hFile , const char * pszSrc , bool bUtf8File ,int nLen = -1 )
+static bool bWriteTextToFile( HANDLE hFile, const char *pszSrc, bool bUtf8File, int nLen = -1)
{
- if( nLen == -1 )
- nLen = (int)strlen( pszSrc );
- wchar_t * pszWstr = new wchar_t[nLen];
- bool bRet = false;
- if( MultiByteToWideChar(CP_ACP, 0, pszSrc, nLen, pszWstr, nLen ) == nLen )
- {
- bRet = bWriteTextToFile( hFile , pszWstr , bUtf8File , nLen );
+ if ( !bUtf8File)
+ return bWriteToFile(hFile, pszSrc, nLen);
+
+ if (nLen != -1) {
+ char *tmp = (char*)alloca(nLen+1);
+ strncpy(tmp, pszSrc, nLen);
+ tmp[nLen] = 0;
+ pszSrc = tmp;
}
- return bRet;
+
+ mir_ptr<char> pszUtf8( mir_utf8encode(pszSrc));
+ return bWriteToFile(hFile, pszUtf8, -1);
}
/////////////////////////////////////////////////////////////////////
@@ -484,16 +487,16 @@ bool bWriteTextToFile( HANDLE hFile , const char * pszSrc , bool bUtf8File ,int
//
// References : -
// Remarks : -
-// Created : 020629 , 29 June 2002
+// Created : 020629, 29 June 2002
// Developer : KN
/////////////////////////////////////////////////////////////////////
const char szNewLineIndent[] = "\r\n ";
-bool bWriteNewLine( HANDLE hFile , DWORD dwIndent )
+bool bWriteNewLine( HANDLE hFile, DWORD dwIndent )
{
- if( dwIndent > sizeof( szNewLineIndent ) - 2 )
- dwIndent = sizeof( szNewLineIndent ) - 2;
- return bWriteToFile( hFile , szNewLineIndent , dwIndent + 2 );
+ if (dwIndent > sizeof( szNewLineIndent) - 2 )
+ dwIndent = sizeof( szNewLineIndent) - 2;
+ return bWriteToFile( hFile, szNewLineIndent, dwIndent + 2 );
}
/////////////////////////////////////////////////////////////////////
@@ -507,18 +510,18 @@ bool bWriteNewLine( HANDLE hFile , DWORD dwIndent )
//
// References : -
// Remarks : -
-// Created : 021203 , 03 December 2002
+// Created : 021203, 03 December 2002
// Developer : KN
/////////////////////////////////////////////////////////////////////
-bool bWriteHexToFile( HANDLE hFile , void * pData, int nSize )
+bool bWriteHexToFile( HANDLE hFile, void * pData, int nSize )
{
char cBuf[10];
BYTE * p = (BYTE*)pData;
for( int n = 0 ; n < nSize ; n++ )
{
- sprintf( cBuf , "%.2X " , p[n] );
- if( ! bWriteToFile( hFile , cBuf , 3 ) )
+ sprintf( cBuf, "%.2X ", p[n] );
+ if ( !bWriteToFile( hFile, cBuf, 3))
return false;
}
return true;
@@ -533,17 +536,17 @@ bool bWriteHexToFile( HANDLE hFile , void * pData, int nSize )
// Handles the reading from the mirandaboot.ini to get the %dbpath%
// References : -
// Remarks : -
-// Created : 020422 , 22 April 2002
+// Created : 020422, 22 April 2002
// Developer : KN
/////////////////////////////////////////////////////////////////////
bool bReadMirandaDirAndPath()
{
- _TCHAR szDBPath[MAX_PATH];
+ TCHAR szDBPath[MAX_PATH];
char tmp[MAX_PATH];
TCHAR *tmp2;
- _tcscpy( szDBPath , pszDbPathError );
+ _tcscpy( szDBPath, pszDbPathError );
PathToAbsolute("miranda32.exe", tmp);
tmp2 = mir_utf8decodeT(tmp);
sMirandaPath = tmp2;
@@ -565,16 +568,16 @@ bool bReadMirandaDirAndPath()
//
// References : -
// Remarks : -
-// Created : 021020 , 20 October 2002
+// Created : 021020, 20 October 2002
// Developer : KN
/////////////////////////////////////////////////////////////////////
void ReplaceDBPath( tstring &sRet )
{
- ReplaceAll( sRet , _T("%dbpath%") , sDBPath );
+ ReplaceAll( sRet, _T("%dbpath%"), sDBPath );
// Try to firure out if it is a relative path ( ..\..\MsgExport\ )
- if( sRet.size() <= 2 || ! ( sRet[1] == ':' ||
- ( sRet[0] == '\\' && sRet[1] == '\\' ) )
+ if (sRet.size() <= 2 || ! ( sRet[1] == ':' ||
+ ( sRet[0] == '\\' && sRet[1] == '\\'))
)
{
// Relative path
@@ -594,17 +597,17 @@ void ReplaceDBPath( tstring &sRet )
//
// References : -
// Remarks : -
-// Created : 020422 , 22 April 2002
+// Created : 020422, 22 April 2002
// Developer : KN
/////////////////////////////////////////////////////////////////////
tstring GetFilePathFromUser( HANDLE hContact )
{
- tstring sFilePath = sExportDir + _DBGetString( hContact , MODULE , "FileName" , sDefaultFile.c_str() );
+ tstring sFilePath = sExportDir + _DBGetString( hContact, MODULE, "FileName", sDefaultFile.c_str());
- bool bNickUsed = sFilePath.find( _T("%nick%") ) != string::npos;
+ bool bNickUsed = sFilePath.find( _T("%nick%")) != string::npos;
- ReplaceDefines( hContact , sFilePath );
+ ReplaceDefines( hContact, sFilePath );
tstring sNoDBPath = sFilePath;
@@ -612,16 +615,16 @@ tstring GetFilePathFromUser( HANDLE hContact )
ReplaceDBPath( sFilePath );
// Previous file name check to see if it has changed !!
- tstring sPrevFileName = _DBGetString( hContact , MODULE , "PrevFileName" , _T("") );
- if( sNoDBPath != sPrevFileName )
+ tstring sPrevFileName = _DBGetString( hContact, MODULE, "PrevFileName", _T(""));
+ if (sNoDBPath != sPrevFileName )
{
- if( ! sPrevFileName.empty() )
+ if ( !sPrevFileName.empty())
{
ReplaceDBPath( sPrevFileName );
// Here we will try to avoide the (Unknown Contact) in cases where the protocol for
// this user has been removed.
- if( bNickUsed && ( _tcsstr( NickFromHandle( hContact ),LPGENT("(Unknown Contact)")) != 0) )
+ if (bNickUsed && ( _tcsstr( NickFromHandle( hContact ),LPGENT("(Unknown Contact)")) != 0))
{
// Then the filename must have changed from a correct path to one including the (Unknown Contact)
return sPrevFileName;
@@ -629,58 +632,58 @@ tstring GetFilePathFromUser( HANDLE hContact )
// file name has changed
- if( enRenameAction != eDANothing )
+ if (enRenameAction != eDANothing )
{
// we can not use FILE_SHARE_DELETE because this is not supported by
// win 98 / ME
- HANDLE hPrevFile = CreateFile( sPrevFileName.c_str() ,
- GENERIC_READ ,
- FILE_SHARE_READ | FILE_SHARE_WRITE ,
+ HANDLE hPrevFile = CreateFile( sPrevFileName.c_str(),
+ GENERIC_READ,
+ FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL,
- OPEN_EXISTING ,
- FILE_ATTRIBUTE_NORMAL ,
+ OPEN_EXISTING,
+ FILE_ATTRIBUTE_NORMAL,
NULL );
- if( hPrevFile != INVALID_HANDLE_VALUE )
+ if (hPrevFile != INVALID_HANDLE_VALUE )
{
CloseHandle( hPrevFile );
- _TCHAR szTemp[500];
+ TCHAR szTemp[500];
// There is a previous file we can move
// ask user ?
bool bTryRename;
- if( enRenameAction != eDAAutomatic )
+ if (enRenameAction != eDAAutomatic )
{
tstring sRemoteUser = NickFromHandle(hContact);
- _sntprintf( szTemp , sizeof( szTemp ) ,
+ _sntprintf( szTemp, sizeof( szTemp ),
TranslateT("File name for the user \"%s\" has changed!\n\nfrom:\t%s\nto:\t%s\n\nDo you wish to rename file?"),
sRemoteUser.c_str(),
sPrevFileName.c_str(),
- sFilePath.c_str() );
- bTryRename = MessageBox(NULL, szTemp, MSG_BOX_TITEL, MB_YESNO ) == IDYES;
+ sFilePath.c_str());
+ bTryRename = MessageBox(NULL, szTemp, MSG_BOX_TITEL, MB_YESNO) == IDYES;
}
else
bTryRename = true;
- if( bTryRename )
+ if (bTryRename )
{
- if( ! MoveFile( sPrevFileName.c_str(), sFilePath.c_str() ) )
+ if ( !MoveFile( sPrevFileName.c_str(), sFilePath.c_str()))
{
// this might be because the new path isent created
// so we will try to create it
bCreatePathToFile( sFilePath );
- while( ! MoveFile( sPrevFileName.c_str(), sFilePath.c_str() ) )
+ while( ! MoveFile( sPrevFileName.c_str(), sFilePath.c_str()))
{
- _sntprintf( szTemp , sizeof( szTemp ) ,
+ _sntprintf( szTemp, sizeof( szTemp ),
TranslateT("Failed to rename file\n\nfrom:\t%s\nto:\t%s\n\nFailed with error: %s"),
sPrevFileName.c_str(),
- sFilePath.c_str() ,
- sGetErrorString().c_str() );
+ sFilePath.c_str(),
+ sGetErrorString().c_str());
- if( MessageBox(NULL, szTemp, MSG_BOX_TITEL, MB_RETRYCANCEL) != IDRETRY)
+ if (MessageBox(NULL, szTemp, MSG_BOX_TITEL, MB_RETRYCANCEL) != IDRETRY)
break;
}
}
@@ -690,7 +693,7 @@ tstring GetFilePathFromUser( HANDLE hContact )
}
// Store the Filename used so that we can check if it changes.
- db_set_ts( hContact , MODULE , "PrevFileName" , sNoDBPath.c_str() );
+ db_set_ts( hContact, MODULE, "PrevFileName", sNoDBPath.c_str());
}
return sFilePath;
@@ -705,7 +708,7 @@ tstring GetFilePathFromUser( HANDLE hContact )
// Description : Replaceses invalid file name chars
// References : -
// Remarks : -
-// Created : 030107 , 07 January 2003
+// Created : 030107, 07 January 2003
// Developer : KN
/////////////////////////////////////////////////////////////////////
@@ -730,16 +733,16 @@ tstring FileNickFromHandle( HANDLE hContact)
//
// References : -
// Remarks : -
-// Created : 040205 , 05 februar 2004
+// Created : 040205, 05 februar 2004
// Developer : KN
/////////////////////////////////////////////////////////////////////
-void ReplaceAllNoColon( tstring &sSrc , const _TCHAR * pszReplace , tstring &sNew)
+void ReplaceAllNoColon( tstring &sSrc, const TCHAR *pszReplace, tstring &sNew)
{
tstring::size_type nCur = 0;
while( (nCur = sNew.find_first_of(_T(':'),nCur)) != sNew.npos )
sNew[nCur] = cBadCharReplace;
- ReplaceAll( sSrc , pszReplace , sNew );
+ ReplaceAll( sSrc, pszReplace, sNew );
}
/////////////////////////////////////////////////////////////////////
@@ -752,33 +755,33 @@ void ReplaceAllNoColon( tstring &sSrc , const _TCHAR * pszReplace , tstring &sNe
//
// References : -
// Remarks : -
-// Created : 020525 , 25 May 2002
+// Created : 020525, 25 May 2002
// Developer : KN
/////////////////////////////////////////////////////////////////////
-void ReplaceDefines( HANDLE hContact , tstring & sTarget )
+void ReplaceDefines( HANDLE hContact, tstring & sTarget )
{
- if( sTarget.find( _T("%nick%") ) != string::npos )
+ if (sTarget.find( _T("%nick%")) != string::npos )
{
- ReplaceAll( sTarget , _T("%nick%") , FileNickFromHandle( hContact ) );
+ ReplaceAll( sTarget, _T("%nick%"), FileNickFromHandle( hContact));
}
- bool bUINUsed = sTarget.find( _T("%UIN%") ) != string::npos;
- bool bEMailUsed = sTarget.find( _T("%e-mail%") ) != string::npos;
- bool bProtoUsed = sTarget.find( _T("%protocol%") ) != string::npos;
- bool bIdentifierUsed = sTarget.find( _T("%identifier%") ) != string::npos;
+ bool bUINUsed = sTarget.find( _T("%UIN%")) != string::npos;
+ bool bEMailUsed = sTarget.find( _T("%e-mail%")) != string::npos;
+ bool bProtoUsed = sTarget.find( _T("%protocol%")) != string::npos;
+ bool bIdentifierUsed = sTarget.find( _T("%identifier%")) != string::npos;
- if( bUINUsed || bEMailUsed || bProtoUsed || bIdentifierUsed )
+ if (bUINUsed || bEMailUsed || bProtoUsed || bIdentifierUsed )
{
- string sProto = _DBGetStringA( hContact , "Protocol" , "p" , "" );
- if( bUINUsed || ( bIdentifierUsed && sProto == "ICQ" ) )
+ string sProto = _DBGetStringA( hContact, "Protocol", "p", "" );
+ if (bUINUsed || ( bIdentifierUsed && sProto == "ICQ"))
{
DWORD dwUIN = db_get_dw(hContact, sProto.c_str(), "UIN", 0);
tstring sReplaceUin;
- if( dwUIN )
+ if (dwUIN )
{
- _TCHAR sTmp[20];
- _sntprintf( sTmp , sizeof( sTmp ) ,_T("%d") , dwUIN );
+ TCHAR sTmp[20];
+ _sntprintf( sTmp, sizeof( sTmp ),_T("%d"), dwUIN );
sReplaceUin = sTmp;
}
else
@@ -786,61 +789,61 @@ void ReplaceDefines( HANDLE hContact , tstring & sTarget )
sReplaceUin = FileNickFromHandle( hContact );
}
- if( bUINUsed )
- ReplaceAll( sTarget , _T("%UIN%") , sReplaceUin );
- if( bIdentifierUsed && sProto == "ICQ" )
+ if (bUINUsed )
+ ReplaceAll( sTarget, _T("%UIN%"), sReplaceUin );
+ if (bIdentifierUsed && sProto == "ICQ" )
{
bIdentifierUsed = false;
- ReplaceAll( sTarget , _T("%identifier%") , sReplaceUin );
+ ReplaceAll( sTarget, _T("%identifier%"), sReplaceUin );
}
}
- if( bEMailUsed || ( bIdentifierUsed && sProto == "MSN"))
+ if (bEMailUsed || ( bIdentifierUsed && sProto == "MSN"))
{
- tstring sEMail = _DBGetString( hContact , sProto.c_str() , "e-mail" , _T("") );
- if( sEMail.empty() )
+ tstring sEMail = _DBGetString( hContact, sProto.c_str(), "e-mail", _T(""));
+ if (sEMail.empty())
{
- sEMail = _DBGetString( hContact , "MSN" , "e-mail" , _T("") );
- if( sEMail.empty() )
+ sEMail = _DBGetString( hContact, "MSN", "e-mail", _T(""));
+ if (sEMail.empty())
{
// We can't finde the E-mail address we will use the the nick
sEMail = FileNickFromHandle( hContact );
}
}
- if( bEMailUsed )
- ReplaceAllNoColon( sTarget , _T("%e-mail%") , sEMail );
- if( bIdentifierUsed && sProto == "MSN")
+ if (bEMailUsed )
+ ReplaceAllNoColon( sTarget, _T("%e-mail%"), sEMail );
+ if (bIdentifierUsed && sProto == "MSN")
{
bIdentifierUsed = false;
- ReplaceAllNoColon( sTarget , _T("%identifier%") , sEMail );
+ ReplaceAllNoColon( sTarget, _T("%identifier%"), sEMail );
}
}
- if( bIdentifierUsed && sProto == "Jabber" )
+ if (bIdentifierUsed && sProto == "Jabber" )
{
- tstring sReplace = _DBGetString( hContact , "Jabber" , "jid" , _T("") );
- if( sReplace.empty() )
+ tstring sReplace = _DBGetString( hContact, "Jabber", "jid", _T(""));
+ if (sReplace.empty())
{
sReplace = FileNickFromHandle( hContact );
}
bIdentifierUsed = false;
- ReplaceAll( sTarget , _T("%identifier%") , sReplace );
+ ReplaceAll( sTarget, _T("%identifier%"), sReplace );
}
- if( bProtoUsed )
+ if (bProtoUsed )
{
- tstring tmp = _DBGetString( hContact , "Protocol" , "p" , _T("") );
- ReplaceAllNoColon( sTarget , _T("%protocol%") , tmp );
+ tstring tmp = _DBGetString( hContact, "Protocol", "p", _T(""));
+ ReplaceAllNoColon( sTarget, _T("%protocol%"), tmp );
}
- if( bIdentifierUsed )
+ if (bIdentifierUsed )
{
// It has still not been replaced we will just use nick
- ReplaceAll( sTarget , _T("%nick%") , FileNickFromHandle( hContact ) );
+ ReplaceAll( sTarget, _T("%nick%"), FileNickFromHandle( hContact));
}
}
- if( sTarget.find( _T("%group%") ) != string::npos )
+ if (sTarget.find( _T("%group%")) != string::npos )
{
- tstring sGroup = _DBGetString( hContact , "CList" , "Group" , _T("") );
- ReplaceAllNoColon( sTarget , _T("%group%") , sGroup );
+ tstring sGroup = _DBGetString( hContact, "CList", "Group", _T(""));
+ ReplaceAllNoColon( sTarget, _T("%group%"), sGroup );
}
// We can't replace the : here because if the user uses C:\... in the file path
@@ -861,26 +864,26 @@ void ReplaceDefines( HANDLE hContact , tstring & sTarget )
//
// References : -
// Remarks : -
-// Created : 040219 , 19 februar 2004
+// Created : 040219, 19 februar 2004
// Developer : KN
/////////////////////////////////////////////////////////////////////
void ReplaceTimeVariables( tstring &sRet )
{
- if( sRet.find( _T("%year%") ) != string::npos ||
- sRet.find( _T("%month%") ) != string::npos ||
- sRet.find( _T("%day%") ) != string::npos )
+ if (sRet.find( _T("%year%")) != string::npos ||
+ sRet.find( _T("%month%")) != string::npos ||
+ sRet.find( _T("%day%")) != string::npos )
{
SYSTEMTIME stTime;
GetLocalTime( &stTime );
- _TCHAR sTmp[20];
-
- _sntprintf( sTmp , sizeof( sTmp ) ,_T("%d") , stTime.wYear );
- ReplaceAll( sRet , _T("%year%") , sTmp );
- _sntprintf( sTmp , sizeof( sTmp ) ,_T("%.2d") , stTime.wMonth );
- ReplaceAll( sRet , _T("%month%") , sTmp );
- _sntprintf( sTmp , sizeof( sTmp ) ,_T("%.2d") , stTime.wDay );
- ReplaceAll( sRet , _T("%day%") , sTmp );
+ TCHAR sTmp[20];
+
+ _sntprintf( sTmp, sizeof( sTmp ),_T("%d"), stTime.wYear );
+ ReplaceAll( sRet, _T("%year%"), sTmp );
+ _sntprintf( sTmp, sizeof( sTmp ),_T("%.2d"), stTime.wMonth );
+ ReplaceAll( sRet, _T("%month%"), sTmp );
+ _sntprintf( sTmp, sizeof( sTmp ),_T("%.2d"), stTime.wDay );
+ ReplaceAll( sRet, _T("%day%"), sTmp );
}
}
@@ -893,7 +896,7 @@ void ReplaceTimeVariables( tstring &sRet )
//
// References : -
// Remarks : -
-// Created : 020422 , 22 April 2002
+// Created : 020422, 22 April 2002
// Developer : KN
/////////////////////////////////////////////////////////////////////
@@ -905,11 +908,11 @@ void UpdateFileToColWidth()
for(;;)
{
tstring sNick = NickFromHandle( hContact );
- string::size_type &rnValue = clFileTo1ColWidth[ GetFilePathFromUser( hContact ) ];
- if( rnValue < sNick.size() )
+ string::size_type &rnValue = clFileTo1ColWidth[ GetFilePathFromUser( hContact) ];
+ if (rnValue < sNick.size())
rnValue = sNick.size();
- if( ! hContact )
+ if ( !hContact )
break;
hContact = db_find_next(hContact);
@@ -929,11 +932,11 @@ void UpdateFileToColWidth()
//
// References : -
// Remarks : -
-// Created : 021203 , 03 December 2002
+// Created : 021203, 03 December 2002
// Developer : KN
/////////////////////////////////////////////////////////////////////
-void DisplayErrorDialog( const _TCHAR * pszError , tstring& sFilePath , DBEVENTINFO * dbei )
+void DisplayErrorDialog( const TCHAR *pszError, tstring& sFilePath, DBEVENTINFO * dbei )
{
tstring sError = TranslateTS(pszError);
sError += sFilePath;
@@ -941,11 +944,11 @@ void DisplayErrorDialog( const _TCHAR * pszError , tstring& sFilePath , DBEVENTI
sError += sGetErrorString();
sError += TranslateT("\nMessage has not been saved!\n");
sError += TranslateT("Do you wish to save debug information?");
- if( MessageBox(NULL, sError.c_str(), MSG_BOX_TITEL, MB_YESNO) == IDYES)
+ if (MessageBox(NULL, sError.c_str(), MSG_BOX_TITEL, MB_YESNO) == IDYES)
{
OPENFILENAME ofn; // common dialog box structure
- _TCHAR szFile[260]; // buffer for file name
- _tcscpy( szFile , _T("DebugInfo.txt") );
+ TCHAR szFile[260]; // buffer for file name
+ _tcscpy( szFile, _T("DebugInfo.txt"));
// Initialize OPENFILENAME
ZeroMemory(&ofn, sizeof(OPENFILENAME));
@@ -963,28 +966,28 @@ void DisplayErrorDialog( const _TCHAR * pszError , tstring& sFilePath , DBEVENTI
// Display the Open dialog box.
- if( GetSaveFileName(&ofn) )
+ if (GetSaveFileName(&ofn))
{
HANDLE hf = CreateFile(ofn.lpstrFile, GENERIC_WRITE,
0, (LPSECURITY_ATTRIBUTES) NULL,
CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL,
(HANDLE) NULL); // file handle
- bWriteTextToFile( hf , sError.c_str() , false );
- if( dbei )
+ bWriteTextToFile( hf, sError.c_str(), false );
+ if (dbei )
{
- bWriteToFile( hf , "\r\ndbei :" );
+ bWriteToFile( hf, "\r\ndbei :" );
- bWriteHexToFile( hf , dbei , sizeof( DBEVENTINFO ));
- if( dbei->pBlob )
+ bWriteHexToFile( hf, dbei, sizeof( DBEVENTINFO ));
+ if (dbei->pBlob )
{
- bWriteToFile( hf , "\r\ndbei.pBlob :" );
- bWriteHexToFile( hf , dbei->pBlob , min( dbei->cbBlob , 10000 ));
+ bWriteToFile( hf, "\r\ndbei.pBlob :" );
+ bWriteHexToFile( hf, dbei->pBlob, min( dbei->cbBlob, 10000 ));
}
- if( dbei->szModule )
+ if (dbei->szModule )
{
- bWriteToFile( hf , "\r\ndbei.szModule :" );
- bWriteToFile( hf , dbei->szModule );
+ bWriteToFile( hf, "\r\ndbei.szModule :" );
+ bWriteToFile( hf, dbei->szModule );
}
}
CloseHandle( hf );
@@ -1002,31 +1005,31 @@ void DisplayErrorDialog( const _TCHAR * pszError , tstring& sFilePath , DBEVENTI
//
// References : -
// Remarks : -
-// Created : 050429 , 29 april 2005
+// Created : 050429, 29 april 2005
// Developer : KN
/////////////////////////////////////////////////////////////////////
void ExportDBEventInfo(HANDLE hContact, DBEVENTINFO &dbei )
{
- _TCHAR szTemp[500];
+ TCHAR szTemp[500];
tstring sFilePath = GetFilePathFromUser( hContact );
GetLastError();// Clear last error !!
- HANDLE hFile = CreateFile( sFilePath.c_str() , GENERIC_WRITE | GENERIC_READ, FILE_SHARE_READ , 0 ,OPEN_ALWAYS , FILE_ATTRIBUTE_NORMAL , NULL );
- if( hFile == INVALID_HANDLE_VALUE )
+ HANDLE hFile = CreateFile( sFilePath.c_str(), GENERIC_WRITE | GENERIC_READ, FILE_SHARE_READ, 0,OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL );
+ if (hFile == INVALID_HANDLE_VALUE )
{
// this might be because the path isent created
// so we will try to create it
- if( bCreatePathToFile( sFilePath ) )
+ if (bCreatePathToFile( sFilePath))
{
- hFile = CreateFile( sFilePath.c_str() , GENERIC_WRITE | GENERIC_READ, FILE_SHARE_READ , 0 ,OPEN_ALWAYS , FILE_ATTRIBUTE_NORMAL , NULL );
+ hFile = CreateFile( sFilePath.c_str(), GENERIC_WRITE | GENERIC_READ, FILE_SHARE_READ, 0,OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL );
}
}
- if( hFile == INVALID_HANDLE_VALUE )
+ if (hFile == INVALID_HANDLE_VALUE )
{
- DisplayErrorDialog( LPGENT("Failed to open or create file :\n") , sFilePath , NULL );
+ DisplayErrorDialog( LPGENT("Failed to open or create file :\n"), sFilePath, NULL );
return;
}
@@ -1034,7 +1037,7 @@ void ExportDBEventInfo(HANDLE hContact, DBEVENTINFO &dbei )
tstring sRemoteUser;
string::size_type nFirstColumnWidth;
- if( bUseLessAndGreaterInExport )
+ if (bUseLessAndGreaterInExport )
{
sLocalUser = _T("<<");
sRemoteUser = _T(">>");
@@ -1044,8 +1047,8 @@ void ExportDBEventInfo(HANDLE hContact, DBEVENTINFO &dbei )
{
sLocalUser = NickFromHandle(0);
sRemoteUser = NickFromHandle(hContact);
- nFirstColumnWidth = max( sRemoteUser.size() , clFileTo1ColWidth[sFilePath] );
- nFirstColumnWidth = max( sLocalUser.size() , nFirstColumnWidth );
+ nFirstColumnWidth = max( sRemoteUser.size(), clFileTo1ColWidth[sFilePath] );
+ nFirstColumnWidth = max( sLocalUser.size(), nFirstColumnWidth );
nFirstColumnWidth += 2;
}
@@ -1055,22 +1058,22 @@ void ExportDBEventInfo(HANDLE hContact, DBEVENTINFO &dbei )
DWORD dwLowSize;
DWORD dwHighSize = 0;
- dwLowSize = GetFileSize( hFile , &dwHighSize );
+ dwLowSize = GetFileSize( hFile, &dwHighSize );
- if( dwLowSize == INVALID_FILE_SIZE || dwLowSize != 0 || dwHighSize != 0 )
+ if (dwLowSize == INVALID_FILE_SIZE || dwLowSize != 0 || dwHighSize != 0 )
{
DWORD dwDataRead = 0;
BYTE ucByteOrder[3];
- if( ReadFile( hFile , ucByteOrder , 3 , &dwDataRead , NULL ) )
+ if (ReadFile( hFile, ucByteOrder, 3, &dwDataRead, NULL))
{
bWriteUTF8Format = bIsUtf8Header( ucByteOrder );
}
- DWORD dwPtr = SetFilePointer( hFile , 0 , 0 , FILE_END );
- if( dwPtr == INVALID_SET_FILE_POINTER )
+ DWORD dwPtr = SetFilePointer( hFile, 0, 0, FILE_END );
+ if (dwPtr == INVALID_SET_FILE_POINTER )
{
// we need to aborte mission here because if we continue we risk
// overwriting old log.
- DisplayErrorDialog( LPGENT("Failed to move to the end of the file :\n") , sFilePath , NULL );
+ DisplayErrorDialog( LPGENT("Failed to move to the end of the file :\n"), sFilePath, NULL );
CloseHandle( hFile );
return;
}
@@ -1078,11 +1081,11 @@ void ExportDBEventInfo(HANDLE hContact, DBEVENTINFO &dbei )
else
{
bWriteUTF8Format = bUseUtf8InNewFiles;
- if( bWriteUTF8Format )
+ if (bWriteUTF8Format )
{
- if( ! bWriteToFile( hFile , szUtf8ByteOrderHeader, sizeof( szUtf8ByteOrderHeader ) - 1 ) )
+ if ( !bWriteToFile( hFile, szUtf8ByteOrderHeader, sizeof( szUtf8ByteOrderHeader) - 1))
{
- DisplayErrorDialog( LPGENT("Failed to UTF8 byte order code to file :\n") , sFilePath , NULL );
+ DisplayErrorDialog( LPGENT("Failed to UTF8 byte order code to file :\n"), sFilePath, NULL );
CloseHandle( hFile );
return;
}
@@ -1107,29 +1110,29 @@ void ExportDBEventInfo(HANDLE hContact, DBEVENTINFO &dbei )
// This is written this way because I expect this will become a string the user may set
// in the options dialog.
- ReplaceAll( output , _T("%User%") , sRemoteUser );
+ ReplaceAll( output, _T("%User%"), sRemoteUser );
- string sProto = _DBGetStringA( hContact , "Protocol" , "p" , "" );
- ReplaceAll( output , _T("%Proto%") , _DBGetString( hContact , "Protocol" , "p" , _T("") ) );
+ string sProto = _DBGetStringA( hContact, "Protocol", "p", "" );
+ ReplaceAll( output, _T("%Proto%"), _DBGetString( hContact, "Protocol", "p", _T("")));
for( int nCur = 0 ; nCur < 9 ; nCur++ )
{
- ReplaceAll( output , pszReplaceList[nCur] , _DBGetString( hContact , sProto.c_str() , pszReplaceListA[nCur] , _T("") ) );
+ ReplaceAll( output, pszReplaceList[nCur], _DBGetString( hContact, sProto.c_str(), pszReplaceListA[nCur], _T("")));
}
- _sntprintf( szTemp , sizeof( szTemp ) , _T("%d") , db_get_dw(hContact, sProto.c_str(), "UIN", 0) );
- ReplaceAll( output , _T("%UIN%") , szTemp );
+ _sntprintf( szTemp, sizeof( szTemp ), _T("%d"), db_get_dw(hContact, sProto.c_str(), "UIN", 0));
+ ReplaceAll( output, _T("%UIN%"), szTemp );
- _sntprintf( szTemp , sizeof( szTemp ) , _T("%d") , db_get_w(hContact, sProto.c_str(), "Age", 0));
- ReplaceAll( output , _T("%Age%") , szTemp );
+ _sntprintf( szTemp, sizeof( szTemp ), _T("%d"), db_get_w(hContact, sProto.c_str(), "Age", 0));
+ ReplaceAll( output, _T("%Age%"), szTemp );
- szTemp[0] = (_TCHAR)db_get_b(hContact, sProto.c_str(), "Gender", 0);
+ szTemp[0] = (TCHAR)db_get_b(hContact, sProto.c_str(), "Gender", 0);
szTemp[1] = 0;
- ReplaceAll( output , _T("%Gender%") , szTemp );
+ ReplaceAll( output, _T("%Gender%"), szTemp );
- if( ! bWriteTextToFile( hFile , output.data(), bWriteUTF8Format, (int)output.size() ) )
+ if ( !bWriteTextToFile( hFile, output.data(), bWriteUTF8Format, (int)output.size()))
{
- DisplayErrorDialog( LPGENT("Failed to write user details to file :\n") , sFilePath , NULL );
+ DisplayErrorDialog( LPGENT("Failed to write user details to file :\n"), sFilePath, NULL );
CloseHandle( hFile );
return;
}
@@ -1139,14 +1142,14 @@ void ExportDBEventInfo(HANDLE hContact, DBEVENTINFO &dbei )
int nIndent;
{ // Get time stamp
- nIndent = _sntprintf( szTemp , sizeof( szTemp ) , _T("%-*s") ,
- nFirstColumnWidth ,
- dbei.flags & DBEF_SENT ? sLocalUser.c_str() : sRemoteUser.c_str() );
+ nIndent = _sntprintf( szTemp, sizeof( szTemp ), _T("%-*s"),
+ nFirstColumnWidth,
+ dbei.flags & DBEF_SENT ? sLocalUser.c_str() : sRemoteUser.c_str());
DBTIMETOSTRINGT dbtts;
dbtts.cbDest = sizeof(szTemp) - nIndent - 2;
dbtts.szDest = &szTemp[nIndent];
- dbtts.szFormat = (_TCHAR*)sTimeFormat.c_str();
+ dbtts.szFormat = (TCHAR*)sTimeFormat.c_str();
CallService(MS_DB_TIME_TIMESTAMPTOSTRINGT,dbei.timestamp,(LPARAM)&dbtts);
@@ -1154,15 +1157,15 @@ void ExportDBEventInfo(HANDLE hContact, DBEVENTINFO &dbei )
szTemp[nIndent++] = ' ';
// Write first part of line with name and timestamp
- if( ! bWriteTextToFile( hFile , szTemp , bWriteUTF8Format , nIndent ) )
+ if ( !bWriteTextToFile( hFile, szTemp, bWriteUTF8Format, nIndent))
{
- DisplayErrorDialog( LPGENT("Failed to write timestamp and username to file :\n") , sFilePath , &dbei );
+ DisplayErrorDialog( LPGENT("Failed to write timestamp and username to file :\n"), sFilePath, &dbei );
CloseHandle( hFile );
return;
}
}
- if( dbei.pBlob != NULL && dbei.cbBlob >= 2 )
+ if (dbei.pBlob != NULL && dbei.cbBlob >= 2 )
{
dbei.pBlob[ dbei.cbBlob ] = 0;
@@ -1171,22 +1174,22 @@ void ExportDBEventInfo(HANDLE hContact, DBEVENTINFO &dbei )
case EVENTTYPE_MESSAGE:
{
TCHAR* msg = DbGetEventTextT( &dbei, CP_ACP );
- if( ! bWriteIndentedToFile( hFile , nIndent , msg , bWriteUTF8Format ) )
+ if ( !bWriteIndentedToFile( hFile, nIndent, msg, bWriteUTF8Format))
{
- DisplayErrorDialog( LPGENT("Failed to write message to the file :\n") , sFilePath , &dbei );
+ DisplayErrorDialog( LPGENT("Failed to write message to the file :\n"), sFilePath, &dbei );
}
mir_free(msg);
break;
/*
- const char * pszData = (const char*)dbei.pBlob;
+ const char *pszData = (const char*)dbei.pBlob;
bool bConvertedToUtf8 = false;
- if( bWriteUTF8Format )// Write UTF-8 format in file ?
+ if (bWriteUTF8Format )// Write UTF-8 format in file ?
{
int nAnsiLen = strlen((char *) dbei.pBlob)+1;
- if( nAnsiLen < (int)dbei.cbBlob )
+ if (nAnsiLen < (int)dbei.cbBlob )
{
// Message is also encoded in unicode UTF-16/UCS-2, little endian.
- if( WideCharToMultiByte( CP_UTF8 , 0 , (wchar_t*)&dbei.pBlob[ nAnsiLen ] , nAnsiLen , szTemp , sizeof(szTemp) , 0 , 0 ) )
+ if (WideCharToMultiByte( CP_UTF8, 0, (wchar_t*)&dbei.pBlob[ nAnsiLen ], nAnsiLen, szTemp, sizeof(szTemp), 0, 0))
{
pszData = szTemp;
bConvertedToUtf8 = true;
@@ -1194,19 +1197,19 @@ void ExportDBEventInfo(HANDLE hContact, DBEVENTINFO &dbei )
}
// We need to write in UTF8 format so we have to convert ansi string to UTF8
}
- if( ! bWriteIndentedToFile( hFile , nIndent , pszData , bWriteUTF8Format ) )
+ if ( !bWriteIndentedToFile( hFile, nIndent, pszData, bWriteUTF8Format))
{
- DisplayErrorDialog( _T("Failed to write message to the file :\n") , sFilePath , &dbei );
+ DisplayErrorDialog( _T("Failed to write message to the file :\n"), sFilePath, &dbei );
}
break;*/
}
case EVENTTYPE_URL:
case EVENTTYPE_FILE:
{
- const _TCHAR * pszType;
- const char * pszData;
+ const TCHAR *pszType;
+ const char *pszData;
- if( dbei.eventType == EVENTTYPE_URL )
+ if (dbei.eventType == EVENTTYPE_URL )
{
pszType = LPGENT("URL: ");
pszData = (char *)dbei.pBlob;
@@ -1220,24 +1223,24 @@ void ExportDBEventInfo(HANDLE hContact, DBEVENTINFO &dbei )
bool bWriteOk = false;
int nLen = (int)strlen( pszData );
- if( (pszData - (char *)dbei.pBlob) + nLen < (int)dbei.cbBlob )
+ if ((pszData - (char *)dbei.pBlob) + nLen < (int)dbei.cbBlob )
{
- if( bWriteTextToFile( hFile , pszType , bWriteUTF8Format ) &&
- bWriteIndentedToFile( hFile , nIndent , pszData , bWriteUTF8Format ) )
+ if (bWriteTextToFile( hFile, pszType, bWriteUTF8Format) &&
+ bWriteIndentedToFile( hFile, nIndent, pszData, bWriteUTF8Format))
{
pszData += nLen + 1;
- if( (pszData - (char *)dbei.pBlob) >= (int)dbei.cbBlob )
+ if ((pszData - (char *)dbei.pBlob) >= (int)dbei.cbBlob )
{
bWriteOk = true;
}
else
{
nLen = (int)strlen( pszData );
- if( (pszData - (char *)dbei.pBlob) + nLen < (int)dbei.cbBlob )
+ if ((pszData - (char *)dbei.pBlob) + nLen < (int)dbei.cbBlob )
{
- if( bWriteNewLine( hFile , nIndent ) &&
- bWriteTextToFile( hFile , LPGENT("Description: ") , bWriteUTF8Format) &&
- bWriteIndentedToFile( hFile , nIndent , pszData , bWriteUTF8Format ) )
+ if (bWriteNewLine( hFile, nIndent) &&
+ bWriteTextToFile( hFile, LPGENT("Description: "), bWriteUTF8Format) &&
+ bWriteIndentedToFile( hFile, nIndent, pszData, bWriteUTF8Format))
{
bWriteOk = true;
}
@@ -1246,34 +1249,34 @@ void ExportDBEventInfo(HANDLE hContact, DBEVENTINFO &dbei )
}
}
- if( ! bWriteOk )
- DisplayErrorDialog( LPGENT("Failed to write URL/File to the file :\n") , sFilePath , &dbei );
+ if ( !bWriteOk )
+ DisplayErrorDialog( LPGENT("Failed to write URL/File to the file :\n"), sFilePath, &dbei );
break;
}
case EVENTTYPE_AUTHREQUEST:
case EVENTTYPE_ADDED:
{
- const _TCHAR * pszTypes[] = {
+ const TCHAR *pszTypes[] = {
LPGENT("Nick :"),
LPGENT("FirstName :"),
LPGENT("LastName :"),
LPGENT("e-mail :"),
LPGENT("Reason :")};
- if( dbei.cbBlob < 8 || dbei.cbBlob > 5000 )
+ if (dbei.cbBlob < 8 || dbei.cbBlob > 5000 )
{
- int n = _sntprintf( szTemp , sizeof( szTemp ) , LPGENT("Invalid Database event received. Type %d, size %d"),dbei.eventType, dbei.cbBlob );
- if( ! bWriteTextToFile( hFile , szTemp , bWriteUTF8Format , n ) )
- DisplayErrorDialog( LPGENT("Failed to write Invalid Database event the file :\n") , sFilePath , &dbei );
+ int n = _sntprintf( szTemp, sizeof( szTemp ), LPGENT("Invalid Database event received. Type %d, size %d"),dbei.eventType, dbei.cbBlob );
+ if ( !bWriteTextToFile( hFile, szTemp, bWriteUTF8Format, n))
+ DisplayErrorDialog( LPGENT("Failed to write Invalid Database event the file :\n"), sFilePath, &dbei );
break;
}
bool bWriteOk = false;
int nStringCount;
- const _TCHAR *pszTitle;
+ const TCHAR *pszTitle;
char *pszCurBlobPos;
- if( dbei.eventType == EVENTTYPE_AUTHREQUEST )
+ if (dbei.eventType == EVENTTYPE_AUTHREQUEST )
{ // request
//blob is: uin(DWORD), hContact(DWORD), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), email(ASCIIZ), reason(ASCIIZ)
nStringCount = 5;
@@ -1288,22 +1291,22 @@ void ExportDBEventInfo(HANDLE hContact, DBEVENTINFO &dbei )
pszTitle = LPGENT("The following user added you to their contact list:");
}
- if( bWriteTextToFile( hFile , pszTitle , bWriteUTF8Format ) &&
- bWriteNewLine( hFile , nIndent ) &&
- bWriteTextToFile( hFile , LPGENT("UIN :") , bWriteUTF8Format ) )
+ if (bWriteTextToFile( hFile, pszTitle, bWriteUTF8Format) &&
+ bWriteNewLine( hFile, nIndent) &&
+ bWriteTextToFile( hFile, LPGENT("UIN :"), bWriteUTF8Format))
{
DWORD uin = *((PDWORD)(dbei.pBlob));
- int n = _sntprintf( szTemp , sizeof( szTemp ) ,_T("%d"), uin );
- if( bWriteTextToFile( hFile , szTemp , bWriteUTF8Format , n ) )
+ int n = _sntprintf( szTemp, sizeof( szTemp ),_T("%d"), uin );
+ if (bWriteTextToFile( hFile, szTemp, bWriteUTF8Format, n))
{
char *pszEnd = (char *) (dbei.pBlob + dbei.cbSize);
for( int n = 0 ; n < nStringCount && pszCurBlobPos < pszEnd ; n++ )
{
- if( *pszCurBlobPos )
+ if (*pszCurBlobPos )
{
- if( ! bWriteNewLine( hFile , nIndent ) ||
- ! bWriteTextToFile( hFile , TranslateTS(pszTypes[ n ]) , bWriteUTF8Format ) ||
- ! bWriteIndentedToFile( hFile , nIndent , pszCurBlobPos , bWriteUTF8Format ) )
+ if ( !bWriteNewLine( hFile, nIndent) ||
+ ! bWriteTextToFile( hFile, TranslateTS(pszTypes[ n ]), bWriteUTF8Format) ||
+ ! bWriteIndentedToFile( hFile, nIndent, pszCurBlobPos, bWriteUTF8Format))
{
break;
}
@@ -1315,8 +1318,8 @@ void ExportDBEventInfo(HANDLE hContact, DBEVENTINFO &dbei )
}
}
- if( ! bWriteOk )
- DisplayErrorDialog( LPGENT("Failed to write AUTHREQUEST or ADDED to the file :\n") , sFilePath , &dbei );
+ if ( !bWriteOk )
+ DisplayErrorDialog( LPGENT("Failed to write AUTHREQUEST or ADDED to the file :\n"), sFilePath, &dbei );
break;
}
@@ -1338,53 +1341,53 @@ void ExportDBEventInfo(HANDLE hContact, DBEVENTINFO &dbei )
//ASCIIZ from e-mail
const char* pszStr = (const char*)dbei.pBlob;
- if( dbei.eventType == ICQEVENTTYPE_EMAILEXPRESS )
- bWriteTextToFile( hFile , LPGENT("EmailExpress from:") , bWriteUTF8Format);
+ if (dbei.eventType == ICQEVENTTYPE_EMAILEXPRESS )
+ bWriteTextToFile( hFile, LPGENT("EmailExpress from:"), bWriteUTF8Format);
else
- bWriteTextToFile( hFile , LPGENT("WebPager from:") , bWriteUTF8Format );
+ bWriteTextToFile( hFile, LPGENT("WebPager from:"), bWriteUTF8Format );
- bWriteNewLine( hFile , nIndent );
+ bWriteNewLine( hFile, nIndent );
- size_t nMsgLenght = strlen( pszStr ) + 1;
- if( nMsgLenght < dbei.cbBlob )
+ size_t nMsgLenght = strlen( pszStr) + 1;
+ if (nMsgLenght < dbei.cbBlob )
{
size_t nFriendlyLen = strlen( &pszStr[nMsgLenght] );
- bWriteTextToFile( hFile , &pszStr[nMsgLenght] , bWriteUTF8Format , (int)nFriendlyLen );
+ bWriteTextToFile( hFile, &pszStr[nMsgLenght], bWriteUTF8Format, (int)nFriendlyLen );
size_t nEmailOffset = nMsgLenght + nFriendlyLen + 1;
- if( nEmailOffset < dbei.cbBlob )
+ if (nEmailOffset < dbei.cbBlob )
{
- bWriteTextToFile( hFile , _T("<") , bWriteUTF8Format );
+ bWriteTextToFile( hFile, _T("<"), bWriteUTF8Format );
size_t nEmailLen = strlen( &pszStr[nEmailOffset] );
- bWriteTextToFile( hFile , &pszStr[nEmailOffset] , bWriteUTF8Format , (int)nEmailLen );
- bWriteTextToFile( hFile , _T(">") , bWriteUTF8Format );
+ bWriteTextToFile( hFile, &pszStr[nEmailOffset], bWriteUTF8Format, (int)nEmailLen );
+ bWriteTextToFile( hFile, _T(">"), bWriteUTF8Format );
}
}
else
{
- bWriteTextToFile( hFile , LPGENT("No from address") , bWriteUTF8Format );
+ bWriteTextToFile( hFile, LPGENT("No from address"), bWriteUTF8Format );
}
- if( ! bWriteNewLine( hFile , nIndent ) ||
- ! bWriteIndentedToFile( hFile , nIndent , pszStr , bWriteUTF8Format ) )
+ if ( !bWriteNewLine( hFile, nIndent) ||
+ ! bWriteIndentedToFile( hFile, nIndent, pszStr, bWriteUTF8Format))
{
- DisplayErrorDialog( LPGENT("Failed to write EmailExpress to the file :\n") , sFilePath , &dbei );
+ DisplayErrorDialog( LPGENT("Failed to write EmailExpress to the file :\n"), sFilePath, &dbei );
}
break;
}
case ICQEVENTTYPE_SMS:
{
- if( ! bWriteIndentedToFile( hFile , nIndent , (const char*)dbei.pBlob , bWriteUTF8Format ) )
+ if ( !bWriteIndentedToFile( hFile, nIndent, (const char*)dbei.pBlob, bWriteUTF8Format))
{
- DisplayErrorDialog( LPGENT("Failed to write SMS to the file :\n") , sFilePath , &dbei );
+ DisplayErrorDialog( LPGENT("Failed to write SMS to the file :\n"), sFilePath, &dbei );
}
break;
}
default:
{
- int n = _sntprintf( szTemp , sizeof( szTemp ) , LPGENT("Unknown event type %d, size %d") , dbei.eventType, dbei.cbBlob );
- if( ! bWriteTextToFile( hFile , szTemp , bWriteUTF8Format , n ) )
+ int n = _sntprintf( szTemp, sizeof( szTemp ), LPGENT("Unknown event type %d, size %d"), dbei.eventType, dbei.cbBlob );
+ if ( !bWriteTextToFile( hFile, szTemp, bWriteUTF8Format, n))
{
- DisplayErrorDialog( LPGENT("Failed to write Unknown event to the file :\n") , sFilePath , &dbei );
+ DisplayErrorDialog( LPGENT("Failed to write Unknown event to the file :\n"), sFilePath, &dbei );
}
break;
}
@@ -1392,14 +1395,14 @@ void ExportDBEventInfo(HANDLE hContact, DBEVENTINFO &dbei )
}
else
{
- int n = _sntprintf( szTemp , sizeof( szTemp ) , LPGENT("Unknown event type %d, size %d") , dbei.eventType, dbei.cbBlob );
- bWriteTextToFile( hFile , szTemp , bWriteUTF8Format , n );
+ int n = _sntprintf( szTemp, sizeof( szTemp ), LPGENT("Unknown event type %d, size %d"), dbei.eventType, dbei.cbBlob );
+ bWriteTextToFile( hFile, szTemp, bWriteUTF8Format, n );
}
- bWriteToFile( hFile , bAppendNewLine ? "\r\n\r\n" : "\r\n" );
+ bWriteToFile( hFile, bAppendNewLine ? "\r\n\r\n" : "\r\n" );
CloseHandle( hFile );
- UpdateFileViews( sFilePath.c_str() );
+ UpdateFileViews( sFilePath.c_str());
}
/////////////////////////////////////////////////////////////////////
@@ -1412,7 +1415,7 @@ void ExportDBEventInfo(HANDLE hContact, DBEVENTINFO &dbei )
// Or from the Export All funktion
// References : -
// Remarks : -
-// Created : 020422 , 22 April 2002
+// Created : 020422, 22 April 2002
// Developer : KN
/////////////////////////////////////////////////////////////////////
@@ -1421,7 +1424,7 @@ int nExportEvent(WPARAM wparam,LPARAM lparam)
{
HANDLE hContact = (HANDLE)wparam;
- if( ! db_get_b(hContact,MODULE,"EnableLog",1) )
+ if ( !db_get_b(hContact,MODULE,"EnableLog",1))
return 0;
DBEVENTINFO dbei={0};
@@ -1431,7 +1434,7 @@ int nExportEvent(WPARAM wparam,LPARAM lparam)
{ // Get Blob data size
int nSize = (int)CallService(MS_DB_EVENT_GETBLOBSIZE,(WPARAM)lparam,0);
- if( nSize > 0 )
+ if (nSize > 0 )
{
dbei.cbBlob = nSize;
dbei.pBlob = (PBYTE)malloc(dbei.cbBlob + 2 );
@@ -1443,32 +1446,32 @@ int nExportEvent(WPARAM wparam,LPARAM lparam)
// else dbei.cbBlob will be 0
}
- if( ! CallService(MS_DB_EVENT_GET,(WPARAM)lparam,(LPARAM)&dbei) )
+ if ( !CallService(MS_DB_EVENT_GET,(WPARAM)lparam,(LPARAM)&dbei))
{
- if( dbei.eventType != EVENTTYPE_STATUSCHANGE )
+ if (dbei.eventType != EVENTTYPE_STATUSCHANGE )
{
- _snprintf( szTemp , sizeof( szTemp ) , "DisableProt_%s" , dbei.szModule );
- if( db_get_b(NULL,MODULE,szTemp,1) )
+ _snprintf( szTemp, sizeof( szTemp ), "DisableProt_%s", dbei.szModule );
+ if (db_get_b(NULL,MODULE,szTemp,1))
{
- ExportDBEventInfo( hContact , dbei );
+ ExportDBEventInfo( hContact, dbei );
}
}
}
- if( dbei.pBlob )
+ if (dbei.pBlob )
free(dbei.pBlob);
return 0;
}
#ifdef _UNICODE
-bool bWriteIndentedToFile( HANDLE hFile , int nIndent , const char * pszSrc , bool bUtf8File )
+bool bWriteIndentedToFile( HANDLE hFile, int nIndent, const char *pszSrc, bool bUtf8File )
{
int nLen = (int)strlen( pszSrc );
wchar_t * pszWstr = new wchar_t[nLen+1];
bool bRet = false;
- if( MultiByteToWideChar(CP_ACP, 0, pszSrc, nLen, pszWstr, nLen ) == nLen )
+ if (MultiByteToWideChar(CP_ACP, 0, pszSrc, nLen, pszWstr, nLen) == nLen )
{
pszWstr[nLen] = NULL;
- bRet = bWriteIndentedToFile( hFile , nIndent , pszWstr , bUtf8File );
+ bRet = bWriteIndentedToFile( hFile, nIndent, pszWstr, bUtf8File );
}
return bRet;
}
@@ -1485,11 +1488,11 @@ bool bWriteIndentedToFile( HANDLE hFile , int nIndent , const char * pszSrc , bo
//
// References : -
// Remarks : -
-// Created : 020629 , 29 June 2002
+// Created : 020629, 29 June 2002
// Developer : KN
/////////////////////////////////////////////////////////////////////
-bool bWriteIndentedToFile( HANDLE hFile , int nIndent , const _TCHAR * pszSrc , bool bUtf8File )
+bool bWriteIndentedToFile( HANDLE hFile, int nIndent, const TCHAR *pszSrc, bool bUtf8File )
{
if (pszSrc == NULL)
return true;
@@ -1502,20 +1505,20 @@ bool bWriteIndentedToFile( HANDLE hFile , int nIndent , const _TCHAR * pszSrc ,
int nLineLen = 0;
do
{
- if( pszSrc[nLineLen] == _T('\n') || pszSrc[nLineLen] == _T('\r'))
+ if (pszSrc[nLineLen] == _T('\n') || pszSrc[nLineLen] == _T('\r'))
break;
- if( nLineLen >= nMaxLineWidth )
+ if (nLineLen >= nMaxLineWidth )
{ // ok the line was not broken. we need to force a break
// we will scan backwards again to finde a space !!
// then we will look for a ? and so on.
- const _TCHAR ac[] = { _T(' '),_T('?'),_T('-'),_T('.'),_T(',') };
- for( int y = 0 ; y < sizeof( ac ) ; y++)
+ const TCHAR ac[] = { _T(' '),_T('?'),_T('-'),_T('.'),_T(',') };
+ for( int y = 0 ; y < sizeof( ac) ; y++)
{
for( int n = nLineLen ; n > 0 ; n-- )
{
- if( pszSrc[n] == ac[y] )
+ if (pszSrc[n] == ac[y] )
{
nLineLen = n;
goto SuperBreak;
@@ -1529,7 +1532,7 @@ bool bWriteIndentedToFile( HANDLE hFile , int nIndent , const _TCHAR * pszSrc ,
while( pszSrc[nLineLen] );
// trim away traling spaces !!
- if( nLineLen > 0 )
+ if (nLineLen > 0 )
{
while( pszSrc[nLineLen-1] == ' ' )
nLineLen--;
@@ -1539,31 +1542,31 @@ SuperBreak:
// nLineLen should contain the number af chars we need to write to the file
- if( nLineLen > 0 )
+ if (nLineLen > 0 )
{
- if( !bFirstLine )
+ if (!bFirstLine )
{
- if( ! bWriteNewLine( hFile , nIndent ) )
+ if ( !bWriteNewLine( hFile, nIndent))
{
bOk = false;
}
}
-/* if( bUtf8Src )
+/* if (bUtf8Src )
{
// Programming error writing UTF8 string to ansi file
- if( ! bUtf8File )
+ if ( !bUtf8File )
{
- MessageBox( NULL , _T("Programming error writing UTF8 string to ansi file") ,MSG_BOX_TITEL,MB_OK );
+ MessageBox( NULL, _T("Programming error writing UTF8 string to ansi file") ,MSG_BOX_TITEL,MB_OK );
// bUtf8File must be true here
}
- if( !bWriteToFile( hFile , pszSrc , nLineLen ) )
+ if (!bWriteToFile( hFile, pszSrc, nLineLen))
{
bOk = false;
}
}
else*/
{// Text format !!
- if( ! bWriteTextToFile( hFile , pszSrc , bUtf8File , nLineLen ) )
+ if ( !bWriteTextToFile( hFile, pszSrc, bUtf8File, nLineLen))
bOk = false;
}
}
@@ -1571,12 +1574,12 @@ SuperBreak:
// skip any noice chars, MAC style '\r' '\r' '\n'
// and excess spaces
- const _TCHAR * pszPrev = pszSrc;
+ const TCHAR *pszPrev = pszSrc;
pszSrc += nLineLen;
- while( *pszSrc == _T(' ') || *pszSrc == _T('\n') || *pszSrc == _T('\r') )
+ while( *pszSrc == _T(' ') || *pszSrc == _T('\n') || *pszSrc == _T('\r'))
pszSrc++;
- if( pszPrev == pszSrc )
+ if (pszPrev == pszSrc )
{
// this is an programming error we have not moved forward in string
MessageBox(NULL, _T("Programming error on line __LINE__ please report this"), MSG_BOX_TITEL, MB_OK);
@@ -1599,7 +1602,7 @@ SuperBreak:
//
// References : -
// Remarks : -
-// Created : 021222 , 22 December 2002
+// Created : 021222, 22 December 2002
// Developer : KN
/////////////////////////////////////////////////////////////////////
@@ -1611,7 +1614,7 @@ int nContactDeleted(WPARAM wparam,LPARAM /*lparam*/)
if(hInternalWindow)
CloseWindow(hInternalWindow);
- if( enDeleteAction == eDANothing )
+ if (enDeleteAction == eDANothing )
return 0;
tstring sFilePath = GetFilePathFromUser( hContact );
@@ -1619,7 +1622,7 @@ int nContactDeleted(WPARAM wparam,LPARAM /*lparam*/)
{ // Test if there is another user using this file
for(HANDLE hOtherContact = db_find_first();hOtherContact;hOtherContact = db_find_next(hOtherContact))
{
- if( hContact != hOtherContact && sFilePath == GetFilePathFromUser( hOtherContact ) )
+ if (hContact != hOtherContact && sFilePath == GetFilePathFromUser( hOtherContact))
{
return 0; // we found another contact abort mission :-)
}
@@ -1628,31 +1631,31 @@ int nContactDeleted(WPARAM wparam,LPARAM /*lparam*/)
// Test to see if there is a file to delete
- HANDLE hPrevFile = CreateFile( sFilePath.c_str() ,
- GENERIC_READ ,
- FILE_SHARE_READ | FILE_SHARE_WRITE ,
+ HANDLE hPrevFile = CreateFile( sFilePath.c_str(),
+ GENERIC_READ,
+ FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL,
- OPEN_EXISTING ,
- FILE_ATTRIBUTE_NORMAL ,
+ OPEN_EXISTING,
+ FILE_ATTRIBUTE_NORMAL,
NULL );
- if( hPrevFile != INVALID_HANDLE_VALUE )
+ if (hPrevFile != INVALID_HANDLE_VALUE )
{
CloseHandle( hPrevFile );
- _TCHAR szTemp[500];
- _sntprintf( szTemp , sizeof( szTemp ) , _T("%s\r\n%s") ,
+ TCHAR szTemp[500];
+ _sntprintf( szTemp, sizeof( szTemp ), _T("%s\r\n%s"),
TranslateT("User has been deleted do you want to delete the file?"), sFilePath.c_str());
- if( enDeleteAction == eDAAutomatic ||
- MessageBox(NULL, szTemp, MSG_BOX_TITEL, MB_YESNO ) == IDYES )
+ if (enDeleteAction == eDAAutomatic ||
+ MessageBox(NULL, szTemp, MSG_BOX_TITEL, MB_YESNO) == IDYES )
{
- if( ! DeleteFile( sFilePath.c_str() ) )
+ if ( !DeleteFile( sFilePath.c_str()))
{
- _sntprintf( szTemp , sizeof( szTemp ) ,
+ _sntprintf( szTemp, sizeof( szTemp ),
_T("%s\r\n%s"),
LPGENT("Failed to delete the file"),
- sFilePath.c_str() );
+ sFilePath.c_str());
DisplayLastError( szTemp );
}
@@ -1670,25 +1673,25 @@ int nContactDeleted(WPARAM wparam,LPARAM /*lparam*/)
//
// References : -
// Remarks : -
-// Created : 020429 , 29 April 2002
+// Created : 020429, 29 April 2002
// Developer : KN
/////////////////////////////////////////////////////////////////////
void SaveSettings()
{
- db_set_w( NULL , MODULE , "MaxLineWidth" , (WORD) nMaxLineWidth );
- db_set_ts( NULL , MODULE , "ExportDir" , sExportDir.c_str() );
- db_set_ts( NULL , MODULE , "DefaultFile" , sDefaultFile.c_str() );
- db_set_ts( NULL , MODULE , "TimeFormat" , sTimeFormat.c_str() );
-
- db_set_ts( NULL , MODULE , "FileViewerPrg" , sFileViewerPrg.c_str() );
- db_set_b( NULL , MODULE , "UseInternalViewer" , bUseInternalViewer() );
- db_set_b( NULL , MODULE , "ReplaceHistory" , bReplaceHistory );
- db_set_b( NULL , MODULE , "AppendNewLine" , bAppendNewLine );
- db_set_b( NULL , MODULE , "UseUtf8InNewFiles" , bUseUtf8InNewFiles );
- db_set_b( NULL , MODULE , "UseLessAndGreaterInExport" , bUseLessAndGreaterInExport );
-
- db_set_b( NULL , MODULE , "RenameAction" , (BYTE)enRenameAction );
- db_set_b( NULL , MODULE , "DeleteAction" , (BYTE)enDeleteAction );
+ db_set_w( NULL, MODULE, "MaxLineWidth", (WORD) nMaxLineWidth );
+ db_set_ts( NULL, MODULE, "ExportDir", sExportDir.c_str());
+ db_set_ts( NULL, MODULE, "DefaultFile", sDefaultFile.c_str());
+ db_set_ts( NULL, MODULE, "TimeFormat", sTimeFormat.c_str());
+
+ db_set_ts( NULL, MODULE, "FileViewerPrg", sFileViewerPrg.c_str());
+ db_set_b( NULL, MODULE, "UseInternalViewer", bUseInternalViewer());
+ db_set_b( NULL, MODULE, "ReplaceHistory", bReplaceHistory );
+ db_set_b( NULL, MODULE, "AppendNewLine", bAppendNewLine );
+ db_set_b( NULL, MODULE, "UseUtf8InNewFiles", bUseUtf8InNewFiles );
+ db_set_b( NULL, MODULE, "UseLessAndGreaterInExport", bUseLessAndGreaterInExport );
+
+ db_set_b( NULL, MODULE, "RenameAction", (BYTE)enRenameAction );
+ db_set_b( NULL, MODULE, "DeleteAction", (BYTE)enDeleteAction );
}
diff --git a/plugins/Msg_Export/src/utils.h b/plugins/Msg_Export/src/utils.h
index 37b16b23e5..6264ad2a62 100755
--- a/plugins/Msg_Export/src/utils.h
+++ b/plugins/Msg_Export/src/utils.h
@@ -39,7 +39,7 @@ extern int nMaxLineWidth;
extern tstring sExportDir;
extern tstring sDefaultFile;
extern tstring sTimeFormat;
-extern map<tstring , string::size_type , less<tstring> > clFileTo1ColWidth;
+extern map<tstring, string::size_type, less<tstring> > clFileTo1ColWidth;
extern bool bAppendNewLine;
extern bool bUseUtf8InNewFiles;
@@ -49,9 +49,9 @@ extern bool bReplaceHistory;
tstring sGetErrorString(DWORD dwError);
tstring sGetErrorString();
-void DisplayLastError(const _TCHAR * pszError);
+void DisplayLastError(const TCHAR *pszError);
-_TCHAR * CheckedTranslate( const _TCHAR *szEng , int nFormatCount = -1 );
+TCHAR *CheckedTranslate( const TCHAR *szEng, int nFormatCount = -1 );
void SaveSettings();
void ShowDebugInfo();
@@ -59,27 +59,27 @@ void ShowDebugInfo();
int nExportEvent(WPARAM wparam,LPARAM lparam);
int nContactDeleted(WPARAM wparam,LPARAM lparam);
-const _TCHAR *NickFromHandle(HANDLE hContact);
+const TCHAR *NickFromHandle(HANDLE hContact);
-tstring __inline _DBGetStringW(HANDLE hContact,const char *szModule,const char *szSetting , const _TCHAR * pszError );
-string __inline _DBGetStringA(HANDLE hContact,const char *szModule,const char *szSetting , const char * pszError );
+tstring __inline _DBGetStringW(HANDLE hContact,const char *szModule,const char *szSetting, const TCHAR *pszError );
+string __inline _DBGetStringA(HANDLE hContact,const char *szModule,const char *szSetting, const char *pszError );
-void ReplaceAll( tstring &sSrc , const _TCHAR * pszReplace , const tstring &sNew);
-void ReplaceAll( tstring &sSrc , const _TCHAR * pszReplace , const _TCHAR * pszNew);
+void ReplaceAll( tstring &sSrc, const TCHAR *pszReplace, const tstring &sNew);
+void ReplaceAll( tstring &sSrc, const TCHAR *pszReplace, const TCHAR *pszNew);
void UpdateFileToColWidth();
bool bReadMirandaDirAndPath();
tstring GetFilePathFromUser( HANDLE hContact );
-void ReplaceDefines( HANDLE hContact , tstring & sTarget );
+void ReplaceDefines( HANDLE hContact, tstring & sTarget );
void ReplaceTimeVariables( tstring &sRet );
bool bCreatePathToFile( tstring sFilePath );
-bool bWriteIndentedToFile( HANDLE hFile , int nIndent , const char * pszSrc , bool bUtf8File );
-bool bWriteIndentedToFile( HANDLE hFile , int nIndent , const _TCHAR * pszSrc , bool bUtf8File );
-bool bWriteNewLine( HANDLE hFile , DWORD dwIndent );
+bool bWriteIndentedToFile( HANDLE hFile, int nIndent, const char *pszSrc, bool bUtf8File );
+bool bWriteIndentedToFile( HANDLE hFile, int nIndent, const TCHAR *pszSrc, bool bUtf8File );
+bool bWriteNewLine( HANDLE hFile, DWORD dwIndent );
bool bIsUtf8Header( BYTE * pucByteOrder );
#endif