summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-10-09 15:12:16 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-10-09 15:12:16 +0300
commit3d1fe22f1c2037bffaf46b98211d5fadfc57d77a (patch)
treef7945f1df3c1be0bda18ef199fd237dd7a687a23
parent2a85aee317bd1ab486b04030b1b4fd3140ec821b (diff)
suddenly the old code contains manual implementation of db_delete_module()
-rw-r--r--src/mir_app/src/proto_accs.cpp31
1 files changed, 1 insertions, 30 deletions
diff --git a/src/mir_app/src/proto_accs.cpp b/src/mir_app/src/proto_accs.cpp
index 8d7f068c9e..077a3b81e7 100644
--- a/src/mir_app/src/proto_accs.cpp
+++ b/src/mir_app/src/proto_accs.cpp
@@ -118,38 +118,10 @@ void LoadDbAccounts(void)
/////////////////////////////////////////////////////////////////////////////////////////
-struct enumDB_ProtoProcParam
-{
- int arrlen;
- char **pszSettingName;
-};
-
-static int enumDB_ProtoProc(const char* szSetting, void *lParam)
-{
- if (szSetting) {
- enumDB_ProtoProcParam* p = (enumDB_ProtoProcParam*)lParam;
-
- p->arrlen++;
- p->pszSettingName = (char**)mir_realloc(p->pszSettingName, p->arrlen*sizeof(char*));
- p->pszSettingName[p->arrlen - 1] = mir_strdup(szSetting);
- }
- return 0;
-}
-
void WriteDbAccounts()
{
// enum all old settings to delete
- enumDB_ProtoProcParam param = { 0, nullptr };
- db_enum_settings(0, enumDB_ProtoProc, "Protocols", &param);
-
- // delete all settings
- if (param.arrlen) {
- for (int i = 0; i < param.arrlen; i++) {
- db_unset(0, "Protocols", param.pszSettingName[i]);
- mir_free(param.pszSettingName[i]);
- }
- mir_free(param.pszSettingName);
- }
+ db_delete_module(0, "Protocols");
// write new data
for (int i = 0; i < accounts.getCount(); i++) {
@@ -172,7 +144,6 @@ void WriteDbAccounts()
db_set_ws(0, "Protocols", buf, pa->tszAccountName);
}
- db_unset(0, "Protocols", "ProtoCount");
db_set_dw(0, "Protocols", "ProtoCount", accounts.getCount());
db_set_dw(0, "Protocols", "PrVer", 4);
}