OTTrackable::OTTrackable(const OTIdentifier & SERVER_ID, const OTIdentifier & ASSET_ID, const OTIdentifier & ACCT_ID, const OTIdentifier & USER_ID) : ot_super(SERVER_ID, ASSET_ID), m_lTransactionNum(0) { InitTrackable(); SetSenderAcctID(ACCT_ID); SetSenderUserID(USER_ID); }
// return -1 if error, 0 if nothing, and 1 if the node was processed. int OTAgreement::ProcessXMLNode(irr::io::IrrXMLReader*& xml) { int nReturnVal = 0; // Here we call the parent class first. // If the node is found there, or there is some error, // then we just return either way. But if it comes back // as '0', then nothing happened, and we'll continue executing. // // -- Note you can choose not to call the parent if // you don't want to use any of those xml tags. // As I do below, in the case of OTAccount. if (0 != (nReturnVal = OTCronItem::ProcessXMLNode(xml))) return nReturnVal; // ------------------------------------------------- if (!strcmp("agreement", xml->getNodeName())) { m_strVersion = xml->getAttributeValue("version"); SetTransactionNum( atol(xml->getAttributeValue("transactionNum")) ); SetCreationDate( atoi(xml->getAttributeValue("creationDate"))); SetValidFrom( atoi(xml->getAttributeValue("validFrom"))); SetValidTo( atoi(xml->getAttributeValue("validTo"))); // --------------------- const OTString strServerID(xml->getAttributeValue("serverID")), strAssetTypeID(xml->getAttributeValue("assetTypeID")), strSenderAcctID(xml->getAttributeValue("senderAcctID")), strSenderUserID(xml->getAttributeValue("senderUserID")), strRecipientAcctID(xml->getAttributeValue("recipientAcctID")), strRecipientUserID(xml->getAttributeValue("recipientUserID")); const OTIdentifier SERVER_ID(strServerID), ASSET_ID(strAssetTypeID), SENDER_ACCT_ID(strSenderAcctID), SENDER_USER_ID(strSenderUserID), RECIPIENT_ACCT_ID(strRecipientAcctID), RECIPIENT_USER_ID(strRecipientUserID); SetServerID(SERVER_ID); SetAssetID(ASSET_ID); SetSenderAcctID(SENDER_ACCT_ID); SetSenderUserID(SENDER_USER_ID); SetRecipientAcctID(RECIPIENT_ACCT_ID); SetRecipientUserID(RECIPIENT_USER_ID); // --------------------- OTLog::vOutput(0, "\n\nAgreement. Transaction Number: %ld\n", m_lTransactionNum); OTLog::vOutput(1, " Creation Date: %d Valid From: %d\n Valid To: %d\n" " AssetTypeID: %s\n ServerID: %s\n" " senderAcctID: %s\n senderUserID: %s\n " " recipientAcctID: %s\n recipientUserID: %s\n ", GetCreationDate(), GetValidFrom(), GetValidTo(), strAssetTypeID.Get(), strServerID.Get(), strSenderAcctID.Get(), strSenderUserID.Get(), strRecipientAcctID.Get(), strRecipientUserID.Get()); nReturnVal = 1; } else if (!strcmp("consideration", xml->getNodeName())) { if (false == LoadEncodedTextField(xml, m_strConsideration)) { OTLog::Error("Error in OTPaymentPlan::ProcessXMLNode: consideration field without value.\n"); return (-1); // error condition } nReturnVal = 1; } else if (!strcmp("merchantSignedCopy", xml->getNodeName())) { if (false == LoadEncodedTextField(xml, m_strMerchantSignedCopy)) { OTLog::Error("Error in OTPaymentPlan::ProcessXMLNode: merchant_signed_copy field without value.\n"); return (-1); // error condition } nReturnVal = 1; } // ------------------------------------------- // std::deque<long> m_dequeRecipientClosingNumbers; // Numbers used for CLOSING a transaction. (finalReceipt.) else if (!strcmp("closingRecipientNumber", xml->getNodeName())) { OTString strClosingNumber = xml->getAttributeValue("value"); if (strClosingNumber.Exists()) { const long lClosingNumber = atol(strClosingNumber.Get()); this->AddRecipientClosingTransactionNo(lClosingNumber); } else { OTLog::Error("Error in OTAgreement::ProcessXMLNode: closingRecipientNumber field without value.\n"); return (-1); // error condition } nReturnVal = 1; } return nReturnVal; }