summaryrefslogtreecommitdiff
path: root/plugins/DbEditorPP
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2022-02-09 17:40:09 +0300
committerGeorge Hazan <ghazan@miranda.im>2022-02-09 17:40:09 +0300
commita43d5bcb1e0bdafb0193662168976aac989ed922 (patch)
treec4f154f05f36626678efc64ae7a1139b30b5f4fe /plugins/DbEditorPP
parent760867149a99443036f53c73190d53bd87039def (diff)
db_is_module_empty & db_copy_module - new database helpers
Diffstat (limited to 'plugins/DbEditorPP')
-rw-r--r--plugins/DbEditorPP/src/copymodule.cpp2
-rw-r--r--plugins/DbEditorPP/src/deletemodule.cpp6
-rw-r--r--plugins/DbEditorPP/src/exportimport.cpp8
-rw-r--r--plugins/DbEditorPP/src/findwindow.cpp2
-rw-r--r--plugins/DbEditorPP/src/main_window.cpp2
-rw-r--r--plugins/DbEditorPP/src/modsettingenum.cpp12
-rw-r--r--plugins/DbEditorPP/src/moduletree.cpp6
-rw-r--r--plugins/DbEditorPP/src/renamemodule.cpp2
-rw-r--r--plugins/DbEditorPP/src/settinglist.cpp2
-rw-r--r--plugins/DbEditorPP/src/stdafx.h1
-rw-r--r--plugins/DbEditorPP/src/watchedvars.cpp2
11 files changed, 18 insertions, 27 deletions
diff --git a/plugins/DbEditorPP/src/copymodule.cpp b/plugins/DbEditorPP/src/copymodule.cpp
index a8bebffcff..12ebee4e73 100644
--- a/plugins/DbEditorPP/src/copymodule.cpp
+++ b/plugins/DbEditorPP/src/copymodule.cpp
@@ -3,7 +3,7 @@
void copyModule(const char *module, MCONTACT hContactFrom, MCONTACT hContactTo)
{
ModuleSettingLL msll;
- if (IsModuleEmpty(hContactFrom, module) || !EnumSettings(hContactFrom, module, &msll))
+ if (db_is_module_empty(hContactFrom, module) || !EnumSettings(hContactFrom, module, &msll))
return;
DBVARIANT dbv;
diff --git a/plugins/DbEditorPP/src/deletemodule.cpp b/plugins/DbEditorPP/src/deletemodule.cpp
index 61d06228d1..9a14210a80 100644
--- a/plugins/DbEditorPP/src/deletemodule.cpp
+++ b/plugins/DbEditorPP/src/deletemodule.cpp
@@ -5,7 +5,7 @@ static HWND hwnd2Delete = nullptr;
int deleteModule(HWND hwndParent, MCONTACT hContact, const char *module, int confirm)
{
- if (!module || IsModuleEmpty(hContact, module))
+ if (!module || db_is_module_empty(hContact, module))
return 0;
if (confirm && g_plugin.bWarnOnDelete) {
@@ -40,7 +40,7 @@ void __cdecl PopulateModuleDropListThreadFunc(void *param)
while (module && working) {
moduleEmpty = 1;
// check the null
- if (!IsModuleEmpty(NULL, module->name)) {
+ if (!db_is_module_empty(NULL, module->name)) {
SendDlgItemMessageA(hwnd, IDC_CONTACTS, CB_ADDSTRING, 0, (LPARAM)module->name);
moduleEmpty = 0;
module = module->next;
@@ -48,7 +48,7 @@ void __cdecl PopulateModuleDropListThreadFunc(void *param)
}
for (auto &hContact : Contacts()) {
- if (!IsModuleEmpty(hContact, module->name)) {
+ if (!db_is_module_empty(hContact, module->name)) {
SendDlgItemMessageA(hwnd, IDC_CONTACTS, CB_ADDSTRING, 0, (LPARAM)module->name);
moduleEmpty = 0;
break;
diff --git a/plugins/DbEditorPP/src/exportimport.cpp b/plugins/DbEditorPP/src/exportimport.cpp
index d835bf60de..077de74188 100644
--- a/plugins/DbEditorPP/src/exportimport.cpp
+++ b/plugins/DbEditorPP/src/exportimport.cpp
@@ -52,7 +52,7 @@ void exportModule(MCONTACT hContact, const char *module, FILE *file)
ModuleSettingLL settinglist;
ModSetLinkLinkItem *setting;
- if (IsModuleEmpty(hContact, module) || !EnumSettings(hContact, module, &settinglist))
+ if (db_is_module_empty(hContact, module) || !EnumSettings(hContact, module, &settinglist))
return;
// print the module header..
@@ -165,7 +165,7 @@ void exportDB(MCONTACT hContact, const char *module)
fprintf(file, "SETTINGS:\n");
mod = modlist.first;
while (mod) {
- if (IsModuleEmpty(NULL, mod->name)) {
+ if (db_is_module_empty(NULL, mod->name)) {
mod = (ModSetLinkLinkItem *)mod->next;
continue;
}
@@ -192,7 +192,7 @@ void exportDB(MCONTACT hContact, const char *module)
{
mod = modlist.first;
while (mod) {
- if (IsModuleEmpty(cc, mod->name)) {
+ if (db_is_module_empty(cc, mod->name)) {
mod = (ModSetLinkLinkItem *)mod->next;
continue;
}
@@ -218,7 +218,7 @@ void exportDB(MCONTACT hContact, const char *module)
mod = modlist.first;
while (mod) {
- if (IsModuleEmpty(hContact, mod->name)) {
+ if (db_is_module_empty(hContact, mod->name)) {
mod = (ModSetLinkLinkItem *)mod->next;
continue;
}
diff --git a/plugins/DbEditorPP/src/findwindow.cpp b/plugins/DbEditorPP/src/findwindow.cpp
index cf669b3970..a75ed148c4 100644
--- a/plugins/DbEditorPP/src/findwindow.cpp
+++ b/plugins/DbEditorPP/src/findwindow.cpp
@@ -187,7 +187,7 @@ class CFindWindowDlg : public CDlgBase
for (module = ModuleList.first; module; module = module->next) {
- if (IsModuleEmpty(hContact, module->name))
+ if (db_is_module_empty(hContact, module->name))
continue;
if (fi->options & (F_SETVAL | F_SETNAME)) {
diff --git a/plugins/DbEditorPP/src/main_window.cpp b/plugins/DbEditorPP/src/main_window.cpp
index 78d74c1f6e..b0b8221c22 100644
--- a/plugins/DbEditorPP/src/main_window.cpp
+++ b/plugins/DbEditorPP/src/main_window.cpp
@@ -530,7 +530,7 @@ void CMainDlg::onItemExpand_Modules(CCtrlTreeView::TEventInfo *ev)
ModSetLinkLinkItem *module = modlist.first;
while (module && g_pMainWindow) {
- if (module->name[0] && !IsModuleEmpty(hContact, module->name))
+ if (module->name[0] && !db_is_module_empty(hContact, module->name))
insertItem(hContact, module->name, ev->nmtv->itemNew.hItem);
module = (ModSetLinkLinkItem *)module->next;
diff --git a/plugins/DbEditorPP/src/modsettingenum.cpp b/plugins/DbEditorPP/src/modsettingenum.cpp
index 0a693640fa..6137fe38a8 100644
--- a/plugins/DbEditorPP/src/modsettingenum.cpp
+++ b/plugins/DbEditorPP/src/modsettingenum.cpp
@@ -71,15 +71,7 @@ int EnumSettings(MCONTACT hContact, const char *module, ModuleSettingLL *msll)
return 1;
}
-int CheckIfModuleIsEmptyProc(const char*, void*)
-{
- return 1;
-}
-
-int IsModuleEmpty(MCONTACT hContact, const char *module)
-{
- return 0 > db_enum_settings(hContact, CheckIfModuleIsEmptyProc, module);
-}
+/////////////////////////////////////////////////////////////////////////////////////////
static int stringCompare(const char *p1, const char *p2)
{
@@ -162,7 +154,7 @@ int fixResidentSettings()
for (auto &hContact : Contacts()) {
for (ModSetLinkLinkItem *module = ModuleList.first; module; module = module->next) {
- if (IsModuleEmpty(hContact, module->name))
+ if (db_is_module_empty(hContact, module->name))
continue;
ModuleSettingLL SettingList;
diff --git a/plugins/DbEditorPP/src/moduletree.cpp b/plugins/DbEditorPP/src/moduletree.cpp
index c5e8c1e1a1..92f4ad3d89 100644
--- a/plugins/DbEditorPP/src/moduletree.cpp
+++ b/plugins/DbEditorPP/src/moduletree.cpp
@@ -75,7 +75,7 @@ int CMainDlg::doContacts(HTREEITEM contactsRoot, ModuleSettingLL *modlist, MCONT
if (hSelectedContact == hContact) {
for (ModSetLinkLinkItem *module = modlist->first; module && g_pMainWindow; module = module->next) {
- if (!module->name[0] || IsModuleEmpty(hContact, module->name))
+ if (!module->name[0] || db_is_module_empty(hContact, module->name))
continue;
insertItem(hContact, module->name, contact);
}
@@ -127,7 +127,7 @@ void CMainDlg::doItems(ModuleSettingLL *modlist, int count)
SetCaption(percent);
for (ModSetLinkLinkItem *module = modlist->first; module && g_pMainWindow; module = module->next) {
- if (!module->name[0] || IsModuleEmpty(hContact, module->name))
+ if (!module->name[0] || db_is_module_empty(hContact, module->name))
continue;
insertItem(hContact, module->name, item.hItem);
@@ -396,7 +396,7 @@ void __cdecl CMainDlg::PopulateModuleTreeThreadFunc(void *param)
MCONTACT hContact = 0;
for (ModSetLinkLinkItem *module = modlist.first; module && g_pMainWindow; module = module->next) {
- if (!module->name[0] || IsModuleEmpty(hContact, module->name))
+ if (!module->name[0] || db_is_module_empty(hContact, module->name))
continue;
g_pMainWindow->insertItem(hContact, module->name, contact);
}
diff --git a/plugins/DbEditorPP/src/renamemodule.cpp b/plugins/DbEditorPP/src/renamemodule.cpp
index 0c08ca0690..122569be71 100644
--- a/plugins/DbEditorPP/src/renamemodule.cpp
+++ b/plugins/DbEditorPP/src/renamemodule.cpp
@@ -3,7 +3,7 @@
int renameModule(MCONTACT hContact, const char *oldName, const char *newName)
{
ModuleSettingLL settinglist;
- if (IsModuleEmpty(hContact, oldName) || !EnumSettings(hContact, oldName, &settinglist))
+ if (db_is_module_empty(hContact, oldName) || !EnumSettings(hContact, oldName, &settinglist))
return 0;
int cnt = 0;
diff --git a/plugins/DbEditorPP/src/settinglist.cpp b/plugins/DbEditorPP/src/settinglist.cpp
index eca77599a6..1893447210 100644
--- a/plugins/DbEditorPP/src/settinglist.cpp
+++ b/plugins/DbEditorPP/src/settinglist.cpp
@@ -335,7 +335,7 @@ void CMainDlg::PopulateSettings(MCONTACT hContact, const char *module)
mir_strncpy(m_module, tmp, _countof(m_module));
ModuleSettingLL setlist;
- if (IsModuleEmpty(m_hContact, m_module) || !EnumSettings(m_hContact, m_module, &setlist))
+ if (db_is_module_empty(m_hContact, m_module) || !EnumSettings(m_hContact, m_module, &setlist))
return;
for (ModSetLinkLinkItem *setting = setlist.first; setting; setting = setting->next)
diff --git a/plugins/DbEditorPP/src/stdafx.h b/plugins/DbEditorPP/src/stdafx.h
index 0934c31319..9ce98b774e 100644
--- a/plugins/DbEditorPP/src/stdafx.h
+++ b/plugins/DbEditorPP/src/stdafx.h
@@ -331,7 +331,6 @@ void popupWatchedVar(MCONTACT hContact, const char *module, const char *setting)
int EnumModules(ModuleSettingLL *msll);
int EnumSettings(MCONTACT hContact, const char *module, ModuleSettingLL *msll);
void FreeModuleSettingLL(ModuleSettingLL *msll);
-int IsModuleEmpty(MCONTACT hContact, const char *module);
int LoadResidentSettings();
void FreeResidentSettings();
int IsResidentSetting(const char *module, const char *setting);
diff --git a/plugins/DbEditorPP/src/watchedvars.cpp b/plugins/DbEditorPP/src/watchedvars.cpp
index 0155f5551e..af5fefbb46 100644
--- a/plugins/DbEditorPP/src/watchedvars.cpp
+++ b/plugins/DbEditorPP/src/watchedvars.cpp
@@ -87,7 +87,7 @@ void addwatchtolist(HWND hwnd, struct DBsetting *lParam)
if (!lParam->setting) // add every item in the module and return
{
ModuleSettingLL settinglist;
- if (IsModuleEmpty(lParam->hContact, lParam->module) || !EnumSettings(lParam->hContact, lParam->module, &settinglist))
+ if (db_is_module_empty(lParam->hContact, lParam->module) || !EnumSettings(lParam->hContact, lParam->module, &settinglist))
return;
struct DBsetting dummy = {};