Пример #1
0
 EModRet OnRawMessage(CMessage& msg) override {
     if (msg.GetCommand().Equals("AUTHENTICATE")) {
         Authenticate(msg.GetParam(0));
         return HALT;
     }
     return CONTINUE;
 }
Пример #2
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;
    }
Пример #3
0
bool CClient::OnOtherMessage(CMessage& Message) {
    const CString& sCommand = Message.GetCommand();

    if (sCommand.Equals("ZNC")) {
        CString sTarget = Message.GetParam(0);
        CString sModCommand;

        if (sTarget.TrimPrefix(m_pUser->GetStatusPrefix())) {
            sModCommand = Message.GetParams(1);
        } else {
            sTarget = "status";
            sModCommand = Message.GetParams(0);
        }

        if (sTarget.Equals("status")) {
            if (sModCommand.empty())
                PutStatus("Hello. How may I help you?");
            else
                UserCommand(sModCommand);
        } else {
            if (sModCommand.empty())
                CALLMOD(sTarget, this, m_pUser, m_pNetwork,
                        PutModule("Hello. How may I help you?"))
            else
                CALLMOD(sTarget, this, m_pUser, m_pNetwork,
                        OnModCommand(sModCommand))
        }
        return true;
    } else if (sCommand.Equals("ATTACH")) {
Пример #4
0
    EModRet OnUserRawMessage(CMessage& msg) override {
        if (!msg.GetCommand().Equals("AWAY")) return CONTINUE;

        // If a client set us away, we don't touch that away message
        m_bClientSetAway = !msg.GetParam(0).Trim_n(" ").empty();
        m_bWeSetAway = false;

        return CONTINUE;
    }
Пример #5
0
CModule::EModRet TwitchTMI::OnRawMessage(CMessage &msg)
{
	if(msg.GetCommand().Equals("HOSTTARGET"))
	{
		return CModule::HALT;
	}
	else if(msg.GetCommand().Equals("CLEARCHAT"))
	{
		msg.SetCommand("NOTICE");
		if(msg.GetParam(1) != "")
		{
			msg.SetParam(1, msg.GetParam(1) + " was timed out.");
		}
		else
		{
			msg.SetParam(1, "Chat was cleared by a moderator.");
		}
	}
	else if(msg.GetCommand().Equals("USERSTATE"))
	{
		return CModule::HALT;
	}
	else if(msg.GetCommand().Equals("ROOMSTATE"))
	{
		return CModule::HALT;
	}
	else if(msg.GetCommand().Equals("RECONNECT"))
	{
		return CModule::HALT;
	}
	else if(msg.GetCommand().Equals("GLOBALUSERSTATE"))
	{
		return CModule::HALT;
	}
	else if(msg.GetCommand().Equals("WHISPER"))
	{
		msg.SetCommand("PRIVMSG");
	}
	else if(msg.GetCommand().Equals("USERNOTICE"))
	{
		//TODO: Translate Tags to useful message
		msg.SetCommand("PRIVMSG");
		msg.SetParam(1, "<<<RESUB>>> " + msg.GetParam(1));
	}

	CString realNick = msg.GetTag("display-name").Trim_n();
	if(realNick != "")
		msg.GetNick().SetNick(realNick);

	return CModule::CONTINUE;
}
Пример #6
0
CModule::EModRet TwitchGroupChat::OnRawMessage(CMessage &msg)
{
    if(msg.GetCommand().Equals("WHISPER"))
        msg.SetCommand("PRIVMSG");

    CString realNick = msg.GetTag("display-name").Trim_n();
    if(realNick != "")
        msg.GetNick().SetNick(realNick);

    CIRCSock *twnw = GetTwitchNetwork();
    if(twnw)
        twnw->ReadLine(msg.ToString());

    return CModule::CONTINUE;
}
Пример #7
0
bool CMessage::Equals(const CMessage& Other) const {
    return m_Nick.NickEquals(Other.GetNick().GetNick()) &&
           m_sCommand.Equals(Other.GetCommand()) &&
           m_vsParams == Other.GetParams();
}