From ef451a30cfa4fe0a5d90c9313313a2be910c0d15 Mon Sep 17 00:00:00 2001 From: Tobias Weimer Date: Tue, 21 May 2013 14:18:33 +0000 Subject: minor adaptions for Miranda NG git-svn-id: http://svn.miranda-ng.org/main/trunk@4774 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Spamotron/src/options.cpp | 26 +++++++++++++------------- plugins/Spamotron/src/spamotron.cpp | 15 +++++++-------- plugins/Spamotron/src/utils.cpp | 6 +++--- 3 files changed, 23 insertions(+), 24 deletions(-) (limited to 'plugins/Spamotron') diff --git a/plugins/Spamotron/src/options.cpp b/plugins/Spamotron/src/options.cpp index ca7c78317a..0c9fda4762 100644 --- a/plugins/Spamotron/src/options.cpp +++ b/plugins/Spamotron/src/options.cpp @@ -89,7 +89,7 @@ BOOL _saveDlgItemScore(HWND hDialog, int controlID, char* option) extern HINSTANCE hInst; -BOOL CALLBACK DlgProcOptionsMain(HWND optDlg, UINT msg, WPARAM wParam, LPARAM lParam) +INT_PTR CALLBACK DlgProcOptionsMain(HWND optDlg, UINT msg, WPARAM wParam, LPARAM lParam) { static int bInitializing = 0, i, j, numProtocols; PROTOCOLDESCRIPTOR** pd; @@ -216,7 +216,7 @@ BOOL CALLBACK DlgProcOptionsMain(HWND optDlg, UINT msg, WPARAM wParam, LPARAM lP return FALSE; } -BOOL CALLBACK DlgProcOptionsQuestion(HWND optDlg, UINT msg, WPARAM wParam, LPARAM lParam) +INT_PTR CALLBACK DlgProcOptionsQuestion(HWND optDlg, UINT msg, WPARAM wParam, LPARAM lParam) { static int bInitializing = 0; int i, selectedMode; @@ -419,7 +419,7 @@ void EnableControlsBayes(HWND hwnd, BOOL enable) EnableWindow(GetDlgItem(hwnd, IDC_STATIC_HAMCOUNT_LABEL), enable); } -BOOL CALLBACK DlgProcOptionsBayes(HWND optDlg, UINT msg, WPARAM wParam, LPARAM lParam) +INT_PTR CALLBACK DlgProcOptionsBayes(HWND optDlg, UINT msg, WPARAM wParam, LPARAM lParam) { static int bInitializing = 0, len; BOOL bEnabled; @@ -555,7 +555,7 @@ BOOL CALLBACK DlgProcOptionsBayes(HWND optDlg, UINT msg, WPARAM wParam, LPARAM l return FALSE; } -extern BOOL CALLBACK DlgProcOptionsPopups(HWND optDlg, UINT msg, WPARAM wParam, LPARAM lParam); +extern INT_PTR CALLBACK DlgProcOptionsPopups(HWND optDlg, UINT msg, WPARAM wParam, LPARAM lParam); int OnOptInitialize(WPARAM wParam, LPARAM lParam) { @@ -563,29 +563,29 @@ int OnOptInitialize(WPARAM wParam, LPARAM lParam) odp.cbSize = sizeof(odp); odp.position = 0; odp.hInstance = hInst; - odp.ptszGroup = _T("Message Sessions"); + odp.ptszGroup = LPGENT("Message Sessions"); odp.ptszTitle = _T(PLUGIN_NAME); odp.flags = ODPF_TCHAR | ODPF_BOLDGROUPS; - odp.ptszTab = _T("Settings"); + odp.ptszTab = LPGENT("Settings"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_SPAMOTRON_MAIN); - odp.pfnDlgProc = (DLGPROC)DlgProcOptionsMain; + odp.pfnDlgProc = DlgProcOptionsMain; Options_AddPage(wParam, &odp); - odp.ptszTab = _T("Messages"); + odp.ptszTab = LPGENT("Messages"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_SPAMOTRON_Q); - odp.pfnDlgProc = (DLGPROC)DlgProcOptionsQuestion; + odp.pfnDlgProc = DlgProcOptionsQuestion; Options_AddPage(wParam, &odp); - odp.ptszTab = _T("Bayes"); + odp.ptszTab = LPGENT("Bayes"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_SPAMOTRON_BAYES); - odp.pfnDlgProc = (DLGPROC)DlgProcOptionsBayes; + odp.pfnDlgProc = DlgProcOptionsBayes; Options_AddPage(wParam, &odp); if (ServiceExists(MS_POPUP_ADDPOPUP)) { odp.pszTemplate = MAKEINTRESOURCEA(IDD_SPAMOTRON_POPUPS); - odp.pfnDlgProc = (DLGPROC)DlgProcOptionsPopups; - odp.ptszGroup = _T("Popups"); + odp.pfnDlgProc = DlgProcOptionsPopups; + odp.ptszGroup = LPGENT("Popups"); odp.ptszTab = NULL; Options_AddPage(wParam, &odp); } diff --git a/plugins/Spamotron/src/spamotron.cpp b/plugins/Spamotron/src/spamotron.cpp index b656b87c85..82c0a2aa46 100644 --- a/plugins/Spamotron/src/spamotron.cpp +++ b/plugins/Spamotron/src/spamotron.cpp @@ -30,14 +30,14 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) return TRUE; } -int OnModulesLoaded(WPARAM wParam, LPARAM lParam) +int OnModulesLoaded(WPARAM, LPARAM) { hOptInitialize = HookEvent(ME_OPT_INITIALISE, OnOptInitialize); return 0; } -int OnDBContactAdded(WPARAM wParam, LPARAM lParam) +int OnDBContactAdded(WPARAM, LPARAM) { //MessageBox(NULL, _T("OnDBContactAdded"), _T("Event"), MB_OK); return 0; @@ -258,8 +258,7 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam) TCHAR AuthEventModule[100]; char* szAuthEventModule; if (db_get(hContact, PLUGIN_NAME, "AuthEvent", &_dbv) == 0) { - DBEVENTINFO *_dbei = NULL; - _dbei = (DBEVENTINFO *)malloc(sizeof(DBEVENTINFO)); + DBEVENTINFO *_dbei = (DBEVENTINFO *)malloc(sizeof(DBEVENTINFO)); if (_dbei != NULL) { memcpy(&_dbei->cbBlob, _dbv.pbVal, sizeof(DWORD)); _dbei->eventType = EVENTTYPE_AUTHREQUEST; @@ -270,7 +269,7 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam) _dbei->flags = 0; _dbei->cbSize = sizeof(DBEVENTINFO); _dbei->pBlob = _dbv.pbVal + sizeof(DWORD); - CallService(MS_DB_EVENT_ADD, (WPARAM)hContact, (LPARAM)_dbei); + db_event_add(hContact,_dbei); db_unset(hContact, PLUGIN_NAME, "AuthEvent"); db_unset(hContact, PLUGIN_NAME, "AuthEventPending"); db_unset(hContact, PLUGIN_NAME, "AuthEventModule"); @@ -514,7 +513,7 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam) } else { dbei->flags |= DBEF_READ; - CallService(MS_DB_EVENT_ADD, (WPARAM)hContact, (LPARAM)dbei); + db_event_add(hContact, dbei); } } } @@ -526,7 +525,7 @@ void RemoveNotOnListSettings() { DBVARIANT dbv; char protoName[256] = {0}; - HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); + HANDLE hContact = db_find_first(); strcpy(protoName, "proto_"); while (hContact != NULL) { if (db_get_s(hContact, "Protocol", "p", &dbv) == 0) { @@ -539,7 +538,7 @@ void RemoveNotOnListSettings() db_free(&dbv); } protoName[6] = 0; - hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0); + hContact = db_find_next(hContact); } } diff --git a/plugins/Spamotron/src/utils.cpp b/plugins/Spamotron/src/utils.cpp index ca31eda236..5f930e47bd 100644 --- a/plugins/Spamotron/src/utils.cpp +++ b/plugins/Spamotron/src/utils.cpp @@ -480,7 +480,7 @@ int LogToSystemHistory(char *message, char *origmessage) dbei.cbBlob = (DWORD)strlen(msg)+1; dbei.eventType = EVENTTYPE_MESSAGE; dbei.flags = DBEF_READ; - CallService(MS_DB_EVENT_ADD, (WPARAM)NULL, (LPARAM)&dbei); + db_event_add(NULL, &dbei); return 0; } @@ -488,7 +488,6 @@ void MarkUnread(HANDLE hContact) { // We're not actually marking anything. We just pushing saved events to the database from a temporary location DBVARIANT _dbv = {0}; - DBEVENTINFO _dbei; PBYTE pos; if (hContact == NULL) @@ -497,6 +496,7 @@ void MarkUnread(HANDLE hContact) if (db_get(hContact, PLUGIN_NAME, "LastMsgEvents", &_dbv) == 0) { pos = _dbv.pbVal; while (pos - _dbv.pbVal < _dbv.cpbVal) { + DBEVENTINFO _dbei; ZeroMemory(&_dbei, sizeof(_dbei)); _dbei.cbSize = sizeof(_dbei); @@ -513,7 +513,7 @@ void MarkUnread(HANDLE hContact) memcpy(_dbei.pBlob, pos, _dbei.cbBlob); pos += _dbei.cbBlob; - CallService(MS_DB_EVENT_ADD, (WPARAM)hContact, (LPARAM)&_dbei); + db_event_add(hContact,&_dbei); } db_free(&_dbv); db_unset(hContact, PLUGIN_NAME, "LastMsgEvents"); -- cgit v1.2.3