// DbHelpers.cpp // ////////////////////////////////////////////////////////////////////// #include "stdafx.h" typedef std::vector SettingsList; static int EnumSettingsProc1(const char *pszSetting, LPARAM lParam) { return 0; } bool ModuleSettingsExists(MCONTACT hContact, const char* pszModuleName) { DBCONTACTENUMSETTINGS dbces = {0}; dbces.szModule = pszModuleName; dbces.pfnEnumProc = EnumSettingsProc1; int nResult = ::CallService(MS_DB_CONTACT_ENUMSETTINGS, (WPARAM)hContact, (LPARAM)&dbces); return (nResult != -1); } static int EnumSettingsProc2(const char *pszSetting, LPARAM lParam) { SettingsList& settingsList = *((SettingsList*)lParam); settingsList.push_back(_strdup(pszSetting)); return 0; } void DeleteModuleSettings(MCONTACT hContact, const char* pszModuleName) { SettingsList settingsList; DBCONTACTENUMSETTINGS dbces = {0}; dbces.szModule = pszModuleName; dbces.lParam = (LPARAM)&settingsList; dbces.pfnEnumProc = EnumSettingsProc2; int nResult = ::CallService(MS_DB_CONTACT_ENUMSETTINGS, (WPARAM)hContact, (LPARAM)&dbces); if (nResult != -1) { for(unsigned i=0; itype != DBVT_UTF8) return rr; else return 1; } void RenameModule(MCONTACT hContact, const char* pszOldName, const char* pszNewName) { SettingsList settingsList; DBCONTACTENUMSETTINGS dbces = {0}; dbces.szModule = pszOldName; dbces.lParam = (LPARAM)&settingsList; dbces.pfnEnumProc = EnumSettingsProc2; int nResult = ::CallService(MS_DB_CONTACT_ENUMSETTINGS, (WPARAM)hContact, (LPARAM)&dbces); if (nResult != -1) { DBVARIANT dbv; for(unsigned i=0; i