Exemple #1
0
CConnectionEventBase* CIRCEventFactory::createKickEvent(
        const CIRCResponseData& message) const
{
    CStreamEvent<CKickMessage>* event = new CStreamEvent<CKickMessage>(myEVT_THREAD_KICK);
    CKickMessage* log = new CKickMessage();
    log->setServiceId(m_connectionId);
    log->setChannelName(message.m_channel);
    log->setUserName(message.m_username);
    log->setTarget(message.m_target);
    event->setServiceLog(log);
    return event;
}
Exemple #2
0
// キックストリーム受信時
void CMainWindow::onKick(CStreamEvent<CKickMessage>& event)
{
    CChatServiceBase* service = m_serviceHolder->getService(
            event.getConnectionId());
    if (service != NULL){
        m_logHolder->pushLog(event.getServiceLog());
        CKickMessage* log = event.getServiceLog();

        if (log->getTarget() == service->getUser()->getUserName()){
            wxMessageDialog dialog(this,
                    wxString::Format(wxT("%s-チャンネル[%s]からキックされました。"),
                            service->getName(), log->getChannelName()), "確認",
                    wxOK);
            if (dialog.ShowModal() == wxID_OK){
                service->partChannel(log->getChannelName());
            }
        } else{

            if (log->getChannelName() == service->getCurrentChannel()
                    && m_serviceHolder->getCurrentServiceId()
                            == event.getConnectionId()){
                m_view->addMessage(event.getServiceLog());
            }
            service->onGetPartStream(log->getChannelName(), log->getTarget());
            service->addLog(event.getServiceLog());
            updateMemberView(event.getConnectionId(), log->getChannelName());
            // 表示の更新
            m_view->displayLogs(m_logHolder->getLogs(), m_serviceHolder); // ログペイン
        }
    }
}
Exemple #3
0
bool CIRCSock::OnKickMessage(CKickMessage& Message) {
    CString sChan = Message.GetParam(0);
    CString sKickedNick = Message.GetKickedNick();

    CChan* pChan = m_pNetwork->FindChan(sChan);

    if (pChan) {
        Message.SetChan(pChan);
        IRCSOCKMODULECALL(OnKickMessage(Message), NOTHING);
        // do not remove the nick till after the OnKick call, so modules
        // can do Chan.FindNick or something to get more info.
        pChan->RemNick(sKickedNick);
    }

    if (GetNick().Equals(sKickedNick) && pChan) {
        pChan->SetIsOn(false);

        // Don't try to rejoin!
        pChan->Disable();
    }

    return (pChan && pChan->IsDetached());
}
Exemple #4
0
 void OnKickMessage(CKickMessage& Message) override {
     const CNick& OpNick = Message.GetNick();
     const CString sKickedNick = Message.GetKickedNick();
     CChan& Channel = *Message.GetChan();
     const CString sMessage = Message.GetReason();
     AddBuffer(Channel, OpNick.GetNickMask() + " kicked " + sKickedNick +
                            " Reason: [" + sMessage + "]",
               &Message.GetTime(), Message.GetTags());
 }
Exemple #5
0
 void OnKickMessage(CKickMessage& Message) override {
     const CNick& OpNick = Message.GetNick();
     const CString sKickedNick = Message.GetKickedNick();
     CChan& Channel = *Message.GetChan();
     const CString sMessage = Message.GetReason();
     AddBuffer(Channel, t_f("{1} kicked {2} with reason: {3}")(
                            OpNick.GetNickMask(), sKickedNick, sMessage),
               &Message.GetTime(), Message.GetTags());
 }
Exemple #6
0
	void OnKickMessage(CKickMessage& msg) override { vsHooks.push_back("OnKickMessage"); vsMessages.push_back(msg.ToString()); vNetworks.push_back(msg.GetNetwork()); vChannels.push_back(msg.GetChan()); }
Exemple #7
0
TEST(MessageTest, Kick) {
	CKickMessage msg;
	msg.Parse(":nick KICK #chan person :reason");
	EXPECT_EQ("nick", msg.GetNick().GetNick());
	EXPECT_EQ("KICK", msg.GetCommand());
	EXPECT_EQ("#chan", msg.GetTarget());
	EXPECT_EQ("person", msg.GetKickedNick());
	EXPECT_EQ("reason", msg.GetReason());
	EXPECT_EQ(CMessage::Type::Kick, msg.GetType());

	msg.SetKickedNick("noone");
	EXPECT_EQ("noone", msg.GetKickedNick());
	msg.SetReason("test");
	EXPECT_EQ("test", msg.GetReason());
	EXPECT_EQ(":nick KICK #chan noone :test", msg.ToString());
}