wrap more functions
authorVolker Birk <vb@pep.foundation>
Wed, 15 Jul 2020 00:32:01 +0200
changeset 449ef89f31611af
parent 447 18a75cc8b45f
child 450 bd19e2ba0d54
wrap more functions
CpEpEngine.cpp
     1.1 --- a/CpEpEngine.cpp	Fri Jul 10 07:45:52 2020 +0200
     1.2 +++ b/CpEpEngine.cpp	Wed Jul 15 00:32:01 2020 +0200
     1.3 @@ -78,7 +78,7 @@
     1.4      size_t size = SysStringLen(keyData);
     1.5      ::identity_list *private_keys = nullptr;
     1.6  
     1.7 -    PEP_STATUS status = ::import_key(session(), key_data.c_str(), size, &private_keys);
     1.8 +    PEP_STATUS status = passphrase_cache.api(::import_key, session(), key_data.c_str(), size, &private_keys);
     1.9      assert(status != ::PEP_OUT_OF_MEMORY);
    1.10      if (status == ::PEP_OUT_OF_MEMORY)
    1.11          return E_OUTOFMEMORY;
    1.12 @@ -122,7 +122,7 @@
    1.13      char *_key_data = NULL;
    1.14      size_t _size = 0;
    1.15  
    1.16 -    PEP_STATUS status = ::export_key(session(), _fpr.c_str(), &_key_data, &_size);
    1.17 +    PEP_STATUS status = passphrase_cache.api(::export_key, session(), _fpr.c_str(), &_key_data, &_size);
    1.18      assert(status != ::PEP_OUT_OF_MEMORY);
    1.19      if (status == ::PEP_OUT_OF_MEMORY)
    1.20          return E_OUTOFMEMORY;
    1.21 @@ -139,7 +139,7 @@
    1.22  
    1.23  STDMETHODIMP CpEpEngine::LeaveDeviceGroup()
    1.24  {
    1.25 -    PEP_STATUS status = ::leave_device_group(session());
    1.26 +    PEP_STATUS status = passphrase_cache.api(::leave_device_group, session());
    1.27  
    1.28      if (status == PEP_OUT_OF_MEMORY)
    1.29          return E_OUTOFMEMORY;
    1.30 @@ -547,7 +547,7 @@
    1.31          return FAIL(ex.what());;
    1.32      }
    1.33  
    1.34 -    PEP_STATUS status = ::set_identity_flags(session(), _ident, (identity_flags_t)flags);
    1.35 +    PEP_STATUS status = passphrase_cache.api(::set_identity_flags, session(), _ident, (identity_flags_t)flags);
    1.36      ::free_identity(_ident);
    1.37      if (status != PEP_STATUS_OK)
    1.38          return FAIL(_T("SetIdentityFlags"), status);
    1.39 @@ -576,7 +576,7 @@
    1.40          return FAIL(ex.what());;
    1.41      }
    1.42  
    1.43 -    PEP_STATUS status = ::unset_identity_flags(session(), _ident, (identity_flags_t)flags);
    1.44 +    PEP_STATUS status = passphrase_cache.api(::unset_identity_flags, session(), _ident, (identity_flags_t)flags);
    1.45      ::free_identity(_ident);
    1.46      if (status != PEP_STATUS_OK)
    1.47          return FAIL(_T("UnsetIdentityFlags"), status);
    1.48 @@ -707,7 +707,7 @@
    1.49          status = ::config_passphrase_for_new_keys(session(), true, passphrase_for_new_keys.c_str());
    1.50      else
    1.51          status = ::config_passphrase_for_new_keys(session(), false, passphrase_for_new_keys.c_str());
    1.52 -    status = ::myself(session(), _ident);
    1.53 +    status = passphrase_cache.api(::myself, session(), _ident);
    1.54  
    1.55      if (status == PEP_STATUS_OK) {
    1.56          assert(_ident->fpr);
    1.57 @@ -747,7 +747,7 @@
    1.58      if (_ident == NULL)
    1.59          return E_OUTOFMEMORY;
    1.60  
    1.61 -    PEP_STATUS status = ::update_identity(session(), _ident);
    1.62 +    PEP_STATUS status = passphrase_cache.api(::update_identity, session(), _ident);
    1.63  
    1.64      if (status == PEP_STATUS_OK) {
    1.65          copy_identity(result, _ident);
    1.66 @@ -791,7 +791,7 @@
    1.67          return FAIL(ex.what());;
    1.68      }
    1.69  
    1.70 -    PEP_STATUS status = ::key_mistrusted(session(), _ident);
    1.71 +    PEP_STATUS status = passphrase_cache.api(::key_mistrusted, session(), _ident);
    1.72      free_identity(_ident);
    1.73  
    1.74      if (status == PEP_OUT_OF_MEMORY)
    1.75 @@ -825,7 +825,7 @@
    1.76      }
    1.77  
    1.78      bool is_pep = FALSE;
    1.79 -    PEP_STATUS status = ::is_pEp_user(session(), _ident, &is_pep);
    1.80 +    PEP_STATUS status = passphrase_cache.api(::is_pEp_user, session(), _ident, &is_pep);
    1.81  
    1.82      *ispEp = is_pep;
    1.83  
    1.84 @@ -1073,7 +1073,7 @@
    1.85          return E_INVALIDARG;
    1.86  
    1.87      string _fpr = utf8_string(fpr);
    1.88 -    PEP_STATUS status = ::blacklist_add(session(), _fpr.c_str());
    1.89 +    PEP_STATUS status = passphrase_cache.api(::blacklist_add, session(), _fpr.c_str());
    1.90      assert(status == PEP_STATUS_OK);
    1.91      if (status != PEP_STATUS_OK)
    1.92          return FAIL(L"blacklist_add failed in pEp engine", status);
    1.93 @@ -1088,7 +1088,7 @@
    1.94          return E_INVALIDARG;
    1.95  
    1.96      string _fpr = utf8_string(fpr);
    1.97 -    PEP_STATUS status = ::blacklist_delete(session(), _fpr.c_str());
    1.98 +    PEP_STATUS status = passphrase_cache.api(::blacklist_delete, session(), _fpr.c_str());
    1.99      assert(status == PEP_STATUS_OK);
   1.100      if (status != PEP_STATUS_OK)
   1.101          return FAIL(L"blacklist_delete failed in pEp engine", status);
   1.102 @@ -1106,7 +1106,7 @@
   1.103  
   1.104      string _fpr = utf8_string(fpr);
   1.105      bool result;
   1.106 -    PEP_STATUS status = ::blacklist_is_listed(session(), _fpr.c_str(), &result);
   1.107 +    PEP_STATUS status = passphrase_cache.api(::blacklist_is_listed, session(), _fpr.c_str(), &result);
   1.108      assert(status == PEP_STATUS_OK);
   1.109      if (status != PEP_STATUS_OK)
   1.110          return FAIL(L"blacklist_is_listed failed in pEp engine", status);
   1.111 @@ -1123,7 +1123,7 @@
   1.112          return E_INVALIDARG;
   1.113  
   1.114      ::stringlist_t *_blacklist = NULL;
   1.115 -    PEP_STATUS status = ::blacklist_retrieve(session(), &_blacklist);
   1.116 +    PEP_STATUS status = passphrase_cache.api(::blacklist_retrieve, session(), &_blacklist);
   1.117      assert(status == PEP_STATUS_OK);
   1.118      if (status != PEP_STATUS_OK)
   1.119          return FAIL(L"blacklist_retrieve failed in pEp engine", status);
   1.120 @@ -1437,7 +1437,7 @@
   1.121      ::stringlist_t *_keylist = new_stringlist(x_KeyList);
   1.122      ::PEP_rating _rating = PEP_rating_undefined;
   1.123  
   1.124 -    PEP_STATUS status = ::re_evaluate_message_rating(session(), _msg, _keylist, (PEP_rating)x_EncStatus, &_rating);
   1.125 +    PEP_STATUS status = passphrase_cache.api(::re_evaluate_message_rating, session(), _msg, _keylist, (PEP_rating)x_EncStatus, &_rating);
   1.126  
   1.127      ::free_stringlist(_keylist);
   1.128      ::free_message(_msg);
   1.129 @@ -1467,7 +1467,7 @@
   1.130      }
   1.131  
   1.132      PEP_rating _rating;
   1.133 -    PEP_STATUS status = ::outgoing_message_rating(session(), _msg, &_rating);
   1.134 +    PEP_STATUS status = passphrase_cache.api(::outgoing_message_rating, session(), _msg, &_rating);
   1.135      if (status != PEP_STATUS_OK)
   1.136          return FAIL(L"cannot get message rating", status);
   1.137  
   1.138 @@ -1524,7 +1524,7 @@
   1.139      }
   1.140  
   1.141      PEP_rating _rating;
   1.142 -    PEP_STATUS status = ::identity_rating(session(), _ident, &_rating);
   1.143 +    PEP_STATUS status = passphrase_cache.api(::identity_rating, session(), _ident, &_rating);
   1.144      free_identity(_ident);
   1.145  
   1.146      if (status != PEP_STATUS_OK)
   1.147 @@ -1558,7 +1558,7 @@
   1.148      *ownIdentities = nullptr;
   1.149  
   1.150      ::identity_list *il = nullptr;
   1.151 -    PEP_STATUS status = ::own_identities_retrieve(session(), &il);
   1.152 +    PEP_STATUS status = passphrase_cache.api(::own_identities_retrieve, session(), &il);
   1.153      if (status == PEP_OUT_OF_MEMORY) {
   1.154          return E_OUTOFMEMORY;
   1.155      }
   1.156 @@ -1618,7 +1618,7 @@
   1.157          verbose(ss.str());
   1.158      }
   1.159  
   1.160 -    PEP_STATUS status = ::trust_personal_key(session(), _ident);
   1.161 +    PEP_STATUS status = passphrase_cache.api(::trust_personal_key, session(), _ident);
   1.162  
   1.163      if (verbose_mode) {
   1.164          stringstream ss;
   1.165 @@ -1733,7 +1733,7 @@
   1.166          _pattern = utf8_string(search_pattern);
   1.167      ::stringpair_list_t* _keyinfo_list = NULL;
   1.168  
   1.169 -    PEP_STATUS status = ::OpenPGP_list_keyinfo(session(), _pattern.c_str(), &_keyinfo_list);
   1.170 +    PEP_STATUS status = passphrase_cache.api(::OpenPGP_list_keyinfo, session(), _pattern.c_str(), &_keyinfo_list);
   1.171      assert(status != PEP_OUT_OF_MEMORY);
   1.172      if (status == PEP_OUT_OF_MEMORY)
   1.173          return E_OUTOFMEMORY;
   1.174 @@ -1779,7 +1779,7 @@
   1.175          return E_OUTOFMEMORY;
   1.176  
   1.177      string _fpr = utf8_string(fpr);
   1.178 -    PEP_STATUS status = ::set_own_key(session(), _ident, _fpr.c_str());
   1.179 +    PEP_STATUS status = passphrase_cache.api(::set_own_key, session(), _ident, _fpr.c_str());
   1.180  
   1.181      if (status == PEP_STATUS_OK) {
   1.182          copy_identity(result, _ident);
   1.183 @@ -1819,7 +1819,7 @@
   1.184      if (_ident == NULL)
   1.185          return E_OUTOFMEMORY;
   1.186  
   1.187 -    PEP_STATUS status = ::trust_own_key(session(), _ident);
   1.188 +    PEP_STATUS status = passphrase_cache.api(::trust_own_key, session(), _ident);
   1.189  
   1.190      ::free_identity(_ident);
   1.191  
   1.192 @@ -1863,7 +1863,7 @@
   1.193      string _fpr = utf8_string(fpr);
   1.194  
   1.195      PEP_comm_type _commType;
   1.196 -    PEP_STATUS status = ::get_key_rating(session(), _fpr.c_str(), &_commType);
   1.197 +    PEP_STATUS status = passphrase_cache.api(::get_key_rating, session(), _fpr.c_str(), &_commType);
   1.198      if (status != PEP_STATUS_OK)
   1.199          return FAIL(L"cannot get key rating", status);
   1.200  
   1.201 @@ -1884,7 +1884,7 @@
   1.202      string _fpr = utf8_string(fpr);
   1.203  
   1.204      PEP_rating _rating;
   1.205 -    PEP_STATUS status = ::get_key_rating_for_user(session(), user_id.c_str(), _fpr.c_str(), &_rating);
   1.206 +    PEP_STATUS status = passphrase_cache.api(::get_key_rating_for_user, session(), user_id.c_str(), _fpr.c_str(), &_rating);
   1.207      if (status != PEP_STATUS_OK)
   1.208          return FAIL(L"cannot get key rating for user", status);
   1.209  
   1.210 @@ -2010,7 +2010,7 @@
   1.211      if (_ident == NULL)
   1.212          return E_OUTOFMEMORY;
   1.213  
   1.214 -    PEP_STATUS status = ::enable_identity_for_sync(session(), _ident);
   1.215 +    PEP_STATUS status = passphrase_cache.api(::enable_identity_for_sync, session(), _ident);
   1.216  
   1.217      ::free_identity(_ident);
   1.218  
   1.219 @@ -2113,8 +2113,8 @@
   1.220          return FAIL(L"ConfigPassphraseForNewKeys", status);
   1.221  }
   1.222  
   1.223 -STDMETHODIMP CpEpEngine::ShowNotification(BSTR title, BSTR message) 
   1.224 -{
   1.225 +STDMETHODIMP CpEpEngine::ShowNotification(BSTR title, BSTR message) 
   1.226 +{
   1.227      pEp::GateKeeper::gatekeeper()->show_notification(title, message);
   1.228      return S_OK;
   1.229  }
   1.230 \ No newline at end of file