mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-15 02:44:20 -05:00
added commandline option '-U' to allow user to access different profile
- in the situation where autologin is enabled - BUG found (or rather autologin induced it), if one asks to make friends to a peer (in ConfCertDialg) 'within' a session that uses autologin it freezes git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2703 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
c6c8e63e91
commit
aef367ebff
@ -297,10 +297,11 @@ int RsInit::InitRetroShare(int argcIgnored, char **argvIgnored)
|
||||
/******************************** WINDOWS/UNIX SPECIFIC PART ******************/
|
||||
|
||||
int c;
|
||||
/* getopt info: every availiable option is listet here. if it is followed by a ':' it
|
||||
std::string prefPgpName = "";
|
||||
/* 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.
|
||||
*/
|
||||
while((c = getopt(argc, argv,"hesamui:p:c:w:l:d:")) != -1)
|
||||
while((c = getopt(argc, argv,"hesamui:p:c:w:l:d:U:")) != -1)
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
@ -366,6 +367,11 @@ int RsInit::InitRetroShare(int argcIgnored, char **argvIgnored)
|
||||
std::cerr << "Opt for External Port Mode";
|
||||
std::cerr << std::endl;
|
||||
break;
|
||||
case 'U':
|
||||
prefPgpName = optarg;
|
||||
std::cerr << "Opt for User Id ";
|
||||
std::cerr << std::endl;
|
||||
break;
|
||||
case 'h':
|
||||
std::cerr << "Help: " << std::endl;
|
||||
std::cerr << "The commandline options are for retroshare-nogui, a headless server in a shell, or systems without QT." << std::endl << std::endl;
|
||||
@ -380,6 +386,7 @@ int RsInit::InitRetroShare(int argcIgnored, char **argvIgnored)
|
||||
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;
|
||||
exit(1);
|
||||
@ -479,6 +486,27 @@ int RsInit::InitRetroShare(int argcIgnored, char **argvIgnored)
|
||||
std::list<accountId>::iterator it;
|
||||
getAvailableAccounts(RsInitConfig::accountIds);
|
||||
|
||||
// if a different user id has been passed to cmd line check for that instead
|
||||
|
||||
bool pgpNameFound = false;
|
||||
if(prefPgpName != ""){
|
||||
|
||||
for(it = RsInitConfig::accountIds.begin() ; it!= RsInitConfig::accountIds.end() ; it++){
|
||||
|
||||
if(prefPgpName == it->pgpName){
|
||||
|
||||
RsInitConfig::preferedId = it->sslId;
|
||||
pgpNameFound = true;
|
||||
}
|
||||
}
|
||||
if(!pgpNameFound){
|
||||
std::cerr << "Invalid User name -U pgpName not Found" << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* check that preferedId */
|
||||
std::string userName;
|
||||
std::string userId;
|
||||
@ -498,6 +526,7 @@ int RsInit::InitRetroShare(int argcIgnored, char **argvIgnored)
|
||||
{
|
||||
std::cerr << "No Existing User" << std::endl;
|
||||
RsInitConfig::preferedId == "";
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user