CpEpEngine.h
branchCOM-74
changeset 267 ae02fcd56811
parent 264 aa6bd84bd6c3
child 271 92866cd8b0c4
     1.1 --- a/CpEpEngine.h	Fri Dec 01 19:38:09 2017 +0100
     1.2 +++ b/CpEpEngine.h	Sat Jan 13 14:02:03 2018 +0100
     1.3 @@ -22,9 +22,9 @@
     1.4  
     1.5  class ATL_NO_VTABLE CpEpEngine :
     1.6      public CComObjectRootEx<CComObjectThreadModel>,
     1.7 -	public CComCoClass<CpEpEngine, &CLSID_pEpEngine>,
     1.8 -	public ISupportErrorInfo,
     1.9 -	public IpEpEngine2
    1.10 +    public CComCoClass<CpEpEngine, &CLSID_pEpEngine>,
    1.11 +    public ISupportErrorInfo,
    1.12 +    public IpEpEngine2
    1.13  {
    1.14  
    1.15  protected:
    1.16 @@ -32,10 +32,10 @@
    1.17  
    1.18  public:
    1.19      CpEpEngine() : keymanagement_thread(NULL), identity_queue(NULL), verbose_mode(false)
    1.20 -	{
    1.21 -		std::lock_guard<std::mutex> lock(init_mutex);
    1.22 -		PEP_STATUS status = ::init(&m_session);
    1.23 -		assert(status == PEP_STATUS_OK);
    1.24 +    {
    1.25 +        std::lock_guard<std::mutex> lock(init_mutex);
    1.26 +        PEP_STATUS status = ::init(&m_session);
    1.27 +        assert(status == PEP_STATUS_OK);
    1.28  
    1.29          ::register_examine_function(m_session, CpEpEngine::examine_identity, (void *)this);
    1.30          ::log_event(m_session, "Startup", "pEp COM Adapter", NULL, NULL);
    1.31 @@ -46,8 +46,8 @@
    1.32          stop_keysync();
    1.33          StopKeyserverLookup();
    1.34          ::log_event(m_session, "Shutdown", "pEp COM Adapter", NULL, NULL);
    1.35 -		std::lock_guard<std::mutex> lock(init_mutex);
    1.36 -		::release(m_session);
    1.37 +        std::lock_guard<std::mutex> lock(init_mutex);
    1.38 +        ::release(m_session);
    1.39      }
    1.40  
    1.41  DECLARE_REGISTRY_RESOURCEID(IDR_PEPENGINE)
    1.42 @@ -61,19 +61,19 @@
    1.43  END_COM_MAP()
    1.44  
    1.45  // ISupportsErrorInfo
    1.46 -	STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
    1.47 +    STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
    1.48  
    1.49  
    1.50 -	DECLARE_PROTECT_FINAL_CONSTRUCT()
    1.51 +    DECLARE_PROTECT_FINAL_CONSTRUCT()
    1.52  
    1.53 -	HRESULT FinalConstruct()
    1.54 -	{
    1.55 -		return S_OK;
    1.56 -	}
    1.57 +    HRESULT FinalConstruct()
    1.58 +    {
    1.59 +        return S_OK;
    1.60 +    }
    1.61  
    1.62 -	void FinalRelease()
    1.63 -	{
    1.64 -	}
    1.65 +    void FinalRelease()
    1.66 +    {
    1.67 +    }
    1.68  
    1.69  
    1.70  protected:
    1.71 @@ -131,19 +131,19 @@
    1.72      bool verbose_mode;
    1.73  
    1.74  
    1.75 -	IpEpEngineCallbacks* client_callbacks = NULL;
    1.76 +    IpEpEngineCallbacks* client_callbacks = NULL;
    1.77      IpEpEngineCallbacks* client_callbacks_on_sync_thread = NULL;
    1.78      IpEpEngineCallbacks2* client_callbacks2_on_sync_thread = NULL;
    1.79      bool client_last_signalled_polling_state = true;
    1.80  
    1.81 -	// Keysync members
    1.82 +    // Keysync members
    1.83      static int inject_sync_msg(void *msg, void* management);
    1.84      static void* retrieve_next_sync_msg(void* management, time_t *timeout);
    1.85      void start_keysync();
    1.86      static void do_keysync_in_thread(CpEpEngine* self, LPSTREAM marshaled_callbacks);
    1.87      void stop_keysync();
    1.88  
    1.89 -	static std::mutex init_mutex;
    1.90 +    static std::mutex init_mutex;
    1.91  
    1.92      std::recursive_mutex keysync_mutex;
    1.93      std::condition_variable_any keysync_condition;
    1.94 @@ -191,8 +191,8 @@
    1.95      STDMETHOD(GetCrashdumpLog)(LONG maxlines, BSTR * log);
    1.96      STDMETHOD(GetEngineVersion)(BSTR * engineVersion);
    1.97      STDMETHOD(GetLanguageList)(BSTR * languages);
    1.98 -	STDMETHOD(SetIdentityFlags)(struct pEpIdentity *identity, pEpIdentityFlags flags);
    1.99 -	STDMETHOD(UnsetIdentityFlags)(struct pEpIdentity *identity, pEpIdentityFlags flags);
   1.100 +    STDMETHOD(SetIdentityFlags)(struct pEpIdentity *identity, pEpIdentityFlags flags);
   1.101 +    STDMETHOD(UnsetIdentityFlags)(struct pEpIdentity *identity, pEpIdentityFlags flags);
   1.102  
   1.103      // keymanagement API
   1.104  
   1.105 @@ -204,7 +204,7 @@
   1.106      STDMETHOD(KeyMistrusted)(struct pEpIdentity *ident);
   1.107      STDMETHOD(KeyResetTrust)(struct pEpIdentity *ident);
   1.108      STDMETHOD(TrustPersonalKey)(struct pEpIdentity *ident, struct pEpIdentity *result);
   1.109 -	STDMETHOD(OwnIdentitiesRetrieve)(LPSAFEARRAY* ownIdentities);
   1.110 +    STDMETHOD(OwnIdentitiesRetrieve)(LPSAFEARRAY* ownIdentities);
   1.111  
   1.112      // Blacklist API
   1.113  
   1.114 @@ -220,7 +220,7 @@
   1.115      STDMETHOD(ReEvaluateMessageRating)(TextMessage * msg, SAFEARRAY * x_KeyList, pEpRating x_EncStatus, pEpRating *rating);
   1.116      STDMETHOD(OutgoingMessageRating)(TextMessage *msg, pEpRating * pVal);
   1.117      STDMETHOD(IdentityRating)(pEpIdentity * ident, pEpRating * pVal);
   1.118 -	STDMETHOD(ColorFromRating)(pEpRating rating, pEpColor * pVal);
   1.119 +    STDMETHOD(ColorFromRating)(pEpRating rating, pEpColor * pVal);
   1.120  
   1.121      STDMETHOD(EncryptMessageForSelf)(
   1.122          pEpIdentity * targetId, 
   1.123 @@ -229,19 +229,26 @@
   1.124          pEpEncryptFlags flags
   1.125          );
   1.126  
   1.127 -	// Event callbacks
   1.128 +    STDMETHOD(EncryptMessage2)(
   1.129 +        /* [in] */ struct TextMessage *src,
   1.130 +        /* [out] */ struct TextMessage *dst,
   1.131 +        /* [in] */ SAFEARRAY * extra,
   1.132 +        /* [defaultvalue][in] */ pEpEncryptFlags flags = pEpEncryptFlagDefault,
   1.133 +        /* [defaultvalue][in] */ pEpEncFormat encFormat = pEpEncPep);
   1.134  
   1.135 -	STDMETHOD(RegisterCallbacks)(IpEpEngineCallbacks *new_callback);
   1.136 -	STDMETHOD(UnregisterCallbacks)();
   1.137 +    // Event callbacks
   1.138 +
   1.139 +    STDMETHOD(RegisterCallbacks)(IpEpEngineCallbacks *new_callback);
   1.140 +    STDMETHOD(UnregisterCallbacks)();
   1.141  
   1.142      // PGP compatibility functions
   1.143      STDMETHOD(OpenPGPListKeyinfo)(BSTR search_pattern, LPSAFEARRAY* keyinfo_list);
   1.144  
   1.145 -	STDMETHOD(UndoLastMistrust)();
   1.146 +    STDMETHOD(UndoLastMistrust)();
   1.147  
   1.148  protected:
   1.149 -	HRESULT Fire_MessageToSend(
   1.150 -		/* [in] */ struct TextMessage *msg);
   1.151 +    HRESULT Fire_MessageToSend(
   1.152 +        /* [in] */ struct TextMessage *msg);
   1.153  };
   1.154  
   1.155  OBJECT_ENTRY_AUTO(__uuidof(pEpEngine), CpEpEngine)