mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-02 22:25:04 -04:00
Merge pull request #2224 from csoler/v0.6-BugFixing_5
continue bug fixing for 0.6.6 (See commits)
This commit is contained in:
commit
5ec3ae8640
9 changed files with 128 additions and 56 deletions
|
@ -834,7 +834,7 @@ int RsGenExchange::createMessage(RsNxsMsg* msg)
|
|||
std::cerr << "RsGenExchange::createMessage() " << std::endl;
|
||||
#endif
|
||||
RsGxsGrpMetaTemporaryMap metaMap ;
|
||||
metaMap.insert(std::make_pair(id, (RsGxsGrpMetaData*)(NULL)));
|
||||
metaMap[id] = std::make_shared<RsGxsGrpMetaData>();
|
||||
mDataStore->retrieveGxsGrpMetaData(metaMap);
|
||||
|
||||
RsGxsMsgMetaData &meta = *(msg->metaData);
|
||||
|
@ -2231,7 +2231,7 @@ bool RsGenExchange::processGrpMask(const RsGxsGroupId& grpId, ContentValue &grpC
|
|||
bool ok = false;
|
||||
|
||||
RsGxsGrpMetaTemporaryMap grpMetaMap;
|
||||
grpMetaMap.insert(std::make_pair(grpId, (RsGxsGrpMetaData*)(NULL)));
|
||||
grpMetaMap[grpId] = std::make_shared<RsGxsGrpMetaData>();
|
||||
|
||||
mDataStore->retrieveGxsGrpMetaData(grpMetaMap);
|
||||
auto mit = grpMetaMap.find(grpId);
|
||||
|
|
|
@ -5424,6 +5424,12 @@ bool RsGxsNetService::search( const std::string& substring,
|
|||
group_infos.clear();
|
||||
|
||||
#ifdef RS_DEEP_CHANNEL_INDEX
|
||||
|
||||
#warning TODO: filter deep index search result to non circle-restricted groups.
|
||||
// /!\
|
||||
// /!\ These results should be filtered to only return results coming from a non restricted group!
|
||||
// /!\
|
||||
|
||||
std::vector<DeepChannelsSearchResult> results;
|
||||
DeepChannelsIndex::search(substring, results);
|
||||
|
||||
|
@ -5470,7 +5476,7 @@ bool RsGxsNetService::search( const std::string& substring,
|
|||
|
||||
RsGroupNetworkStats stats;
|
||||
for(auto it(grpMetaMap.begin());it!=grpMetaMap.end();++it)
|
||||
if(termSearch(it->second->mGroupName,substring))
|
||||
if(it->second->mCircleType==GXS_CIRCLE_TYPE_PUBLIC && termSearch(it->second->mGroupName,substring))
|
||||
{
|
||||
getGroupNetworkStats(it->first,stats);
|
||||
|
||||
|
|
|
@ -66,7 +66,6 @@ p3HistoryMgr::~p3HistoryMgr()
|
|||
|
||||
/***** p3HistoryMgr *****/
|
||||
|
||||
//void p3HistoryMgr::addMessage(bool incoming, const RsPeerId &chatPeerId, const RsPeerId &msgPeerId, const RsChatMsgItem *chatItem)
|
||||
void p3HistoryMgr::addMessage(const ChatMessage& cm)
|
||||
{
|
||||
uint32_t addMsgId = 0;
|
||||
|
@ -99,7 +98,8 @@ void p3HistoryMgr::addMessage(const ChatMessage& cm)
|
|||
}
|
||||
if (cm.chat_id.isLobbyId() && mLobbyEnable == true) {
|
||||
peerName = cm.lobby_peer_gxs_id.toStdString();
|
||||
enabled = true;
|
||||
msgPeerId = RsPeerId(cm.lobby_peer_gxs_id);
|
||||
enabled = true;
|
||||
}
|
||||
|
||||
if(cm.chat_id.isDistantChatId()&& mDistantEnable == true)
|
||||
|
@ -114,6 +114,8 @@ void p3HistoryMgr::addMessage(const ChatMessage& cm)
|
|||
peerName = det.mNickname;
|
||||
else
|
||||
peerName = writer_id.toStdString();
|
||||
|
||||
msgPeerId = cm.incoming?RsPeerId(dcpinfo.own_id):RsPeerId(dcpinfo.to_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -420,10 +420,14 @@ public:
|
|||
/**
|
||||
* @brief Update identity data (name, avatar...)
|
||||
* @jsonapi{development}
|
||||
* @param[in] identityData updated identiy data
|
||||
* @return false on error, true otherwise
|
||||
* @param[in] id Id of the identity
|
||||
* @param[in] name New name of the identity
|
||||
* @param[in] avatar New avatar for the identity
|
||||
* @param[in] pseudonimous Set to true to make the identity anonymous. If set to false, updating will require the profile passphrase.
|
||||
* @param[in] pgpPassword Profile passphrase, if non pseudonymous.
|
||||
* @return false on error, true otherwise
|
||||
*/
|
||||
virtual bool updateIdentity(RsGxsIdGroup& identityData) = 0;
|
||||
virtual bool updateIdentity( const RsGxsId& id, const std::string& name, const RsGxsImage& avatar, bool pseudonimous, const std::string& pgpPassword) =0;
|
||||
|
||||
/**
|
||||
* @brief Get identity details, from the cache
|
||||
|
@ -637,9 +641,6 @@ public:
|
|||
virtual bool submitOpinion(uint32_t& token, const RsGxsId &id,
|
||||
bool absOpinion, int score) = 0;
|
||||
|
||||
RS_DEPRECATED
|
||||
virtual bool updateIdentity(uint32_t& token, RsGxsIdGroup &group) = 0;
|
||||
|
||||
RS_DEPRECATED
|
||||
virtual bool deleteIdentity(uint32_t& token, RsGxsIdGroup &group) = 0;
|
||||
|
||||
|
|
|
@ -1041,37 +1041,87 @@ bool p3IdService::createIdentity(uint32_t& token, RsIdentityParameters ¶ms)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool p3IdService::updateIdentity(RsGxsIdGroup& identityData)
|
||||
bool p3IdService::updateIdentity( const RsGxsId& id, const std::string& name, const RsGxsImage& avatar, bool pseudonimous, const std::string& pgpPassword)
|
||||
{
|
||||
// 1 - get back the identity group
|
||||
|
||||
std::vector<RsGxsIdGroup> idsInfo;
|
||||
|
||||
if(!getIdentitiesInfo(std::set<RsGxsId>{ id }, idsInfo))
|
||||
return false;
|
||||
|
||||
RsGxsIdGroup& group(idsInfo[0]);
|
||||
|
||||
// 2 - update it with the new information
|
||||
|
||||
group.mMeta.mGroupName = name;
|
||||
group.mMeta.mCircleType = GXS_CIRCLE_TYPE_PUBLIC ;
|
||||
group.mImage = avatar;
|
||||
|
||||
if(!pseudonimous)
|
||||
{
|
||||
#warning csoler 2020-01-21: Backward compatibility issue to fix here in v0.7.0
|
||||
|
||||
// This is a hack, because a bad decision led to having RSGXSID_GROUPFLAG_REALID be equal to GXS_SERV::FLAG_PRIVACY_PRIVATE.
|
||||
// In order to keep backward compatibility, we'll also add the new value
|
||||
// When the ID is not PGP linked, the group flag cannot be let empty, so we use PUBLIC.
|
||||
//
|
||||
// The correct combination of flags should be:
|
||||
// PGP-linked: GXS_SERV::FLAGS_PRIVACY_PUBLIC | RSGXSID_GROUPFLAG_REALID
|
||||
// Anonymous : GXS_SERV::FLAGS_PRIVACY_PUBLIC
|
||||
|
||||
group.mMeta.mGroupFlags |= GXS_SERV::FLAG_PRIVACY_PRIVATE; // this is also equal to RSGXSID_GROUPFLAG_REALID_deprecated
|
||||
group.mMeta.mGroupFlags |= RSGXSID_GROUPFLAG_REALID;
|
||||
|
||||
// The current version should be able to produce new identities that old peers will accept as well.
|
||||
// In the future, we need to:
|
||||
// - set the current group flags here (see above)
|
||||
// - replace all occurences of RSGXSID_GROUPFLAG_REALID_deprecated by RSGXSID_GROUPFLAG_REALID in the code.
|
||||
}
|
||||
else
|
||||
group.mMeta.mGroupFlags |= GXS_SERV::FLAG_PRIVACY_PUBLIC;
|
||||
|
||||
uint32_t token;
|
||||
if(!updateGroup(token, identityData))
|
||||
bool ret = true;
|
||||
|
||||
// Cache pgp passphrase to allow a proper re-signing of the group data
|
||||
|
||||
if(!pseudonimous && !pgpPassword.empty())
|
||||
{
|
||||
if(!rsNotify->cachePgpPassphrase(pgpPassword))
|
||||
{
|
||||
RsErr() << __PRETTY_FUNCTION__ << " Failure caching password" << std::endl;
|
||||
ret = false;
|
||||
goto LabelUpdateIdentityCleanup;
|
||||
}
|
||||
|
||||
if(!rsNotify->setDisableAskPassword(true))
|
||||
{
|
||||
RsErr() << __PRETTY_FUNCTION__ << " Failure disabling password user request" << std::endl;
|
||||
ret = false;
|
||||
goto LabelUpdateIdentityCleanup;
|
||||
}
|
||||
}
|
||||
|
||||
if(!updateGroup(token, group))
|
||||
{
|
||||
std::cerr << __PRETTY_FUNCTION__ << "Error! Failed updating group."
|
||||
<< std::endl;
|
||||
return false;
|
||||
std::cerr << __PRETTY_FUNCTION__ << "Error! Failed updating group." << std::endl;
|
||||
ret = false;
|
||||
goto LabelUpdateIdentityCleanup;
|
||||
}
|
||||
|
||||
if(waitToken(token) != RsTokenService::COMPLETE)
|
||||
{
|
||||
std::cerr << __PRETTY_FUNCTION__ << "Error! GXS operation failed."
|
||||
<< std::endl;
|
||||
return false;
|
||||
std::cerr << __PRETTY_FUNCTION__ << "Error! GXS operation failed." << std::endl;
|
||||
ret = false;
|
||||
goto LabelUpdateIdentityCleanup;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
LabelUpdateIdentityCleanup:
|
||||
if(!pseudonimous && !pgpPassword.empty())
|
||||
rsNotify->clearPgpPassphrase();
|
||||
|
||||
bool p3IdService::updateIdentity(uint32_t& token, RsGxsIdGroup &group)
|
||||
{
|
||||
#ifdef DEBUG_IDS
|
||||
std::cerr << "p3IdService::updateIdentity()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
group.mMeta.mCircleType = GXS_CIRCLE_TYPE_PUBLIC ;
|
||||
|
||||
updateGroup(token, group);
|
||||
|
||||
return false;
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool p3IdService::deleteIdentity(RsGxsId& id)
|
||||
|
|
|
@ -261,10 +261,7 @@ public:
|
|||
virtual bool createIdentity(uint32_t& token, RsIdentityParameters ¶ms) override;
|
||||
|
||||
/// @see RsIdentity
|
||||
bool updateIdentity(RsGxsIdGroup& identityData) override;
|
||||
|
||||
RS_DEPRECATED
|
||||
virtual bool updateIdentity(uint32_t& token, RsGxsIdGroup &group) override;
|
||||
bool updateIdentity( const RsGxsId& id, const std::string& name, const RsGxsImage& avatar, bool pseudonimous, const std::string& pgpPassword) override;
|
||||
|
||||
/// @see RsIdentity
|
||||
bool deleteIdentity(RsGxsId& id) override;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue