diff --git a/CpEpEngine.cpp b/CpEpEngine.cpp index 435479d..60b4f82 100644 --- a/CpEpEngine.cpp +++ b/CpEpEngine.cpp @@ -1770,3 +1770,26 @@ STDMETHODIMP CpEpEngine::DeliverHandshakeResult(enum SyncHandshakeResult result, return S_OK; } + +STDMETHODIMP CpEpEngine::PERToXERSyncMessage(TextMessage *msg, BSTR * xer) +{ + assert(msg); + + if (!msg) + return E_INVALIDARG; + + char* text; + ::message *_msg = text_message_to_C(msg); + char* val = _msg->attachments->value; + + PEP_STATUS status = ::PER_to_XER_Sync_msg(val, strlen(val), &text); + free_message(_msg); + + if (status != PEP_STATUS_OK) + return FAIL(L"cannot get XER", status); + + *xer = utf16_bstr(text); + pEp_free(text); + + return S_OK; +} diff --git a/CpEpEngine.h b/CpEpEngine.h index bfcdef5..20e4314 100644 --- a/CpEpEngine.h +++ b/CpEpEngine.h @@ -12,6 +12,7 @@ #include #include #include "..\libpEpAdapter\pc_container.hh" +#include "..\pEp\sync_codec.h" #if defined(_WIN32_WCE) && !defined(_CE_DCOM) && !defined(_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA) #error "Single-threaded COM objects are not properly supported on Windows CE platform, such as the Windows Mobile platforms that do not include full DCOM support. Define _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA to force ATL to support creating single-thread COM object's and allow use of it's single-threaded COM object implementations. The threading model in your rgs file was set to 'Free' as that is the only threading model supported in non DCOM Windows CE platforms." @@ -277,6 +278,8 @@ public: // sync API STDMETHOD(DeliverHandshakeResult)(enum SyncHandshakeResult result, SAFEARRAY *identities_sharing); STDMETHOD(LeaveDeviceGroup)(); + + STDMETHOD(PERToXERSyncMessage)(TextMessage *msg, BSTR * xer); }; OBJECT_ENTRY_AUTO(__uuidof(pEpEngine), CpEpEngine) diff --git a/pEpCOMServerAdapter.idl b/pEpCOMServerAdapter.idl index 954c553..9f87b3c 100644 --- a/pEpCOMServerAdapter.idl +++ b/pEpCOMServerAdapter.idl @@ -493,6 +493,9 @@ interface IpEpEngine : IUnknown { // Get the comm type a bare key has [id(53)] HRESULT GetKeyRating([in] BSTR fpr, [out, retval] pEpComType *commType); + + // Decode a Sync message from PER into XER + [id(54)] HRESULT PERToXERSyncMessage([in] struct TextMessage *msg, [out, retval] BSTR *xer); }; [