mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-28 00:49:28 -05:00
added update for forum messages list when an author gets banned
This commit is contained in:
parent
5a3756f058
commit
7dc59845e9
@ -37,7 +37,6 @@
|
||||
/****
|
||||
* #define DEBUG_REPUTATION 1
|
||||
****/
|
||||
#define DEBUG_REPUTATION 1
|
||||
|
||||
/************ IMPLEMENTATION NOTES *********************************
|
||||
*
|
||||
@ -130,7 +129,7 @@ static const uint32_t UPPER_LIMIT = 2; // used to
|
||||
static const float REPUTATION_ASSESSMENT_THRESHOLD_X1 = 0.5f ; // reputation under which the peer gets killed
|
||||
static const int kMaximumPeerAge = 180; // half a year.
|
||||
static const int kMaximumSetSize = 100; // max set of updates to send at once.
|
||||
static const int ACTIVE_FRIENDS_UPDATE_PERIOD = 60;//600 ;// 10 minutes
|
||||
static const int ACTIVE_FRIENDS_UPDATE_PERIOD = 600 ; // 10 minutes
|
||||
static const int ACTIVE_FRIENDS_ONLINE_DELAY = 86400*7 ; // 1 week.
|
||||
|
||||
|
||||
@ -167,23 +166,25 @@ int p3GxsReputation::tick()
|
||||
{
|
||||
processIncoming();
|
||||
sendPackets();
|
||||
|
||||
time_t now = time(NULL);
|
||||
|
||||
if(mLastActiveFriendsUpdate + ACTIVE_FRIENDS_UPDATE_PERIOD < now)
|
||||
{
|
||||
|
||||
time_t now = time(NULL);
|
||||
|
||||
if(mLastActiveFriendsUpdate + ACTIVE_FRIENDS_UPDATE_PERIOD < now)
|
||||
{
|
||||
updateActiveFriends() ;
|
||||
mLastActiveFriendsUpdate = now ;
|
||||
}
|
||||
cleanup() ;
|
||||
|
||||
mLastActiveFriendsUpdate = now ;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_REPUTATION
|
||||
static time_t last_debug_print = time(NULL) ;
|
||||
|
||||
if(now > 10+last_debug_print)
|
||||
{
|
||||
last_debug_print = now ;
|
||||
debug_print() ;
|
||||
}
|
||||
static time_t last_debug_print = time(NULL) ;
|
||||
|
||||
if(now > 10+last_debug_print)
|
||||
{
|
||||
last_debug_print = now ;
|
||||
debug_print() ;
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
@ -193,6 +194,16 @@ int p3GxsReputation::status()
|
||||
return 1;
|
||||
}
|
||||
|
||||
void p3GxsReputation::cleanup()
|
||||
{
|
||||
// remove opinions from friends that havn't been seen online for more than the specified delay
|
||||
|
||||
#ifdef DEBUG_REPUTATION
|
||||
std::cerr << "p3GxsReputation::cleanup() " << std::endl;
|
||||
#endif
|
||||
std::cerr << __PRETTY_FUNCTION__ << ": not implemented. TODO!" << std::endl;
|
||||
}
|
||||
|
||||
void p3GxsReputation::updateActiveFriends()
|
||||
{
|
||||
RsStackMutex stack(mReputationMtx); /****** LOCKED MUTEX *******/
|
||||
@ -347,8 +358,10 @@ bool p3GxsReputation::SendReputations(RsGxsReputationRequestItem *request)
|
||||
|
||||
if (count > kMaximumSetSize)
|
||||
{
|
||||
#ifdef DEBUG_REPUTATION
|
||||
std::cerr << "p3GxsReputation::SendReputations() Sending Full Packet";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
sendItem(pkt);
|
||||
|
||||
@ -360,8 +373,10 @@ bool p3GxsReputation::SendReputations(RsGxsReputationRequestItem *request)
|
||||
|
||||
if (!pkt->mOpinions.empty())
|
||||
{
|
||||
#ifdef DEBUG_REPUTATION
|
||||
std::cerr << "p3GxsReputation::SendReputations() Sending Final Packet";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
sendItem(pkt);
|
||||
}
|
||||
@ -370,8 +385,10 @@ bool p3GxsReputation::SendReputations(RsGxsReputationRequestItem *request)
|
||||
delete pkt;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_REPUTATION
|
||||
std::cerr << "p3GxsReputation::SendReputations() Total Count: " << totalcount;
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -117,13 +117,12 @@ class p3GxsReputation: public p3Service, public p3Config, public RsReputations /
|
||||
|
||||
// internal update of data. Takes care of cleaning empty boxes.
|
||||
void locked_updateOpinion(const RsPeerId &from, const RsGxsId &about, RsReputations::Opinion op);
|
||||
bool loadReputationSet(RsGxsReputationSetItem *item, const std::set<RsPeerId> &peerSet);
|
||||
|
||||
bool loadReputationSet(RsGxsReputationSetItem *item,
|
||||
const std::set<RsPeerId> &peerSet);
|
||||
|
||||
int sendPackets();
|
||||
int sendPackets();
|
||||
void cleanup();
|
||||
void sendReputationRequests();
|
||||
int sendReputationRequest(RsPeerId peerid);
|
||||
int sendReputationRequest(RsPeerId peerid);
|
||||
void debug_print() ;
|
||||
|
||||
private:
|
||||
|
@ -1363,7 +1363,7 @@ void GxsForumThreadWidget::insertMessageData(const RsGxsForumMsg &msg)
|
||||
QString extraTxt = tr("<p><font color=\"#ff0000\"><b>The author of this message (with ID %1) is banned.</b>").arg(QString::fromStdString(msg.mMeta.mAuthorId.toStdString())) ;
|
||||
extraTxt += tr("<UL><li><b><font color=\"#ff0000\">Messages from this author are not forwarded. </font></b></li>") ;
|
||||
extraTxt += tr("<li><b><font color=\"#ff0000\">Messages from this author are replaced by this text. </font></b></li></ul>") ;
|
||||
extraTxt += tr("<p><font color=\"#ff0000\">You can force the visibility and forwarding of messages by setting a different opinion for that Id in People's tab.</font></p>") ;
|
||||
extraTxt += tr("<p><b><font color=\"#ff0000\">You can force the visibility and forwarding of messages by setting a different opinion for that Id in People's tab.</font></b></p>") ;
|
||||
|
||||
ui->postText->setHtml(extraTxt);
|
||||
}
|
||||
@ -1746,7 +1746,6 @@ void GxsForumThreadWidget::flagpersonasbad()
|
||||
|
||||
uint32_t token;
|
||||
mTokenQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, mTokenTypeBanAuthor);
|
||||
|
||||
}
|
||||
|
||||
void GxsForumThreadWidget::replytomessage()
|
||||
@ -2055,8 +2054,7 @@ void GxsForumThreadWidget::loadMsgData_BanAuthor(const uint32_t &token)
|
||||
std::cerr << "GxsForumThreadWidget::loadMsgData_ReplyMessage() ERROR Missing Message Data...";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
|
||||
requestGroupData() ;
|
||||
updateDisplay(true) ;
|
||||
}
|
||||
/*********************** **** **** **** ***********************/
|
||||
/*********************** **** **** **** ***********************/
|
||||
|
Loading…
Reference in New Issue
Block a user