adding flags functions
authorVolker Birk <vb@pep-project.org>
Wed, 23 Nov 2016 17:04:34 +0100
changeset 218ef80732697e6
parent 217 7ebb44e5bf85
child 219 03531c4d3fda
adding flags functions
CpEpEngine.cpp
CpEpEngine.h
pEpCOMServerAdapter.idl
     1.1 --- a/CpEpEngine.cpp	Wed Nov 23 16:45:55 2016 +0100
     1.2 +++ b/CpEpEngine.cpp	Wed Nov 23 17:04:34 2016 +0100
     1.3 @@ -294,6 +294,56 @@
     1.4  	return S_OK;
     1.5  }
     1.6  
     1.7 +STDMETHODIMP CpEpEngine::SetIdentityFlags(struct pEpIdentity *identity, LONG flags)
     1.8 +{
     1.9 +	::pEp_identity *_ident = nullptr;
    1.10 +
    1.11 +	try {
    1.12 +		_ident = new_identity(identity);
    1.13 +		assert(_ident);
    1.14 +		if (_ident == NULL)
    1.15 +			return E_OUTOFMEMORY;
    1.16 +	}
    1.17 +	catch (bad_alloc&) {
    1.18 +		return E_OUTOFMEMORY;
    1.19 +	}
    1.20 +	catch (exception& ex) {
    1.21 +		return FAIL(ex.what());;
    1.22 +	}
    1.23 +
    1.24 +	PEP_STATUS status = ::set_identity_flags(get_session(), _ident, (identity_flags_t)flags);
    1.25 +	::free_identity(_ident);
    1.26 +	if (status != PEP_STATUS_OK)
    1.27 +		return FAIL(_T("SetIdentityFlags"), status);
    1.28 +
    1.29 +	return S_OK;
    1.30 +}
    1.31 +
    1.32 +STDMETHODIMP CpEpEngine::UnsetIdentityFlags(struct pEpIdentity *identity, LONG flags)
    1.33 +{
    1.34 +	::pEp_identity *_ident = nullptr;
    1.35 +
    1.36 +	try {
    1.37 +		_ident = new_identity(identity);
    1.38 +		assert(_ident);
    1.39 +		if (_ident == NULL)
    1.40 +			return E_OUTOFMEMORY;
    1.41 +	}
    1.42 +	catch (bad_alloc&) {
    1.43 +		return E_OUTOFMEMORY;
    1.44 +	}
    1.45 +	catch (exception& ex) {
    1.46 +		return FAIL(ex.what());;
    1.47 +	}
    1.48 +
    1.49 +	PEP_STATUS status = ::unset_identity_flags(get_session(), _ident, (identity_flags_t)flags);
    1.50 +	::free_identity(_ident);
    1.51 +	if (status != PEP_STATUS_OK)
    1.52 +		return FAIL(_T("UnsetIdentityFlags"), status);
    1.53 +
    1.54 +	return S_OK;
    1.55 +}
    1.56 +
    1.57  STDMETHODIMP CpEpEngine::StartKeyserverLookup()
    1.58  {
    1.59  	if (identity_queue.load())
     2.1 --- a/CpEpEngine.h	Wed Nov 23 16:45:55 2016 +0100
     2.2 +++ b/CpEpEngine.h	Wed Nov 23 17:04:34 2016 +0100
     2.3 @@ -161,6 +161,8 @@
     2.4      STDMETHOD(GetCrashdumpLog)(LONG maxlines, BSTR * log);
     2.5      STDMETHOD(GetEngineVersion)(BSTR * engineVersion);
     2.6      STDMETHOD(GetLanguageList)(BSTR * languages);
     2.7 +	STDMETHOD(SetIdentityFlags)(struct pEpIdentity *identity, LONG flags);
     2.8 +	STDMETHOD(UnsetIdentityFlags)(struct pEpIdentity *identity, LONG flags);
     2.9  
    2.10      // keymanagement API
    2.11  
     3.1 --- a/pEpCOMServerAdapter.idl	Wed Nov 23 16:45:55 2016 +0100
     3.2 +++ b/pEpCOMServerAdapter.idl	Wed Nov 23 17:04:34 2016 +0100
     3.3 @@ -132,6 +132,9 @@
     3.4  		int Flags;
     3.5      };
     3.6  
     3.7 +	HRESULT SetIdentityFlags([in] struct pEpIdentity *identity, [in] LONG flags);
     3.8 +	HRESULT UnsetIdentityFlags([in] struct pEpIdentity *identity, [in] LONG flags);
     3.9 +
    3.10      // Keymanagement API
    3.11  
    3.12      HRESULT StartKeyserverLookup();