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.cpp30
-rwxr-xr-xplugins/Msg_Export/src/options.cpp14
-rwxr-xr-xplugins/Msg_Export/src/utils.cpp38
3 files changed, 26 insertions, 56 deletions
diff --git a/plugins/Msg_Export/src/FileViewer.cpp b/plugins/Msg_Export/src/FileViewer.cpp
index 5de43566b3..3b4a2f12fb 100755
--- a/plugins/Msg_Export/src/FileViewer.cpp
+++ b/plugins/Msg_Export/src/FileViewer.cpp
@@ -649,32 +649,23 @@ 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 );
return false;
}
-
- HANDLE hFile = CreateFile( pclDlg->sPath.c_str(), GENERIC_READ,
+ 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 )
- {
- int nDBCount = (int)CallService( MS_DB_EVENT_GETCOUNT, (WPARAM)(pclDlg->hContact),0 );
+ if (hFile == INVALID_HANDLE_VALUE) {
+ int nDBCount = db_event_count(pclDlg->hContact);
TCHAR szTmp[1500];
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());
- }
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 );
- }
SETTEXTEX stText = {0};
stText.codepage = CP_ACP;
@@ -688,8 +679,7 @@ bool bLoadFile( HWND hwndDlg, CLHistoryDlg * pclDlg )
bool bScrollToBottom = true;
if (pclDlg->bFirstLoad )
pclDlg->bFirstLoad = false;
- else
- {
+ else {
SCROLLINFO sScrollInfo = { 0 };
sScrollInfo.cbSize = sizeof( SCROLLINFO );
sScrollInfo.fMask = SIF_POS | SIF_RANGE | SIF_PAGE;
@@ -697,7 +687,6 @@ bool bLoadFile( HWND hwndDlg, CLHistoryDlg * pclDlg )
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;
@@ -717,8 +706,7 @@ bool bLoadFile( HWND hwndDlg, CLHistoryDlg * pclDlg )
EDITSTREAM eds;
eds.dwError = 0;
- if (bUseSyntaxHL )
- {
+ if (bUseSyntaxHL ) {
SendMessage( hRichEdit, // handle to destination window
EM_EXLIMITTEXT, // message to send
0, // not used; must be zero
@@ -731,8 +719,7 @@ bool bLoadFile( HWND hwndDlg, CLHistoryDlg * pclDlg )
SendMessage(hRichEdit, EM_STREAMIN, (WPARAM)SF_RTF, (LPARAM)&eds);
pclDlg->bUtf8File = clInfo.bUtf8File;
}
- else
- {
+ else {
eds.dwCookie = (DWORD )hFile;
eds.pfnCallback = RichEditStreamLoadFile;
@@ -746,7 +733,6 @@ bool bLoadFile( HWND hwndDlg, CLHistoryDlg * pclDlg )
mir_sntprintf( szTmp, 99, _T("File open time %d\n"), GetTickCount() - dwStart );
OutputDebugString( szTmp );
-
GETTEXTLENGTHEX sData = { 0 };
sData.flags = GTL_NUMCHARS;
sData.flags = GTL_DEFAULT;
diff --git a/plugins/Msg_Export/src/options.cpp b/plugins/Msg_Export/src/options.cpp
index 9280c3fc1c..a691f2da31 100755
--- a/plugins/Msg_Export/src/options.cpp
+++ b/plugins/Msg_Export/src/options.cpp
@@ -64,9 +64,8 @@ class CLDBEvent
hUser = hU;
hDbEvent = hDBE;
- DBEVENTINFO dbei={0}; //dbei.cbBlob=0;
- dbei.cbSize=sizeof(dbei);
- CallService(MS_DB_EVENT_GET,(WPARAM)hDbEvent,(LPARAM)&dbei);
+ DBEVENTINFO dbei = { sizeof(dbei) };
+ db_event_get(hDbEvent, &dbei);
time = dbei.timestamp;
}
bool operator <(const CLDBEvent& rOther) const
@@ -240,13 +239,10 @@ int nExportCompleatList(HWND hParent, bool bOnlySelected )
list< CLDBEvent > & rclCurList = AllEvents[ GetFilePathFromUser( hContact) ];
- HANDLE hDbEvent = (HANDLE) CallService(MS_DB_EVENT_FINDFIRST,(WPARAM)hContact,0);
- while( hDbEvent)
- {
+ HANDLE hDbEvent = db_event_first(hContact);
+ while( hDbEvent) {
rclCurList.push_back( CLDBEvent( hContact, hDbEvent));
-
- // Get next event in chain
- hDbEvent = (HANDLE) CallService(MS_DB_EVENT_FINDNEXT,(WPARAM)hDbEvent,0);
+ hDbEvent = db_event_next(hDbEvent);
}
SendMessage( hProg, PBM_SETPOS, nCur, 0);
diff --git a/plugins/Msg_Export/src/utils.cpp b/plugins/Msg_Export/src/utils.cpp
index a2accf6a7d..f614520b28 100755
--- a/plugins/Msg_Export/src/utils.cpp
+++ b/plugins/Msg_Export/src/utils.cpp
@@ -1417,39 +1417,27 @@ void ExportDBEventInfo(HANDLE hContact, DBEVENTINFO &dbei )
int nExportEvent(WPARAM wparam,LPARAM lparam)
{
- HANDLE hContact = (HANDLE)wparam;
-
+ HANDLE hContact = (HANDLE)wparam, hDbEvent = (HANDLE)lparam;
if ( !db_get_b(hContact,MODULE,"EnableLog",1))
return 0;
- DBEVENTINFO dbei={0};
- dbei.cbSize=sizeof(dbei);
- char szTemp[500];
-
- { // Get Blob data size
-
- int nSize = (int)CallService(MS_DB_EVENT_GETBLOBSIZE,(WPARAM)lparam,0);
- if (nSize > 0 )
- {
- dbei.cbBlob = nSize;
- dbei.pBlob = (PBYTE)malloc(dbei.cbBlob + 2 );
- dbei.pBlob[dbei.cbBlob] = 0;
- dbei.pBlob[dbei.cbBlob+1] = 0;
- // Double null terminate, this shut pervent most errors
- // where the blob received has an invalid format
- }
- // else dbei.cbBlob will be 0
+ DBEVENTINFO dbei = { sizeof(dbei) };
+ int nSize = db_event_getBlobSize(hDbEvent);
+ if (nSize > 0) {
+ dbei.cbBlob = nSize;
+ dbei.pBlob = (PBYTE)malloc(dbei.cbBlob + 2 );
+ dbei.pBlob[dbei.cbBlob] = 0;
+ dbei.pBlob[dbei.cbBlob+1] = 0;
+ // Double null terminate, this shut pervent most errors
+ // where the blob received has an invalid format
}
- if ( !CallService(MS_DB_EVENT_GET,(WPARAM)lparam,(LPARAM)&dbei))
- {
- if (dbei.eventType != EVENTTYPE_STATUSCHANGE )
- {
+ if ( !db_event_get(hDbEvent, &dbei)) {
+ if (dbei.eventType != EVENTTYPE_STATUSCHANGE) {
+ char szTemp[500];
_snprintf( szTemp, sizeof( szTemp ), "DisableProt_%s", dbei.szModule );
if (db_get_b(NULL,MODULE,szTemp,1))
- {
ExportDBEventInfo( hContact, dbei );
- }
}
}
if (dbei.pBlob )