Index: src/plugin/PluginUserSettings.cpp |
=================================================================== |
--- a/src/plugin/PluginUserSettings.cpp |
+++ b/src/plugin/PluginUserSettings.cpp |
@@ -14,8 +14,9 @@ |
static const CString s_GetWhitelistDomains = L"GetWhitelistDomains"; |
static const CString s_AddWhitelistDomain = L"AddWhitelistDomain"; |
static const CString s_RemoveWhitelistDomain = L"RemoveWhitelistDomain"; |
+static const CString s_Require = L"require"; |
-static const CString s_Methods[] = {s_GetMessage, s_GetLanguageCount, s_GetLanguageByIndex, s_GetLanguageTitleByIndex, s_SetLanguage, s_GetLanguage, s_GetWhitelistDomains, s_AddWhitelistDomain, s_RemoveWhitelistDomain}; |
+static const CString s_Methods[] = {s_GetMessage, s_GetLanguageCount, s_GetLanguageByIndex, s_GetLanguageTitleByIndex, s_SetLanguage, s_GetLanguage, s_GetWhitelistDomains, s_AddWhitelistDomain, s_RemoveWhitelistDomain, s_Require}; |
CPluginUserSettings::CPluginUserSettings() |
{ |
@@ -305,6 +306,25 @@ |
settings->RemoveWhiteListedDomain((BSTR)domain); |
} |
} |
+ else if (s_Require == method) |
+ { |
+ if (1 != pDispparams->cArgs) |
+ return DISP_E_BADPARAMCOUNT; |
+ |
+ if (VT_BSTR != pDispparams->rgvarg[0].vt) |
+ return DISP_E_TYPEMISMATCH; |
+ |
+ pVarResult->vt = VT_BSTR; |
+ CComBSTR name = pDispparams->rgvarg[0].bstrVal; |
+ if (name.Length()) |
+ { |
+ pVarResult->bstrVal = SysAllocString(settings->GetRequire(std::wstring(name))); |
+ } |
+ else |
+ { |
+ pVarResult->bstrVal = SysAllocString(L""); |
+ } |
+ } |
else |
return DISP_E_MEMBERNOTFOUND; |