only load hidden nodes in retro-only mode

This commit is contained in:
csoler 2017-12-21 21:34:51 +01:00
parent 5b5a2bef81
commit f5ce711ad6
5 changed files with 46 additions and 29 deletions

View file

@ -10,6 +10,9 @@ DESTDIR = lib
#CONFIG += dsdv
retrotor {
DEFINES *= RETROTOR
}
# the dht stunner is used to obtain RS' external ip addr. when it is natted
# this system is unreliable and rs supports a newer and better one (asking connected peers)
# CONFIG += useDhtStunner

View file

@ -71,8 +71,11 @@ RsAccountsDetail::RsAccountsDetail() : mAccountsLocked(false), mPreferredId("")
bool RsAccountsDetail::loadAccounts()
{
int failing_accounts ;
getAvailableAccounts(mAccounts,failing_accounts,mUnsupportedKeys);
#ifdef RETROTOR
getAvailableAccounts(mAccounts,failing_accounts,mUnsupportedKeys,true);
#else
getAvailableAccounts(mAccounts,failing_accounts,mUnsupportedKeys,false);
#endif
loadPreferredAccount();
checkPreferredId();
@ -512,7 +515,7 @@ bool RsAccountsDetail::getAccountOptions(bool &ishidden, bool &isFirstTimeRun)
/* directories with valid certificates in the expected location */
bool RsAccountsDetail::getAvailableAccounts(std::map<RsPeerId, AccountDetails> &accounts,int& failing_accounts,std::map<std::string,std::vector<std::string> >& unsupported_keys)
bool RsAccountsDetail::getAvailableAccounts(std::map<RsPeerId, AccountDetails> &accounts,int& failing_accounts,std::map<std::string,std::vector<std::string> >& unsupported_keys,bool hidden_only)
{
failing_accounts = 0 ;
/* get the directories */
@ -615,6 +618,9 @@ bool RsAccountsDetail::getAvailableAccounts(std::map<RsPeerId, AccountDetails> &
continue;
}
if(hidden_only && !hidden_location)
continue ;
if(valid_prefix && isHexaString(lochex) && (lochex).length() == 32)
{
std::string accountdir = mBaseDirectory + "/" + *it;

View file

@ -142,9 +142,9 @@ class RsAccountsDetail
static bool defaultBaseDirectory();
bool getAvailableAccounts(std::map<RsPeerId, AccountDetails> &accounts,
bool getAvailableAccounts(std::map<RsPeerId, AccountDetails> &accounts,
int& failing_accounts,
std::map<std::string,std::vector<std::string> >& unsupported_keys);
std::map<std::string,std::vector<std::string> >& unsupported_keys, bool hidden_only=false);
bool setupAccount(const std::string& accountdir);