mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-24 14:23:36 -05:00
fixed bug causing wrong "from" field in sent messages
This commit is contained in:
parent
6327ccf6ae
commit
8185dba0d8
@ -1370,7 +1370,24 @@ bool MessageComposer::buildMessage(MessageInfo& mi)
|
||||
{
|
||||
// add a GXS signer/from in case the message is to be sent to a distant peer
|
||||
|
||||
mi.from = MsgAddress(RsGxsId(ui.respond_to_CB->itemData(ui.respond_to_CB->currentIndex()).toString().toStdString()),MsgAddress::MSG_ADDRESS_MODE_TO) ;
|
||||
bool at_least_one_gxsid = false;
|
||||
|
||||
for(auto m:mi.destinations)
|
||||
if(m.type() == MsgAddress::MSG_ADDRESS_TYPE_RSGXSID)
|
||||
{
|
||||
at_least_one_gxsid=true;
|
||||
break;
|
||||
}
|
||||
|
||||
if(!at_least_one_gxsid)
|
||||
mi.from = Rs::Msgs::MsgAddress(rsPeers->getOwnId(),MsgAddress::MSG_ADDRESS_MODE_TO);
|
||||
else if(mi.from.type() != MsgAddress::MSG_ADDRESS_TYPE_RSGXSID)
|
||||
{
|
||||
QMessageBox::warning(this, tr("RetroShare"), tr("Please create an identity to sign distant messages, or remove the distant peers from the destination list."), QMessageBox::Ok);
|
||||
return false; // Don't send if cannot sign.
|
||||
}
|
||||
else
|
||||
mi.from = MsgAddress(RsGxsId(ui.respond_to_CB->itemData(ui.respond_to_CB->currentIndex()).toString().toStdString()),MsgAddress::MSG_ADDRESS_MODE_TO) ;
|
||||
|
||||
//std::cerr << "MessageSend: setting 'from' field to GXS id = " << mi.rsgxsid_srcId << std::endl;
|
||||
|
||||
@ -1452,9 +1469,9 @@ bool MessageComposer::buildMessage(MessageInfo& mi)
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case TO: mi.destinations.insert(MsgAddress(pid,MsgAddress::MSG_ADDRESS_MODE_TO)); break;
|
||||
case CC: mi.destinations.insert(MsgAddress(pid,MsgAddress::MSG_ADDRESS_MODE_CC)); break;
|
||||
case BCC: mi.destinations.insert(MsgAddress(pid,MsgAddress::MSG_ADDRESS_MODE_BCC)); break;
|
||||
case TO: mi.destinations.insert(MsgAddress(pid,MsgAddress::MSG_ADDRESS_MODE_TO)); break;
|
||||
case CC: mi.destinations.insert(MsgAddress(pid,MsgAddress::MSG_ADDRESS_MODE_CC)); break;
|
||||
case BCC: mi.destinations.insert(MsgAddress(pid,MsgAddress::MSG_ADDRESS_MODE_BCC)); break;
|
||||
}
|
||||
}
|
||||
break ;
|
||||
@ -1464,9 +1481,9 @@ bool MessageComposer::buildMessage(MessageInfo& mi)
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case TO: mi.destinations.insert(MsgAddress(gid,MsgAddress::MSG_ADDRESS_MODE_TO)); break;
|
||||
case CC: mi.destinations.insert(MsgAddress(gid,MsgAddress::MSG_ADDRESS_MODE_CC)); break;
|
||||
case BCC: mi.destinations.insert(MsgAddress(gid,MsgAddress::MSG_ADDRESS_MODE_BCC)); break;
|
||||
case TO: mi.destinations.insert(MsgAddress(gid,MsgAddress::MSG_ADDRESS_MODE_TO)); break;
|
||||
case CC: mi.destinations.insert(MsgAddress(gid,MsgAddress::MSG_ADDRESS_MODE_CC)); break;
|
||||
case BCC: mi.destinations.insert(MsgAddress(gid,MsgAddress::MSG_ADDRESS_MODE_BCC)); break;
|
||||
}
|
||||
}
|
||||
break ;
|
||||
@ -1526,22 +1543,9 @@ bool MessageComposer::sendMessage_internal(bool bDraftbox)
|
||||
return false; // Don't send with no recipient
|
||||
}
|
||||
|
||||
bool at_least_one_gxsid = false;
|
||||
for(auto m:mi.destinations)
|
||||
if(m.type() == MsgAddress::MSG_ADDRESS_TYPE_RSGXSID)
|
||||
{
|
||||
at_least_one_gxsid=true;
|
||||
break;
|
||||
}
|
||||
|
||||
if(at_least_one_gxsid && mi.from.type() != MsgAddress::MSG_ADDRESS_TYPE_RSGXSID)
|
||||
{
|
||||
QMessageBox::warning(this, tr("RetroShare"), tr("Please create an identity to sign distant messages, or remove the distant peers from the destination list."), QMessageBox::Ok);
|
||||
return false; // Don't send if cannot sign.
|
||||
}
|
||||
if (rsMail->MessageSend(mi) == false) {
|
||||
if (rsMail->MessageSend(mi) == false)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_msgParentId.empty() == false) {
|
||||
switch (m_msgType) {
|
||||
|
Loading…
Reference in New Issue
Block a user