include JSON server adapter

COM-121
Volker Birk 2 years ago
parent 110a0c9ddd
commit e95095a697
  1. 22
      CpEpEngine.cpp
  2. 23
      pEpCOMServerAdapter.cpp
  3. 33
      pEpCOMServerAdapter.vcxproj
  4. 14
      pEpCOMServerAdapter.vcxproj.filters
  5. 1
      stdafx.h

@ -620,7 +620,7 @@ STDMETHODIMP CpEpEngine::MIMEDecodeMessage(BSTR mimeText, TextMessage *msg)
{
assert(mimeText);
if (!mimeText)
if (!mimeText)
return E_INVALIDARG;
string _mimeText = utf8_string(mimeText);
@ -635,7 +635,7 @@ STDMETHODIMP CpEpEngine::MIMEDecodeMessage(BSTR mimeText, TextMessage *msg)
if (status != PEP_STATUS_OK)
return FAIL(L"mime_decode_message", status);
if (_msg)
if (_msg)
text_message_from_C(msg, _msg);
free_message(_msg);
@ -648,7 +648,7 @@ STDMETHODIMP CpEpEngine::MIMEEncodeMessage(TextMessage *msg, VARIANT_BOOL omitFi
{
assert(msg);
if (!msg)
if (!msg)
return E_INVALIDARG;
::message *_msg = NULL;
@ -2075,7 +2075,7 @@ STDMETHODIMP CpEpEngine::ShutDownSync()
return S_OK;
}
STDMETHODIMP CpEpEngine::ConfigPassphrase(BSTR passphrase)
STDMETHODIMP CpEpEngine::ConfigPassphrase(BSTR passphrase)
{
string _passphrase = "";
@ -2089,23 +2089,23 @@ STDMETHODIMP CpEpEngine::ConfigPassphrase(BSTR passphrase)
else if (status == PEP_OUT_OF_MEMORY)
return E_OUTOFMEMORY;
else
return FAIL(L"ConfigPassphrase", status);
}
STDMETHODIMP CpEpEngine::ConfigPassphraseForNewKeys(VARIANT_BOOL enable, BSTR passphrase)
{
return FAIL(L"ConfigPassphrase", status);
}
STDMETHODIMP CpEpEngine::ConfigPassphraseForNewKeys(VARIANT_BOOL enable, BSTR passphrase)
{
string _passphrase = "";
if (passphrase)
_passphrase = utf8_string(passphrase);
passphrase_for_new_keys = _passphrase;
PEP_STATUS status = ::config_passphrase_for_new_keys(session(), enable && _passphrase != "", _passphrase.c_str());
PEP_STATUS status = ::config_passphrase_for_new_keys(session(), enable, cache.add(_passphrase));
if (status == PEP_STATUS_OK)
return S_OK;
else if (status == PEP_OUT_OF_MEMORY)
return E_OUTOFMEMORY;
else
return FAIL(L"ConfigPassphraseForNewKeys", status);
return FAIL(L"ConfigPassphraseForNewKeys", status);
}

@ -7,6 +7,7 @@
#include "GateKeeper.h"
#include "pEpCOMServerAdapter.h"
#include "LocalJSONAdapter.h"
using namespace ATL;
using namespace std;
@ -21,10 +22,28 @@ CpEpCOMServerAdapterModule _AtlModule;
//
extern "C" int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/,
LPTSTR /*lpCmdLine*/, int nShowCmd)
LPTSTR lpCmdLine, int nShowCmd)
{
_AtlModule.hModule(hInstance);
_AtlModule.start_gatekeeper();
return _AtlModule.WinMain(nShowCmd);
PEP_SESSION first_session;
PEP_STATUS status = ::init(&first_session, NULL, NULL);
LocalJSONAdapter* ljs = nullptr;
SessionRegistry* sr = nullptr;
if (!boost::algorithm::iequals(lpCmdLine, "/regserver"))
ljs= &LocalJSONAdapter::createInstance();
if (ljs)
ljs->startup();
auto rv = _AtlModule.WinMain(nShowCmd);
if (ljs)
ljs->shutdown_now();
::release(first_session);
return rv;
}

@ -41,14 +41,14 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<IgnoreImportLibrary>true</IgnoreImportLibrary>
<LinkIncremental>true</LinkIncremental>
<IncludePath>$(ProjectDir)..\;$(ProjectDir)..\pEpEngine\src;$(IncludePath)</IncludePath>
<IncludePath>$(SolutionDir)pEpJSONServerAdapter\server;$(ProjectDir)..\;$(ProjectDir)..\pEpEngine\src;$(IncludePath)</IncludePath>
<CodeAnalysisRuleSet>C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Static Analysis Tools\Rule Sets\NativeRecommendedRules.ruleset</CodeAnalysisRuleSet>
<RunCodeAnalysis>false</RunCodeAnalysis>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<IgnoreImportLibrary>true</IgnoreImportLibrary>
<LinkIncremental>false</LinkIncremental>
<IncludePath>$(ProjectDir)..\;$(ProjectDir)..\pEpEngine\src;$(IncludePath)</IncludePath>
<IncludePath>$(SolutionDir)pEpJSONServerAdapter\server;$(ProjectDir)..\;$(ProjectDir)..\pEpEngine\src;$(IncludePath)</IncludePath>
<CodeAnalysisRuleSet>C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Static Analysis Tools\Rule Sets\NativeRecommendedRules.ruleset</CodeAnalysisRuleSet>
<RunCodeAnalysis>false</RunCodeAnalysis>
</PropertyGroup>
@ -70,7 +70,7 @@ xcopy /y "..\Dependencies\zlib\zlib1.dll" "$(OutDir)"
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>JSON_ADAPTER_LIBRARY;DEBUG_ENABLED;WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<EnablePREfast>false</EnablePREfast>
</ClCompile>
@ -104,7 +104,7 @@ xcopy /y "..\Dependencies\zlib\zlib1.dll" "$(OutDir)"
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>JSON_ADAPTER_LIBRARY;DEBUG_ENABLED;WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<EnablePREfast>false</EnablePREfast>
</ClCompile>
@ -137,6 +137,7 @@ xcopy /y "..\Dependencies\zlib\zlib1.dll" "$(OutDir)"
<ItemGroup>
<ClCompile Include="CpEpEngine.cpp" />
<ClCompile Include="GateKeeper.cpp" />
<ClCompile Include="LocalJSONAdapter.cpp" />
<ClCompile Include="pEpCOMServerAdapter.cpp" />
<ClCompile Include="pEpCOMServerAdapter_i.c">
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsManaged>
@ -162,8 +163,10 @@ xcopy /y "..\Dependencies\zlib\zlib1.dll" "$(OutDir)"
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\pEpJSONServerAdapter\server\adapter-library.hh" />
<ClInclude Include="CpEpEngine.h" />
<ClInclude Include="GateKeeper.h" />
<ClInclude Include="LocalJSONAdapter.h" />
<ClInclude Include="pEpCOMServerAdapter.h" />
<ClInclude Include="pEpCOMServerAdapter_i.h" />
<ClInclude Include="pEp_utility.h" />
@ -182,6 +185,7 @@ xcopy /y "..\Dependencies\zlib\zlib1.dll" "$(OutDir)"
</ItemGroup>
<ItemGroup>
<None Include="..\pEpForOutlook\pep_test.snk" />
<None Include="packages.config" />
<None Include="pEpCOMServerAdapter.rgs" />
<None Include="pEpEngine.rgs" />
<None Include="updatekey.bin" />
@ -197,7 +201,28 @@ xcopy /y "..\Dependencies\zlib\zlib1.dll" "$(OutDir)"
<Project>{146e69f8-e1da-456a-b048-6dd29d9acf6b}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Library Include="..\Debug\libpEpWebserver.lib" />
<Library Include="..\Debug\pEpJSONServerAdapterLibrary.lib" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\packages\boost.1.72.0.0\build\boost.targets" Condition="Exists('..\packages\boost.1.72.0.0\build\boost.targets')" />
<Import Project="..\packages\boost_date_time-vc142.1.72.0.0\build\boost_date_time-vc142.targets" Condition="Exists('..\packages\boost_date_time-vc142.1.72.0.0\build\boost_date_time-vc142.targets')" />
<Import Project="..\packages\boost_regex-vc142.1.72.0.0\build\boost_regex-vc142.targets" Condition="Exists('..\packages\boost_regex-vc142.1.72.0.0\build\boost_regex-vc142.targets')" />
<Import Project="..\packages\boost_filesystem-vc142.1.72.0.0\build\boost_filesystem-vc142.targets" Condition="Exists('..\packages\boost_filesystem-vc142.1.72.0.0\build\boost_filesystem-vc142.targets')" />
<Import Project="..\packages\boost_thread-vc142.1.72.0.0\build\boost_thread-vc142.targets" Condition="Exists('..\packages\boost_thread-vc142.1.72.0.0\build\boost_thread-vc142.targets')" />
<Import Project="..\packages\boost_chrono-vc142.1.72.0.0\build\boost_chrono-vc142.targets" Condition="Exists('..\packages\boost_chrono-vc142.1.72.0.0\build\boost_chrono-vc142.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\boost.1.72.0.0\build\boost.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\boost.1.72.0.0\build\boost.targets'))" />
<Error Condition="!Exists('..\packages\boost_date_time-vc142.1.72.0.0\build\boost_date_time-vc142.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\boost_date_time-vc142.1.72.0.0\build\boost_date_time-vc142.targets'))" />
<Error Condition="!Exists('..\packages\boost_regex-vc142.1.72.0.0\build\boost_regex-vc142.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\boost_regex-vc142.1.72.0.0\build\boost_regex-vc142.targets'))" />
<Error Condition="!Exists('..\packages\boost_filesystem-vc142.1.72.0.0\build\boost_filesystem-vc142.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\boost_filesystem-vc142.1.72.0.0\build\boost_filesystem-vc142.targets'))" />
<Error Condition="!Exists('..\packages\boost_thread-vc142.1.72.0.0\build\boost_thread-vc142.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\boost_thread-vc142.1.72.0.0\build\boost_thread-vc142.targets'))" />
<Error Condition="!Exists('..\packages\boost_chrono-vc142.1.72.0.0\build\boost_chrono-vc142.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\boost_chrono-vc142.1.72.0.0\build\boost_chrono-vc142.targets'))" />
</Target>
</Project>

@ -43,6 +43,9 @@
<ClCompile Include="GateKeeper.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="LocalJSONAdapter.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h">
@ -75,6 +78,12 @@
<ClInclude Include="pEpCOMServerAdapter.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="LocalJSONAdapter.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\pEpJSONServerAdapter\server\adapter-library.hh">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="pEpCOMServerAdapter.rc">
@ -96,10 +105,15 @@
<Filter>Resource Files</Filter>
</None>
<None Include="..\pEpForOutlook\pep_test.snk" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Midl Include="pEpCOMServerAdapter.idl">
<Filter>Source Files</Filter>
</Midl>
</ItemGroup>
<ItemGroup>
<Library Include="..\Debug\pEpJSONServerAdapterLibrary.lib" />
<Library Include="..\Debug\libpEpWebserver.lib" />
</ItemGroup>
</Project>

@ -59,3 +59,4 @@
#include <pEp/openpgp_compat.h>
#include <pEp/platform.h>
#include <boost/algorithm/string/predicate.hpp>
Loading…
Cancel
Save