本文整理汇总了C++中OT_ME::accept_inbox_items方法的典型用法代码示例。如果您正苦于以下问题:C++ OT_ME::accept_inbox_items方法的具体用法?C++ OT_ME::accept_inbox_items怎么用?C++ OT_ME::accept_inbox_items使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OT_ME
的用法示例。
在下文中一共展示了OT_ME::accept_inbox_items方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AcceptIncomingTransferOrReceipt
// ---------------------------------------
bool MTRecord::AcceptIncomingTransferOrReceipt()
{
if (!this->CanAcceptIncoming())
return false;
switch (this->GetRecordType())
{
// --------------------------------------------
// Accept transfer or receipt from asset account inbox.
//
case MTRecord::Transfer:
case MTRecord::Receipt:
{
if (m_str_server_id.empty() || m_str_nym_id.empty() || m_str_account_id.empty())
{
OTLog::vError("%s: Error: missing server id (%s) or nym id (%s) or acct id (%s)\n",
__FUNCTION__, m_str_server_id.c_str(), m_str_nym_id.c_str(), m_str_account_id.c_str());
return false;
}
// ------------------------------
if (0 == m_lTransactionNum)
{
OTLog::vError("%s: Error: Transaction number is 0, in asset account inbox for server id (%s), nym id (%s)\n",
__FUNCTION__, m_str_server_id.c_str(), m_str_nym_id.c_str());
return false;
}
// ------------------------------
const OTIdentifier theServerID(m_str_server_id), theNymID(m_str_nym_id), theAcctID(m_str_account_id);
// Open the Nym's asset account inbox.
OTLedger * pInbox = OTAPI_Wrap::OTAPI()->LoadInbox(theServerID, theNymID, theAcctID);
OTCleanup<OTLedger> theInboxAngel(pInbox);
// ------------------------------------------
if (NULL == pInbox)
{
OTLog::vError("%s: Error: Unable to load asset account inbox for server id (%s), nym id (%s)\n",
__FUNCTION__, m_str_server_id.c_str(), m_str_nym_id.c_str());
return false;
}
// ------------------------------------------
// Find the transfer/receipt therein that correlates to this MTRecord.
//
int nIndex = pInbox->GetTransactionIndex(m_lTransactionNum);
if ((-1) == nIndex)
{
OTLog::vError("%s: Error: Unable to find transaction %ld in payment inbox for server id (%s), nym id (%s), acct id (%s)\n",
__FUNCTION__, m_lTransactionNum, m_str_server_id.c_str(), m_str_nym_id.c_str(), m_str_account_id.c_str());
return false;
}
// ------------------------------------------
// Accept it.
//
OTString strIndices;
strIndices.Format("%d", nIndex);
const std::string str_indices(strIndices.Get());
OT_ME madeEasy;
return madeEasy.accept_inbox_items(m_str_account_id, 0, str_indices);
}
break;
// --------------------------------------------
default:
OTLog::vError("%s: Unexpected type: %s\n",
__FUNCTION__, this->GetInstrumentType().c_str());
return false;
}
return true;
}