Browse Source

just cosmetics

JNI-114
heck 5 years ago
parent
commit
5f85c064a1
  1. 1
      .hgignore
  2. 2
      src/foundation_pEp_jniadapter_AbstractEngine.cc
  3. 9
      src/passphrase_callback.hh
  4. 12
      src/passphrase_callback.hxx

1
.hgignore

@ -39,6 +39,7 @@ IdentityFlags.java
SyncHandshakeSignal.java
CipherSuite.java
passphrase_status_list.yml2
status_list.yml2
ndk*/

2
src/foundation_pEp_jniadapter_AbstractEngine.cc

@ -131,7 +131,7 @@ char* JNIAdapter::passphraseRequiredCallback(const PEP_STATUS status) {
status_ = element;
break;
}
JNISync::env() -> DeleteLocalRef(element);
JNISync::env()->DeleteLocalRef(element);
}
}
assert(objj && passphraseRequiredMethodID);

9
src/passphrase_callback.hh

@ -5,11 +5,10 @@
namespace pEp {
namespace JNIAdapter {
char* passphraseRequiredCallback(const PEP_STATUS status);
char* passphraseRequiredCallback(const PEP_STATUS status);
template<typename... A> PEP_STATUS passphraseWrap(
PEP_STATUS f(PEP_SESSION, A...), PEP_SESSION session, A... a);
};
};
template<typename... A> PEP_STATUS passphraseWrap(PEP_STATUS f(PEP_SESSION, A...), PEP_SESSION session, A... a);
}
}
#include "passphrase_callback.hxx"

12
src/passphrase_callback.hxx

@ -5,8 +5,7 @@
namespace pEp {
namespace JNIAdapter {
template<typename... A> PEP_STATUS passphraseWrap(
PEP_STATUS f(PEP_SESSION, A...), PEP_SESSION session, A... a) {
template<typename... A> PEP_STATUS passphraseWrap(PEP_STATUS f(PEP_SESSION, A...), PEP_SESSION session, A... a) {
pEpLog("cached passphrase mode");
bool retryAgain = false;
int maxRetries = 3;
@ -17,15 +16,16 @@ namespace pEp {
pEpLog("calling passphrase_cache.api from basic_api");
status = passphrase_cache.api(f, session, a...);
pEpLog("PEP_STATUS:" << status);
if (status == PEP_PASSPHRASE_REQUIRED || status == PEP_WRONG_PASSPHRASE
|| status == PEP_PASSPHRASE_FOR_NEW_KEYS_REQUIRED) {
if (status == PEP_PASSPHRASE_REQUIRED ||
status == PEP_WRONG_PASSPHRASE ||
status == PEP_PASSPHRASE_FOR_NEW_KEYS_REQUIRED)
{
pEpLog("none of the cached passphrases worked");
if (retryCount < maxRetries) {
// call the app
char *_passphrase = passphraseRequiredCallback(status);
pEpLog("callback returned, config_passphrase() with new passphrase");
PEP_STATUS status = ::config_passphrase(session,
passphrase_cache.add(_passphrase));
PEP_STATUS status = ::config_passphrase(session, passphrase_cache.add(_passphrase));
retryAgain = true;
retryCount++;
} else {

Loading…
Cancel
Save