From 1b098ca45335c8132b4c9997e1485c22e51ba59f Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 15 Oct 2015 17:07:58 +0000 Subject: l*/L*/-* - deletes settings whose name match the preceding mask (* and ? are supported) Log*=L- git-svn-id: http://svn.miranda-ng.org/main/trunk@15562 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/mir_app/src/dbini.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/mir_app/src/dbini.cpp b/src/mir_app/src/dbini.cpp index b3661aeb76..bc52e12d02 100644 --- a/src/mir_app/src/dbini.cpp +++ b/src/mir_app/src/dbini.cpp @@ -216,6 +216,20 @@ static void ConvertBackslashes(char *str, UINT fileCp) } } +struct ESFDParam +{ + LIST *pList; + const char *pMask; +}; + +static int EnumSettingsForDeletion(const char *szSetting, LPARAM param) +{ + ESFDParam *pParam = (ESFDParam*)param; + if (wildcmpi(szSetting, pParam->pMask)) + pParam->pList->insert(mir_strdup(szSetting)); + return 0; +} + static void ProcessIniFile(TCHAR* szIniPath, char *szSafeSections, char *szUnsafeSections, int secur, bool secFN) { FILE *fp = _tfopen(szIniPath, _T("rt")); @@ -329,6 +343,20 @@ LBL_NewLine: case 'l': case 'L': case '-': + if (szValue[1] == '*') { + LIST arSettings(1); + ESFDParam param = { &arSettings, szName }; + DBCONTACTENUMSETTINGS dbep = {}; + dbep.pfnEnumProc = EnumSettingsForDeletion; + dbep.szModule = szSection; + dbep.lParam = (LPARAM)¶m; + CallService(MS_DB_CONTACT_ENUMSETTINGS, NULL, LPARAM(&dbep)); + while (arSettings.getCount()) { + db_unset(NULL, szSection, arSettings[0]); + mir_free(arSettings[0]); + arSettings.remove(0); + } + } db_unset(NULL, szSection, szName); break; case 'e': -- cgit v1.2.3