Fixed to display Avatars and nickname on news feeds Messages Item for Distant Messages.

Added for Invite Message RS_MSG_USER_REQUEST flag & auto send invites to outbox.
Optimized Messages Item for Invite Messages, display a Send Invite Button, to send back own rs cert link via Distant Message.
This commit is contained in:
defnax 2017-01-29 19:01:38 +01:00
parent 7327f1a98b
commit 7861b092c3
9 changed files with 307 additions and 53 deletions

View file

@ -62,6 +62,8 @@ MsgItem::MsgItem(FeedHolder *parent, uint32_t feedId, const std::string &msgId,
connect( playButton, SIGNAL( clicked( void ) ), this, SLOT( playMedia ( void ) ) );
connect( deleteButton, SIGNAL( clicked( void ) ), this, SLOT( deleteMsg ( void ) ) );
connect( replyButton, SIGNAL( clicked( void ) ), this, SLOT( replyMsg ( void ) ) );
connect( sendinviteButton, SIGNAL( clicked( void ) ), this, SLOT( sendInvite ( void ) ) );
expandFrame->hide();
@ -87,7 +89,7 @@ void MsgItem::updateItemStatic()
/* get peer Id */
if (mi.msgflags & RS_MSG_SIGNED)
if (mi.msgflags & RS_MSG_DISTANT)
avatar->setGxsId(mi.rsgxsid_srcId) ;
else
avatar->setId(ChatId(mi.rspeerid_srcId)) ;
@ -99,7 +101,7 @@ void MsgItem::updateItemStatic()
srcName = "RetroShare";
else
{
if(mi.msgflags & RS_MSG_SIGNED)
if(mi.msgflags & RS_MSG_DISTANT)
{
RsIdentityDetails details ;
rsIdentity->getIdDetails(mi.rsgxsid_srcId, details) ;
@ -110,11 +112,19 @@ void MsgItem::updateItemStatic()
srcName = QString::fromUtf8(rsPeers->getPeerName(mi.rspeerid_srcId).c_str());
}
timestampLabel->setText(DateTime::formatLongDateTime(mi.ts));
if (!mIsHome)
{
title = tr("Message From") + ": ";
if (mi.msgflags & RS_MSG_USER_REQUEST)
{
title = QString::fromUtf8(mi.title.c_str()) + " " + tr("from") + " " + srcName;
subjectLabel->hide();
}
else
{
title = tr("Message From") + ": " + srcName;
sendinviteButton->hide();
}
}
else
{
@ -141,11 +151,11 @@ void MsgItem::updateItemStatic()
break;
}
}
title += srcName;
titleLabel->setText(title);
subjectLabel->setText(QString::fromUtf8(mi.title.c_str()));
mMsg = QString::fromUtf8(mi.msg.c_str());
timestampLabel->setText(DateTime::formatLongDateTime(mi.ts));
if (wasExpanded() || expandFrame->isVisible()) {
fillExpandFrame();
@ -344,3 +354,18 @@ void MsgItem::checkMessageReadStatus()
removeItem();
}
void MsgItem::sendInvite()
{
MessageInfo mi;
if (!rsMail)
return;
if (!rsMail->getMessage(mMsgId, mi))
return;
MessageComposer::sendInvite(mi.rsgxsid_srcId);
}