summaryrefslogtreecommitdiff
path: root/plugins/DbeditorPP/modsettingenum.cpp
diff options
context:
space:
mode:
authorVadim Dashevskiy <watcherhd@gmail.com>2012-07-16 20:35:50 +0000
committerVadim Dashevskiy <watcherhd@gmail.com>2012-07-16 20:35:50 +0000
commita089c8f17cca1cdf688e91be38ec315803168ed8 (patch)
treeb05f66848c3715fd964ab3b810fa43de58175419 /plugins/DbeditorPP/modsettingenum.cpp
parenta473ff2857a9ad01b05f2f43923dbfd8352ee52a (diff)
Svc_dbepp is renamed to DbeditorPP
Svc_crshdmp is renamed to CrashDumper Svc_vi is renamed to VersionInfo git-svn-id: http://svn.miranda-ng.org/main/trunk@992 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/DbeditorPP/modsettingenum.cpp')
-rw-r--r--plugins/DbeditorPP/modsettingenum.cpp88
1 files changed, 88 insertions, 0 deletions
diff --git a/plugins/DbeditorPP/modsettingenum.cpp b/plugins/DbeditorPP/modsettingenum.cpp
new file mode 100644
index 0000000000..7eaecdd1a0
--- /dev/null
+++ b/plugins/DbeditorPP/modsettingenum.cpp
@@ -0,0 +1,88 @@
+#include "headers.h"
+
+void FreeModuleSettingLL(ModuleSettingLL* msll)
+{
+ if (msll)
+ {
+
+ struct ModSetLinkLinkItem *item = msll->first;
+ struct ModSetLinkLinkItem *temp;
+
+ while (item)
+ {
+ mir_free(item->name);
+ temp = item;
+ item = (struct ModSetLinkLinkItem *)item->next;
+ mir_free(temp);
+ }
+
+ msll->first = 0;
+ msll->last = 0;
+ }
+}
+
+int enumModulesSettingsProc( const char *szName , DWORD ofsModuleName , LPARAM lParam)
+{
+ ModuleSettingLL *msll = (ModuleSettingLL *)lParam;
+ if (!msll->first)
+ {
+ msll->first = (struct ModSetLinkLinkItem *)mir_alloc(sizeof(struct ModSetLinkLinkItem));
+ if (!msll->first) return 1;
+ msll->first->name = mir_tstrdup(szName);
+ msll->first->next = 0;
+ msll->last = msll->first;
+ }
+ else
+ {
+ struct ModSetLinkLinkItem *item = (struct ModSetLinkLinkItem *)mir_alloc(sizeof(struct ModSetLinkLinkItem));
+ if (!item) return 1;
+ msll->last->next = (BYTE*)item;
+ msll->last = (struct ModSetLinkLinkItem *)item;
+ item->name = mir_tstrdup(szName);
+ item->next = 0;
+ }
+ return 0;
+}
+
+int EnumModules(ModuleSettingLL *msll) // 1 = success, 0 = fail
+{
+ msll->first = 0;
+ msll->last = 0;
+ return !CallService(MS_DB_MODULES_ENUM, (WPARAM)msll,(WPARAM)enumModulesSettingsProc);
+}
+
+
+int enumSettingsProc(const char *szSetting,LPARAM lParam)
+{
+ return enumModulesSettingsProc(szSetting,0,lParam);
+}
+
+
+int EnumSettings(HANDLE hContact, char* module, ModuleSettingLL *msll)
+{
+ DBCONTACTENUMSETTINGS dbces;
+ // enum all setting the contact has for the module
+ dbces.pfnEnumProc = enumSettingsProc;
+ dbces.szModule = module;
+ dbces.lParam = (LPARAM)msll;
+ msll->first = 0;
+ msll->last = 0;
+ return !CallService(MS_DB_CONTACT_ENUMSETTINGS, (WPARAM)hContact,(LPARAM)&dbces);
+}
+
+int CheckIfModuleIsEmptyProc(const char *szSetting,LPARAM lParam)
+{
+ return 1;
+}
+
+int IsModuleEmpty(HANDLE hContact, char* szModule)
+{
+ DBCONTACTENUMSETTINGS dbces;
+ int retVal;
+ dbces.pfnEnumProc = CheckIfModuleIsEmptyProc;
+ dbces.szModule = szModule;
+ retVal = CallService(MS_DB_CONTACT_ENUMSETTINGS, (WPARAM)hContact,(LPARAM)&dbces);
+ if (retVal >= 0)
+ return 0;
+ else return 1;
+} \ No newline at end of file