示例#1
0
    EModRet OnRawMessage(CMessage& msg) override {
        CString sCmd = msg.GetCommand().AsUpper();
        size_t i = 0;

        if (!m_pReplies) return CONTINUE;

        // Is this a "not enough arguments" error?
        if (sCmd == "461") {
            // :server 461 nick WHO :Not enough parameters
            CString sOrigCmd = msg.GetParam(1);

            if (m_sLastRequest.Token(0).Equals(sOrigCmd)) {
                // This is the reply to the last request
                if (RouteReply(msg, true)) return HALTCORE;
                return CONTINUE;
            }
        }

        while (m_pReplies[i].szReply != nullptr) {
            if (m_pReplies[i].szReply == sCmd) {
                if (RouteReply(msg, m_pReplies[i].bLastResponse))
                    return HALTCORE;
                return CONTINUE;
            }
            i++;
        }

        // TODO HALTCORE is wrong, it should not be passed to
        // the clients, but the core itself should still handle it!

        return CONTINUE;
    }
示例#2
0
	virtual EModRet OnRaw(CString& sLine)
	{
		CString sCmd = sLine.Token(1).AsUpper();
		size_t i = 0;

		if (!m_pReplies)
			return CONTINUE;

		// Is this a "not enough arguments" error?
		if (sCmd == "461") {
			// :server 461 nick WHO :Not enough parameters
			CString sOrigCmd = sLine.Token(3);

			if (m_sLastRequest.Token(0).Equals(sOrigCmd)) {
				// This is the reply to the last request
				if (RouteReply(sLine, true))
					return HALTCORE;
				return CONTINUE;
			}
		}

		while (m_pReplies[i].szReply != NULL) {
			if (m_pReplies[i].szReply == sCmd) {
				if (RouteReply(sLine, m_pReplies[i].bLastResponse, sCmd == "353"))
					return HALTCORE;
				return CONTINUE;
			}
			i++;
		}

		// TODO HALTCORE is wrong, it should not be passed to
		// the clients, but the core itself should still handle it!

		return CONTINUE;
	}