You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
786 B
C++
29 lines
786 B
C++
2 years ago
|
// This file is under GNU General Public License 3.0
|
||
|
// see LICENSE.txt
|
||
|
|
||
|
#ifndef LIBPEPADAPTER_PASSPHRASE_CACHE_HXX
|
||
|
#define LIBPEPADAPTER_PASSPHRASE_CACHE_HXX
|
||
|
|
||
3 years ago
|
#include "passphrase_cache.hh"
|
||
|
|
||
|
namespace pEp {
|
||
2 years ago
|
template<typename... A>
|
||
|
PEP_STATUS PassphraseCache::api(PEP_STATUS f(PEP_SESSION, A...), PEP_SESSION session, A... a)
|
||
3 years ago
|
{
|
||
|
PEP_STATUS status;
|
||
|
|
||
|
for_each_passphrase([&](std::string passphrase) {
|
||
3 years ago
|
status = ::config_passphrase(session, passphrase.c_str());
|
||
|
if (status)
|
||
|
return true;
|
||
|
|
||
3 years ago
|
status = f(session, a...);
|
||
2 years ago
|
return status != PEP_PASSPHRASE_REQUIRED && status != PEP_WRONG_PASSPHRASE;
|
||
3 years ago
|
});
|
||
|
|
||
|
return status;
|
||
|
}
|
||
2 years ago
|
}; // namespace pEp
|
||
3 years ago
|
|
||
2 years ago
|
#endif // LIBPEPADAPTER_PASSPHRASE_CACHE_HXX
|