diff --git a/libretroshare/src/services/p3msgservice.cc b/libretroshare/src/services/p3msgservice.cc index aa0adf549..ef26c1926 100644 --- a/libretroshare/src/services/p3msgservice.cc +++ b/libretroshare/src/services/p3msgservice.cc @@ -807,6 +807,11 @@ bool p3MsgService::MessageToDraft(MessageInfo &info) } /* STORE MsgID */ imsg[msg->msgId] = msg; + + // return new message id + std::ostringstream out; + out << msg->msgId; + info.msgId = out.str(); } IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/ @@ -1267,8 +1272,6 @@ void p3MsgService::initRsMIS(RsMsgItem *msg, MsgInfoSummary &mis) mis.ts = msg->sendTime; } - - RsMsgItem *p3MsgService::initMIRsMsg(MessageInfo &info, std::string to) { RsMsgItem *msg = new RsMsgItem(); @@ -1320,4 +1323,3 @@ RsMsgItem *p3MsgService::initMIRsMsg(MessageInfo &info, std::string to) //msg->print(std::cerr); return msg; } - diff --git a/retroshare-gui/src/gui/msgs/MessageComposer.cpp b/retroshare-gui/src/gui/msgs/MessageComposer.cpp index bc7ad71fa..cfdfbcf2b 100644 --- a/retroshare-gui/src/gui/msgs/MessageComposer.cpp +++ b/retroshare-gui/src/gui/msgs/MessageComposer.cpp @@ -52,8 +52,6 @@ MessageComposer::MessageComposer(QWidget *parent, Qt::WFlags flags) /* Invoke the Qt Designer generated object setup routine */ ui.setupUi(this); - m_nBox = -1; // not defined - setupFileActions(); setupEditActions(); setupViewActions(); @@ -495,7 +493,7 @@ void MessageComposer::newMsg(std::string msgId /*= ""*/) insertSendList(); m_sMsgId = msgId; - m_nBox = -1; // not defined + m_sDraftMsgId.clear(); if (m_sMsgId.empty() == false) { // fill existing message @@ -506,7 +504,9 @@ void MessageComposer::newMsg(std::string msgId /*= ""*/) return; } - m_nBox = msgInfo.msgflags & RS_MSG_BOXMASK; + if (msgInfo.msgflags & RS_MSG_DRAFT) { + m_sDraftMsgId = msgId; + } insertTitleText( QString::fromStdWString(msgInfo.title).toStdString()); @@ -621,11 +621,11 @@ void MessageComposer::sendMessage_internal(bool bDraftbox) } if (bDraftbox) { - if (m_nBox != -1 && (m_nBox & RS_MSG_DRAFTBOX) == RS_MSG_DRAFTBOX) { - // only save draft box to draft box again, for all other message create a new one in draft box - mi.msgId = m_sMsgId; - } + mi.msgId = m_sDraftMsgId; rsMsgs->MessageToDraft(mi); + + // use new message id + m_sDraftMsgId = mi.msgId; } else { rsMsgs->MessageSend(mi); } @@ -1440,4 +1440,4 @@ bool MessageComposer::FilterItem(QTreeWidgetItem *pItem, QString &sPattern) } return (bVisible || nVisibleChildCount); -} \ No newline at end of file +} diff --git a/retroshare-gui/src/gui/msgs/MessageComposer.h b/retroshare-gui/src/gui/msgs/MessageComposer.h index 5c93685b1..e234e9a31 100644 --- a/retroshare-gui/src/gui/msgs/MessageComposer.h +++ b/retroshare-gui/src/gui/msgs/MessageComposer.h @@ -178,8 +178,8 @@ private: QHash autoLinkTitleDictionary; QHash autoLinkTargetDictionary; - std::string m_sMsgId; // existing message id - int m_nBox; // box from the existing message + std::string m_sMsgId; // existing message id + std::string m_sDraftMsgId; // existing message id /* maps of files */ std::list mAttachments;