mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-20 21:29:01 -04:00
changed Mail interface to use the generic MsgAddress type instead of the GxsId/RsPeerId combination
This commit is contained in:
parent
4e0bd19182
commit
ba4982f2ca
8 changed files with 298 additions and 214 deletions
|
@ -391,7 +391,8 @@ void MessageWidget::getcurrentrecommended()
|
|||
}
|
||||
|
||||
std::list<RsPeerId> srcIds;
|
||||
srcIds.push_back(msgInfo.rspeerid_srcId);
|
||||
if(msgInfo.from.type()==MsgAddress::MSG_ADDRESS_TYPE_RSPEERID)
|
||||
srcIds.push_back(msgInfo.from.toRsPeerId());
|
||||
|
||||
QModelIndexList list = ui.msgList->selectionModel()->selectedIndexes();
|
||||
|
||||
|
@ -439,7 +440,10 @@ void MessageWidget::getallrecommended()
|
|||
for(it = recList.begin(); it != recList.end(); ++it) {
|
||||
std::cerr << "MessageWidget::getallrecommended() Calling File Request" << std::endl;
|
||||
std::list<RsPeerId> srcIds;
|
||||
srcIds.push_back(msgInfo.rspeerid_srcId);
|
||||
|
||||
if(msgInfo.from.type()==MsgAddress::MSG_ADDRESS_TYPE_RSPEERID)
|
||||
srcIds.push_back(msgInfo.from.toRsPeerId());
|
||||
|
||||
rsFiles->FileRequest(it->fname, it->hash, it->size, "", RS_FILE_REQ_ANONYMOUS_ROUTING, srcIds);
|
||||
}
|
||||
}
|
||||
|
@ -565,17 +569,21 @@ void MessageWidget::fill(const std::string &msgId)
|
|||
return;
|
||||
}
|
||||
|
||||
if ((msgInfo.msgflags & RS_MSG_USER_REQUEST) && msgInfo.rsgxsid_srcId.isNull()){
|
||||
ui.info_Frame_Invite->show();
|
||||
ui.sendInviteButton->hide();
|
||||
ui.infoLabel_Invite->setText(tr("You got an invite to make friend! You may accept this request."));
|
||||
} else if ((msgInfo.msgflags & RS_MSG_USER_REQUEST) && (!msgInfo.rsgxsid_srcId.isNull())){
|
||||
ui.info_Frame_Invite->show();
|
||||
ui.sendInviteButton->show();
|
||||
ui.infoLabel_Invite->setText(tr("You got an invite to make friend! You may accept this request and send your own Certificate back"));
|
||||
} else {
|
||||
ui.info_Frame_Invite->hide();
|
||||
}
|
||||
if (msgInfo.msgflags & RS_MSG_USER_REQUEST)
|
||||
if(msgInfo.from.type() == MsgAddress::MSG_ADDRESS_TYPE_RSPEERID)
|
||||
{
|
||||
ui.info_Frame_Invite->show();
|
||||
ui.sendInviteButton->hide();
|
||||
ui.infoLabel_Invite->setText(tr("You got an invite to make friend! You may accept this request."));
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.info_Frame_Invite->show();
|
||||
ui.sendInviteButton->show();
|
||||
ui.infoLabel_Invite->setText(tr("You got an invite to make friend! You may accept this request and send your own Certificate back"));
|
||||
}
|
||||
else
|
||||
ui.info_Frame_Invite->hide();
|
||||
|
||||
const std::list<FileInfo> &recList = msgInfo.files;
|
||||
std::list<FileInfo>::const_iterator it;
|
||||
|
@ -604,63 +612,44 @@ void MessageWidget::fill(const std::string &msgId)
|
|||
|
||||
/* iterate through the sources */
|
||||
RetroShareLink link;
|
||||
QString text;
|
||||
QString to_text,cc_text,bcc_text;
|
||||
|
||||
for(auto m:msgInfo.to)
|
||||
{
|
||||
if(m.type()==MsgAddress::MSG_ADDRESS_TYPE_RSGXSID)
|
||||
link = RetroShareLink::createMessage(m.toGxsId(), "");
|
||||
else
|
||||
link = RetroShareLink::createMessage(m.toRsPeerId(), "");
|
||||
|
||||
for(std::set<RsPeerId>::const_iterator pit = msgInfo.rspeerid_msgto.begin(); pit != msgInfo.rspeerid_msgto.end(); ++pit) {
|
||||
link = RetroShareLink::createMessage(*pit, "");
|
||||
if (link.valid())
|
||||
text += link.toHtml() + " ";
|
||||
}
|
||||
for(std::set<RsGxsId >::const_iterator pit = msgInfo.rsgxsid_msgto.begin(); pit != msgInfo.rsgxsid_msgto.end(); ++pit) {
|
||||
link = RetroShareLink::createMessage(*pit, "");
|
||||
if (link.valid())
|
||||
text += link.toHtml() + " ";
|
||||
}
|
||||
switch(m.mode())
|
||||
{
|
||||
case MsgAddress::MSG_ADDRESS_MODE_TO: to_text += link.toHtml() + " "; break;
|
||||
case MsgAddress::MSG_ADDRESS_MODE_CC: cc_text += link.toHtml() + " "; break;
|
||||
case MsgAddress::MSG_ADDRESS_MODE_BCC: bcc_text += link.toHtml() + " "; break;
|
||||
}
|
||||
}
|
||||
|
||||
ui.trans_ToText->setText(text);
|
||||
ui.trans_ToText->setText(to_text);
|
||||
|
||||
if (!msgInfo.rspeerid_msgcc.empty() || !msgInfo.rsgxsid_msgcc.empty())
|
||||
if (!cc_text.isNull())
|
||||
{
|
||||
ui.ccLabel->setVisible(true);
|
||||
ui.trans_CCText->setVisible(true);
|
||||
|
||||
text.clear();
|
||||
for(std::set<RsPeerId>::const_iterator pit = msgInfo.rspeerid_msgcc.begin(); pit != msgInfo.rspeerid_msgcc.end(); ++pit) {
|
||||
link = RetroShareLink::createMessage(*pit, "");
|
||||
if (link.valid())
|
||||
text += link.toHtml() + " ";
|
||||
}
|
||||
for(std::set<RsGxsId>::const_iterator pit = msgInfo.rsgxsid_msgcc.begin(); pit != msgInfo.rsgxsid_msgcc.end(); ++pit) {
|
||||
link = RetroShareLink::createMessage(*pit, "");
|
||||
if (link.valid())
|
||||
text += link.toHtml() + " ";
|
||||
}
|
||||
|
||||
ui.trans_CCText->setText(text);
|
||||
ui.trans_CCText->setText(cc_text);
|
||||
} else {
|
||||
ui.ccLabel->setVisible(false);
|
||||
ui.trans_CCText->setVisible(false);
|
||||
ui.trans_CCText->clear();
|
||||
}
|
||||
|
||||
if (!msgInfo.rspeerid_msgbcc.empty() || !msgInfo.rsgxsid_msgbcc.empty())
|
||||
if (!bcc_text.isNull())
|
||||
{
|
||||
ui.bccLabel->setVisible(true);
|
||||
ui.trans_BCCText->setVisible(true);
|
||||
|
||||
text.clear();
|
||||
for(std::set<RsPeerId>::const_iterator pit = msgInfo.rspeerid_msgbcc.begin(); pit != msgInfo.rspeerid_msgbcc.end(); ++pit) {
|
||||
link = RetroShareLink::createMessage(*pit, "");
|
||||
if (link.valid())
|
||||
text += link.toHtml() + " ";
|
||||
}
|
||||
for(std::set<RsGxsId>::const_iterator pit = msgInfo.rsgxsid_msgbcc.begin(); pit != msgInfo.rsgxsid_msgbcc.end(); ++pit) {
|
||||
link = RetroShareLink::createMessage(*pit, "");
|
||||
if (link.valid())
|
||||
text += link.toHtml() + " ";
|
||||
}
|
||||
|
||||
ui.trans_BCCText->setText(text);
|
||||
ui.trans_BCCText->setText(bcc_text);
|
||||
} else {
|
||||
ui.bccLabel->setVisible(false);
|
||||
ui.trans_BCCText->setVisible(false);
|
||||
|
@ -680,16 +669,16 @@ void MessageWidget::fill(const std::string &msgId)
|
|||
|
||||
if(msgInfo.msgflags & RS_MSG_DISTANT) // distant message
|
||||
{
|
||||
tooltip_string = PeerDefs::rsidFromId(msgInfo.rsgxsid_srcId) ;
|
||||
link = RetroShareLink::createMessage(msgInfo.rsgxsid_srcId, "");
|
||||
tooltip_string = PeerDefs::rsidFromId(msgInfo.from.toGxsId()) ;
|
||||
link = RetroShareLink::createMessage(msgInfo.from.toGxsId(), "");
|
||||
}
|
||||
else
|
||||
{
|
||||
tooltip_string = PeerDefs::rsidFromId(msgInfo.rspeerid_srcId) ;
|
||||
link = RetroShareLink::createMessage(msgInfo.rspeerid_srcId, "");
|
||||
tooltip_string = PeerDefs::rsidFromId(msgInfo.from.toRsPeerId()) ;
|
||||
link = RetroShareLink::createMessage(msgInfo.from.toRsPeerId(), "");
|
||||
}
|
||||
|
||||
if (((msgInfo.msgflags & RS_MSG_SYSTEM) && msgInfo.rspeerid_srcId == ownId) || msgInfo.rspeerid_srcId.isNull()) {
|
||||
if (((msgInfo.msgflags & RS_MSG_SYSTEM) && msgInfo.from.toRsPeerId() == ownId) || msgInfo.from.type()!=MsgAddress::MSG_ADDRESS_TYPE_RSPEERID) {
|
||||
ui.fromText->setText("[Notification]");
|
||||
if (toolButtonReply) toolButtonReply->setEnabled(false);
|
||||
} else {
|
||||
|
@ -706,7 +695,7 @@ void MessageWidget::fill(const std::string &msgId)
|
|||
if (Settings->valueFromGroup(QString("Messages"), QString::fromUtf8("Emoticons"), true).toBool()) {
|
||||
formatTextFlag |= RSHTML_FORMATTEXT_EMBED_SMILEYS ;
|
||||
}
|
||||
text = RsHtmlMsg(msgInfo.msgflags).formatText(ui.msgText->document(), QString::fromUtf8(msgInfo.msg.c_str()), formatTextFlag);
|
||||
QString text = RsHtmlMsg(msgInfo.msgflags).formatText(ui.msgText->document(), QString::fromUtf8(msgInfo.msg.c_str()), formatTextFlag);
|
||||
ui.msgText->resetImagesStatus(Settings->getMsgLoadEmbeddedImages() || (msgInfo.msgflags & RS_MSG_LOAD_EMBEDDED_IMAGES));
|
||||
ui.msgText->setHtml(text);
|
||||
|
||||
|
@ -883,19 +872,21 @@ void MessageWidget::loadImagesAlways()
|
|||
|
||||
void MessageWidget::sendInvite()
|
||||
{
|
||||
MessageInfo mi;
|
||||
MessageInfo mi;
|
||||
|
||||
if (!rsMail)
|
||||
return;
|
||||
if (!rsMail)
|
||||
return;
|
||||
|
||||
if (!rsMail->getMessage(currMsgId, mi))
|
||||
return;
|
||||
if (!rsMail->getMessage(currMsgId, mi))
|
||||
return;
|
||||
|
||||
//if ((QMessageBox::question(this, tr("Send invite?"),tr("Do you really want send a invite with your Certificate?"),QMessageBox::Yes|QMessageBox::No, QMessageBox::Yes))== QMessageBox::Yes)
|
||||
//{
|
||||
MessageComposer::sendInvite(mi.rsgxsid_srcId,false);
|
||||
//}
|
||||
if(!mi.from.type()==MsgAddress::MSG_ADDRESS_TYPE_RSGXSID)
|
||||
return;
|
||||
|
||||
if ((QMessageBox::question(this, tr("Send invite?"),tr("Do you really want send a invite with your Certificate?"),QMessageBox::Yes|QMessageBox::No, QMessageBox::Cancel))== QMessageBox::Yes)
|
||||
{
|
||||
MessageComposer::sendInvite(mi.from.toGxsId(),false);
|
||||
}
|
||||
}
|
||||
|
||||
void MessageWidget::setToolbarButtonStyle(Qt::ToolButtonStyle style)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue