fixed auto-positive opinions for contacts

This commit is contained in:
csoler 2016-08-04 16:10:00 +02:00
parent c7576309a7
commit 3993fbf5cc
2 changed files with 22 additions and 14 deletions

View File

@ -266,7 +266,7 @@ static const uint32_t RS_NXS_ITEM_ENCRYPTION_STATUS_GXS_KEY_MISSING = 0x05 ;
|| defined(NXS_NET_DEBUG_4) || defined(NXS_NET_DEBUG_5) || defined(NXS_NET_DEBUG_6) || defined(NXS_NET_DEBUG_7)
static const RsPeerId peer_to_print = RsPeerId(std::string("")) ;
static const RsGxsGroupId group_id_to_print = RsGxsGroupId(std::string("30501fac090b65f5b9def169598b53ed" )) ; // use this to allow to this group id only, or "" for all IDs
static const RsGxsGroupId group_id_to_print = RsGxsGroupId(std::string("")) ; // use this to allow to this group id only, or "" for all IDs
static const uint32_t service_to_print = 0x211 ; // use this to allow to this service id only, or 0 for all services
// warning. Numbers should be SERVICE IDS (see serialiser/rsserviceids.h. E.g. 0x0215 for forums)

View File

@ -449,11 +449,11 @@ void p3IdService::notifyChanges(std::vector<RsGxsNotify *> &changes)
/* iterate through and grab any new messages */
std::list<RsGxsGroupId> unprocessedGroups;
std::vector<RsGxsNotify *>::iterator it;
for(it = changes.begin(); it != changes.end(); ++it)
for(uint32_t i = 0;i<changes.size();++i)
{
RsGxsGroupChange *groupChange = dynamic_cast<RsGxsGroupChange *>(*it);
RsGxsMsgChange *msgChange = dynamic_cast<RsGxsMsgChange *>(*it);
RsGxsGroupChange *groupChange = dynamic_cast<RsGxsGroupChange *>(changes[i]);
RsGxsMsgChange *msgChange = dynamic_cast<RsGxsMsgChange *>(changes[i]);
if (msgChange && !msgChange->metaChange())
{
#ifdef DEBUG_IDS
@ -479,10 +479,10 @@ void p3IdService::notifyChanges(std::vector<RsGxsNotify *> &changes)
std::cerr << "p3IdService::notifyChanges() Found Group Change Notification";
std::cerr << std::endl;
#endif
std::list<RsGxsGroupId> &groupList = groupChange->mGrpIdList;
std::list<RsGxsGroupId>::iterator git;
for(git = groupList.begin(); git != groupList.end(); ++git)
for(git = groupList.begin(); git != groupList.end();)
{
#ifdef DEBUG_IDS
std::cerr << "p3IdService::notifyChanges() Auto Subscribe to Incoming Groups: " << *git;
@ -496,15 +496,17 @@ void p3IdService::notifyChanges(std::vector<RsGxsNotify *> &changes)
// also time_stamp the key that this group represents
timeStampKey(RsGxsId(*git)) ;
++git;
}
else
{
std::cerr << "(EE) Received banned identity " << *git << ": this should not happen. Deleting it!" << std::endl;
uint32_t token ;
RsGxsIdGroup group;
group.mMeta.mGroupId=RsGxsGroupId(*git);
deleteIdentity(token, group);
}
git = groupList.erase(git) ;
}
if(groupList.empty())
{
delete changes[i] ;
changes[i] = NULL ;
}
}
}
@ -543,6 +545,12 @@ bool p3IdService::getIdDetails(const RsGxsId &id, RsIdentityDetails &details)
if (mKeyCache.fetch(id, data))
{
// This step is needed, because p3GxsReputation does not know all identities, and might not have any data for
// the ones in the contact list. So we change them on demand.
if((details.mFlags & RS_IDENTITY_FLAGS_IS_A_CONTACT) && rsReputations->nodeAutoPositiveOpinionForContacts())
rsReputations->setOwnOpinion(id,RsReputations::OPINION_POSITIVE) ;
details = data.details;
details.mLastUsageTS = locked_getLastUsageTS(id) ;