Esempio n. 1
0
bool CIRCSock::OnJoinMessage(CJoinMessage& Message) {
    const CNick& Nick = Message.GetNick();
    CString sChan = Message.GetParam(0);
    CChan* pChan = nullptr;

    if (Nick.NickEquals(GetNick())) {
        m_pNetwork->AddChan(sChan, false);
        pChan = m_pNetwork->FindChan(sChan);
        if (pChan) {
            pChan->Enable();
            pChan->SetIsOn(true);
            PutIRC("MODE " + sChan);
        }
    } else {
        pChan = m_pNetwork->FindChan(sChan);
    }

    if (pChan) {
        pChan->AddNick(Nick.GetNickMask());
        Message.SetChan(pChan);
        IRCSOCKMODULECALL(OnJoinMessage(Message), NOTHING);

        if (pChan->IsDetached()) {
            return true;
        }
    }

    return false;
}
Esempio n. 2
0
TEST(MessageTest, Join) {
	CJoinMessage msg;
	msg.Parse(":nick JOIN #chan");
	EXPECT_EQ("nick", msg.GetNick().GetNick());
	EXPECT_EQ("JOIN", msg.GetCommand());
	EXPECT_EQ("#chan", msg.GetTarget());
	EXPECT_EQ(CMessage::Type::Join, msg.GetType());

	EXPECT_EQ(":nick JOIN #chan", msg.ToString());
}
Esempio n. 3
0
 void OnJoinMessage(CJoinMessage& Message) override {
     const CNick& Nick = Message.GetNick();
     CChan& Channel = *Message.GetChan();
     AddBuffer(Channel, Nick.GetNickMask() + " joined", &Message.GetTime(),
               Message.GetTags());
 }