Ejemplo n.º 1
0
bool CIRCSock::OnQuitMessage(CQuitMessage& Message) {
    const CNick& Nick = Message.GetNick();
    bool bIsVisible = false;

    if (Nick.NickEquals(GetNick())) {
        m_pNetwork->PutStatus("You quit [" + Message.GetReason() + "]");
        // We don't call module hooks and we don't
        // forward this quit to clients (Some clients
        // disconnect if they receive such a QUIT)
        return true;
    }

    vector<CChan*> vFoundChans;
    const vector<CChan*>& vChans = m_pNetwork->GetChans();

    for (CChan* pChan : vChans) {
        if (pChan->RemNick(Nick.GetNick())) {
            vFoundChans.push_back(pChan);

            if (!pChan->IsDetached()) {
                bIsVisible = true;
            }
        }
    }

    IRCSOCKMODULECALL(OnQuitMessage(Message, vFoundChans), NOTHING);

    return !bIsVisible;
}
Ejemplo n.º 2
0
 void OnQuitMessage(CQuitMessage& Message,
                    const vector<CChan*>& vChans) override {
     const CNick& Nick = Message.GetNick();
     const CString sMessage = Message.GetReason();
     const CString sMsg = t_f("{1} quit: {2}")(Nick.GetNickMask(), sMessage);
     for (CChan* pChan : vChans) {
         AddBuffer(*pChan, sMsg, &Message.GetTime(), Message.GetTags());
     }
 }
Ejemplo n.º 3
0
 void OnQuitMessage(CQuitMessage& Message,
                    const vector<CChan*>& vChans) override {
     const CNick& Nick = Message.GetNick();
     const CString sMessage = Message.GetReason();
     CString sMsg =
         Nick.GetNickMask() + " quit with message: [" + sMessage + "]";
     for (CChan* pChan : vChans) {
         AddBuffer(*pChan, sMsg, &Message.GetTime(), Message.GetTags());
     }
 }
Ejemplo n.º 4
0
TEST(MessageTest, Quit) {
	CQuitMessage msg;
	msg.Parse(":nick QUIT :reason");
	EXPECT_EQ("nick", msg.GetNick().GetNick());
	EXPECT_EQ("QUIT", msg.GetCommand());
	EXPECT_EQ("reason", msg.GetReason());
	EXPECT_EQ(CMessage::Type::Quit, msg.GetType());

	msg.SetReason("test");
	EXPECT_EQ("test", msg.GetReason());
	EXPECT_EQ(":nick QUIT :test", msg.ToString());
}
Ejemplo n.º 5
0
	void OnQuitMessage(CQuitMessage& msg, const std::vector<CChan*>& vChans) override { vsHooks.push_back("OnQuitMessage"); vsMessages.push_back(msg.ToString()); vNetworks.push_back(msg.GetNetwork()); vChannels.push_back(msg.GetChan()); }