mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-02 14:16:16 -04:00
restored the retroshare-nogui executable
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3225 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
918decfd0d
commit
f7ff141a37
5 changed files with 91 additions and 60 deletions
|
@ -177,6 +177,27 @@ bool RsInitConfig::udpListenerOnly;
|
|||
static bool getAvailableAccounts(std::list<accountId> &ids);
|
||||
static bool checkAccount(std::string accountdir, accountId &id);
|
||||
|
||||
static std::string toUpperCase(const std::string& s)
|
||||
{
|
||||
std::string res(s) ;
|
||||
|
||||
for(uint32_t i=0;i<res.size();++i)
|
||||
if(res[i] > 96 && res[i] < 123)
|
||||
res[i] -= 97-65 ;
|
||||
|
||||
return res ;
|
||||
}
|
||||
|
||||
static std::string toLowerCase(const std::string& s)
|
||||
{
|
||||
std::string res(s) ;
|
||||
|
||||
for(uint32_t i=0;i<res.size();++i)
|
||||
if(res[i] > 64 && res[i] < 91)
|
||||
res[i] += 97-65 ;
|
||||
|
||||
return res ;
|
||||
}
|
||||
|
||||
void RsInit::InitRsConfig()
|
||||
{
|
||||
|
@ -307,7 +328,7 @@ int RsInit::InitRetroShare(int argcIgnored, char **argvIgnored, bool strictCheck
|
|||
/******************************** WINDOWS/UNIX SPECIFIC PART ******************/
|
||||
|
||||
int c;
|
||||
std::string prefPgpName = "";
|
||||
std::string prefUserString = "";
|
||||
/* getopt info: every availiable option is listed here. if it is followed by a ':' it
|
||||
needs an argument. If it is followed by a '::' the argument is optional.
|
||||
*/
|
||||
|
@ -378,7 +399,7 @@ int RsInit::InitRetroShare(int argcIgnored, char **argvIgnored, bool strictCheck
|
|||
std::cerr << std::endl;
|
||||
break;
|
||||
case 'U':
|
||||
prefPgpName = optarg;
|
||||
prefUserString = optarg;
|
||||
std::cerr << "Opt for User Id ";
|
||||
std::cerr << std::endl;
|
||||
break;
|
||||
|
@ -395,10 +416,8 @@ int RsInit::InitRetroShare(int argcIgnored, char **argvIgnored, bool strictCheck
|
|||
std::cerr << "-a AutoLogin (Windows Only) + StartMinimised" << std::endl;
|
||||
std::cerr << "-m StartMinimised" << std::endl;
|
||||
std::cerr << "-u Only listen to UDP" << std::endl;
|
||||
std::cerr << "-e Use a forwarded external Port" << std::endl << std::endl;
|
||||
std::cerr << "-U [User Name] Sets Account to Use, Useful when Autologin is enabled" << std::endl;
|
||||
std::cerr << "Example" << std::endl;
|
||||
std::cerr << "./retroshare-nogui -wmysecretpassword -e" << std::endl;
|
||||
std::cerr << "-e Use a forwarded external Port" << std::endl ;
|
||||
std::cerr << "-U [User Name/GPG id/SSL id] Sets Account to Use, Useful when Autologin is enabled." << std::endl;
|
||||
exit(1);
|
||||
break;
|
||||
default:
|
||||
|
@ -504,22 +523,28 @@ int RsInit::InitRetroShare(int argcIgnored, char **argvIgnored, bool strictCheck
|
|||
|
||||
// if a different user id has been passed to cmd line check for that instead
|
||||
|
||||
bool pgpNameFound = false;
|
||||
if(prefPgpName != ""){
|
||||
std::string lower_case_user_string = toLowerCase(prefUserString) ;
|
||||
std::string upper_case_user_string = toUpperCase(prefUserString) ;
|
||||
|
||||
for(it = RsInitConfig::accountIds.begin() ; it!= RsInitConfig::accountIds.end() ; it++){
|
||||
bool pgpNameFound = false;
|
||||
if(prefUserString != "")
|
||||
{
|
||||
|
||||
if(prefPgpName == it->pgpName){
|
||||
for(it = RsInitConfig::accountIds.begin() ; it!= RsInitConfig::accountIds.end() ; it++)
|
||||
{
|
||||
std::cerr << "Checking account (gpgid = " << it->pgpId << ", name=" << it->pgpName << ", sslId=" << it->sslId << ")" << std::endl ;
|
||||
|
||||
RsInitConfig::preferedId = it->sslId;
|
||||
pgpNameFound = true;
|
||||
}
|
||||
}
|
||||
if(!pgpNameFound){
|
||||
std::cerr << "Invalid User name -U pgpName not Found" << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
if(prefUserString == it->pgpName || upper_case_user_string == it->pgpId || lower_case_user_string == it->sslId)
|
||||
{
|
||||
RsInitConfig::preferedId = it->sslId;
|
||||
pgpNameFound = true;
|
||||
}
|
||||
}
|
||||
if(!pgpNameFound){
|
||||
std::cerr << "Invalid User name/GPG id/SSL id: not found in list" << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue