mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-06 21:58:57 -04:00
added auto-resend of unsent messages. Fixed display of From field in outbox
This commit is contained in:
parent
0c591f08ae
commit
75edb46c99
2 changed files with 108 additions and 77 deletions
|
@ -332,15 +332,20 @@ int p3MsgService::checkOutgoingMessages()
|
||||||
* if online, send
|
* if online, send
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
static const uint32_t OLD_MESSAGE_FLUSHING_DELAY = 86400*7 ; // re-send old messages every week. This mainly ensures that
|
||||||
|
// messages that where never sent get sent at some point.
|
||||||
|
|
||||||
|
time_t now = time(NULL);
|
||||||
bool changed = false ;
|
bool changed = false ;
|
||||||
std::list<RsMsgItem*> output_queue ;
|
std::list<RsMsgItem*> output_queue ;
|
||||||
|
|
||||||
{
|
{
|
||||||
|
RS_STACK_MUTEX(mMsgMtx); /********** STACK LOCKED MTX ******/
|
||||||
|
|
||||||
const RsPeerId& ownId = mServiceCtrl->getOwnId();
|
const RsPeerId& ownId = mServiceCtrl->getOwnId();
|
||||||
|
|
||||||
std::list<uint32_t>::iterator it;
|
std::list<uint32_t>::iterator it;
|
||||||
std::list<uint32_t> toErase;
|
std::list<uint32_t> toErase;
|
||||||
RsStackMutex stack(mMsgMtx); /********** STACK LOCKED MTX ******/
|
|
||||||
|
|
||||||
std::map<uint32_t, RsMsgItem *>::iterator mit;
|
std::map<uint32_t, RsMsgItem *>::iterator mit;
|
||||||
for(mit = msgOutgoing.begin(); mit != msgOutgoing.end(); ++mit)
|
for(mit = msgOutgoing.begin(); mit != msgOutgoing.end(); ++mit)
|
||||||
|
@ -350,10 +355,27 @@ int p3MsgService::checkOutgoingMessages()
|
||||||
|
|
||||||
/* find the certificate */
|
/* find the certificate */
|
||||||
RsPeerId pid = mit->second->PeerId();
|
RsPeerId pid = mit->second->PeerId();
|
||||||
|
bool should_send = false ;
|
||||||
|
|
||||||
if( pid == ownId
|
if( pid == ownId)
|
||||||
|| ( (mit->second->msgFlags & RS_MSG_FLAGS_DISTANT) && (!(mit->second->msgFlags & RS_MSG_FLAGS_ROUTED)))
|
should_send = true ;
|
||||||
|| mServiceCtrl->isPeerConnected(getServiceInfo().mServiceType, pid) ) /* FEEDBACK Msg to Ourselves */
|
|
||||||
|
if( mServiceCtrl->isPeerConnected(getServiceInfo().mServiceType, pid) ) /* FEEDBACK Msg to Ourselves */
|
||||||
|
should_send = true ;
|
||||||
|
|
||||||
|
if (mit->second->msgFlags & RS_MSG_FLAGS_DISTANT)
|
||||||
|
{
|
||||||
|
if(!(mit->second->msgFlags & RS_MSG_FLAGS_ROUTED))
|
||||||
|
should_send = true ;
|
||||||
|
|
||||||
|
if(mit->second->sendTime + OLD_MESSAGE_FLUSHING_DELAY < now)
|
||||||
|
{
|
||||||
|
should_send = true ;
|
||||||
|
mit->second->sendTime = now;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(should_send)
|
||||||
{
|
{
|
||||||
/* send msg */
|
/* send msg */
|
||||||
pqioutput(PQL_DEBUG_BASIC, msgservicezone,
|
pqioutput(PQL_DEBUG_BASIC, msgservicezone,
|
||||||
|
|
|
@ -1098,25 +1098,34 @@ void MessagesDialog::insertMessages()
|
||||||
// From ....
|
// From ....
|
||||||
{
|
{
|
||||||
bool setText = true;
|
bool setText = true;
|
||||||
if (msgbox == RS_MSG_INBOX || msgbox == RS_MSG_OUTBOX) {
|
if (msgbox == RS_MSG_INBOX || msgbox == RS_MSG_OUTBOX)
|
||||||
|
{
|
||||||
if ((it->msgflags & RS_MSG_SYSTEM) && it->srcId == ownId) {
|
if ((it->msgflags & RS_MSG_SYSTEM) && it->srcId == ownId) {
|
||||||
text = "RetroShare";
|
text = "RetroShare";
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if (it->msgflags & RS_MSG_DISTANT)
|
if (it->msgflags & RS_MSG_DISTANT)
|
||||||
{
|
{
|
||||||
// distant message
|
// distant message
|
||||||
setText = false;
|
setText = false;
|
||||||
if (gotInfo || rsMail->getMessage(it->msgId, msgInfo)) {
|
if (gotInfo || rsMail->getMessage(it->msgId, msgInfo)) {
|
||||||
gotInfo = true;
|
gotInfo = true;
|
||||||
|
|
||||||
|
if(msgbox != RS_MSG_INBOX && !msgInfo.rsgxsid_msgto.empty())
|
||||||
|
item->setId(RsGxsId(*msgInfo.rsgxsid_msgto.begin()), COLUMN_FROM, false);
|
||||||
|
else
|
||||||
item->setId(RsGxsId(msgInfo.rsgxsid_srcId), COLUMN_FROM, false);
|
item->setId(RsGxsId(msgInfo.rsgxsid_srcId), COLUMN_FROM, false);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
std::cerr << "MessagesDialog::insertMsgTxtAndFiles() Couldn't find Msg" << std::endl;
|
std::cerr << "MessagesDialog::insertMsgTxtAndFiles() Couldn't find Msg" << std::endl;
|
||||||
}
|
}
|
||||||
} else {
|
else
|
||||||
text = QString::fromUtf8(rsPeers->getPeerName(it->srcId).c_str());
|
text = QString::fromUtf8(rsPeers->getPeerName(it->srcId).c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
else
|
||||||
|
{
|
||||||
if (gotInfo || rsMail->getMessage(it->msgId, msgInfo)) {
|
if (gotInfo || rsMail->getMessage(it->msgId, msgInfo)) {
|
||||||
gotInfo = true;
|
gotInfo = true;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue