summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-10-15 17:07:58 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-10-15 17:07:58 +0000
commit1b098ca45335c8132b4c9997e1485c22e51ba59f (patch)
treef6a48c6099610a45098f39185ca9056069132844
parentfd7bc518df1ec6039c25caf43a4310543217d5ae (diff)
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
-rw-r--r--src/mir_app/src/dbini.cpp28
1 files changed, 28 insertions, 0 deletions
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<char> *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<char> arSettings(1);
+ ESFDParam param = { &arSettings, szName };
+ DBCONTACTENUMSETTINGS dbep = {};
+ dbep.pfnEnumProc = EnumSettingsForDeletion;
+ dbep.szModule = szSection;
+ dbep.lParam = (LPARAM)&param;
+ 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':