merged with upstream/master

This commit is contained in:
csoler 2016-03-25 21:09:37 -04:00
commit 6c8737c84a
38 changed files with 284 additions and 109 deletions

View File

@ -1,5 +1,70 @@
retroshare06 (0.6.0-1.XXXXXX~YYYYYY) YYYYYY; urgency=low
bb26069 csoler Wed, 2 Mar 2016 19:00:51 -0500 attempt at fixing negative bw rates in GUI that may pop up when an erro
20fcf63 electron128 Fri, 26 Feb 2016 18:13:20 +0100 Merge pull request #285 from PhenomRetroShare/Fix_SSGxsChannelGro
1a110e4 Phenom Mon, 22 Feb 2016 19:07:49 +0100 Define empty service string as a valid case.
3c3d23b Phenom Wed, 17 Feb 2016 19:27:28 +0100 Fix error "(EE) SSGxsChannelGroup::load() asked to load a null string.
0bcf52c csoler Wed, 24 Feb 2016 16:51:25 -0500 added missing update of mRecvTS in database when updating a group meta
d1fd5d3 defnax Wed, 24 Feb 2016 21:51:34 +0100 update todo
7b1460c defnax Wed, 24 Feb 2016 21:45:43 +0100 Merge branch 'master' of https://github.com/RetroShare/RetroShare
f5eb791 csoler Tue, 23 Feb 2016 23:04:04 -0500 added notification for modified metadata in group. Does not yet work o
b8c42a9 csoler Tue, 23 Feb 2016 22:43:13 -0500 added copy of previous subscription flags when group update is receive
fafe75d csoler Tue, 23 Feb 2016 22:20:40 -0500 added update of mServerUpdateTS up to last mRecvTS of each group, whic
a6f0b8d csoler Mon, 22 Feb 2016 16:57:13 -0500 Merge pull request #290 from sehraf/pr-improved-unused-location-c
dbdfdcd sehraf Mon, 22 Feb 2016 21:09:10 +0100 removed unused map lookups
77166cb sehraf Mon, 22 Feb 2016 16:41:31 +0100 impoved cleanup of unused locations
cd4d743 csoler Mon, 22 Feb 2016 10:14:29 -0500 added missing -lpthread
3446e20 csoler Sun, 21 Feb 2016 11:47:44 -0500 removed debug output from p3grouter.cc
1222e82 electron128 Sun, 21 Feb 2016 11:23:33 +0100 fix format in readme
dcbd99f electron128 Sun, 21 Feb 2016 11:20:14 +0100 Merge pull request #202 from electron128/fixtests
5a48070 csoler Fri, 19 Feb 2016 10:45:18 -0500 Merge pull request #281 from sehraf/pr-disc-increase-auto-clean-t
4140969 sehraf Fri, 19 Feb 2016 16:32:57 +0100 added seperated limit for discovery (30 days)
6695a38 Thunder Thu, 18 Feb 2016 17:21:15 +0100 Merge pull request #283 from PhenomRetroShare/Fix_ChatMsgItemAvatar_u
e639dc5 Phenom Wed, 17 Feb 2016 17:37:09 +0100 Fix connect for avatar updateAvatar in ChatMsgItem and MessengerWindow
b059a8e Thunder Wed, 17 Feb 2016 20:23:44 +0100 Merge pull request #284 from PhenomRetroShare/Fix_CannotUpdateAvatarE
dc2578b Phenom Wed, 17 Feb 2016 18:18:56 +0100 Fix "(EE) cannot update avatar. mId has unhandled type." error.
697ef40 csoler Wed, 17 Feb 2016 09:38:36 -0500 added test against arbitrary large items in turtle search requests.
51d90a4 csoler Wed, 17 Feb 2016 09:37:34 -0500 added test against arbitrary large items in turtle search requests.
c15e8b5 csoler Tue, 16 Feb 2016 17:46:34 -0500 Merge pull request #282 from PhenomRetroShare/Add_MinSizeForStack
d878334 csoler Tue, 16 Feb 2016 17:45:49 -0500 Merge pull request #206 from realityfabric/master
3276790 Phenom Tue, 16 Feb 2016 23:15:33 +0100 Add minimal Size for stackPages in MainWindow for first start.
841299d sehraf Tue, 16 Feb 2016 20:20:41 +0100 discovery: don't remove new added locations too soon
efadc7d csoler Sun, 14 Feb 2016 13:38:08 -0500 Merge pull request #270 from PhenomRetroShare/Fix_GxsChannelFilte
44882b9 csoler Sun, 14 Feb 2016 13:35:32 -0500 Merge pull request #278 from PhenomRetroShare/Fix_bencode.c_Compi
3ab7c89 csoler Sun, 14 Feb 2016 13:33:27 -0500 Merge pull request #279 from cavebeat/single_dh_op
9843c83 cave beat Sun, 14 Feb 2016 18:49:37 +0100 added openSSL option SSL_OP_SINGLE_DH_USE regarding CVE-2016-0701
7d21666 Phenom Sun, 14 Feb 2016 17:40:10 +0100 Fix compilation of bencode.c for C compilator.
821c144 electron128 Sun, 14 Feb 2016 12:48:52 +0100 remove dead code from RsNotify (old forum and channel read status
63a8260 electron128 Sun, 14 Feb 2016 11:53:27 +0100 change RsNotify to use RsGxsId for chat lobby events
36135d4 electron128 Sun, 14 Feb 2016 10:23:37 +0100 added info about tests to readme
11dcbb7 electron128 Sun, 14 Feb 2016 10:23:26 +0100 remove wrong info about webui from readme (webui settings in gui
68cd1f9 electron128 Sun, 14 Feb 2016 10:21:48 +0100 disabled gxs_grp_sync test, because it fails after rebase to mast
abf7a72 defnax Sat, 13 Feb 2016 17:38:01 +0100 increase default font size for the ListWidget.
8637d3c defnax Sat, 13 Feb 2016 16:15:41 +0100 Fixed issue #263
a031d1e electron128 Thu, 24 Dec 2015 12:57:52 +0100 disabled tlvrandom test because it is buggy and fails sometimes
b874167 electron128 Thu, 24 Dec 2015 11:58:57 +0100 give gxs grp sync test more time, because of sync and timestamp u
8f64df0 electron128 Sun, 20 Dec 2015 17:24:13 +0100 fix compile for new gxs metadata serialisation
a6a3d66 electron128 Sun, 20 Dec 2015 14:32:11 +0100 exclude not serialised member from operator== for RsNxsTransac
a8b2bc7 electron128 Sun, 20 Dec 2015 14:31:26 +0100 fixed threading issue in NxsTestHub. NxsTesthub has to wait for i
63c6629 electron128 Sun, 20 Dec 2015 14:29:24 +0100 added missing initialisation of local, not serialised msg meta da
dca7dec electron128 Wed, 16 Dec 2015 17:34:35 +0100 attempt to fix output redirect for unittests in travis
218daa8 electron128 Sun, 13 Dec 2015 20:50:31 +0100 enabled RsNxsItem test
c03ce56 electron128 Sun, 13 Dec 2015 20:50:08 +0100 added missing mutex in nxstesthub
aa93505 electron128 Sun, 13 Dec 2015 20:49:44 +0100 added missing lock in RsSharedPtr destructor
64b9e34 electron128 Sun, 13 Dec 2015 20:48:55 +0100 fixed uninitialised memory read in test libretroshare_gxs.gxs_grp
7d0845e electron128 Sun, 13 Dec 2015 20:48:05 +0100 redirect travis testing output to /dev/null, because the logfile
8d15f44 electron128 Sun, 13 Dec 2015 18:44:24 +0100 added CONFIG+=NO_SQLCIPHER support to unittests (travis wants thi
9f92212 electron128 Sun, 13 Dec 2015 17:22:31 +0100 - make tests compile - added tests to travis.yml - excluded grout
3e4c154 csoler Fri, 12 Feb 2016 23:08:59 -0500 Merge pull request #275 from PhenomRetroShare/Fix_GenCertDialogOn
3ebb8c6 Phenom Fri, 12 Feb 2016 17:54:35 +0100 Fix GenCertDialog on Mac stay on.
4033f35 defnax Mon, 8 Feb 2016 21:34:45 +0100 update todo
5f0afb3 Phenom Mon, 8 Feb 2016 19:42:56 +0100 Fix Channel filter when loading big post. And fix "Not a GxsChannelPost
7ded128 thunder2 Sat, 6 Feb 2016 19:18:22 +0100 Update rsversion.in
-- Cyril Soler <csoler@users.sourceforge.net> Sun, 06 Mar 2016 20:00:00 -0500
retroshare06 (0.6.0-1.20160206.4a8edee6~trusty) trusty; urgency=low
a41d9df csoler Mon, 1 Feb 2016 09:59:13 -0500 fixed small bug in probability computation in grouter
6d1a393 csoler Mon, 1 Feb 2016 00:33:11 -0500 fixed but in re-sending of failed grouter items
aa194ca csoler Sun, 31 Jan 2016 20:27:53 -0500 fixed bug preventing save of routage info in distant messaging

View File

@ -1543,13 +1543,20 @@ void p3GRouter::handleIncomingReceiptItem(RsGRouterSignedReceiptItem *receipt_it
else
std::cerr << " checking receipt hash : OK" << std::endl;
#endif
// check signature.
// check signature. The policy if the following:
// if we're the destination:
// signature should check and signing key should be available // always ensures the receipt is valid
// else
// if key is available, signature should check // early protects against frodulent receipts that we can check
uint32_t error_status ;
if(! verifySignedDataItem(receipt_item))
{
std::cerr << " checking receipt signature : FAILED. Receipt is dropped." << std::endl;
return ;
}
if(! verifySignedDataItem(receipt_item,error_status))
if( (it->second.routing_flags & GRouterRoutingInfo::ROUTING_FLAGS_IS_ORIGIN) || (error_status != RsGixs::RS_GIXS_ERROR_KEY_NOT_AVAILABLE))
{
std::cerr << " checking receipt signature : FAILED. Receipt is dropped. Error status=" << error_status << std::endl;
return ;
}
#ifdef GROUTER_DEBUG
std::cerr << " checking receipt signature : OK. " << std::endl;
std::cerr << " removing messsage from cache." << std::endl;
@ -1698,7 +1705,9 @@ void p3GRouter::handleIncomingDataItem(RsGRouterGenericDataItem *data_item)
#ifdef GROUTER_DEBUG
std::cerr << " step B: item is for us and is new, so make sure it's authentic and create a receipt" << std::endl;
#endif
if(!verifySignedDataItem(data_item)) // we should get proper flags out of this
uint32_t error_status ;
if(!verifySignedDataItem(data_item,error_status)) // we should get proper flags out of this
{
std::cerr << " verifying item signature: FAILED! Droping that item" ;
std::cerr << " You probably received a message from a person you don't have key." << std::endl;
@ -1978,7 +1987,7 @@ bool p3GRouter::signDataItem(RsGRouterAbstractMsgItem *item,const RsGxsId& signi
return false ;
}
}
bool p3GRouter::verifySignedDataItem(RsGRouterAbstractMsgItem *item)
bool p3GRouter::verifySignedDataItem(RsGRouterAbstractMsgItem *item,uint32_t& error_status)
{
try
{
@ -1997,9 +2006,6 @@ bool p3GRouter::verifySignedDataItem(RsGRouterAbstractMsgItem *item)
if(!item->serialise_signed_data(data,data_size))
throw std::runtime_error("Cannot serialise signed data.") ;
uint32_t error_status ;
if(!mGixs->validateData(data,data_size,item->signature,true,error_status))
{
switch(error_status)
@ -2115,8 +2121,9 @@ bool p3GRouter::sendData(const RsGxsId& destination,const GRouterServiceId& clie
}
// Verify the signature. If that fails, there's a bug somewhere!!
if(!verifySignedDataItem(data_item))
uint32_t error_status;
if(!verifySignedDataItem(data_item,error_status))
{
std::cerr << "Cannot verify data item that was just signed. Some error occured!" << std::endl;
delete data_item;

View File

@ -263,7 +263,7 @@ private:
// signs an item with the given key.
bool signDataItem(RsGRouterAbstractMsgItem *item,const RsGxsId& id) ;
bool verifySignedDataItem(RsGRouterAbstractMsgItem *item) ;
bool verifySignedDataItem(RsGRouterAbstractMsgItem *item, uint32_t &error_status) ;
bool encryptDataItem(RsGRouterGenericDataItem *item,const RsGxsId& destination_key) ;
bool decryptDataItem(RsGRouterGenericDataItem *item) ;

View File

@ -2873,11 +2873,11 @@ void RsGenExchange::processRecvdGroups()
if(gpsi.mAttempts == VALIDATE_MAX_ATTEMPTS)
{
delete grp;
erase = true;
#ifdef GEN_EXCH_DEBUG
std::cerr << " max attempts " << VALIDATE_MAX_ATTEMPTS << " reached. Will delete group " << grp->grpId << std::endl;
#endif
delete grp;
erase = true;
}
else
{

View File

@ -763,15 +763,19 @@ bool p3GxsTunnelService::handleEncryptedData(const uint8_t *data_bytes,uint32_t
uint32_t encrypted_size = data_size - GXS_TUNNEL_ENCRYPTION_IV_SIZE - GXS_TUNNEL_ENCRYPTION_HMAC_SIZE;
uint32_t decrypted_size = RsAES::get_buffer_size(encrypted_size);
uint8_t *encrypted_data = (uint8_t*)data_bytes+GXS_TUNNEL_ENCRYPTION_IV_SIZE+GXS_TUNNEL_ENCRYPTION_HMAC_SIZE;
uint8_t *decrypted_data = new uint8_t[decrypted_size];
RsTemporaryMemory decrypted_data(decrypted_size);
uint8_t aes_key[GXS_TUNNEL_AES_KEY_SIZE] ;
if(!decrypted_data)
return false ;
std::map<TurtleVirtualPeerId,GxsTunnelDHInfo>::iterator it = _gxs_tunnel_virtual_peer_ids.find(virtual_peer_id) ;
if(it == _gxs_tunnel_virtual_peer_ids.end())
{
std::cerr << "(EE) item is not coming out of a registered tunnel. Weird. hash=" << hash << ", peer id = " << virtual_peer_id << std::endl;
return true ;
return false ;
}
tunnel_id = it->second.tunnel_id ;
@ -780,7 +784,7 @@ bool p3GxsTunnelService::handleEncryptedData(const uint8_t *data_bytes,uint32_t
if(it2 == _gxs_tunnel_contacts.end())
{
std::cerr << "(EE) no tunnel data for tunnel ID=" << tunnel_id << ". This is a bug." << std::endl;
return true ;
return false ;
}
memcpy(aes_key,it2->second.aes_key,GXS_TUNNEL_AES_KEY_SIZE) ;
@ -800,8 +804,6 @@ bool p3GxsTunnelService::handleEncryptedData(const uint8_t *data_bytes,uint32_t
std::cerr << "(EE) packet HMAC does not match. Computed HMAC=" << RsUtil::BinToHex((char*)hm,GXS_TUNNEL_ENCRYPTION_HMAC_SIZE) << std::endl;
std::cerr << "(EE) resetting new DH session." << std::endl;
delete[] decrypted_data ;
locked_restartDHSession(virtual_peer_id,it2->second.own_gxs_id) ;
return false ;
@ -812,8 +814,6 @@ bool p3GxsTunnelService::handleEncryptedData(const uint8_t *data_bytes,uint32_t
std::cerr << "(EE) packet decryption failed." << std::endl;
std::cerr << "(EE) resetting new DH session." << std::endl;
delete[] decrypted_data ;
locked_restartDHSession(virtual_peer_id,it2->second.own_gxs_id) ;
return false ;
@ -829,8 +829,6 @@ bool p3GxsTunnelService::handleEncryptedData(const uint8_t *data_bytes,uint32_t
//
citem = dynamic_cast<RsGxsTunnelItem*>(RsGxsTunnelSerialiser().deserialise(decrypted_data,&decrypted_size)) ;
delete[] decrypted_data ;
if(citem == NULL)
{
std::cerr << "(EE) item could not be de-serialized. That is an error." << std::endl;
@ -1003,7 +1001,7 @@ void p3GxsTunnelService::handleRecvDHPublicKey(RsGxsTunnelDHPublicKeyItem *item)
#ifdef DEBUG_GXS_TUNNEL
std::cerr << " DH key computed. Tunnel is now secured!" << std::endl;
std::cerr << " Key computed: " << RsUtil::BinToHex((char*)pinfo.aes_key,16) << std::cerr << std::endl;
std::cerr << " Key computed: " << RsUtil::BinToHex((char*)pinfo.aes_key,16) << std::endl;
std::cerr << " Sending a ACK packet." << std::endl;
#endif

View File

@ -823,8 +823,6 @@ continue_packet:
std::cerr << "[" << (void*)pthread_self() << "] " << "deserializing. Size=" << pktlen << std::endl ;
#endif
inReadBytes_locked(pktlen); // only count deserialised packets, because that's what is actually been transfered.
RsItem *pkt = mRsSerialiser->deserialise(block, &pktlen);
if ((pkt != NULL) && (0 < handleincomingitem_locked(pkt,pktlen)))
@ -832,6 +830,7 @@ continue_packet:
#ifdef DEBUG_PQISTREAMER
pqioutput(PQL_DEBUG_BASIC, pqistreamerzone, "Successfully Read a Packet!");
#endif
inReadBytes_locked(pktlen); // only count deserialised packets, because that's what is actually been transfered.
}
else
{
@ -952,7 +951,7 @@ int pqistreamer::inAllowedBytes_locked()
static const float AVG_PERIOD = 5; // sec
static const float AVG_FRAC = 0.8; // for low pass filter.
void pqistreamer::outSentBytes_locked(int outb)
void pqistreamer::outSentBytes_locked(uint32_t outb)
{
#ifdef DEBUG_PQISTREAMER
{
@ -1022,7 +1021,7 @@ void pqistreamer::outSentBytes_locked(int outb)
return;
}
void pqistreamer::inReadBytes_locked(int inb)
void pqistreamer::inReadBytes_locked(uint32_t inb)
{
#ifdef DEBUG_PQISTREAMER
{

View File

@ -102,10 +102,10 @@ class pqistreamer: public PQInterface
float outTimeSlice_locked();
int outAllowedBytes_locked();
void outSentBytes_locked(int );
void outSentBytes_locked(uint32_t );
int inAllowedBytes_locked();
void inReadBytes_locked(int );
void inReadBytes_locked(uint32_t );

View File

@ -1258,6 +1258,9 @@ int RsServer::StartupRetroShare()
std::vector<std::string> plugins_directories ;
#ifdef __APPLE__
plugins_directories.push_back(rsAccounts->PathDataDirectory()) ;
#endif
#ifndef WINDOWS_SYS
plugins_directories.push_back(std::string(PLUGIN_DIR)) ;
#endif

View File

@ -280,7 +280,7 @@ int p3BandwidthControl::getAllBandwidthRates(std::map<RsPeerId, RsConfigDataRate
}
int p3BandwidthControl::ExtractTrafficInfo(std::list<RSTrafficClue>& in_stats,std::list<RSTrafficClue>& out_stats)
int p3BandwidthControl::ExtractTrafficInfo(std::list<RSTrafficClue>& out_stats, std::list<RSTrafficClue>& in_stats)
{
return mPg->ExtractTrafficInfo(out_stats,in_stats) ;
}

View File

@ -94,7 +94,7 @@ class p3BandwidthControl: public p3Service, public pqiServiceMonitor
virtual int getAllBandwidthRates(std::map<RsPeerId, RsConfigDataRates> &ratemap);
virtual int ExtractTrafficInfo(std::list<RSTrafficClue> &in_stats, std::list<RSTrafficClue> &out_stats);
virtual int ExtractTrafficInfo(std::list<RSTrafficClue> &out_stats, std::list<RSTrafficClue> &in_stats);
/*!
* Interface stuff.

View File

@ -514,20 +514,20 @@ bool p3GxsChannels::setChannelDownloadDirectory(const RsGxsGroupId &groupId, con
return true;
}
bool p3GxsChannels::getChannelDownloadDirectory(const RsGxsGroupId & id,std::string& directory)
bool p3GxsChannels::getChannelDownloadDirectory(const RsGxsGroupId & groupId,std::string& directory)
{
#ifdef GXSCHANNELS_DEBUG
std::cerr << "p3GxsChannels::autoDownloadEnabled(" << id << ")" << std::endl;
std::cerr << "p3GxsChannels::getChannelDownloadDirectory(" << id << ")" << std::endl;
#endif
std::map<RsGxsGroupId, RsGroupMetaData>::iterator it;
it = mSubscribedGroups.find(id);
it = mSubscribedGroups.find(groupId);
if (it == mSubscribedGroups.end())
{
#ifdef GXSCHANNELS_DEBUG
std::cerr << "p3GxsChannels::autoDownloadEnabled() No Entry" << std::endl;
std::cerr << "p3GxsChannels::getChannelDownloadDirectory() No Entry" << std::endl;
#endif
return false;
@ -904,7 +904,7 @@ void p3GxsChannels::handleResponse(uint32_t token, uint32_t req_type)
/********************************************************************************************/
bool p3GxsChannels::autoDownloadEnabled(const RsGxsGroupId &id,bool& enabled)
bool p3GxsChannels::autoDownloadEnabled(const RsGxsGroupId &groupId,bool& enabled)
{
#ifdef GXSCHANNELS_DEBUG
std::cerr << "p3GxsChannels::autoDownloadEnabled(" << id << ")";
@ -913,7 +913,7 @@ bool p3GxsChannels::autoDownloadEnabled(const RsGxsGroupId &id,bool& enabled)
std::map<RsGxsGroupId, RsGroupMetaData>::iterator it;
it = mSubscribedGroups.find(id);
it = mSubscribedGroups.find(groupId);
if (it == mSubscribedGroups.end())
{
#ifdef GXSCHANNELS_DEBUG
@ -927,22 +927,24 @@ bool p3GxsChannels::autoDownloadEnabled(const RsGxsGroupId &id,bool& enabled)
/* extract from ServiceString */
SSGxsChannelGroup ss;
ss.load(it->second.mServiceString);
enabled = ss.mAutoDownload;
enabled = ss.mAutoDownload;
return true ;
return true;
}
bool SSGxsChannelGroup::load(const std::string &input)
{
if(input.empty())
{
#ifdef GXSCHANNELS_DEBUG
std::cerr << "SSGxsChannelGroup::load() asked to load a null string." << std::endl;
#endif
return true ;
}
int download_val;
mAutoDownload = false;
mDownloadDirectory.clear();
if(input.empty())
{
std::cerr << "(EE) SSGxsChannelGroup::load() asked to load a null string. Weird." << std::endl;
return false ;
}
RsTemporaryMemory tmpmem(input.length());

View File

@ -45,12 +45,12 @@
class SSGxsChannelGroup
{
public:
SSGxsChannelGroup(): mAutoDownload(false), mDownloadDirectory("") {}
bool load(const std::string &input);
std::string save() const;
bool mAutoDownload;
std::string mDownloadDirectory ;
std::string mDownloadDirectory;
};
@ -176,7 +176,7 @@ static uint32_t channelsAuthenPolicy();
void updateSubscribedGroup(const RsGroupMetaData &group);
void clearUnsubscribedGroup(const RsGxsGroupId &id);
bool setAutoDownload(const RsGxsGroupId &groupId, bool enabled);
bool autoDownloadEnabled(const RsGxsGroupId &id, bool &enabled);
bool autoDownloadEnabled(const RsGxsGroupId &groupId, bool &enabled);

View File

@ -859,7 +859,7 @@ void p3turtle::handleSearchRequest(RsTurtleSearchRequestItem *item)
#ifdef P3TURTLE_DEBUG
std::cerr << " Dropping, because the serial size exceeds the accepted limit." << std::endl ;
#endif
std::cerr << " Caught a turtle search item with arbitrary large size from " << item->PeerId() << " of size " << item->serial_size() << ". This is not allowed => dropping." << std::endl;
std::cerr << " Caught a turtle search item with arbitrary large size from " << item->PeerId() << " of size " << item->serial_size() << " and depth " << item->depth << ". This is not allowed => dropping." << std::endl;
return ;
}

View File

@ -182,6 +182,7 @@ void ContentValue::put(const std::string &key, uint32_t len, const char* value){
mKvData.insert(std::pair<std::string, std::pair<uint32_t, char*> >
(key, std::pair<uint32_t, char*>(len, dest)));
//delete[] dest; //Deleted by clearData()
}
bool ContentValue::getAsBool(const std::string &key, bool& value) const{

View File

@ -572,7 +572,15 @@ static int parse_headers(dearmour_arg_t *arg,ops_error_t **errors,
if(size <= nbuf+1)
{
size+=size+80;
buf=realloc(buf,size);
char *nbuf;
nbuf=realloc(buf,size);
if (nbuf == NULL)
{
free(buf);
rtn=-1;
goto end;
}
buf = nbuf;
}
buf[nbuf++]=c;
}

View File

@ -96,7 +96,7 @@ void DLListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
temp = "";
} else {
multi = 1.0;
for(int i = 0; i < 5; ++i) {
for(int i = 0; i < 4; ++i) {
if (fileSize < 1024) {
fileSize = index.data().toLongLong();
temp.sprintf("%.2f ", fileSize / multi);
@ -115,7 +115,7 @@ void DLListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
temp = "";
} else {
multi = 1.0;
for(int i = 0; i < 5; ++i) {
for(int i = 0; i < 4; ++i) {
if (remaining < 1024) {
remaining = index.data().toLongLong();
temp.sprintf("%.2f ", remaining / multi);
@ -134,7 +134,7 @@ void DLListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
temp = "";
} else {
multi = 1.0;
for(int i = 0; i < 5; ++i) {
for(int i = 0; i < 4; ++i) {
if (completed < 1024) {
completed = index.data().toLongLong();
temp.sprintf("%.2f ", completed / multi);

View File

@ -85,7 +85,7 @@ void ULListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
temp = "";
} else {
multi = 1.0;
for(int i = 0; i < 5; ++i) {
for(int i = 0; i < 4; ++i) {
if (fileSize < 1024) {
fileSize = index.data().toLongLong();
temp.sprintf("%.2f ", fileSize / multi);
@ -104,7 +104,7 @@ void ULListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
temp = "";
} else {
multi = 1.0;
for(int i = 0; i < 5; ++i) {
for(int i = 0; i < 4; ++i) {
if (transferred < 1024) {
transferred = index.data().toLongLong();
temp.sprintf("%.2f ", transferred / multi);

View File

@ -593,7 +593,7 @@ anonymous, you can use a fake email.</string>
<item>
<widget class="QLabel" name="label_hiddenaddr2">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This can be a Tor Onion address of the form: xa76giaf6ifda7ri63i263.onion &lt;br/&gt;or an I2P address in the form: [52 characters].b32.i2p &lt;/p&gt;&lt;p&gt;In order to get one, you must configure either Tor or I2P to create a new hidden service / server tunnel. If you do not yet have one, you can still go on, and make it right later in Retroshare's Options-&amp;gt;Server-&amp;gt;Hidden Service configuration panel.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This can be a Tor Onion address of the form: xa76giaf6ifda7ri63i263.onion &lt;br/&gt;or an I2P address in the form: [52 characters].b32.i2p &lt;/p&gt;&lt;p&gt;In order to get one, you must configure either Tor or I2P to create a new hidden service / server tunnel. If you do not yet have one, you can still go on, and make it right later in RetroShare's Options-&amp;gt;Network-&amp;gt;Hidden Service configuration panel.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>

View File

@ -65,7 +65,7 @@
#define HOST_SEARCH "search"
#define HOST_CERTIFICATE "certificate"
#define HOST_PUBLIC_MSG "public_msg"
#define HOST_REGEXP "file|person|forum|channel|search|message|certificate|private_chat|public_msg"
#define HOST_REGEXP "file|extra|person|forum|channel|search|message|certificate|private_chat|public_msg"
#define FILE_NAME "name"
#define FILE_SIZE "size"

View File

@ -85,6 +85,7 @@ ChatLobbyDialog::ChatLobbyDialog(const ChatLobbyId& lid, QWidget *parent, Qt::Wi
ui.participantsList->setColumnHidden(COLUMN_ID,true);
muteAct = new QAction(QIcon(), tr("Mute participant"), this);
banAct = new QAction(QIcon(":/icons/yellow_biohazard64.png"), tr("Ban this person (Sets negative opinion)"), this);
distantChatAct = new QAction(QIcon(":/images/chat_24.png"), tr("Start private chat"), this);
sendMessageAct = new QAction(QIcon(":/images/mail_new.png"), tr("Send Message"), this);
@ -103,6 +104,7 @@ ChatLobbyDialog::ChatLobbyDialog(const ChatLobbyId& lid, QWidget *parent, Qt::Wi
connect(muteAct, SIGNAL(triggered()), this, SLOT(changePartipationState()));
connect(distantChatAct, SIGNAL(triggered()), this, SLOT(distantChatParticipant()));
connect(sendMessageAct, SIGNAL(triggered()), this, SLOT(sendMessage()));
connect(banAct, SIGNAL(triggered()), this, SLOT(banParticipant()));
connect(actionSortByName, SIGNAL(triggered()), this, SLOT(sortParcipants()));
connect(actionSortByActivity, SIGNAL(triggered()), this, SLOT(sortParcipants()));
@ -201,15 +203,16 @@ void ChatLobbyDialog::participantsTreeWidgetCustomPopupMenu(QPoint)
contextMnu.addAction(distantChatAct);
contextMnu.addAction(sendMessageAct);
contextMnu.addSeparator();
contextMnu.addAction(muteAct);
contextMnu.addSeparator();
contextMnu.addAction(actionSortByActivity);
contextMnu.addAction(actionSortByName);
contextMnu.addSeparator();
contextMnu.addAction(muteAct);
contextMnu.addAction(banAct);
muteAct->setCheckable(true);
muteAct->setEnabled(false);
muteAct->setChecked(false);
banAct->setEnabled(false);
if (selectedItems.size())
{
@ -219,6 +222,7 @@ void ChatLobbyDialog::participantsTreeWidgetCustomPopupMenu(QPoint)
if(selectedItems.count()>1 || (RsGxsId(selectedItems.at(0)->text(COLUMN_ID).toStdString())!=nickName))
{
muteAct->setEnabled(true);
banAct->setEnabled(true);
QList<QTreeWidgetItem*>::iterator item;
for (item = selectedItems.begin(); item != selectedItems.end(); ++item) {
@ -237,6 +241,40 @@ void ChatLobbyDialog::participantsTreeWidgetCustomPopupMenu(QPoint)
contextMnu.exec(QCursor::pos());
}
/**
* @brief Called when the "ban" menu is selected. Sets a negative reputation on the selected user.
*/
void ChatLobbyDialog::banParticipant()
{
QList<QTreeWidgetItem*> selectedItems = ui.participantsList->selectedItems();
if (selectedItems.isEmpty()) {
return;
}
QList<QTreeWidgetItem*>::iterator item;
for (item = selectedItems.begin(); item != selectedItems.end(); ++item) {
RsGxsId nickname;
dynamic_cast<GxsIdRSTreeWidgetItem*>(*item)->getId(nickname) ;
RsGxsId gxs_id;
rsMsgs->getIdentityForChatLobby(lobbyId, gxs_id);
// This test avoids to mute/ban your own identity
if (gxs_id!=nickname)
{
std::cerr << "Giving negative opinion to GXS id " << nickname << std::endl;
rsReputations->setOwnOpinion(nickname, RsReputations::OPINION_NEGATIVE);
dynamic_cast<GxsIdRSTreeWidgetItem*>(*item)->forceUpdate();
}
}
}
void ChatLobbyDialog::init()
{
ChatLobbyInfo linfo ;
@ -502,6 +540,8 @@ void ChatLobbyDialog::updateParticipantsList()
if (RsGxsId(participant.toStdString()) == gxs_id) widgetitem->setIcon(COLUMN_ICON, QIcon(":/icons/bullet_yellow_128.png"));
widgetitem->updateBannedState();
QTime qtLastAct=QTime(0,0,0).addSecs(now-tLastAct);
widgetitem->setToolTip(COLUMN_ICON,tr("Right click to mute/unmute participants<br/>Double click to address this person<br/>")
+tr("This participant is not active since:")

View File

@ -79,6 +79,7 @@ protected slots:
void distantChatParticipant();
void participantsTreeWidgetDoubleClicked(QTreeWidgetItem *item, int column);
void sendMessage();
void banParticipant();
private:
void updateParticipantsList();
@ -104,6 +105,7 @@ private:
std::set<RsGxsId> mutedParticipants;
QAction *muteAct;
QAction *banAct;
QAction *distantChatAct;
QAction *actionSortByName;
QAction *actionSortByActivity;

View File

@ -265,7 +265,13 @@ static QString getStyle(const QDir &styleDir, const QString &styleVariant, enumG
return style;
}
QString ChatStyle::formatMessage(enumFormatMessage type, const QString &name, const QDateTime &timestamp, const QString &message, unsigned int flag)
QString ChatStyle::formatMessage(enumFormatMessage type
, const QString &name
, const QDateTime &timestamp
, const QString &message
, unsigned int flag
, const QColor &backgroundColor /*= Qt::white*/
)
{
bool me = false;
QDomDocument doc ;
@ -343,20 +349,27 @@ QString ChatStyle::formatMessage(enumFormatMessage type, const QString &name, co
}
#ifdef COLORED_NICKNAMES
QColor color;
if (flag & CHAT_FORMATMSG_SYSTEM) {
color = Qt::darkBlue;
QColor color;
QString colorName;
if (flag & CHAT_FORMATMSG_SYSTEM) {
color = Qt::darkBlue;
} else {
// Calculate color from the name
uint hash = 0;
for (int i = 0; i < name.length(); ++i) {
hash = (((hash << 1) + (hash >> 14)) ^ ((int) name[i].toLatin1())) & 0x3fff;
// Calculate color from the name
uint hash = 0;
for (int i = 0; i < name.length(); ++i) {
hash = (((hash << 1) + (hash >> 14)) ^ ((int) name[i].toLatin1())) & 0x3fff;
}
color.setHsv(hash, 255, 150);
color.setHsv(hash, 255, 150);
// Always fix colors
qreal desiredContrast = Settings->valueFromGroup("Chat", "MinimumContrast", 4.5).toDouble();
colorName = color.name();
RsHtml::findBestColor(colorName, backgroundColor, desiredContrast);
}
#else
Q_UNUSED(flag);
Q_UNUSED(flag);
Q_UNUSED(backgroundColor);
#endif
QString strName = RsHtml::plainText(name).prepend(QString("<a name=\"name\">")).append(QString("</a>"));
@ -381,7 +394,7 @@ QString ChatStyle::formatMessage(enumFormatMessage type, const QString &name, co
.replace("%date%", strDate)
.replace("%time%", strTime)
#ifdef COLORED_NICKNAMES
.replace("%color%", color.name())
.replace("%color%", colorName)
#endif
.replace("%message%", messageBody ) ;
if ( !styleOptimized.isEmpty() ) {

View File

@ -23,6 +23,7 @@
#ifndef _CHATSTYLE_H
#define _CHATSTYLE_H
#include <QColor>
#include <QString>
#include <QDateTime>
#include <QHash>
@ -82,7 +83,7 @@ public:
bool setStylePath(const QString &stylePath, const QString &styleVariant);
bool setStyleFromSettings(enumStyleType styleType);
QString formatMessage(enumFormatMessage type, const QString &name, const QDateTime &timestamp, const QString &message, unsigned int flag = 0);
QString formatMessage(enumFormatMessage type, const QString &name, const QDateTime &timestamp, const QString &message, unsigned int flag = 0, const QColor &backgroundColor = Qt::white);
static bool getAvailableStyles(enumStyleType styleType, QList<ChatStyleInfo> &styles);
static bool getAvailableVariants(const QString &stylePath, QStringList &variants);

View File

@ -914,7 +914,7 @@ void ChatWidget::addChatMsg(bool incoming, const QString &name, const RsGxsId gx
QString formattedMessage = RsHtml().formatText(ui->textBrowser->document(), message, formatTextFlag, backgroundColor, desiredContrast, desiredMinimumFontSize);
QDateTime dtTimestamp=incoming ? sendTime : recvTime;
QString formatMsg = chatStyle.formatMessage(type, name, dtTimestamp, formattedMessage, formatFlag);
QString formatMsg = chatStyle.formatMessage(type, name, dtTimestamp, formattedMessage, formatFlag, backgroundColor);
QString timeStamp = dtTimestamp.toString(Qt::ISODate);
//replace Date and Time anchors

View File

@ -177,7 +177,7 @@ void AvatarWidget::refreshStatus()
}
case STATUS_FRAME:
{
uint32_t status ;
uint32_t status = 0;
if(mId.isNotSet())
return ;

View File

@ -1818,7 +1818,7 @@ bool FriendList::importExportFriendlistFileDialog(QString &fileName, bool import
{
if(!misc::getSaveFileName(this,
RshareSettings::LASTDIR_CERT,
(import ? tr("Select file for importing yoour friendlist from") :
(import ? tr("Select file for importing your friendlist from") :
tr("Select a file for exporting your friendlist to")),
tr("XML File (*.xml);;All Files (*)"),
fileName,

View File

@ -31,11 +31,12 @@
#include "RsCollectionDialog.h"
#include "RsCollectionFile.h"
#include "util/misc.h"
#define COLUMN_FILE 0
#define COLUMN_SIZE 1
#define COLUMN_HASH 2
#define COLUMN_FILEC 3
#define COLUMN_COUNT 4
#define COLUMN_FILE 0
#define COLUMN_FILEPATH 1
#define COLUMN_SIZE 2
#define COLUMN_HASH 3
#define COLUMN_FILEC 4
#define COLUMN_COUNT 5
// In COLUMN_HASH (COLUMN_FILE reserved for CheckState)
#define ROLE_NAME Qt::UserRole + 1
#define ROLE_PATH Qt::UserRole + 2
@ -145,6 +146,7 @@ RsCollectionDialog::RsCollectionDialog(const QString& collectionFileName
QTreeWidgetItem *headerItem = ui._fileEntriesTW->headerItem();
headerItem->setText(COLUMN_FILE, tr("File"));
headerItem->setText(COLUMN_FILEPATH, tr("File Path"));
headerItem->setText(COLUMN_SIZE, tr("Size"));
headerItem->setText(COLUMN_HASH, tr("Hash"));
headerItem->setText(COLUMN_FILEC, tr("File Count"));
@ -342,6 +344,7 @@ QTreeWidgetItem* RsCollectionDialog::getRootItem()
root->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsTristate);
root->setText(COLUMN_FILE, "/");
root->setToolTip(COLUMN_FILE,tr("This is the root directory."));
root->setText(COLUMN_FILEPATH, "/");
root->setText(COLUMN_HASH, "");
root->setData(COLUMN_HASH, ROLE_NAME, "");
root->setData(COLUMN_HASH, ROLE_PATH, "");
@ -401,9 +404,9 @@ bool RsCollectionDialog::addChild(QTreeWidgetItem* parent, const std::vector<Col
QList<QTreeWidgetItem*> founds;
QList<QTreeWidgetItem*> parentsFounds;
parentsFounds = ui._fileEntriesTW->findItems(colFileInfo.path , Qt::MatchExactly | Qt::MatchRecursive, COLUMN_FILE);
parentsFounds = ui._fileEntriesTW->findItems(colFileInfo.path , Qt::MatchExactly | Qt::MatchRecursive, COLUMN_FILEPATH);
if (colFileInfo.type == DIR_TYPE_DIR){
founds = ui._fileEntriesTW->findItems(colFileInfo.path + "/" +colFileInfo.name, Qt::MatchExactly | Qt::MatchRecursive, COLUMN_FILE);
founds = ui._fileEntriesTW->findItems(colFileInfo.path + "/" +colFileInfo.name, Qt::MatchExactly | Qt::MatchRecursive, COLUMN_FILEPATH);
} else {
founds = ui._fileEntriesTW->findItems(colFileInfo.hash, Qt::MatchExactly | Qt::MatchRecursive, COLUMN_HASH);
}
@ -413,7 +416,8 @@ bool RsCollectionDialog::addChild(QTreeWidgetItem* parent, const std::vector<Col
//item->setFlags(Qt::ItemIsUserCheckable | item->flags());
item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsTristate);
item->setCheckState(COLUMN_FILE, Qt::Checked);
item->setText(COLUMN_FILE, colFileInfo.path + "/" + colFileInfo.name);
item->setText(COLUMN_FILE, colFileInfo.name);
item->setText(COLUMN_FILEPATH, colFileInfo.path + "/" + colFileInfo.name);
item->setText(COLUMN_HASH, colFileInfo.hash);
item->setData(COLUMN_HASH, ROLE_NAME, colFileInfo.name);
item->setData(COLUMN_HASH, ROLE_PATH, colFileInfo.path);
@ -704,7 +708,7 @@ void RsCollectionDialog::addRecursive(bool recursive)
ColFileInfo root;
if (item && (item != getRootItem())) {
root.name = "";
root.path = item->text(COLUMN_FILE);
root.path = item->text(COLUMN_FILEPATH);
} else {
root.name = "";
root.path = "";
@ -725,7 +729,7 @@ void RsCollectionDialog::addRecursive(bool recursive)
it.value() = dirToAdd.value(path);
} else if(item) {
if (item->data(COLUMN_HASH, ROLE_NAME) != "") {
it.value() = item->text(COLUMN_FILE);
it.value() = item->text(COLUMN_FILEPATH);
}//if (item->data(COLUMN_HASH, ROLE_NAME) != "")
}//if (dirToAdd.contains(path))
}//for (QHash<QString,QString>::Iterator it

View File

@ -46,6 +46,7 @@ void GxsIdRSTreeWidgetItem::init()
{
mIdFound = false;
mRetryWhenFailed = false;
mBannedState = false ;
}
static void fillGxsIdRSTreeWidgetItemCallback(GxsIdDetailsType type, const RsIdentityDetails &details, QObject *object, const QVariant &/*data*/)
@ -114,6 +115,20 @@ void GxsIdRSTreeWidgetItem::setId(const RsGxsId &id, int column, bool retryWhenF
startProcess();
}
void GxsIdRSTreeWidgetItem::updateBannedState()
{
if(mBannedState != rsReputations->isIdentityBanned(mId))
forceUpdate() ;
}
void GxsIdRSTreeWidgetItem::forceUpdate()
{
mIdFound = false;
mBannedState = rsReputations->isIdentityBanned(mId) ;
startProcess();
}
void GxsIdRSTreeWidgetItem::startProcess()
{
if (mRetryWhenFailed) {

View File

@ -52,6 +52,10 @@ public:
void setAvatar(const RsGxsImage &avatar);
virtual QVariant data(int column, int role) const;
void forceUpdate();
void setBannedState(bool b) { mBannedState = b; } // does not actually change the state, but used instead by callbacks to leave a trace
void updateBannedState() ; // checks reputation, and update is needed
private slots:
void startProcess();
@ -62,8 +66,9 @@ private:
RsGxsId mId;
int mColumn;
bool mIdFound;
bool mBannedState ;
bool mRetryWhenFailed;
uint32_t mIconTypeMask;
uint32_t mIconTypeMask;
RsGxsImage mAvatar;
};

View File

@ -285,7 +285,8 @@ void ImHistoryBrowser::fillItem(QListWidgetItem *itemWidget, HistoryMsg& msg)
name = QString::fromUtf8(msg.peerName.c_str());
}
QString formatMsg = style.formatMessage(type, name, QDateTime::fromTime_t(msg.sendTime), messageText);
QColor backgroundColor = ui.listWidget->palette().base().color();
QString formatMsg = style.formatMessage(type, name, QDateTime::fromTime_t(msg.sendTime), messageText, 0, backgroundColor);
itemWidget->setData(Qt::DisplayRole, qVariantFromValue(IMHistoryItemPainter(formatMsg)));
itemWidget->setData(ROLE_MSGID, msg.msgId);

View File

@ -339,14 +339,15 @@ void ChatPage::setPreviewMessages(QString &stylePath, QString styleVariant, QTex
QString nameIncoming = tr("Incoming");
QString nameOutgoing = tr("Outgoing");
QDateTime timestmp = QDateTime::fromTime_t(time(NULL));
QColor backgroundColor = textBrowser->palette().base().color();
textBrowser->append(style.formatMessage(ChatStyle::FORMATMSG_HINCOMING, nameIncoming, timestmp, tr("Incoming message in history")));
textBrowser->append(style.formatMessage(ChatStyle::FORMATMSG_HOUTGOING, nameOutgoing, timestmp, tr("Outgoing message in history")));
textBrowser->append(style.formatMessage(ChatStyle::FORMATMSG_INCOMING, nameIncoming, timestmp, tr("Incoming message")));
textBrowser->append(style.formatMessage(ChatStyle::FORMATMSG_OUTGOING, nameOutgoing, timestmp, tr("Outgoing message")));
textBrowser->append(style.formatMessage(ChatStyle::FORMATMSG_OOUTGOING, nameOutgoing, timestmp, tr("Outgoing offline message")));
textBrowser->append(style.formatMessage(ChatStyle::FORMATMSG_SYSTEM, tr("System"), timestmp, tr("System message")));
textBrowser->append(style.formatMessage(ChatStyle::FORMATMSG_OUTGOING, tr("UserName"), timestmp, tr("/me is sending a message with /me")));
textBrowser->append(style.formatMessage(ChatStyle::FORMATMSG_HINCOMING, nameIncoming, timestmp, tr("Incoming message in history"), 0, backgroundColor));
textBrowser->append(style.formatMessage(ChatStyle::FORMATMSG_HOUTGOING, nameOutgoing, timestmp, tr("Outgoing message in history"), 0, backgroundColor));
textBrowser->append(style.formatMessage(ChatStyle::FORMATMSG_INCOMING, nameIncoming, timestmp, tr("Incoming message"), 0, backgroundColor));
textBrowser->append(style.formatMessage(ChatStyle::FORMATMSG_OUTGOING, nameOutgoing, timestmp, tr("Outgoing message"), 0, backgroundColor));
textBrowser->append(style.formatMessage(ChatStyle::FORMATMSG_OOUTGOING, nameOutgoing, timestmp, tr("Outgoing offline message"), 0, backgroundColor));
textBrowser->append(style.formatMessage(ChatStyle::FORMATMSG_SYSTEM, tr("System"), timestmp, tr("System message"), 0, backgroundColor));
textBrowser->append(style.formatMessage(ChatStyle::FORMATMSG_OUTGOING, tr("UserName"), timestmp, tr("/me is sending a message with /me"), 0, backgroundColor));
}
void ChatPage::fillPreview(QListWidget *listWidget, QComboBox *comboBox, QTextBrowser *textBrowser)

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>611</width>
<height>408</height>
<width>1468</width>
<height>659</height>
</rect>
</property>
<property name="windowTitle">
@ -34,8 +34,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>593</width>
<height>156</height>
<width>1450</width>
<height>317</height>
</rect>
</property>
</widget>
@ -83,7 +83,7 @@
</column>
<column>
<property name="text">
<string>Data size</string>
<string>Stored data size</string>
</property>
</column>
<column>
@ -93,12 +93,12 @@
</column>
<column>
<property name="text">
<string>Received</string>
<string>Receive time (secs ago)</string>
</property>
</column>
<column>
<property name="text">
<string>Send</string>
<string>Sending time (secs ago)</string>
</property>
</column>
<column>

View File

@ -258,7 +258,7 @@ void RsHtml::embedHtml(QTextDocument *textDocument, QDomDocument& doc, QDomEleme
return;
QDomNodeList children = currentElement.childNodes();
for(uint index = 0; index < children.length(); index++) {
for(uint index = 0; index < (uint)children.length(); index++) {
QDomNode node = children.item(index);
if(node.isElement()) {
// child is an element, we skip it if it's an <a> tag
@ -473,7 +473,7 @@ static void findElements(QDomDocument& doc, QDomElement& currentElement, const Q
}
QDomNodeList children = currentElement.childNodes();
for (uint index = 0; index < children.length(); index++) {
for (uint index = 0; index < (uint)children.length(); index++) {
QDomNode node = children.item(index);
if (node.isElement()) {
QDomElement element = node.toElement();
@ -555,6 +555,7 @@ static qreal getContrastRatio(qreal lum1, qreal lum2)
* @brief Find a color with the same hue that provides the desired contrast with bglum.
* @param[in,out] val Name of the original color. Will be modified.
* @param bglum Background's relative luminance as returned by getRelativeLuminance().
* @param desiredContrast Contrast to get.
*/
static void findBestColor(QString &val, qreal bglum, qreal desiredContrast)
{
@ -651,7 +652,7 @@ static void optimizeHtml(QDomDocument& doc
bool addBR = false;
QDomNodeList children = currentElement.childNodes();
for (uint index = 0; index < children.length(); ) {
for (uint index = 0; index < (uint)children.length(); ) {
QDomNode node = children.item(index);
if (node.isElement()) {
QDomElement element = node.toElement();
@ -1087,3 +1088,9 @@ void RsHtml::insertSpoilerText(QTextCursor cursor)
QString html = QString("<a href=\"hidden:%1\" title=\"%1\">%2</a>").arg(encoded, publictext);
cursor.insertHtml(html);
}
void RsHtml::findBestColor(QString &val, const QColor &backgroundColor /*= Qt::white*/, qreal desiredContrast /*= 1.0*/)
{
::findBestColor(val, ::getRelativeLuminance(backgroundColor), desiredContrast);
}

View File

@ -77,6 +77,7 @@ public:
static QString makeQuotedText(RSTextBrowser* browser);
static void insertSpoilerText(QTextCursor cursor);
static void findBestColor(QString &val, const QColor &backgroundColor = Qt::white, qreal desiredContrast = 1.0);
protected:
void embedHtml(QTextDocument *textDocument, QDomDocument &doc, QDomElement &currentElement, EmbedInHtml& embedInfos, ulong flag);

View File

@ -624,7 +624,8 @@ bool RsIntroStore::loadPeers()
std::cerr << "RsIntroStore::loadPeers() Cannot open file, trying tmp";
std::cerr << std::endl;
FILE *fd = fopen(mTempStoreFile.c_str(), "r");
fd = fopen(mTempStoreFile.c_str(), "r");
if (!fd)
{
std::cerr << "RsIntroStore::loadPeers() Cannot open tmp file";

View File

@ -802,6 +802,7 @@ bool fill_stream_data(rsctrl::stream::StreamData &data, const RpcStream &stream)
{
std::cerr << "fill_stream_data() Failed to get data. data_size=" << data_size << ", base_loc=" << base_loc << " !";
std::cerr << std::endl;
free(buffer);
return false;
}

View File

@ -147,6 +147,7 @@ void g_string_append_printf(GString* baseString, char* format, ...)
g_string_append(baseString, formattedString);
free(formattedString);
}
va_end(args);
}
void g_string_prepend(GString* baseString, char* prependedString)

View File

@ -187,12 +187,11 @@ bool operator==(const RsTurtleStringSearchRequestItem& it1,const RsTurtleStringS
return false ;
return true ;
}
RsSerialType* init_item(TurtleFileInfo& info)
void init_item(TurtleFileInfo& info)
{
info.hash = RsFileHash("3f753e8ac3b94ab9fddfad94480f747bf4418370");
info.name = "toto.png";
info.size = 0x3392085443897ull ;
return new RsTurtleSerialiser();
}
bool operator==(const TurtleFileInfo& it1,const TurtleFileInfo& it2)
{