mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-02 06:06:10 -04:00
Added new return codes to RsInit::InitRetroShare to know, what failed.
Show error box when gpg initialization failed. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3744 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
89f448d282
commit
0e41211f3c
6 changed files with 208 additions and 112 deletions
|
@ -135,6 +135,8 @@ AuthGPGimpl::AuthGPGimpl()
|
|||
{
|
||||
RsStackMutex stack(gpgMtxEngine); /******* LOCKED ******/
|
||||
|
||||
CTX = NULL;
|
||||
|
||||
setlocale(LC_ALL, "");
|
||||
gpgme_check_version(NULL);
|
||||
gpgme_set_locale(NULL, LC_CTYPE, setlocale (LC_CTYPE, NULL));
|
||||
|
@ -197,6 +199,11 @@ bool AuthGPGimpl::InitAuth ()
|
|||
{
|
||||
std::string HomeDir;
|
||||
|
||||
if (!CTX) {
|
||||
std::cerr << "Error with gpg initialization. Is gpg missing ?" << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef WINDOWS_SYS
|
||||
if (RsInit::isPortable ()) {
|
||||
// set home dir of gpg to configdir\gnupg
|
||||
|
|
|
@ -26,7 +26,11 @@
|
|||
*
|
||||
*/
|
||||
|
||||
|
||||
// Initialize ok, result >= 0
|
||||
#define RS_INIT_OK 0 // Initialize ok
|
||||
#define RS_INIT_HAVE_ACCOUNT 1 // Initialize ok, have account
|
||||
// Initialize failed, result < 0
|
||||
#define RS_INIT_AUTH_FAILED -1 // AuthGPG::InitAuth failed
|
||||
|
||||
|
||||
/****
|
||||
|
@ -55,10 +59,9 @@ class RsInit
|
|||
* @param argc passed from executable
|
||||
* @param argv commandline arguments passed to executable
|
||||
* @param strictCheck set to true if you want rs to continue executing if invalid argument passed and vice versa
|
||||
* @return one is initialisation has been successful
|
||||
* @return RS_INIT_...
|
||||
*/
|
||||
static int InitRetroShare(int argc, char **argv,
|
||||
bool strictCheck=true);
|
||||
static int InitRetroShare(int argc, char **argv, bool strictCheck=true);
|
||||
|
||||
/*!
|
||||
* This return directory seperator for different platforms, not an issue anymore as C library can distinguish
|
||||
|
@ -107,7 +110,7 @@ class RsInit
|
|||
|
||||
/*!
|
||||
* Final Certificate load. This can be called if:
|
||||
* a) InitRetroshare() returns true -> autoLoad/password Set.
|
||||
* a) InitRetroshare() returns RS_INIT_HAVE_ACCOUNT -> autoLoad/password Set.
|
||||
* b) SelectGPGAccount() && LoadPassword()
|
||||
*
|
||||
* This wrapper is used to lock the profile first before
|
||||
|
|
|
@ -585,8 +585,11 @@ int RsInit::InitRetroShare(int argcIgnored, char **argvIgnored, bool strictCheck
|
|||
setupBaseDir();
|
||||
get_configinit(RsInitConfig::basedir, RsInitConfig::preferedId);
|
||||
|
||||
/* Initialize AuthGPG */
|
||||
AuthGPG::getAuthGPG()->InitAuth();
|
||||
/* Initialize AuthGPG */
|
||||
if (AuthGPG::getAuthGPG()->InitAuth() == false) {
|
||||
std::cerr << "AuthGPG::InitAuth failed" << std::endl;
|
||||
return RS_INIT_AUTH_FAILED;
|
||||
}
|
||||
|
||||
//std::list<accountId> ids;
|
||||
std::list<accountId>::iterator it;
|
||||
|
@ -648,7 +651,7 @@ int RsInit::InitRetroShare(int argcIgnored, char **argvIgnored, bool strictCheck
|
|||
|
||||
if (RsInitConfig::havePasswd)
|
||||
{
|
||||
return 1;
|
||||
return RS_INIT_HAVE_ACCOUNT;
|
||||
}
|
||||
|
||||
RsInit::LoadPassword(RsInitConfig::preferedId, "");
|
||||
|
@ -656,10 +659,10 @@ int RsInit::InitRetroShare(int argcIgnored, char **argvIgnored, bool strictCheck
|
|||
if (RsTryAutoLogin())
|
||||
{
|
||||
RsInit::setAutoLogin(true);
|
||||
return 1;
|
||||
return RS_INIT_HAVE_ACCOUNT;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return RS_INIT_OK;
|
||||
}
|
||||
|
||||
/**************************** Access Functions for Init Data **************************/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue