adding events and ConnectionPoint
authorVolker Birk <vb@pep-project.org>
Wed, 11 May 2016 16:35:59 +0200
changeset 726afc06b8c3c5
parent 71 8d19e1c194f0
child 73 9e7bbe855f19
adding events and ConnectionPoint
_IpEpEngineEvents_CP.h
pEpCOMServerAdapter.idl
     1.1 --- a/_IpEpEngineEvents_CP.h	Tue May 03 20:15:26 2016 +0200
     1.2 +++ b/_IpEpEngineEvents_CP.h	Wed May 11 16:35:59 2016 +0200
     1.3 @@ -1,10 +1,51 @@
     1.4  #pragma once
     1.5  
     1.6 -using namespace ATL;
     1.7 +template<class T>
     1.8 +class CProxy_IpEpEngineEvents :
     1.9 +	public ATL::IConnectionPointImpl<T, &__uuidof(_IpEpEngineEvents)>
    1.10 +{
    1.11 +public:
    1.12 +	HRESULT Fire_messageToSend(text_message * msg)
    1.13 +	{
    1.14 +		HRESULT hr = S_OK;
    1.15 +		T * pThis = static_cast<T *>(this);
    1.16 +		int cConnections = m_vec.GetSize();
    1.17  
    1.18 -template <class T>
    1.19 -class CProxy_IpEpEngineEvents : public IConnectionPointImpl<T, &__uuidof( _IpEpEngineEvents ), CComDynamicUnkArray>
    1.20 -{
    1.21 -	// WARNING: This class may be regenerated by the wizard
    1.22 -public:
    1.23 +		for (int iConnection = 0; iConnection < cConnections; iConnection++)
    1.24 +		{
    1.25 +			pThis->Lock();
    1.26 +			CComPtr<IUnknown> punkConnection = m_vec.GetAt(iConnection);
    1.27 +			pThis->Unlock();
    1.28 +
    1.29 +			_IpEpEngineEvents * pConnection = static_cast<_IpEpEngineEvents *>(punkConnection.p);
    1.30 +
    1.31 +			if (pConnection)
    1.32 +			{
    1.33 +				hr = pConnection->messageToSend(msg);
    1.34 +			}
    1.35 +		}
    1.36 +		return hr;
    1.37 +	}
    1.38 +	HRESULT Fire_showHandshake(pEp_identity_s * self, pEp_identity_s * partner, sync_handshake_result * result)
    1.39 +	{
    1.40 +		HRESULT hr = S_OK;
    1.41 +		T * pThis = static_cast<T *>(this);
    1.42 +		int cConnections = m_vec.GetSize();
    1.43 +
    1.44 +		for (int iConnection = 0; iConnection < cConnections; iConnection++)
    1.45 +		{
    1.46 +			pThis->Lock();
    1.47 +			CComPtr<IUnknown> punkConnection = m_vec.GetAt(iConnection);
    1.48 +			pThis->Unlock();
    1.49 +
    1.50 +			_IpEpEngineEvents * pConnection = static_cast<_IpEpEngineEvents *>(punkConnection.p);
    1.51 +
    1.52 +			if (pConnection)
    1.53 +			{
    1.54 +				hr = pConnection->showHandshake(self, partner, result);
    1.55 +			}
    1.56 +		}
    1.57 +		return hr;
    1.58 +	}
    1.59  };
    1.60 +
     2.1 --- a/pEpCOMServerAdapter.idl	Tue May 03 20:15:26 2016 +0200
     2.2 +++ b/pEpCOMServerAdapter.idl	Wed May 11 16:35:59 2016 +0200
     2.3 @@ -261,6 +261,12 @@
     2.4      HRESULT decrypt_message([in] struct text_message *src, [out] struct text_message * dst, [out] SAFEARRAY(BSTR) *keylist, [out, retval] pEp_color *rating);
     2.5      HRESULT outgoing_message_color([in] struct text_message *msg, [out, retval] pEp_color * pVal);
     2.6      HRESULT identity_color([in] struct pEp_identity_s * ident, [out, retval] pEp_color * pVal);
     2.7 +
     2.8 +    typedef enum _sync_handshake_result {
     2.9 +        SYNC_HANDSHAKE_CANCEL = -1,
    2.10 +        SYNC_HANDSHAKE_ACCEPTED = 0,
    2.11 +        SYNC_HANDSHAKE_REJECTED = 1
    2.12 +    } sync_handshake_result;
    2.13  };
    2.14  
    2.15  [
    2.16 @@ -277,6 +283,8 @@
    2.17      {
    2.18      properties:
    2.19      methods:
    2.20 +        [id(1)] HRESULT messageToSend([in] struct text_message * msg);
    2.21 +        [id(2)] HRESULT showHandshake([in] struct pEp_identity_s * self, [in] struct pEp_identity_s * partner, [out, retval] sync_handshake_result *result);
    2.22      };
    2.23      [
    2.24          uuid(EF1B073D-5058-4E0E-829E-B4D22CA21EA2)