mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-24 15:05:35 -04:00
started cleaning the mess with rsAccounts: only exposed useful functionality of rsAccount beyond a static class and removed all references to rsAccounts in the code
This commit is contained in:
parent
e2bb3aef1b
commit
0f758902cd
19 changed files with 279 additions and 214 deletions
|
@ -49,6 +49,7 @@ class AccountDetails
|
|||
std::string mLocation;
|
||||
bool mIsHiddenLoc;
|
||||
bool mFirstRun;
|
||||
bool mIsAutoTor;
|
||||
|
||||
};
|
||||
|
||||
|
@ -58,9 +59,6 @@ class RsAccountsDetail
|
|||
RsAccountsDetail();
|
||||
|
||||
// These functions are externally accessible via RsAccounts namespace.
|
||||
|
||||
|
||||
|
||||
// These functions are accessible from inside libretroshare.
|
||||
|
||||
bool setupBaseDirectory(std::string alt_basedir);
|
||||
|
@ -87,52 +85,43 @@ class RsAccountsDetail
|
|||
// PGP Path is only dependent on BaseDirectory.
|
||||
std::string PathPGPDirectory();
|
||||
|
||||
// Below are dependent on mPreferredId.
|
||||
std::string PathAccountDirectory();
|
||||
std::string PathAccountKeysDirectory();
|
||||
std::string PathKeyFile();
|
||||
std::string PathCertFile();
|
||||
std::string LocationName();
|
||||
// Generate a new account based on a given PGP key returns its SSL id and sets it to be the preferred account.
|
||||
|
||||
bool GenerateSSLCertificate(const RsPgpId& gpg_id, const std::string& org, const std::string& loc, const std::string& country, const bool ishiddenloc, const std::string& passwd, RsPeerId &sslId, std::string &errString);
|
||||
|
||||
// PGP Accounts.
|
||||
|
||||
int GetPGPLogins(std::list<RsPgpId> &pgpIds);
|
||||
int GetPGPLoginDetails(const RsPgpId& id, std::string &name, std::string &email);
|
||||
int GetPGPLoginDetails(const RsPgpId& id, std::string &name, std::string &email);
|
||||
bool GeneratePGPCertificate(const std::string&, const std::string& email, const std::string& passwd, RsPgpId &pgpId, const int keynumbits, std::string &errString);
|
||||
|
||||
bool SelectPGPAccount(const RsPgpId& pgpId);
|
||||
bool SelectPGPAccount(const RsPgpId& pgpId);
|
||||
|
||||
// PGP Support Functions.
|
||||
bool exportIdentity(const std::string& fname,const RsPgpId& pgp_id) ;
|
||||
bool importIdentity(const std::string& fname,RsPgpId& imported_pgp_id,std::string& import_error) ;
|
||||
bool importIdentityFromString(const std::string& data,RsPgpId& imported_pgp_id,std::string& import_error) ;
|
||||
void getUnsupportedKeys(std::map<std::string,std::vector<std::string> > &unsupported_keys);
|
||||
void getUnsupportedKeys(std::map<std::string,std::vector<std::string> > &unsupported_keys);
|
||||
bool copyGnuPGKeyrings() ;
|
||||
|
||||
|
||||
// Selecting Rs Account.
|
||||
bool getAccountIds(std::list<RsPeerId> &ids);
|
||||
bool selectAccountByString(const std::string &prefUserString);
|
||||
bool selectId(const RsPeerId& preferredId);
|
||||
|
||||
// Details of Rs Account.
|
||||
bool getPreferredAccountId(RsPeerId &id);
|
||||
bool getAccountDetails(const RsPeerId &id, RsPgpId& gpgId, std::string &gpgName, std::string &gpgEmail, std::string &location);
|
||||
|
||||
bool getAccountOptions(bool &ishidden, bool &isFirstTimeRun);
|
||||
|
||||
|
||||
bool getAccountIds(std::list<RsPeerId> &ids);
|
||||
|
||||
bool GenerateSSLCertificate(const RsPgpId& gpg_id,
|
||||
const std::string& org, const std::string& loc,
|
||||
const std::string& country, const bool ishiddenloc,
|
||||
const std::string& passwd, RsPeerId &sslId,
|
||||
std::string &errString);
|
||||
|
||||
// From init file.
|
||||
bool storePreferredAccount();
|
||||
bool loadPreferredAccount();
|
||||
|
||||
// Details of current Rs Account.
|
||||
bool getCurrentAccountId(RsPeerId &id);
|
||||
bool getCurrentAccountDetails(const RsPeerId &id, RsPgpId& gpgId, std::string &gpgName, std::string &gpgEmail, std::string &location);
|
||||
bool getCurrentAccountOptions(bool &ishidden, bool &isautotor, bool &isFirstTimeRun);
|
||||
|
||||
std::string getCurrentAccountPathAccountDirectory();
|
||||
std::string getCurrentAccountPathAccountKeysDirectory();
|
||||
std::string getCurrentAccountPathKeyFile();
|
||||
std::string getCurrentAccountPathCertFile();
|
||||
std::string getCurrentAccountLocationName();
|
||||
|
||||
|
||||
private:
|
||||
bool checkPreferredId();
|
||||
|
||||
|
@ -155,6 +144,4 @@ class RsAccountsDetail
|
|||
std::map<std::string,std::vector<std::string> > mUnsupportedKeys ;
|
||||
};
|
||||
|
||||
// Global singleton declaration of data.
|
||||
extern RsAccountsDetail *rsAccounts;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue