delivering identities sync
authorVolker Birk <vb@pep.foundation>
Wed, 24 Apr 2019 12:35:27 +0200
branchsync
changeset 339d11f6666df5f
parent 338 ddf6ed749dc6
child 340 ddcaae01a15d
delivering identities
CpEpEngine.cpp
CpEpEngine.h
pEpCOMServerAdapter.idl
pEp_utility.h
     1.1 --- a/CpEpEngine.cpp	Wed Apr 24 12:18:34 2019 +0200
     1.2 +++ b/CpEpEngine.cpp	Wed Apr 24 12:35:27 2019 +0200
     1.3 @@ -1604,7 +1604,7 @@
     1.4  	return S_OK;
     1.5  }
     1.6  
     1.7 -STDMETHODIMP CpEpEngine::deliverHandshakeResult(enum SyncHandshakeResult result, SAFEARRAY *identities_sharing)
     1.8 +STDMETHODIMP CpEpEngine::DeliverHandshakeResult(enum SyncHandshakeResult result, SAFEARRAY *identities_sharing)
     1.9  {
    1.10  	assert(result);
    1.11  	assert(identities_sharing);
    1.12 @@ -1613,7 +1613,16 @@
    1.13  		return E_INVALIDARG;
    1.14  
    1.15  	sync_handshake_result _result = (sync_handshake_result)result;
    1.16 -	PEP_STATUS status = ::deliverHandshakeResult(session(), _result, NULL);
    1.17 +	identity_list *_identities_sharing = NULL;
    1.18 +	try {
    1.19 +		_identities_sharing = identities(identities_sharing);
    1.20 +	}
    1.21 +	catch (bad_alloc&) {
    1.22 +		return E_OUTOFMEMORY;
    1.23 +	}
    1.24 +
    1.25 +	PEP_STATUS status = ::deliverHandshakeResult(session(), _result, _identities_sharing);
    1.26 +	free_identity_list(_identities_sharing);
    1.27  	switch (status) {
    1.28  	case PEP_STATUS_OK:
    1.29  		break;
     2.1 --- a/CpEpEngine.h	Wed Apr 24 12:18:34 2019 +0200
     2.2 +++ b/CpEpEngine.h	Wed Apr 24 12:35:27 2019 +0200
     2.3 @@ -271,7 +271,7 @@
     2.4  	STDMETHOD(GetKeyRatingForUser)(BSTR userId, BSTR fpr, pEpRating *rating);
     2.5  
     2.6  	// sync API
     2.7 -	STDMETHOD(deliverHandshakeResult)(enum SyncHandshakeResult result, SAFEARRAY *identities_sharing);
     2.8 +	STDMETHOD(DeliverHandshakeResult)(enum SyncHandshakeResult result, SAFEARRAY *identities_sharing);
     2.9  };
    2.10  
    2.11  OBJECT_ENTRY_AUTO(__uuidof(pEpEngine), CpEpEngine)
     3.1 --- a/pEpCOMServerAdapter.idl	Wed Apr 24 12:18:34 2019 +0200
     3.2 +++ b/pEpCOMServerAdapter.idl	Wed Apr 24 12:35:27 2019 +0200
     3.3 @@ -467,7 +467,7 @@
     3.4  		SyncHandshakeRejected = 1
     3.5  	} SyncHandshakeResult;
     3.6  
     3.7 -	[id(48)] HRESULT deliverHandshakeResult([in] enum SyncHandshakeResult result, [in] SAFEARRAY(struct pEpIdentity) identities_sharing);
     3.8 +	[id(48)] HRESULT DeliverHandshakeResult([in] enum SyncHandshakeResult result, [in] SAFEARRAY(struct pEpIdentity) identities_sharing);
     3.9  };
    3.10  
    3.11  [
     4.1 --- a/pEp_utility.h	Wed Apr 24 12:18:34 2019 +0200
     4.2 +++ b/pEp_utility.h	Wed Apr 24 12:35:27 2019 +0200
     4.3 @@ -87,6 +87,7 @@
     4.4              return psaUDType;
     4.5          }
     4.6  
     4.7 +		identity_list *identities(SAFEARRAY * sa);
     4.8          ::message * text_message_to_C(TextMessage *msg);
     4.9          void text_message_from_C(TextMessage *msg2, const ::message *msg);
    4.10      }