2009-07-30 17:27:47 -04:00
|
|
|
#ifndef RETROSHARE_INIT_INTERFACE_H
|
|
|
|
#define RETROSHARE_INIT_INTERFACE_H
|
|
|
|
|
|
|
|
/*
|
|
|
|
* "$Id: rsiface.h,v 1.9 2007-04-21 19:08:51 rmf24 Exp $"
|
|
|
|
*
|
|
|
|
* RetroShare C++ Interface.
|
|
|
|
*
|
|
|
|
* Copyright 2004-2006 by Robert Fernie.
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License Version 2 as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
|
|
* USA.
|
|
|
|
*
|
|
|
|
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2009-02-08 09:30:28 -05:00
|
|
|
/* Initialisation Class (not publicly disclosed to RsIFace) */
|
|
|
|
|
2009-05-23 11:07:35 -04:00
|
|
|
/****
|
|
|
|
* #define RS_USE_PGPSSL 1
|
|
|
|
***/
|
|
|
|
|
2009-07-30 17:27:47 -04:00
|
|
|
#define RS_USE_PGPSSL 1
|
|
|
|
|
2009-02-08 09:30:28 -05:00
|
|
|
class RsInit
|
|
|
|
{
|
|
|
|
public:
|
2009-07-30 17:27:47 -04:00
|
|
|
/* reorganised RsInit system */
|
2009-02-08 09:30:28 -05:00
|
|
|
|
2009-07-30 17:27:47 -04:00
|
|
|
/* PreLogin */
|
|
|
|
static void InitRsConfig() ;
|
|
|
|
static int InitRetroShare(int argc, char **argv);
|
2009-02-08 09:30:28 -05:00
|
|
|
|
2009-05-23 11:07:35 -04:00
|
|
|
|
2009-07-30 17:27:47 -04:00
|
|
|
/* Account Details (Combined GPG+SSL Setup) */
|
|
|
|
static bool getPreferedAccountId(std::string &id);
|
2009-10-27 16:50:30 -04:00
|
|
|
static bool getPGPEngineFileName(std::string &fileName);
|
2009-07-30 17:27:47 -04:00
|
|
|
static bool getAccountIds(std::list<std::string> &ids);
|
|
|
|
static bool getAccountDetails(std::string id,
|
|
|
|
std::string &gpgId, std::string &gpgName,
|
|
|
|
std::string &gpgEmail, std::string &sslName);
|
|
|
|
|
2009-02-08 09:30:28 -05:00
|
|
|
static bool ValidateCertificate(std::string &userName) ;
|
|
|
|
|
|
|
|
|
2009-07-30 17:27:47 -04:00
|
|
|
/* Generating GPGme Account */
|
|
|
|
static int GetPGPLogins(std::list<std::string> &pgpIds);
|
|
|
|
static int GetPGPLoginDetails(std::string id, std::string &name, std::string &email);
|
2010-01-18 07:30:54 -05:00
|
|
|
static bool GeneratePGPCertificate(std::string name, std::string email, std::string passwd, std::string &pgpId, std::string &errString);
|
2009-05-23 11:07:35 -04:00
|
|
|
|
2009-07-30 17:27:47 -04:00
|
|
|
/* Login PGP */
|
|
|
|
static bool SelectGPGAccount(std::string id);
|
|
|
|
static bool LoadGPGPassword(std::string passwd);
|
2009-05-23 11:07:35 -04:00
|
|
|
|
2009-07-30 17:27:47 -04:00
|
|
|
/* Create SSL Certificates */
|
|
|
|
static bool GenerateSSLCertificate(std::string name, std::string org, std::string loc, std::string country, std::string passwd, std::string &sslId, std::string &errString);
|
|
|
|
|
|
|
|
/* Login SSL */
|
|
|
|
static bool LoadPassword(std::string id, std::string passwd) ;
|
2009-05-23 11:07:35 -04:00
|
|
|
|
2010-04-08 08:02:46 -04:00
|
|
|
/** Final Certificate load. This can be called if:
|
2009-07-30 17:27:47 -04:00
|
|
|
* a) InitRetroshare() returns true -> autoLoad/password Set.
|
|
|
|
* b) SelectGPGAccount() && LoadPassword()
|
2009-02-08 09:30:28 -05:00
|
|
|
*/
|
2009-07-30 17:27:47 -04:00
|
|
|
static int LoadCertificates(bool autoLoginNT) ;
|
|
|
|
|
|
|
|
|
|
|
|
/* Post Login Options */
|
|
|
|
static std::string RsConfigDirectory();
|
2010-01-27 17:31:25 -05:00
|
|
|
static std::string RsProfileConfigDirectory();
|
2009-07-30 17:27:47 -04:00
|
|
|
static bool setStartMinimised() ;
|
|
|
|
|
2010-04-08 08:02:46 -04:00
|
|
|
static int getSslPwdLen();
|
|
|
|
static bool getAutoLogin();
|
|
|
|
static void setAutoLogin(bool autoLogin);
|
|
|
|
static bool RsClearAutoLogin() ;
|
|
|
|
|
2009-07-30 17:27:47 -04:00
|
|
|
|
|
|
|
private:
|
|
|
|
/* PreLogin */
|
|
|
|
static std::string getHomePath() ;
|
|
|
|
static void setupBaseDir();
|
|
|
|
|
|
|
|
/* Account Details */
|
|
|
|
static bool get_configinit(std::string dir, std::string &id);
|
|
|
|
static bool create_configinit(std::string dir, std::string id);
|
|
|
|
|
|
|
|
static bool setupAccount(std::string accountdir);
|
|
|
|
|
|
|
|
/* Auto Login */
|
|
|
|
static bool RsStoreAutoLogin() ;
|
|
|
|
static bool RsTryAutoLogin() ;
|
2010-04-08 08:02:46 -04:00
|
|
|
|
2009-07-30 17:27:47 -04:00
|
|
|
|
2009-02-08 09:30:28 -05:00
|
|
|
};
|
|
|
|
|
2009-07-30 17:27:47 -04:00
|
|
|
|
2010-04-08 08:02:46 -04:00
|
|
|
|
2009-07-30 17:27:47 -04:00
|
|
|
#endif
|