当前位置: 首页>>代码示例>>C++>>正文


C++ OT_ME::send_user_msg方法代码示例

本文整理汇总了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;
}
开发者ID:BugFreeSoftware,项目名称:Moneychanger,代码行数:55,代码来源:compose.cpp


注:本文中的OT_ME::send_user_msg方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。