diff options
author | George Hazan <ghazan@miranda.im> | 2020-08-08 14:37:17 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2020-08-08 14:37:17 +0300 |
commit | 62e4253a9a92179d184ffb8dcb8947d4d38b9aea (patch) | |
tree | 81fd8f7fcd8a382e696a1c639c23013eea0c54a3 /src/mir_app | |
parent | 6bb288a0c37e0027e6eea64124df80750744b4ec (diff) |
Dbchecker:
- all global data removed, DbToolOptions now acts as an object attached to the wizard;
- many glitches removed;
- profile manager in the core now teached to use DBChecker, if present
Diffstat (limited to 'src/mir_app')
-rw-r--r-- | src/mir_app/src/miranda.h | 2 | ||||
-rw-r--r-- | src/mir_app/src/newplugins.cpp | 7 | ||||
-rw-r--r-- | src/mir_app/src/profilemanager.cpp | 29 |
3 files changed, 14 insertions, 24 deletions
diff --git a/src/mir_app/src/miranda.h b/src/mir_app/src/miranda.h index fd2e62c307..2493e55130 100644 --- a/src/mir_app/src/miranda.h +++ b/src/mir_app/src/miranda.h @@ -67,7 +67,7 @@ extern DWORD hMainThreadId; extern HANDLE hOkToExitEvent, hModulesLoadedEvent;
extern HANDLE hAccListChanged;
extern wchar_t mirandabootini[MAX_PATH];
-extern struct pluginEntry *plugin_crshdmp, *plugin_service, *plugin_ssl, *plugin_clist;
+extern struct pluginEntry *plugin_checker, *plugin_crshdmp, *plugin_service, *plugin_ssl, *plugin_clist;
extern bool g_bModulesLoadedFired, g_bMirandaTerminated;
/**** newplugins.cpp *******************************************************************/
diff --git a/src/mir_app/src/newplugins.cpp b/src/mir_app/src/newplugins.cpp index e4b9ab5e46..4101c8cb02 100644 --- a/src/mir_app/src/newplugins.cpp +++ b/src/mir_app/src/newplugins.cpp @@ -59,7 +59,7 @@ HANDLE hevLoadModule, hevUnloadModule; wchar_t mirandabootini[MAX_PATH];
static int askAboutIgnoredPlugins;
-pluginEntry *plugin_crshdmp, *plugin_service, *plugin_ssl, *plugin_clist;
+pluginEntry *plugin_checker, *plugin_crshdmp, *plugin_service, *plugin_ssl, *plugin_clist;
#define PLUGINDISABLELIST "PluginDisable"
@@ -395,6 +395,11 @@ pluginEntry* OpenPlugin(wchar_t *tszFileName, wchar_t *dir, wchar_t *path) else if (hasMuuid(pIds, MIID_PROTOCOL) || !mir_wstrcmpi(tszFileName, L"mradio.dll") || !mir_wstrcmpi(tszFileName, L"watrack.dll"))
p->bIsProtocol = true;
+ if (plugin_checker == nullptr && !mir_wstrcmpi(tszFileName, L"dbchecker.dll")) {
+ plugin_checker = p;
+ p->bIsLast = true;
+ }
+
if (plugin_crshdmp == nullptr && !mir_wstrcmpi(tszFileName, L"crashdumper.dll")) {
plugin_crshdmp = p;
p->bIsLast = true;
diff --git a/src/mir_app/src/profilemanager.cpp b/src/mir_app/src/profilemanager.cpp index 196379fc84..1dc56ed2ff 100644 --- a/src/mir_app/src/profilemanager.cpp +++ b/src/mir_app/src/profilemanager.cpp @@ -340,29 +340,14 @@ class CChooseProfileDlg : public CDlgBase m_profileList.DeleteItem(item.iItem); } - void CheckProfile(DATABASELINK *dblink, const wchar_t *profile) + void CheckProfile(const wchar_t *profile) { CMStringW wszFullName(FORMAT, L"%s\\%s\\%s.dat", m_pd->ptszProfileDir, profile, profile); - if (auto *db = dblink->Load(wszFullName, false)) { - if (auto *pChecker = db->GetChecker()) { - DBCHeckCallback cb = { 0, 0, &stubAddMessage }; - memset(numMessages, 0, sizeof(numMessages)); - - pChecker->Start(&cb); - - for (int task = 0;; task++) - if (pChecker->CheckDb(task) != 0) - break; - - pChecker->Destroy(); - - CMStringW wszMsg(FORMAT, TranslateT("Database verification ended with %d fatal errors, %d errors, %d warnings and %d infos"), - numMessages[STATUS_FATAL], numMessages[STATUS_ERROR], numMessages[STATUS_WARNING], numMessages[STATUS_MESSAGE]); - MessageBoxW(m_hwnd, wszMsg, TranslateT("Database"), MB_OK | MB_ICONINFORMATION); - } - delete db; - } + if (TryLoadPlugin(plugin_checker, false)) + CallService(MS_DB_CHECKPROFILE, (WPARAM)wszFullName.c_str(), 0); + else + Plugin_Uninit(plugin_checker); } void CompactProfile(DATABASELINK *dblink, const wchar_t *profile) @@ -452,7 +437,7 @@ class CChooseProfileDlg : public CDlgBase bAdded = true; } - if (dblink->capabilities & MDB_CAPS_CHECK) { + if (plugin_checker && (dblink->capabilities & MDB_CAPS_CHECK)) { AppendMenu(hMenu, MF_STRING, 4, TranslateT("Verify")); bAdded = true; } @@ -477,7 +462,7 @@ class CChooseProfileDlg : public CDlgBase break; case 4: - CheckProfile(dblink, profile); + CheckProfile(profile); break; } DestroyMenu(hMenu); |