fixed GUI tooltips over banned items. Added dropping of messages from banned identities in chat lobbies

This commit is contained in:
csoler 2015-10-11 22:08:19 -04:00
parent 1a76bea6ff
commit 82c16c6a27
3 changed files with 23 additions and 4 deletions

View File

@ -34,6 +34,7 @@
#include "pqi/p3historymgr.h"
#include "retroshare/rspeers.h"
#include "retroshare/rsiface.h"
#include "retroshare/rsreputations.h"
#include "retroshare/rsidentity.h"
#include "rsserver/p3face.h"
#include "gxs/rsgixs.h"
@ -175,6 +176,12 @@ bool DistributedChatService::handleRecvChatLobbyMsgItem(RsChatMsgItem *ci)
return false ;
}
}
if(rsReputations->isIdentityBanned(cli->signature.keyId))
{
std::cerr << "(WW) Received lobby msg/item from banned identity " << cli->signature.keyId << ". Dropping it." << std::endl;
return false ;
}
if(!bounceLobbyObject(cli,cli->PeerId())) // forwards the message to friends, keeps track of subscribers, etc.
return false;
@ -672,6 +679,11 @@ void DistributedChatService::handleRecvChatLobbyEventItem(RsChatLobbyEventItem *
return ;
}
}
if(rsReputations->isIdentityBanned(item->signature.keyId))
{
std::cerr << "(WW) Received lobby msg/item from banned identity " << item->signature.keyId << ". Dropping it." << std::endl;
return ;
}
addTimeShiftStatistics((int)now - (int)item->sendTime) ;
if(now+100 > (time_t) item->sendTime + MAX_KEEP_MSG_RECORD) // the message is older than the max cache keep minus 100 seconds ! It's too old, and is going to make an echo!

View File

@ -76,7 +76,7 @@ static void fillGxsIdRSTreeWidgetItemCallback(GxsIdDetailsType type, const RsIde
break;
case GXS_ID_DETAILS_TYPE_BANNED:
icons.push_back(QIcon(":/icons/yellow_biohazard64.png")) ;
icons.push_back(QIcon("BANNED_IMAGE")) ;
break ;
}
@ -153,7 +153,9 @@ QVariant GxsIdRSTreeWidgetItem::data(int column, int role) const
QString t = RSTreeWidgetItem::data(column, role).toString();
QImage pix;
if(rsReputations->isIdentityBanned(mId))
if(mId.isNull())
return RSTreeWidgetItem::data(column, role);
else if(rsReputations->isIdentityBanned(mId))
pix = QImage(BANNED_IMAGE) ;
else if (mAvatar.mSize == 0 || !pix.loadFromData(mAvatar.mData, mAvatar.mSize, "PNG"))
pix = GxsIdDetails::makeDefaultIcon(mId);

View File

@ -989,10 +989,13 @@ QTreeWidgetItem *GxsForumThreadWidget::convertMsgToThreadWidget(const RsGxsForum
QTreeWidgetItem *GxsForumThreadWidget::generateMissingItem(const RsGxsMessageId &msgId)
{
GxsIdRSTreeWidgetItem *item = new GxsIdRSTreeWidgetItem(mThreadCompareRole,GxsIdDetails::ICON_TYPE_ALL);
item->setText(COLUMN_THREAD_TITLE, tr("[ ... Missing Message ... ]"));
item->setData(COLUMN_THREAD_DATA, ROLE_THREAD_MSGID, QString::fromStdString(msgId.toStdString()));
item->setData(COLUMN_THREAD_DATA, ROLE_THREAD_MISSING, true);
item->setId(RsGxsId(), COLUMN_THREAD_AUTHOR, false); // fixed up columnId()
return item;
}
@ -1358,8 +1361,10 @@ void GxsForumThreadWidget::insertMessageData(const RsGxsForumMsg &msg)
if(redacted)
{
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 += "<UL><li><b><font color=\"#ff0000\">Messages from this author are not forwarded. </font></b></li>" ;
extraTxt += "<li><b><font color=\"#ff0000\">Messages from this author are replaced by this text. </font></b></li></ul>" ;
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>You can still force the visibility and forwarding of messages by setting a different opinion for that Id in People's tab.</p>") ;
ui->postText->setHtml(extraTxt);
}
else