diff --git a/libretroshare/src/services/p3gxsreputation.cc b/libretroshare/src/services/p3gxsreputation.cc index 5ccef637b..4b41e927c 100644 --- a/libretroshare/src/services/p3gxsreputation.cc +++ b/libretroshare/src/services/p3gxsreputation.cc @@ -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 &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& loadList) if(kit->key == "AUTO_BAN_IDENTITIES_THRESHOLD") { float val ; + if (sscanf(kit->value.c_str(), "%f", &val) == 1) { mAutoBanIdentitiesLimit = val ; diff --git a/libretroshare/src/services/p3gxsreputation.h b/libretroshare/src/services/p3gxsreputation.h index 6640ded97..7bed661b2 100644 --- a/libretroshare/src/services/p3gxsreputation.h +++ b/libretroshare/src/services/p3gxsreputation.h @@ -149,6 +149,7 @@ private: time_t mRequestTime; time_t mStoreTime; time_t mLastBannedNodesUpdate ; + time_t mLastIdentityFlagsUpdate ; bool mReputationsUpdated; uint32_t mAverageActiveFriends ; diff --git a/retroshare-gui/src/gui/settings/PeoplePage.cpp b/retroshare-gui/src/gui/settings/PeoplePage.cpp index 197874d90..79959c398 100644 --- a/retroshare-gui/src/gui/settings/PeoplePage.cpp +++ b/retroshare-gui/src/gui/settings/PeoplePage.cpp @@ -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) ; diff --git a/retroshare-gui/src/gui/settings/PeoplePage.ui b/retroshare-gui/src/gui/settings/PeoplePage.ui index e7d05919b..66b9948ab 100644 --- a/retroshare-gui/src/gui/settings/PeoplePage.ui +++ b/retroshare-gui/src/gui/settings/PeoplePage.ui @@ -64,10 +64,10 @@ - <html><head/><body><p>Anyone in your contact list will automatically have a positive opinion. This allows to automatically raise reputations of used nodes. </p></body></html> + <html><head/><body><p>Anyone in your contact list will automatically have a positive opinion if not set. This allows to automatically raise reputations of used nodes. </p></body></html> - automatically give "Positive" option to my contacts + automatically give "Positive" opinion to my contacts true