mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -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
@ -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,19 +523,25 @@ int RsInit::InitRetroShare(int argcIgnored, char **argvIgnored, bool strictCheck
|
||||
|
||||
// if a different user id has been passed to cmd line check for that instead
|
||||
|
||||
std::string lower_case_user_string = toLowerCase(prefUserString) ;
|
||||
std::string upper_case_user_string = toUpperCase(prefUserString) ;
|
||||
|
||||
bool pgpNameFound = false;
|
||||
if(prefPgpName != ""){
|
||||
if(prefUserString != "")
|
||||
{
|
||||
|
||||
for(it = RsInitConfig::accountIds.begin() ; it!= RsInitConfig::accountIds.end() ; it++){
|
||||
|
||||
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 ;
|
||||
|
||||
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 -U pgpName not Found" << std::endl;
|
||||
std::cerr << "Invalid User name/GPG id/SSL id: not found in list" << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
@ -26,6 +26,7 @@
|
||||
|
||||
#include "notifytxt.h"
|
||||
#include "rsiface/rspeers.h"
|
||||
#include <string.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
@ -40,14 +41,21 @@ void NotifyTxt::notifyChat()
|
||||
return;
|
||||
}
|
||||
|
||||
std::string NotifyTxt::askForPassword(const std::string& key_details,bool prev_is_bad)
|
||||
{
|
||||
char *password = getpass(("Please enter GPG password for key "+key_details+": ").c_str()) ;
|
||||
return std::string(password);
|
||||
}
|
||||
|
||||
|
||||
void NotifyTxt::notifyListChange(int list, int type)
|
||||
{
|
||||
std::cerr << "NotifyTxt::notifyListChange()" << std::endl;
|
||||
switch(list)
|
||||
{
|
||||
case NOTIFY_LIST_NEIGHBOURS:
|
||||
displayNeighbours();
|
||||
break;
|
||||
// case NOTIFY_LIST_NEIGHBOURS:
|
||||
// displayNeighbours();
|
||||
// break;
|
||||
case NOTIFY_LIST_FRIENDS:
|
||||
displayFriends();
|
||||
break;
|
||||
@ -72,7 +80,6 @@ void NotifyTxt::notifyListChange(int list, int type)
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void NotifyTxt::displayNeighbours()
|
||||
{
|
||||
std::list<std::string> neighs;
|
||||
|
@ -37,9 +37,10 @@ class NotifyTxt: public NotifyBase
|
||||
virtual ~NotifyTxt() { return; }
|
||||
void setRsIface(RsIface *i) { iface = i; }
|
||||
|
||||
virtual void notifyListChange(int list, int type);
|
||||
virtual void notifyErrorMsg(int list, int sev, std::string msg);
|
||||
virtual void notifyChat();
|
||||
virtual void notifyListChange(int list, int type);
|
||||
virtual void notifyErrorMsg(int list, int sev, std::string msg);
|
||||
virtual void notifyChat();
|
||||
virtual std::string askForPassword(const std::string& key_details,bool prev_is_bad) ;
|
||||
|
||||
private:
|
||||
|
||||
|
@ -2,24 +2,26 @@ TEMPLATE = app
|
||||
TARGET = retroshare-nogui
|
||||
|
||||
################################# Linux ##########################################
|
||||
linux-* {
|
||||
#CONFIG += version_detail_bash_script
|
||||
QMAKE_CXXFLAGS *= -D_FILE_OFFSET_BITS=64
|
||||
|
||||
system(which gpgme-config >/dev/null 2>&1) {
|
||||
INCLUDEPATH += $$system(gpgme-config --cflags | sed -e "s/-I//g")
|
||||
} else {
|
||||
message(Could not find gpgme-config on your system, assuming gpgme.h is in /usr/include)
|
||||
}
|
||||
|
||||
LIBS += ../../libretroshare/src/lib/libretroshare.a
|
||||
LIBS += -lssl -lgpgme -lupnp
|
||||
}
|
||||
|
||||
linux-g++ {
|
||||
OBJECTS_DIR = temp/linux-g++/obj
|
||||
|
||||
LIBS += ../../../../lib/linux-g++/libretroshare.a
|
||||
LIBS += ../../../../lib/linux-g++/libminiupnpc.a
|
||||
LIBS += ../../../../lib/linux-g++/libssl.a
|
||||
LIBS += ../../../../lib/linux-g++/libcrypto.a
|
||||
LIBS += -lz
|
||||
}
|
||||
|
||||
linux-g++-64 {
|
||||
OBJECTS_DIR = temp/linux-g++-64/obj
|
||||
|
||||
LIBS += ../../../../lib/linux-g++-64/libretroshare.a
|
||||
LIBS += ../../../../lib/linux-g++-64/libminiupnpc.a
|
||||
LIBS += ../../../../lib/linux-g++-64/libssl.a
|
||||
LIBS += ../../../../lib/linux-g++-64/libcrypto.a
|
||||
LIBS += -lz
|
||||
}
|
||||
|
||||
#################### Cross compilation for windows under Linux ###################
|
||||
|
@ -46,8 +46,6 @@
|
||||
* The startup routine's are defined in rsiface.h
|
||||
*/
|
||||
|
||||
RsControl *rsicontrol ;
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
/* Retroshare startup is configured using an RsInit object.
|
||||
@ -79,8 +77,6 @@ int main(int argc, char **argv)
|
||||
* otherwise loaded from commandline.
|
||||
*/
|
||||
|
||||
/* Key + Certificate are loaded into libretroshare */
|
||||
RsInit::LoadCertificates(false);
|
||||
|
||||
/* Now setup the libretroshare interface objs
|
||||
* You will need to create you own NotifyXXX class
|
||||
@ -89,17 +85,17 @@ int main(int argc, char **argv)
|
||||
NotifyTxt *notify = new NotifyTxt();
|
||||
RsIface *iface = createRsIface(*notify);
|
||||
RsControl *rsServer = createRsControl(*iface, *notify);
|
||||
rsicontrol = rsServer ;
|
||||
|
||||
notify->setRsIface(iface);
|
||||
|
||||
/* Key + Certificate are loaded into libretroshare */
|
||||
|
||||
RsInit::LoadCertificates(false);
|
||||
|
||||
/* Start-up libretroshare server threads */
|
||||
|
||||
rsServer -> StartupRetroShare();
|
||||
|
||||
rsicontrol = rsServer ;
|
||||
RsInit::passwd = "" ;
|
||||
//CleanupRsConfig(config);
|
||||
|
||||
/* pass control to the GUI */
|
||||
while(1)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user