mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-07 06:02:41 -04:00
Expose more login related JSON API
/rsLoginHelper/isLoggedIn to check if already logged in /rsAccounts/getCurrentAccountId to get the id of current selected account, beware that an account may be selected without actually logging in
This commit is contained in:
parent
a9b1a15b43
commit
a8ddec03fc
7 changed files with 105 additions and 55 deletions
|
@ -51,6 +51,15 @@ struct RsLoginHelper;
|
|||
*/
|
||||
extern RsLoginHelper* rsLoginHelper;
|
||||
|
||||
|
||||
class RsAccounts;
|
||||
|
||||
/**
|
||||
* Pointer to global instance of RsAccounts needed to expose JSON API
|
||||
* @jsonapi{development}
|
||||
*/
|
||||
extern RsAccounts* rsAccounts;
|
||||
|
||||
/*!
|
||||
* Initialisation Class (not publicly disclosed to RsIFace)
|
||||
*/
|
||||
|
@ -132,31 +141,36 @@ private:
|
|||
|
||||
/* Seperate static Class for dealing with Accounts */
|
||||
|
||||
class RsAccountsDetail ;
|
||||
class RsAccountsDetail;
|
||||
|
||||
class RsAccounts
|
||||
{
|
||||
public:
|
||||
// Should be called once before everything else.
|
||||
|
||||
/// Should be called once before everything else.
|
||||
static bool init(const std::string &opt_base_dir, int& error_code);
|
||||
|
||||
/**
|
||||
* @brief ConfigDirectory (normally ~/.retroshare) you can call this method
|
||||
* even before initialisation (you can't with some other methods)
|
||||
*
|
||||
* On linux: ~/.retroshare/
|
||||
*
|
||||
* @see RsAccountsDetail::PathBaseDirectory()
|
||||
*/
|
||||
* @brief ConfigDirectory (usually ~/.retroshare) you can call this method
|
||||
* even before initialisation (you can't with some other methods)
|
||||
* @see RsAccountsDetail::PathBaseDirectory()
|
||||
*/
|
||||
static std::string ConfigDirectory();
|
||||
|
||||
/**
|
||||
* @brief DataDirectory
|
||||
* you can call this method even before initialisation (you can't with some other methods)
|
||||
* @param check if set to true and directory does not exist, return empty string
|
||||
* @return path where global platform independent files are stored, like bdboot.txt or webinterface files
|
||||
*/
|
||||
* @brief Get current account id. Beware that an account may be selected
|
||||
* without actually logging in.
|
||||
* @jsonapi{development}
|
||||
* @param[out] id storage for current account id
|
||||
* @return false if account hasn't been selected yet, true otherwise
|
||||
*/
|
||||
bool getCurrentAccountId(RsPeerId &id);
|
||||
|
||||
/**
|
||||
* @brief DataDirectory
|
||||
* you can call this method even before initialisation (you can't with some other methods)
|
||||
* @param check if set to true and directory does not exist, return empty string
|
||||
* @return path where global platform independent files are stored, like bdboot.txt or webinterface files
|
||||
*/
|
||||
static std::string systemDataDirectory(bool check = true);
|
||||
static std::string PGPDirectory();
|
||||
|
||||
|
@ -207,7 +221,7 @@ public:
|
|||
static void unlockPreferredAccount() ;
|
||||
|
||||
private:
|
||||
static RsAccountsDetail *rsAccounts ;
|
||||
static RsAccountsDetail* rsAccountsDetails;
|
||||
};
|
||||
|
||||
|
||||
|
@ -263,6 +277,14 @@ struct RsLoginHelper
|
|||
const std::string& password, bool makeHidden,
|
||||
bool makeAutoTor, std::string& errorMessage );
|
||||
|
||||
/**
|
||||
* @brief Check if RetroShare is already logged in, this usually return true
|
||||
* after a successfull attemptLogin() and before closeSession()
|
||||
* @jsonapi{development}
|
||||
* @return true if already logged in, false otherwise
|
||||
*/
|
||||
bool isLoggedIn();
|
||||
|
||||
/**
|
||||
* @brief Close RetroShare session
|
||||
* @jsonapi{development}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue