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


C++ CChan::IsModeKnown方法代码示例

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


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

示例1: ReadLine


//.........这里部分代码省略.........
				m_pNetwork->PutStatus("Server [" + m_pNetwork->GetCurrentServer()->GetString(false) +
						"] redirects us to [" + sHost + ":" + sPort + "] with reason [" + sInfo + "]");
				m_pNetwork->PutStatus("Perhaps you want to add it as a new server.");
				// Don't send server redirects to the client
				return;
			}
			case 2:
			case 3:
			case 4:
			case 250:  // highest connection count
			case 251:  // user count
			case 252:  // oper count
			case 254:  // channel count
			case 255:  // client count
			case 265:  // local users
			case 266:  // global users
				m_pNetwork->UpdateRawBuffer(":" + sServer + " " + sCmd + " ", " " + sRest);
				break;
			case 305:
				m_pNetwork->SetIRCAway(false);
				break;
			case 306:
				m_pNetwork->SetIRCAway(true);
				break;
			case 324: {  // MODE
				sRest.Trim();
				CChan* pChan = m_pNetwork->FindChan(sRest.Token(0));

				if (pChan) {
					pChan->SetModes(sRest.Token(1, true));

					// We don't SetModeKnown(true) here,
					// because a 329 will follow
					if (!pChan->IsModeKnown()) {
						// When we JOIN, we send a MODE
						// request. This makes sure the
						// reply isn't forwarded.
						return;
					}
				}
			}
				break;
			case 329: {
				sRest.Trim();
				CChan* pChan = m_pNetwork->FindChan(sRest.Token(0));

				if (pChan) {
					unsigned long ulDate = sLine.Token(4).ToULong();
					pChan->SetCreationDate(ulDate);

					if (!pChan->IsModeKnown()) {
						pChan->SetModeKnown(true);
						// When we JOIN, we send a MODE
						// request. This makes sure the
						// reply isn't forwarded.
						return;
					}
				}
			}
				break;
			case 331: {
				// :irc.server.com 331 yournick #chan :No topic is set.
				CChan* pChan = m_pNetwork->FindChan(sLine.Token(3));

				if (pChan) {
					pChan->SetTopic("");
开发者ID:jimloco,项目名称:znc,代码行数:67,代码来源:IRCSock.cpp

示例2: OnNumericMessage

bool CIRCSock::OnNumericMessage(CNumericMessage& Message) {
    const CString& sCmd = Message.GetCommand();
    CString sServer = Message.GetNick().GetHostMask();
    unsigned int uRaw = Message.GetCode();
    CString sNick = Message.GetParam(0);

    bool bResult = false;
    IRCSOCKMODULECALL(OnNumericMessage(Message), &bResult);
    if (bResult) return true;

    switch (uRaw) {
    case 1: {  // :irc.server.com 001 nick :Welcome to the Internet Relay
        if (m_bAuthed && sServer == "irc.znc.in") {
            // m_bAuthed == true => we already received another 001 => we
            // might be in a traffic loop
            m_pNetwork->PutStatus(
                "ZNC seems to be connected to itself, disconnecting...");
            Quit();
            return true;
        }

        m_pNetwork->SetIRCServer(sServer);
        // Now that we are connected, let nature take its course
        SetTimeout(CIRCNetwork::NO_TRAFFIC_TIMEOUT, TMO_READ);
        PutIRC("WHO " + sNick);

        m_bAuthed = true;
        m_pNetwork->PutStatus("Connected!");

        const vector<CClient*>& vClients = m_pNetwork->GetClients();

        for (CClient* pClient : vClients) {
            CString sClientNick = pClient->GetNick(false);

            if (!sClientNick.Equals(sNick)) {
                // If they connected with a nick that doesn't match the one
                // we got on irc, then we need to update them
                pClient->PutClient(":" + sClientNick + "!" +
                                   m_Nick.GetIdent() + "@" +
                                   m_Nick.GetHost() + " NICK :" + sNick);
            }
        }

        SetNick(sNick);

        IRCSOCKMODULECALL(OnIRCConnected(), NOTHING);

        m_pNetwork->ClearRawBuffer();
        m_pNetwork->AddRawBuffer(BufferMessage(Message));

        m_pNetwork->IRCConnected();

        break;
    }
    case 5:
        ParseISupport(Message);
        m_pNetwork->UpdateExactRawBuffer(BufferMessage(Message));
        break;
    case 10: {  // :irc.server.com 010 nick <hostname> <port> :<info>
        CString sHost = Message.GetParam(1);
        CString sPort = Message.GetParam(2);
        CString sInfo = Message.GetParam(3);
        m_pNetwork->PutStatus(
            "Server [" + m_pNetwork->GetCurrentServer()->GetString(false) +
            "] redirects us to [" + sHost + ":" + sPort +
            "] with reason [" + sInfo + "]");
        m_pNetwork->PutStatus(
            "Perhaps you want to add it as a new server.");
        // Don't send server redirects to the client
        return true;
    }
    case 2:
    case 3:
    case 4:
    case 250:  // highest connection count
    case 251:  // user count
    case 252:  // oper count
    case 254:  // channel count
    case 255:  // client count
    case 265:  // local users
    case 266:  // global users
        m_pNetwork->UpdateRawBuffer(sCmd, BufferMessage(Message));
        break;
    case 305:
        m_pNetwork->SetIRCAway(false);
        break;
    case 306:
        m_pNetwork->SetIRCAway(true);
        break;
    case 324: {  // MODE
        // :irc.server.com 324 nick #chan +nstk key
        CChan* pChan = m_pNetwork->FindChan(Message.GetParam(1));

        if (pChan) {
            pChan->SetModes(Message.GetParams(2));

            // We don't SetModeKnown(true) here,
            // because a 329 will follow
            if (!pChan->IsModeKnown()) {
                // When we JOIN, we send a MODE
//.........这里部分代码省略.........
开发者ID:fnordcordia,项目名称:znc,代码行数:101,代码来源:IRCSock.cpp


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