From 3d1fe22f1c2037bffaf46b98211d5fadfc57d77a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 9 Oct 2018 15:12:16 +0300 Subject: suddenly the old code contains manual implementation of db_delete_module() --- src/mir_app/src/proto_accs.cpp | 31 +------------------------------ 1 file changed, 1 insertion(+), 30 deletions(-) (limited to 'src') 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", ¶m); - - // 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); } -- cgit v1.2.3