From cb4a46e7fbe62d788e66ed6121c717a2d22a4d7c Mon Sep 17 00:00:00 2001 From: watcherhd Date: Thu, 21 Apr 2011 14:14:52 +0000 Subject: svn.miranda.im is moving to a new home! git-svn-id: http://miranda-plugins.googlecode.com/svn/trunk@7 e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb --- dbeditorpp/modsettingenum.c | 88 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 dbeditorpp/modsettingenum.c (limited to 'dbeditorpp/modsettingenum.c') diff --git a/dbeditorpp/modsettingenum.c b/dbeditorpp/modsettingenum.c new file mode 100644 index 0000000..683434c --- /dev/null +++ b/dbeditorpp/modsettingenum.c @@ -0,0 +1,88 @@ +#include "headers.h" + +void FreeModuleSettingLL(ModuleSettingLL* msll) +{ + if (msll) + { + + struct ModSetLinkLinkItem *item = msll->first; + struct ModSetLinkLinkItem *temp; + + while (item) + { + safe_free(item->name); + temp = item; + item = (struct ModSetLinkLinkItem *)item->next; + safe_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 *)malloc(sizeof(struct ModSetLinkLinkItem)); + if (!msll->first) return 1; + msll->first->name = strdup(szName); + msll->first->next = 0; + msll->last = msll->first; + } + else + { + struct ModSetLinkLinkItem *item = (struct ModSetLinkLinkItem *)malloc(sizeof(struct ModSetLinkLinkItem)); + if (!item) return 1; + msll->last->next = (BYTE*)item; + msll->last = (struct ModSetLinkLinkItem *)item; + item->name = strdup(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 -- cgit v1.2.3