CpEpEngine.h
branchkeysync
changeset 169 d776268c12a7
parent 167 9bdd481dd300
child 172 112b0fac353d
     1.1 --- a/CpEpEngine.h	Sun Oct 02 15:39:00 2016 +0200
     1.2 +++ b/CpEpEngine.h	Mon Oct 03 18:46:57 2016 +0200
     1.3 @@ -44,6 +44,7 @@
     1.4  
     1.5      ~CpEpEngine()
     1.6      {
     1.7 +        stop_keysync();
     1.8          stop_keyserver_lookup();
     1.9          ::unregister_sync_callbacks(m_session);
    1.10          ::log_event(m_session, "Shutdown", "pEp COM Adapter", NULL, NULL);
    1.11 @@ -97,7 +98,7 @@
    1.12              me->session_mutex.unlock();
    1.13          }
    1.14  
    1.15 -        operator PEP_SESSION const () 
    1.16 +        operator PEP_SESSION const ()
    1.17          {
    1.18              return me->m_session;
    1.19          }
    1.20 @@ -141,8 +142,6 @@
    1.21      static PEP_STATUS messageToSend(void * obj, message *msg);
    1.22      static PEP_STATUS showHandshake(void * obj, pEp_identity *self, pEp_identity *partner);
    1.23  
    1.24 -	static int inject_sync_msg(void *msg, void* management);
    1.25 -	static void* retreive_next_sync_msg(void* management);
    1.26  
    1.27      HRESULT error(_bstr_t msg);
    1.28  
    1.29 @@ -166,19 +165,24 @@
    1.30  	vector<IpEpEngineCallbacks*> callback_vector;
    1.31  
    1.32  	// Keysync members
    1.33 -	static std::mutex keysync_mutex;
    1.34 -	static std::condition_variable keysync_condition;
    1.35 -	static std::thread *keysync_thread;
    1.36 -	static std::queue<void*> keysync_queue;
    1.37 -	static bool keysync_thread_running;
    1.38 -	static bool keysync_abort_requested;
    1.39 -	static PEP_SESSION keysync_session;
    1.40 +    static int inject_sync_msg(void *msg, void* management);
    1.41 +    static void* retreive_next_sync_msg(void* management);
    1.42 +    void start_keysync();
    1.43 +    void stop_keysync();
    1.44 +
    1.45 +    std::mutex keysync_mutex;
    1.46 +    std::condition_variable keysync_condition;
    1.47 +    std::thread *keysync_thread = NULL;
    1.48 +    std::queue<void*> keysync_queue;
    1.49 +    bool keysync_thread_running = false;
    1.50 +    bool keysync_abort_requested = false;
    1.51 +    PEP_SESSION keysync_session;
    1.52  
    1.53  public:
    1.54      // runtime config of the adapter
    1.55  
    1.56      STDMETHOD(verbose_logging)(VARIANT_BOOL enable);
    1.57 -    
    1.58 +
    1.59      // runtime config of the engine
    1.60  
    1.61      STDMETHOD(passive_mode)(VARIANT_BOOL enable);
    1.62 @@ -221,9 +225,6 @@
    1.63      STDMETHOD(key_reset_trust)(struct pEp_identity_s *ident);
    1.64      STDMETHOD(trust_personal_key)(struct pEp_identity_s *ident, struct pEp_identity_s *result);
    1.65  
    1.66 -	// keysync API
    1.67 -	STDMETHOD(start_keysync)();
    1.68 -	STDMETHOD(stop_keysync)();
    1.69  
    1.70      // Blacklist API
    1.71  
    1.72 @@ -244,7 +245,7 @@
    1.73  
    1.74  	STDMETHOD(register_callbacks)(IpEpEngineCallbacks *new_callback);
    1.75  	STDMETHOD(unregister_callbacks)(IpEpEngineCallbacks *obsolete_callback);
    1.76 -    
    1.77 +
    1.78      // PGP compatibility functions
    1.79      STDMETHOD(OpenPGP_list_keyinfo)(BSTR search_pattern, LPSAFEARRAY* keyinfo_list);
    1.80