fixed a few bugs in the People tab

This commit is contained in:
csoler 2016-07-25 16:04:30 -04:00
parent 218977170c
commit f5e55e849b
4 changed files with 11 additions and 12 deletions

View File

@ -151,6 +151,7 @@ p3GxsReputation::p3GxsReputation(p3LinkMgr *lm)
mStoreTime = 0;
mReputationsUpdated = false;
mLastActiveFriendsUpdate = time(NULL) - 0.5*ACTIVE_FRIENDS_UPDATE_PERIOD; // avoids doing it too soon since the TS from rsIdentity needs to be loaded already
mLastIdentityFlagsUpdate = time(NULL) - 3;
mAverageActiveFriends = 0 ;
mLastBannedNodesUpdate = 0 ;
@ -189,22 +190,18 @@ int p3GxsReputation::tick()
mLastActiveFriendsUpdate = now ;
}
static time_t last_identity_flags_update = 0 ;
// no more than once per 5 second chunk.
if(now > IDENTITY_FLAGS_UPDATE_DELAY+last_identity_flags_update)
if(now > IDENTITY_FLAGS_UPDATE_DELAY+mLastIdentityFlagsUpdate)
{
last_identity_flags_update = now ;
updateIdentityFlags() ;
mLastIdentityFlagsUpdate = now ;
}
if(now > BANNED_NODES_UPDATE_DELAY+mLastBannedNodesUpdate) // 613 is not a multiple of 100, to avoid piling up work
{
mLastBannedNodesUpdate = now ;
updateIdentityFlags() ; // needed before updateBannedNodesList!
updateBannedNodesList();
mLastBannedNodesUpdate = now ;
}
#ifdef DEBUG_REPUTATION
@ -241,7 +238,7 @@ void p3GxsReputation::setNodeAutoPositiveOpinionForContacts(bool b)
if(b != mAutoSetPositiveOptionToContacts)
{
mLastBannedNodesUpdate = 0 ;
mLastIdentityFlagsUpdate = 0 ;
mAutoSetPositiveOptionToContacts = b ;
IndicateConfigChanged() ;
}
@ -953,7 +950,7 @@ bool p3GxsReputation::saveList(bool& cleanup, std::list<RsItem*> &savelist)
vitem->tlvkvs.pairs.push_back(kv) ;
kv.key = "AUTO_BAN_IDENTITIES_THRESHOLD" ;
rs_sprintf(kv.value, "%d", mAutoBanIdentitiesLimit);
rs_sprintf(kv.value, "%f", mAutoBanIdentitiesLimit);
vitem->tlvkvs.pairs.push_back(kv) ;
kv.key = "AUTO_POSITIVE_CONTACTS" ;
@ -1017,6 +1014,7 @@ bool p3GxsReputation::loadList(std::list<RsItem *>& loadList)
if(kit->key == "AUTO_BAN_IDENTITIES_THRESHOLD")
{
float val ;
if (sscanf(kit->value.c_str(), "%f", &val) == 1)
{
mAutoBanIdentitiesLimit = val ;

View File

@ -149,6 +149,7 @@ private:
time_t mRequestTime;
time_t mStoreTime;
time_t mLastBannedNodesUpdate ;
time_t mLastIdentityFlagsUpdate ;
bool mReputationsUpdated;
uint32_t mAverageActiveFriends ;

View File

@ -42,7 +42,7 @@ bool PeoplePage::save(QString &/*errmsg*/)
else
rsReputations->setNodeAutoBanThreshold(ui.identityBanThreshold_SB->value()) ;
if(!ui.autoPositiveOpinion_CB->isChecked())
if(ui.autoPositiveOpinion_CB->isChecked())
rsReputations->setNodeAutoPositiveOpinionForContacts(true) ;
else
rsReputations->setNodeAutoPositiveOpinionForContacts(false) ;

View File

@ -64,10 +64,10 @@
<item>
<widget class="QCheckBox" name="autoPositiveOpinion_CB">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Anyone in your contact list will automatically have a positive opinion. This allows to automatically raise reputations of used nodes. &lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Anyone in your contact list will automatically have a positive opinion if not set. This allows to automatically raise reputations of used nodes. &lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>automatically give &quot;Positive&quot; option to my contacts</string>
<string>automatically give &quot;Positive&quot; opinion to my contacts</string>
</property>
<property name="checked">
<bool>true</bool>