134 #include "../core/util/OTDataFolder.hpp"
135 #include "../core/util/OTPaths.hpp"
136 #include "../core/OTStorage.hpp"
137 #include "../core/OTMessage.hpp"
138 #include "../core/OTTransaction.hpp"
139 #include "../core/OTPseudonym.hpp"
140 #include "../core/OTLog.hpp"
141 #include "../core/util/OTFolders.hpp"
172 int64_t lRequestNum = 0;
184 auto it = messagesMap_.begin();
186 for (; it != messagesMap_.end(); ++it) {
188 const int64_t& lTempReqNum = it->first;
190 if (lTempReqNum != lRequestNum) {
209 messagesMap_.erase(it);
221 std::pair<int64_t, OTMessage*>(lRequestNum, &theMessage));
227 bool bAlreadyExists =
false, bIsNewFolder =
false;
228 OTString strFolder, strFolder1, strFolder2;
237 OTString strFolderPath =
"", strFolder1Path =
"", strFolder2Path =
"";
257 std::string str_data_filename(
"sent.dat");
261 if (strNumList.
Exists()) theNumList.Add(strNumList);
262 theNumList.Add(lRequestNum);
267 it = messagesMap_.begin();
268 while (it != messagesMap_.end()) {
270 const int64_t& lTempReqNum = it->first;
286 theNumList.Add(lTempReqNum);
299 theNumList.
Output(strOutput);
304 otErr <<
"OTMessageOutbuffer::AddSentMessage: Error: failed writing "
305 "list of request numbers to storage.\n";
317 auto it = messagesMap_.begin();
319 for (; it != messagesMap_.end(); ++it) {
321 const int64_t& lTempReqNum = it->first;
323 if (lTempReqNum != lRequestNum) {
350 strFile.
Format(
"%lld.msg", lRequestNum);
355 std::string str_data_filename(
"sent.dat");
361 if (strNumList.
Exists()) theNumList.Add(strNumList);
363 if (theNumList.
Verify(lRequestNum)) {
372 std::unique_ptr<OTMessage> theMsgAngel(pMsg);
379 messagesMap_.insert(std::pair<int64_t, OTMessage*>(
380 lRequestNum, theMsgAngel.release()));
397 const bool* pbHarvestingForRetry)
401 auto it = messagesMap_.begin();
403 while (it != messagesMap_.end()) {
405 const int64_t& lRequestNum = it->first;
413 if (((
nullptr != pstrServerID) &&
415 ((
nullptr != pstrNymID) &&
482 if (
nullptr != pNym) {
489 OT_ASSERT(
nullptr != pbHarvestingForRetry);
535 const bool bReplyWasSuccess =
541 const bool bReplyWasFailure =
567 const bool bTransactionWasSuccess =
571 const bool bTransactionWasFailure =
579 *pbHarvestingForRetry, bReplyWasSuccess,
580 bReplyWasFailure, bTransactionWasSuccess,
581 bTransactionWasFailure);
588 messagesMap_.erase(it);
595 if (
nullptr != pstrNymID &&
nullptr != pstrServerID) {
602 strFile.
Format(
"%lld.msg", lRequestNum);
605 std::string str_data_filename(
"sent.dat");
608 strFolder.
Get(), str_data_filename));
609 if (strNumList.
Exists()) theNumList.Add(strNumList);
610 theNumList.
Remove(lRequestNum);
627 it = messagesMap_.begin();
628 while (it != messagesMap_.end()) {
630 const int64_t& lTempReqNum = it->first;
646 theNumList.Add(lTempReqNum);
663 theNumList.
Output(strOutput);
668 otErr <<
"OTMessageOutbuffer::Clear: Error: failed writing "
669 "list of request numbers to storage.\n";
679 std::unique_ptr<OTMessage> theMsgAngel(pMsg);
701 strFile.
Format(
"%lld.msg", lRequestNum);
703 auto it = messagesMap_.begin();
705 bool bReturnValue =
false;
707 while (it != messagesMap_.end()) {
709 const int64_t& lTempReqNum = it->first;
711 if (lTempReqNum != lRequestNum) {
734 messagesMap_.erase(it);
752 std::string str_data_filename(
"sent.dat");
756 if (strNumList.
Exists()) theNumList.Add(strNumList);
757 theNumList.
Remove(lRequestNum);
762 it = messagesMap_.begin();
763 while (it != messagesMap_.end()) {
765 const int64_t& lTempReqNum = it->first;
781 theNumList.Add(lTempReqNum);
798 theNumList.
Output(strOutput);
800 str_data_filename)) {
801 otErr <<
"OTMessageOutbuffer::RemoveSentMessage: Error: failed writing "
802 "list of request numbers to storage.\n";
810 std::unique_ptr<OTMessage> theMsgAngel(pMsg);
EXPORT bool StorePlainString(std::string strContents, std::string strFolder, std::string oneStr="", std::string twoStr="", std::string threeStr="")
EXPORT OTMessage * GetSentMessage(const int64_t &requestNum, const OTString &serverId, const OTString &nymId)
EXPORT ~OTMessageOutbuffer()
EXPORT bool RemoveSentMessage(const int64_t &requestNum, const OTString &serverId, const OTString &nymId)
EXPORT bool SaveContract()
EXPORT bool Remove(const int64_t &theValue)
static EXPORT const char * PathSeparator()
static EXPORT const OTString & Nym()
const int64_t & GetRequestNum() const
EXPORT void AddSentMessage(OTMessage &message)
EXPORT bool Exists() const
EXPORT void Format(const char *fmt,...)
static EXPORT bool AppendFolder(OTString &out_strPath, const OTString &strBasePath, const OTString &strFolderName)
EXPORT bool Compare(const char *compare) const
const OTIdentifier & GetPurportedServerID() const
EXPORT void Clear(const OTString *serverId=nullptr, const OTString *nymId=nullptr, OTPseudonym *nym=nullptr, const bool *harvestingForRetry=nullptr)
EXPORT std::string QueryPlainString(std::string strFolder, std::string oneStr="", std::string twoStr="", std::string threeStr="")
EXPORT bool Output(std::set< int64_t > &theOutput) const
EXPORT bool EraseValueByKey(std::string strFolder, std::string oneStr="", std::string twoStr="", std::string threeStr="")
virtual EXPORT bool LoadContract()
EXPORT bool CompareID(const OTIdentifier &theIdentifier) const
static EXPORT bool ConfirmCreateFolder(const OTString &strExactPath, bool &out_Exists, bool &out_IsNew)
EXPORT const char * Get() const
OTLOG_IMPORT OTLogStream otErr
EXPORT OTMessageOutbuffer()
OTASCIIArmor m_ascPayload
EXPORT bool HarvestTransactionNumbers(OTPseudonym &theNym, bool bHarvestingForRetry, bool bReplyWasSuccess, bool bReplyWasFailure, bool bTransactionWasSuccess, bool bTransactionWasFailure) const
EXPORT bool Verify(const int64_t &theValue) const
EXPORT bool Exists(std::string strFolder, std::string oneStr="", std::string twoStr="", std::string threeStr="")
const OTIdentifier & GetUserID() const