summaryrefslogtreecommitdiff
path: root/plugins/HistoryLinkListPlus
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-03-30 17:32:39 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-03-30 17:32:39 +0000
commit109877a3c75cb290c55755dcfc88794d2453669d (patch)
tree3ede8b9170b2fc3f6f35dc2cea6742d44b19d631 /plugins/HistoryLinkListPlus
parentfee8d991bdf4a59b563d1b92165ea0ed2f7bacb8 (diff)
MS_DB_EVENT_* services remained, but their calls removed
git-svn-id: http://svn.miranda-ng.org/main/trunk@4255 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/HistoryLinkListPlus')
-rw-r--r--plugins/HistoryLinkListPlus/src/linklist.cpp68
-rw-r--r--plugins/HistoryLinkListPlus/src/linklist_fct.cpp75
2 files changed, 50 insertions, 93 deletions
diff --git a/plugins/HistoryLinkListPlus/src/linklist.cpp b/plugins/HistoryLinkListPlus/src/linklist.cpp
index d3889376a5..6a2cf70e02 100644
--- a/plugins/HistoryLinkListPlus/src/linklist.cpp
+++ b/plugins/HistoryLinkListPlus/src/linklist.cpp
@@ -124,29 +124,11 @@ int InitOptionsDlg(WPARAM wParam, LPARAM lParam)
return 0;
}
-static INT_PTR LinkList_Main(WPARAM wParam,LPARAM lParam)
+static INT_PTR LinkList_Main(WPARAM wParam, LPARAM)
{
- HANDLE hEvent;
HANDLE hContact = (HANDLE)wParam;
- DBEVENTINFO dbe;
- HWND hWnd;
- HWND hWndProgress;
- HWND hWndMain;
-
- int histCount = 0;
- int actCount = 0;
-
- RECT DesktopRect;
- LISTELEMENT *listStart;
-
- UNREFERENCED_PARAMETER(lParam);
-
- listStart = (LISTELEMENT*)malloc(sizeof(LISTELEMENT));
- ZeroMemory(listStart, sizeof(LISTELEMENT));
-
- hWnd = WindowList_Find(hWindowList,hContact);
- if ( hWnd != NULL )
- {
+ HWND hWnd = WindowList_Find(hWindowList, hContact);
+ if ( hWnd != NULL ) {
int len;
SetForegroundWindow(hWnd);
SetFocus(hWnd);
@@ -155,25 +137,24 @@ static INT_PTR LinkList_Main(WPARAM wParam,LPARAM lParam)
return 0;
}
- hEvent = (HANDLE)CallService(MS_DB_EVENT_FINDFIRST, (WPARAM)hContact, 0);
- if ( hEvent == NULL )
- {
+ HANDLE hEvent = db_event_first(hContact);
+ if (hEvent == NULL) {
MessageBox(NULL, TXT_EMPTYHISTORY, TXT_PLUGINNAME, MB_OK | MB_ICONINFORMATION );
return 0;
}
- histCount = CallService(MS_DB_EVENT_GETCOUNT, (WPARAM)hContact, 0);
- ZeroMemory(&dbe, sizeof(dbe));
- dbe.cbSize = sizeof(dbe);
- dbe.cbBlob = (int)CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM)hEvent, 0);
+ int histCount = db_event_count(hContact), actCount = 0;
+
+ DBEVENTINFO dbe = { sizeof(dbe) };
+ dbe.cbBlob = db_event_getBlobSize(hEvent);
dbe.pBlob = (PBYTE)malloc(dbe.cbBlob+1);
- CallService(MS_DB_EVENT_GET, (WPARAM)hEvent, (LPARAM)&dbe);
+ db_event_get(hEvent, &dbe);
dbe.pBlob[dbe.cbBlob] = 0;
+ RECT DesktopRect;
GetWindowRect(GetDesktopWindow(), &DesktopRect);
- hWndProgress = CreateWindow(_T("Progressbar"), TranslateT("Processing history..."), WS_OVERLAPPED, CW_USEDEFAULT, CW_USEDEFAULT, 350, 45, NULL, NULL, hInst, NULL);
- if ( hWndProgress == 0 )
- {
+ HWND hWndProgress = CreateWindow(_T("Progressbar"), TranslateT("Processing history..."), WS_OVERLAPPED, CW_USEDEFAULT, CW_USEDEFAULT, 350, 45, NULL, NULL, hInst, NULL);
+ if ( hWndProgress == 0 ) {
free(dbe.pBlob);
MessageBox(NULL, TranslateT("Could not create window!"), TranslateT("Error"), MB_OK | MB_ICONEXCLAMATION );
return -1;
@@ -182,13 +163,13 @@ static INT_PTR LinkList_Main(WPARAM wParam,LPARAM lParam)
ShowWindow(hWndProgress, SW_SHOW);
SetForegroundWindow(hWndProgress);
- while( 1 )
- {
- if ( dbe.eventType == EVENTTYPE_URL || dbe.eventType == EVENTTYPE_MESSAGE )
- {
+ LISTELEMENT *listStart = (LISTELEMENT*)malloc(sizeof(LISTELEMENT));
+ ZeroMemory(listStart, sizeof(LISTELEMENT));
+
+ while( 1 ) {
+ if ( dbe.eventType == EVENTTYPE_URL || dbe.eventType == EVENTTYPE_MESSAGE ) {
// Call function to find URIs
- if ( ExtractURI(&dbe, hEvent, listStart) < 0 )
- {
+ if ( ExtractURI(&dbe, hEvent, listStart) < 0 ) {
free(dbe.pBlob);
RemoveList(listStart);
MessageBox(NULL, TranslateT("Could not allocate memory!"), TranslateT("Error"), MB_OK | MB_ICONEXCLAMATION);
@@ -199,14 +180,14 @@ static INT_PTR LinkList_Main(WPARAM wParam,LPARAM lParam)
if ( ((int)(((float)actCount/histCount)*100.00)) % 10 == 0 )
SendMessage(hWndProgress, WM_COMMAND, 100, ((int)(((float)actCount/histCount)*100.00)));
- hEvent = (HANDLE)CallService(MS_DB_EVENT_FINDNEXT, (WPARAM)hEvent, 0);
+ hEvent = db_event_next(hEvent);
if ( hEvent == NULL )
break;
free(dbe.pBlob);
- dbe.cbBlob = (int)CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM)hEvent, 0);
+ dbe.cbBlob = db_event_getBlobSize(hEvent);
dbe.pBlob = (PBYTE)malloc(dbe.cbBlob+1);
- CallService(MS_DB_EVENT_GET, (WPARAM)hEvent, (LPARAM)&dbe);
+ db_event_get(hEvent, &dbe);
dbe.pBlob[dbe.cbBlob] = 0;
}
free(dbe.pBlob);
@@ -224,9 +205,8 @@ static INT_PTR LinkList_Main(WPARAM wParam,LPARAM lParam)
DlgParam->chrg.cpMax = -1;
DlgParam->chrg.cpMin = -1;
- hWndMain = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_MAIN_DLG), NULL, MainDlgProc, (LPARAM)DlgParam);
- if ( hWndMain == 0 )
- {
+ HWND hWndMain = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_MAIN_DLG), NULL, MainDlgProc, (LPARAM)DlgParam);
+ if (hWndMain == 0) {
RemoveList(listStart);
MessageBox(NULL, TranslateT("Could not create window!"), TranslateT("Error"), MB_OK | MB_ICONEXCLAMATION );
return -1;
diff --git a/plugins/HistoryLinkListPlus/src/linklist_fct.cpp b/plugins/HistoryLinkListPlus/src/linklist_fct.cpp
index eb2e0ea98a..bc5c5abe61 100644
--- a/plugins/HistoryLinkListPlus/src/linklist_fct.cpp
+++ b/plugins/HistoryLinkListPlus/src/linklist_fct.cpp
@@ -290,7 +290,6 @@ void WriteLinkList(HWND hDlg, BYTE params, LISTELEMENT *listStart, LPCTSTR searc
LISTOPTIONS options;
CHARRANGE sel;
GETTEXTLENGTHEX gtl;
- DBEVENTINFO dbe;
GetListInfo(params, listStart, searchString, &lineLen, &listCount, &realListCount);
GetColour(&colourSet);
@@ -412,30 +411,24 @@ void WriteLinkList(HWND hDlg, BYTE params, LISTELEMENT *listStart, LPCTSTR searc
// Perform deep scan
if ( actualElement->hEvent != NULL )
{
- LPCTSTR msg;
- dbe.cbSize = sizeof(dbe);
- dbe.cbBlob = (int)CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM)actualElement->hEvent, 0);
+ DBEVENTINFO dbe = { sizeof(dbe) };
+ dbe.cbBlob = db_event_getBlobSize(actualElement->hEvent);
dbe.pBlob = (PBYTE)malloc(dbe.cbBlob+1);
- CallService(MS_DB_EVENT_GET, (WPARAM)actualElement->hEvent, (LPARAM)&dbe);
+ db_event_get(actualElement->hEvent, &dbe);
dbe.pBlob[dbe.cbBlob] = 0;
- msg = DbGetEventTextT(&dbe, CP_ACP);
+ LPTSTR msg = DbGetEventTextT(&dbe, CP_ACP);
if ( _tcsstr(msg, searchString))
filter3 = 1;
free(dbe.pBlob);
- mir_free((void*)msg);
+ mir_free(msg);
}
- else
- filter3 = 0;
- }
- else
- {
- if ( _tcsstr(actualElement->link, searchString))
- filter3 = 1;
+ else filter3 = 0;
}
+ else if ( _tcsstr(actualElement->link, searchString))
+ filter3 = 1;
}
- else
- filter3 = 1;
+ else filter3 = 1;
if ( (filter1 == 1) && (filter2 == 1) && (filter3 == 1))
{
@@ -647,25 +640,17 @@ Write Message to window
*/
void WriteMessage(HWND hDlg, LISTELEMENT *listStart, int actLinePos)
{
- LISTELEMENT *actualElement;
- HANDLE hEvent;
- DBEVENTINFO dbe;
-
- actualElement = listStart->nextElement;
- while ( actualElement != NULL )
- {
- if ( actualElement->linePos == actLinePos )
- {
- hEvent = actualElement->hEvent;
- if (hEvent != NULL )
- {
- LPCTSTR msg;
- dbe.cbSize = sizeof(dbe);
- dbe.cbBlob = (int)CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM)hEvent, 0);
+ LISTELEMENT *actualElement = listStart->nextElement;
+ while (actualElement != NULL) {
+ if (actualElement->linePos == actLinePos) {
+ HANDLE hEvent = actualElement->hEvent;
+ if (hEvent != NULL ) {
+ DBEVENTINFO dbe = { sizeof(dbe) };
+ dbe.cbBlob = db_event_getBlobSize(hEvent);
dbe.pBlob = (PBYTE)malloc(dbe.cbBlob+1);
- CallService(MS_DB_EVENT_GET,(WPARAM)hEvent,(LPARAM)&dbe);
+ db_event_get(hEvent, &dbe);
dbe.pBlob[dbe.cbBlob] = 0;
- msg = DbGetEventTextT(&dbe, CP_ACP);
+ LPCTSTR msg = DbGetEventTextT(&dbe, CP_ACP);
SendDlgItemMessage(hDlg, IDC_MESSAGE, WM_SETTEXT , 0, 0);
SendDlgItemMessage(hDlg, IDC_MESSAGE, EM_REPLACESEL, FALSE, (LPARAM)msg);
mir_free((void*)msg);
@@ -786,7 +771,6 @@ void GetListInfo(BYTE params, LISTELEMENT *listStart, LPCTSTR searchString, siz
size_t tempLen;
LISTELEMENT *actualElement;
char filter1, filter2, filter3;
- DBEVENTINFO dbe;
*maxLen = 0;
*elementCount = 0;
@@ -818,11 +802,10 @@ void GetListInfo(BYTE params, LISTELEMENT *listStart, LPCTSTR searchString, siz
// Perform deep scan
if ( actualElement->hEvent != NULL )
{
- dbe.cbSize = sizeof(dbe);
- dbe.pBlob = NULL;
- dbe.cbBlob = (int)CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM)actualElement->hEvent, 0);
+ DBEVENTINFO dbe = { sizeof(dbe) };
+ dbe.cbBlob = db_event_getBlobSize(actualElement->hEvent);
dbe.pBlob = (PBYTE)malloc(dbe.cbBlob+1);
- CallService(MS_DB_EVENT_GET, (WPARAM)actualElement->hEvent, (LPARAM)&dbe);
+ db_event_get(actualElement->hEvent, &dbe);
dbe.pBlob[dbe.cbBlob] = 0;
if ( _tcsstr((LPTSTR)dbe.pBlob, searchString))
filter3 = 1;
@@ -1220,7 +1203,6 @@ int DBUpdate(WPARAM wParam, LPARAM lParam)
{
HANDLE hEvent=(HANDLE)lParam;
HWND hDlg = WindowList_Find(hWindowList, (HANDLE)wParam);
- DBEVENTINFO dbe;
DIALOGPARAM *DlgParam;
HMENU listMenu = GetMenu(hDlg);
int linkNum = 0;
@@ -1230,17 +1212,12 @@ int DBUpdate(WPARAM wParam, LPARAM lParam)
if(GetUpdateSetting() != 1)
return 0;
- if(hDlg)
- {
- ZeroMemory(&dbe, sizeof(dbe));
- dbe.cbSize = sizeof(dbe);
-
- dbe.cbBlob = (int)CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM)hEvent, 0);
+ if(hDlg) {
+ DBEVENTINFO dbe = { sizeof(dbe) };
+ dbe.cbBlob = db_event_getBlobSize(hEvent);
dbe.pBlob = (PBYTE)malloc((size_t)dbe.cbBlob+1);
- CallService(MS_DB_EVENT_GET, (WPARAM)hEvent, (LPARAM)&dbe);
-
- if ( (dbe.eventType == EVENTTYPE_URL) || (dbe.eventType == EVENTTYPE_MESSAGE))
- {
+ db_event_get(hEvent, &dbe);
+ if (dbe.eventType == EVENTTYPE_URL || dbe.eventType == EVENTTYPE_MESSAGE) {
// Call function to find URIs
linkNum = ExtractURI(&dbe, hEvent, DlgParam->listStart);
if ( linkNum > 0 )