limit max number of feed items to 500, to avoid flooding possibility. Improved text

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7023 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2014-01-16 20:51:13 +00:00
parent 8594d68985
commit b8c65db00e
3 changed files with 16 additions and 4 deletions

View File

@ -452,10 +452,22 @@ void NewsFeed::testFeed(FeedNotify *feedNotify)
void NewsFeed::addFeedItem(QWidget *item)
{
static const unsigned int MAX_WIDGETS_SIZE = 500 ;
item->setAttribute(Qt::WA_DeleteOnClose, true);
connect(item, SIGNAL(destroyed(QObject*)), this, SLOT(itemDestroyed(QObject*)));
widgets.insert(item);
widgets.push_back(item);
// costly, but not really a problem here
while(widgets.size() > MAX_WIDGETS_SIZE)
{
QWidget *item = dynamic_cast<QWidget*>(widgets.front()) ;
if(item)
item->close() ;
widgets.pop_front() ;
}
sendNewsFeedChanged();

View File

@ -94,7 +94,7 @@ private:
void sendNewsFeedChanged();
QSet<QObject*> widgets;
std::list<QObject*> widgets;
/* lists of feedItems */
std::list<ForumNewItem *> mForumNewItems;

View File

@ -127,14 +127,14 @@ void SecurityItem::updateItemStatic()
requestLabel->hide();
break;
case RS_FEED_ITEM_SEC_WRONG_SIGNATURE:
title = tr("Certificate has wrong signature!! Peer is not who he claims to be.");
title = tr("Certificate has wrong signature!! This peer is not who he claims to be.");
requestLabel->hide();
break;
case RS_FEED_ITEM_SEC_BAD_CERTIFICATE:
{
RsPeerDetails details ;
if(rsPeers->getPeerDetails(mGpgId, details))
title = tr("Missing/Damaged certificate. Someone is probably trying to impersonate key ") + QString::fromStdString(mGpgId);
title = tr("Missing/Damaged SSL certificate for key ") + QString::fromStdString(mGpgId) ;
else
title = tr("Missing/Damaged certificate. Not a real Retroshare user.");
requestLabel->hide();