本文整理汇总了C++中OT_ME::send_user_msg方法的典型用法代码示例。如果您正苦于以下问题:C++ OT_ME::send_user_msg方法的具体用法?C++ OT_ME::send_user_msg怎么用?C++ OT_ME::send_user_msg使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OT_ME
的用法示例。
在下文中一共展示了OT_ME::send_user_msg方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sendMessage
// ----------------------------------------------------------------------
bool MTCompose::sendMessage(QString body, QString fromNymId, QString toNymId, QString atServerID, QString subject)
{
if (fromNymId.isEmpty())
{
qDebug() << "Cannot send a message from an empty nym id, aborting.";
return false;
}
// ----------------------------------------------------
if (toNymId.isEmpty())
{
qDebug() << "Cannot send a message to an empty nym id, aborting.";
return false;
}
// ----------------------------------------------------
if (subject.isEmpty())
subject = tr("From the desktop client. (Empty subject.)");
// ----------------------------------------------------
if (body.isEmpty())
body = tr("From the desktop client. (Empty message body.)");
// ----------------------------------------------------
std::string str_serverId (atServerID.toStdString());
std::string str_fromNymId (fromNymId.toStdString());
std::string str_toNymId (toNymId.toStdString());
// ----------------------------------------------------
qDebug() << QString("Initiating sendMessage:\n Server:'%1'\n FromNym:'%2'\n ToNym:'%3'\n Subject:'%4'\n Body:'%5'").
arg(atServerID).arg(fromNymId).arg(toNymId).arg(subject).arg(body);
// ----------------------------------------------------
QString contents = tr("%1: %2\n\n%3").arg(tr("Subject")).arg(subject).arg(body);
// ----------------------------------------------------
OT_ME madeEasy;
std::string strResponse;
{
MTSpinner theSpinner;
strResponse = madeEasy.send_user_msg(str_serverId, str_fromNymId, str_toNymId, contents.toStdString());
}
int32_t nReturnVal = madeEasy.VerifyMessageSuccess(strResponse);
if (1 != nReturnVal)
{
qDebug() << "send_message: Failed.";
Moneychanger::HasUsageCredits(this, str_serverId, str_fromNymId);
return false;
}
qDebug() << "Success in send_message!";
m_bSent = true;
// ---------------------------------------------------------
return m_bSent;
}