Merge pull request #703 from RetroShare/v0.6-ImprovedGUI

V0.6 improved gui
This commit is contained in:
csoler 2017-02-26 20:14:34 +01:00 committed by GitHub
commit 99cf69a98c
118 changed files with 4891 additions and 3492 deletions

View file

@ -431,12 +431,25 @@ unsigned short RsCertificate::loc_port_us() const
return (int)ipv4_internal_ip_and_port[4]*256 + (int)ipv4_internal_ip_and_port[5] ;
}
bool RsCertificate::cleanCertificate(const std::string& input,std::string& output,Format& format,int& error_code)
bool RsCertificate::cleanCertificate(const std::string& input,std::string& output,Format& format,int& error_code,bool check_content)
{
if(cleanCertificate(input,output,error_code))
{
format = RS_CERTIFICATE_RADIX ;
return true ;
if(!check_content)
return true ;
try
{
RsCertificate c(input) ;
return true ;
}
catch(uint32_t err_code)
{
error_code = err_code ;
return false;
}
}
return false ;

View file

@ -41,7 +41,7 @@ class RsCertificate
const unsigned char *pgp_key() const { return binary_pgp_key ; }
size_t pgp_key_size() const { return binary_pgp_key_size ; }
static bool cleanCertificate(const std::string& input,std::string& output,RsCertificate::Format& format,int& error_code) ;
static bool cleanCertificate(const std::string& input, std::string& output, RsCertificate::Format& format, int& error_code, bool check_content) ;
private:
static bool cleanCertificate(const std::string& input,std::string& output,int&) ; // new radix format

View file

@ -245,8 +245,37 @@ void p3Notify::notifyDownloadComplete (const std::string& fileHash )
void p3Notify::notifyDownloadCompleteCount (uint32_t count ) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyDownloadCompleteCount (count) ; }
void p3Notify::notifyHistoryChanged (uint32_t msgId , int type) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyHistoryChanged (msgId,type) ; }
bool p3Notify::cachePgpPassphrase(const std::string& s)
{
clearPgpPassphrase() ;
cached_pgp_passphrase = s ;
std::cerr << "(WW) Caching PGP passphrase." << std::endl;
return true ;
}
bool p3Notify::clearPgpPassphrase()
{
std::cerr << "(WW) Clearing PGP passphrase." << std::endl;
// Just whipe out the memory instead of just releasing it.
for(uint32_t i=0;i<cached_pgp_passphrase.length();++i)
cached_pgp_passphrase[i] = 0 ;
cached_pgp_passphrase.clear();
return true ;
}
bool p3Notify::askForPassword (const std::string& title , const std::string& key_details , bool prev_is_bad , std::string& password,bool *cancelled)
{
if(!prev_is_bad && !cached_pgp_passphrase.empty())
{
password = cached_pgp_passphrase ;
if(cancelled)
*cancelled = false ;
return true ;
}
FOR_ALL_NOTIFY_CLIENTS
if( (*it)->askForPassword(title,key_details,prev_is_bad,password,*cancelled))
return true ;

View file

@ -124,6 +124,9 @@ class p3Notify: public RsNotify
bool askForPassword (const std::string& title, const std::string& /* key_details */, bool /* prev_is_bad */, std::string&, bool *cancelled /* password */ ) ;
bool askForPluginConfirmation (const std::string& /* plugin_filename */, const std::string& /* plugin_file_hash */) ;
virtual bool cachePgpPassphrase (const std::string& /* pgp_passphrase */) ;
virtual bool clearPgpPassphrase () ;
private:
RsMutex noteMtx;
@ -134,6 +137,8 @@ class p3Notify: public RsNotify
std::list<RsFeedItem> pendingNewsFeed;
std::list<NotifyClient*> notifyClients ;
std::string cached_pgp_passphrase ;
};

View file

@ -214,7 +214,6 @@ int pqissllistenbase::setuplisten()
if (!mPeerMgr->isHidden()) std::cerr << "Zeroed tmpaddr: " << sockaddr_storage_tostring(tmpaddr) << std::endl;
#endif
exit(1);
return -1;
}
else

View file

@ -199,6 +199,9 @@ class RsNotify
virtual bool NotifyLogMessage(uint32_t &sysid, uint32_t &type, std::string &title, std::string &msg) = 0;
virtual bool GetFeedItem(RsFeedItem &item) = 0;
virtual bool cachePgpPassphrase (const std::string& /* pgp_passphrase */) { return false ; }
virtual bool clearPgpPassphrase () { return false ; }
};
class NotifyClient

View file

@ -1218,7 +1218,7 @@ bool p3Peers::cleanCertificate(const std::string &certstr, std::string &cleanCer
{
RsCertificate::Format format ;
return RsCertificate::cleanCertificate(certstr,cleanCert,format,error_code) ;
return RsCertificate::cleanCertificate(certstr,cleanCert,format,error_code,true) ;
}
bool p3Peers::saveCertificateToFile(const RsPeerId &id, const std::string &/*fname*/)

View file

@ -1095,9 +1095,8 @@ bool p3GxsReputation::saveList(bool& cleanup, std::list<RsItem*> &savelist)
cleanup = true;
RsStackMutex stack(mReputationMtx); /****** LOCKED MUTEX *******/
#ifdef DEBUG_REPUTATION
std::cerr << "p3GxsReputation::saveList()" << std::endl;
#endif
/* save */
std::map<RsPeerId, ReputationConfig>::iterator it;
for(it = mConfig.begin(); it != mConfig.end(); ++it)