diff options
author | George Hazan <ghazan@miranda.im> | 2018-10-09 15:12:16 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-10-09 15:12:16 +0300 |
commit | 3d1fe22f1c2037bffaf46b98211d5fadfc57d77a (patch) | |
tree | f7945f1df3c1be0bda18ef199fd237dd7a687a23 /src | |
parent | 2a85aee317bd1ab486b04030b1b4fd3140ec821b (diff) |
suddenly the old code contains manual implementation of db_delete_module()
Diffstat (limited to 'src')
-rw-r--r-- | src/mir_app/src/proto_accs.cpp | 31 |
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", ¶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); } |