diff --git a/libretroshare/src/chat/distributedchat.cc b/libretroshare/src/chat/distributedchat.cc index 677e61769..4112afd31 100644 --- a/libretroshare/src/chat/distributedchat.cc +++ b/libretroshare/src/chat/distributedchat.cc @@ -385,7 +385,7 @@ bool DistributedChatService::locked_bouncingObjectCheck(RsChatLobbyBouncingObjec // max objects per second: lobby_count * 1/MAX_DELAY_BETWEEN_LOBBY_KEEP_ALIVE objects per second. // So in cache, there is in average that number times MAX_MESSAGES_PER_SECONDS_PERIOD // - float max_cnt = std::max(10.0f, 4*lobby_count / (float)MAX_DELAY_BETWEEN_LOBBY_KEEP_ALIVE * MAX_MESSAGES_PER_SECONDS_PERIOD) ; + float max_cnt = std::max(10.0f, 10*lobby_count / (float)MAX_DELAY_BETWEEN_LOBBY_KEEP_ALIVE * MAX_MESSAGES_PER_SECONDS_PERIOD) ; #ifdef DEBUG_CHAT_LOBBIES std::cerr << "lobby_count=" << lobby_count << std::endl; @@ -406,7 +406,7 @@ bool DistributedChatService::locked_bouncingObjectCheck(RsChatLobbyBouncingObjec if(lst.size() > max_cnt) { - std::cerr << "Too many messages from peer " << pid << ". Someone (name=" << obj->nick << ") is trying to flood this lobby. Message will not be forwarded." << std::endl; + std::cerr << "(WW) more than " << max_cnt << " messages forwarded by peer " << pid << ". Message from \"" << obj->nick << "\" will not be forwarded." << std::endl; return false; } else diff --git a/libretroshare/src/gxs/rsgxsnetutils.cc b/libretroshare/src/gxs/rsgxsnetutils.cc index 41402c9eb..b74abcb0f 100644 --- a/libretroshare/src/gxs/rsgxsnetutils.cc +++ b/libretroshare/src/gxs/rsgxsnetutils.cc @@ -287,16 +287,20 @@ bool MsgCircleIdsRequestVetting::cleared() return false ; } + uint32_t filtered_out_msgs=0; + for(uint32_t i=0;iisRecipient(mCircleId,mGrpId,mMsgs[i].mAuthorId)) { - std::cerr << "(WW) MsgCircleIdsRequestVetting::cleared() filtering out message " << mMsgs[i].mMsgId << " because it's signed by author " << mMsgs[i].mAuthorId << " which is not in circle " << mCircleId << std::endl; - + ++filtered_out_msgs; mMsgs[i] = mMsgs[mMsgs.size()-1] ; mMsgs.pop_back(); } else ++i ; + + if(filtered_out_msgs>0) + std::cerr << "(WW) " << filtered_out_msgs << " messages not sent because they are signed by author(s) not member of that circle " << mCircleId << std::endl; RsPgpId pgpId = mPgpUtils->getPGPId(mPeerId); bool can_send_res = mCircles->canSend(mCircleId, pgpId,mShouldEncrypt); diff --git a/libretroshare/src/pqi/p3linkmgr.cc b/libretroshare/src/pqi/p3linkmgr.cc index 5ce4008aa..97a889b79 100644 --- a/libretroshare/src/pqi/p3linkmgr.cc +++ b/libretroshare/src/pqi/p3linkmgr.cc @@ -799,7 +799,9 @@ bool p3LinkMgrIMPL::connectResult(const RsPeerId &id, bool success, bool isIncom bool updatePeerAddr = false; bool updateLastContact = false; +#ifdef LINKMGR_DEBUG std::cerr << "Connection result with peer " << id << ": " << success << ". Is incoming: " << isIncomingConnection << ", remote addr: " << sockaddr_storage_tostring(remote_peer_address) << std::endl; +#endif { RsStackMutex stack(mLinkMtx); /****** STACK LOCK MUTEX *******/ diff --git a/libretroshare/src/retroshare/rsinit.h b/libretroshare/src/retroshare/rsinit.h index 19c0349bb..73fea2684 100644 --- a/libretroshare/src/retroshare/rsinit.h +++ b/libretroshare/src/retroshare/rsinit.h @@ -155,10 +155,11 @@ class RsInit public: enum RS_DEPRECATED_FOR(RsInitErrorNum) LoadCertificateStatus : uint8_t { - OK, /// Everything go as expected, no error occurred - ERR_ALREADY_RUNNING, /// Another istance is running already - ERR_CANT_ACQUIRE_LOCK, /// Another istance is already running? - ERR_UNKNOWN /// Unkown error, maybe password is wrong? + OK, /// Everything go as expected, no error occurred + ERR_ALREADY_RUNNING, /// Another istance is running already + ERR_CANT_ACQUIRE_LOCK, /// Another istance is already running? + ERR_NO_AVAILABLE_ACCOUNT, /// Used in retroshare-service -U list when no account is available + ERR_UNKNOWN /// Unkown error, maybe password is wrong? }; /* reorganised RsInit system */ diff --git a/libretroshare/src/services/p3idservice.cc b/libretroshare/src/services/p3idservice.cc index e32d6788d..d34f406a6 100644 --- a/libretroshare/src/services/p3idservice.cc +++ b/libretroshare/src/services/p3idservice.cc @@ -954,10 +954,7 @@ bool p3IdService::deserialiseIdentityFromMemory(const std::string& radix_string, return true; } -bool p3IdService::createIdentity( - RsGxsId& id, - const std::string& name, const RsGxsImage& avatar, - bool pseudonimous, const std::string& pgpPassword) +bool p3IdService::createIdentity( RsGxsId& id, const std::string& name, const RsGxsImage& avatar, bool pseudonimous, const std::string& pgpPassword) { bool ret = true; RsIdentityParameters params; @@ -1062,6 +1059,20 @@ bool p3IdService::createIdentity(uint32_t& token, RsIdentityParameters ¶ms) else id.mMeta.mGroupFlags |= GXS_SERV::FLAG_PRIVACY_PUBLIC; + // Anticipate signature validation, since we're creating the signature ourselves. + + SSGxsIdGroup ssdata; + ssdata.pgp.validatedSignature = params.isPgpLinked; + + if(params.isPgpLinked) + { + ssdata.pgp.pgpId = AuthGPG::getAuthGPG()->getGPGOwnId(); + ssdata.pgp.lastCheckTs = time(nullptr); + } + + /* save string */ + id.mMeta.mServiceString = ssdata.save(); + createGroup(token, id); return true; diff --git a/libretroshare/src/services/p3postbase.cc b/libretroshare/src/services/p3postbase.cc index dd4d9f684..6792255a4 100644 --- a/libretroshare/src/services/p3postbase.cc +++ b/libretroshare/src/services/p3postbase.cc @@ -38,7 +38,6 @@ /**** * #define POSTBASE_DEBUG 1 ****/ -#define POSTBASE_DEBUG 1 #define POSTBASE_BACKGROUND_PROCESSING 0x0002 #define PROCESSING_START_PERIOD 30 @@ -630,8 +629,7 @@ void p3PostBase::background_loadMsgs(const uint32_t &token, bool unprocessed) else { /* unknown! */ - std::cerr << "p3PostBase::background_processNewMessages() ERROR Strange NEW Message:"; - std::cerr << std::endl; + std::cerr << "p3PostBase::background_processNewMessages() ERROR Strange NEW Message:" << std::endl; std::cerr << "\t" << (*vit)->meta; std::cerr << std::endl; diff --git a/retroshare-service/src/retroshare-service.cc b/retroshare-service/src/retroshare-service.cc index 1ff3169ff..e80d468e1 100644 --- a/retroshare-service/src/retroshare-service.cc +++ b/retroshare-service/src/retroshare-service.cc @@ -234,14 +234,19 @@ int main(int argc, char* argv[]) { if(prefUserString == "list") { - std::cout << std::endl << std::endl - << "Available accounts:" << std::endl; - std::vector locations; rsLoginHelper->getLocations(locations); - int accountCountDigits = static_cast( - ceil(log(locations.size())/log(10.0)) ); + if(locations.size() == 0) + { + RsErr() << "No available accounts. You cannot use option -U list" << std::endl; + return -RsInit::ERR_NO_AVAILABLE_ACCOUNT; + } + + std::cout << std::endl << std::endl + << "Available accounts:" << std::endl; + + int accountCountDigits = static_cast( ceil(log(locations.size())/log(10.0)) ); for( uint32_t i=0; i