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


C++ IrcMessage::isOwn方法代码示例

本文整理汇总了C++中IrcMessage::isOwn方法的典型用法代码示例。如果您正苦于以下问题:C++ IrcMessage::isOwn方法的具体用法?C++ IrcMessage::isOwn怎么用?C++ IrcMessage::isOwn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IrcMessage的用法示例。


在下文中一共展示了IrcMessage::isOwn方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: processLine

void IrcSessionPrivate::processLine(const QByteArray& line)
{
    Q_Q(IrcSession);

    static bool dbg = qgetenv("COMMUNI_DEBUG").toInt();
    if (dbg) qDebug() << line;

    IrcMessage* msg = IrcMessage::fromData(line, encoding, q);
    if (msg)
    {
        switch (msg->type())
        {
        case IrcMessage::Numeric:
            if (static_cast<IrcNumericMessage*>(msg)->code() == Irc::RPL_WELCOME)
            {
                setNick(msg->parameters().value(0));
                setConnected(true);
            }
            break;
        case IrcMessage::Ping:
            q->sendRaw("PONG " + static_cast<IrcPingMessage*>(msg)->argument());
            break;
        case IrcMessage::Private: {
            IrcPrivateMessage* privMsg = static_cast<IrcPrivateMessage*>(msg);
            if (privMsg->isRequest())
            {
                IrcCommand* reply = q->createCtcpReply(privMsg);
                if (reply)
                    q->sendCommand(reply);
            }
            break;
            }
        case IrcMessage::Nick:
            if (msg->isOwn())
                setNick(static_cast<IrcNickMessage*>(msg)->nick());
            break;
        case IrcMessage::Capability:
            if (!connected)
            {
                IrcCapabilityMessage* capMsg = static_cast<IrcCapabilityMessage*>(msg);
                QString subCommand = capMsg->subCommand();
                if (subCommand == "LS")
                {
                    foreach (const QString& cap, capMsg->capabilities())
                        capabilities.insert(cap);

                    QStringList params = capMsg->parameters();
                    if (params.value(params.count() - 1) != QLatin1String("*"))
                    {
                        QStringList request;
                        emit q->capabilities(capabilities.toList(), &request);
                        if (!request.isEmpty())
                            q->sendCommand(IrcCommand::createCapability("REQ", request));
                        else
                            q->sendData("CAP END");
                    }
                }
                else if (subCommand == "ACK" || subCommand == "NAK")
                {
                    q->sendData("CAP END");
                }
            }
开发者ID:EldFitheach,项目名称:Mudlet,代码行数:62,代码来源:ircsession.cpp


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