From 3976651c35a2d2a9b5593ae442deaaa45db16849 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Sun, 16 Aug 2015 17:11:19 +0200 Subject: [PATCH] Merge CChan+PrivAction, CChan+PrivCTCP, CChan+PrivNotice OnUserAction(), OnUserCTCP(), and OnUserNotice() don't separate private private and channel messages. A module could even redirect a message by modifying its target, so technically, if they were two distinct types, the type of a message could change on the way. The original reason for the separation was that at some point during CMessage development, GetChan() didn't exist in CPrivXxx, but only in CChanXxx message types. To achieve cleaner implementation, the getter was later promoted to CMessage and made return nullptr for non-channel specific messages. From this point of view, the separation is also no longer necessary since the CPrivXxx and CChanXxx types are API-wise identical with each other. --- include/znc/Message.h | 47 ++++++++++++------------------------------- include/znc/Modules.h | 24 +++++++++++----------- src/IRCSock.cpp | 46 +++++++++++++++++++++--------------------- src/Modules.cpp | 24 +++++++++++----------- test/MessageTest.cpp | 8 ++++---- 5 files changed, 64 insertions(+), 85 deletions(-) diff --git a/include/znc/Message.h b/include/znc/Message.h index 1a3a92fe..6586e9ba 100644 --- a/include/znc/Message.h +++ b/include/znc/Message.h @@ -87,28 +87,22 @@ private: CChan* m_pChan = nullptr; }; -class CChanAction : public CMessage { +class CActionMessage : public CMessage { public: CString GetText() const { return GetParam(1).TrimPrefix_n("\001ACTION ").TrimSuffix_n("\001"); } void SetText(const CString& sText) { SetParam(1, "\001ACTION " + sText + "\001"); } }; -class CChanCTCP : public CMessage { -public: - CString GetText() const { return GetParam(1).TrimPrefix_n("\001").TrimSuffix_n("\001"); } - void SetText(const CString& sText) { SetParam(1, "\001" + sText + "\001"); } -}; - class CChanMessage : public CMessage { public: CString GetText() const { return GetParam(1); } void SetText(const CString& sText) { SetParam(1, sText); } }; -class CChanNotice : public CMessage { +class CCTCPMessage : public CMessage { public: - CString GetText() const { return GetParam(1); } - void SetText(const CString& sText) { SetParam(1, sText); } + CString GetText() const { return GetParam(1).TrimPrefix_n("\001").TrimSuffix_n("\001"); } + void SetText(const CString& sText) { SetParam(1, "\001" + sText + "\001"); } }; class CJoinMessage : public CMessage { @@ -122,6 +116,12 @@ public: void SetNewNick(const CString& sNick) { SetParam(0, sNick); } }; +class CNoticeMessage : public CMessage { +public: + CString GetText() const { return GetParam(1); } + void SetText(const CString& sText) { SetParam(1, sText); } +}; + class CKickMessage : public CMessage { public: CString GetKickedNick() const { return GetParam(1); } @@ -136,30 +136,12 @@ public: void SetReason(const CString& sReason) { SetParam(1, sReason); } }; -class CPrivAction : public CMessage { -public: - CString GetText() const { return GetParam(1).TrimPrefix_n("\001ACTION ").TrimSuffix_n("\001"); } - void SetText(const CString& sText) { SetParam(1, "\001ACTION " + sText + "\001"); } -}; - -class CPrivCTCP : public CMessage { -public: - CString GetText() const { return GetParam(1).TrimPrefix_n("\001").TrimSuffix_n("\001"); } - void SetText(const CString& sText) { SetParam(1, "\001" + sText + "\001"); } -}; - class CPrivMessage : public CMessage { public: CString GetText() const { return GetParam(1); } void SetText(const CString& sText) { SetParam(1, sText); } }; -class CPrivNotice : public CMessage { -public: - CString GetText() const { return GetParam(1); } - void SetText(const CString& sText) { SetParam(1, sText); } -}; - class CQuitMessage : public CMessage { public: CString GetReason() const { return GetParam(0); } @@ -175,16 +157,13 @@ public: // The various CMessage subclasses are "mutable views" to the data held by CMessage. // They provide convenient access to message type speficic attributes, but are not // allowed to hold extra data of their own. -static_assert(sizeof(CChanAction) == sizeof(CMessage), "No data members allowed in CMessage subclasses."); -static_assert(sizeof(CChanCTCP) == sizeof(CMessage), "No data members allowed in CMessage subclasses."); +static_assert(sizeof(CActionMessage) == sizeof(CMessage), "No data members allowed in CMessage subclasses."); static_assert(sizeof(CChanMessage) == sizeof(CMessage), "No data members allowed in CMessage subclasses."); -static_assert(sizeof(CChanNotice) == sizeof(CMessage), "No data members allowed in CMessage subclasses."); +static_assert(sizeof(CCTCPMessage) == sizeof(CMessage), "No data members allowed in CMessage subclasses."); static_assert(sizeof(CJoinMessage) == sizeof(CMessage), "No data members allowed in CMessage subclasses."); +static_assert(sizeof(CNoticeMessage) == sizeof(CMessage), "No data members allowed in CMessage subclasses."); static_assert(sizeof(CPartMessage) == sizeof(CMessage), "No data members allowed in CMessage subclasses."); -static_assert(sizeof(CPrivAction) == sizeof(CMessage), "No data members allowed in CMessage subclasses."); -static_assert(sizeof(CPrivCTCP) == sizeof(CMessage), "No data members allowed in CMessage subclasses."); static_assert(sizeof(CPrivMessage) == sizeof(CMessage), "No data members allowed in CMessage subclasses."); -static_assert(sizeof(CPrivNotice) == sizeof(CMessage), "No data members allowed in CMessage subclasses."); static_assert(sizeof(CNickMessage) == sizeof(CMessage), "No data members allowed in CMessage subclasses."); static_assert(sizeof(CKickMessage) == sizeof(CMessage), "No data members allowed in CMessage subclasses."); static_assert(sizeof(CQuitMessage) == sizeof(CMessage), "No data members allowed in CMessage subclasses."); diff --git a/include/znc/Modules.h b/include/znc/Modules.h index 73f9bfe0..4121eae8 100644 --- a/include/znc/Modules.h +++ b/include/znc/Modules.h @@ -758,7 +758,7 @@ public: * @return See CModule::EModRet. */ virtual EModRet OnPrivCTCP(CNick& Nick, CString& sMessage); - virtual EModRet OnPrivCTCPMessage(CPrivCTCP& Message); + virtual EModRet OnPrivCTCPMessage(CCTCPMessage& Message); /** Called when we receive a channel CTCP request from IRC. * @param Nick The nick the CTCP request is from. * @param Channel The channel to which the request was sent. @@ -766,7 +766,7 @@ public: * @return See CModule::EModRet. */ virtual EModRet OnChanCTCP(CNick& Nick, CChan& Channel, CString& sMessage); - virtual EModRet OnChanCTCPMessage(CChanCTCP& Message); + virtual EModRet OnChanCTCPMessage(CCTCPMessage& Message); /** Called when we receive a private CTCP ACTION ("/me" in query) from IRC. * This is called after CModule::OnPrivCTCP(). * @param Nick The nick the action came from. @@ -774,7 +774,7 @@ public: * @return See CModule::EModRet. */ virtual EModRet OnPrivAction(CNick& Nick, CString& sMessage); - virtual EModRet OnPrivActionMessage(CPrivAction& Message); + virtual EModRet OnPrivActionMessage(CActionMessage& Message); /** Called when we receive a channel CTCP ACTION ("/me" in a channel) from IRC. * This is called after CModule::OnChanCTCP(). * @param Nick The nick the action came from. @@ -783,7 +783,7 @@ public: * @return See CModule::EModRet. */ virtual EModRet OnChanAction(CNick& Nick, CChan& Channel, CString& sMessage); - virtual EModRet OnChanActionMessage(CChanAction& Message); + virtual EModRet OnChanActionMessage(CActionMessage& Message); /** Called when we receive a private message from IRC. * @param Nick The nick which sent the message. * @param sMessage The message. @@ -805,7 +805,7 @@ public: * @return See CModule::EModRet. */ virtual EModRet OnPrivNotice(CNick& Nick, CString& sMessage); - virtual EModRet OnPrivNoticeMessage(CPrivNotice& Message); + virtual EModRet OnPrivNoticeMessage(CNoticeMessage& Message); /** Called when we receive a channel notice. * @param Nick The nick which sent the notice. * @param Channel The channel to which the notice was sent. @@ -813,7 +813,7 @@ public: * @return See CModule::EModRet. */ virtual EModRet OnChanNotice(CNick& Nick, CChan& Channel, CString& sMessage); - virtual EModRet OnChanNoticeMessage(CChanNotice& Message); + virtual EModRet OnChanNoticeMessage(CNoticeMessage& Message); /** Called when we receive a channel topic change from IRC. * @param Nick The nick which changed the topic. * @param Channel The channel whose topic was changed. @@ -1243,21 +1243,21 @@ public: bool OnCTCPReply(CNick& Nick, CString& sMessage); bool OnPrivCTCP(CNick& Nick, CString& sMessage); - bool OnPrivCTCPMessage(CPrivCTCP& Message); + bool OnPrivCTCPMessage(CCTCPMessage& Message); bool OnChanCTCP(CNick& Nick, CChan& Channel, CString& sMessage); - bool OnChanCTCPMessage(CChanCTCP& Message); + bool OnChanCTCPMessage(CCTCPMessage& Message); bool OnPrivAction(CNick& Nick, CString& sMessage); - bool OnPrivActionMessage(CPrivAction& Message); + bool OnPrivActionMessage(CActionMessage& Message); bool OnChanAction(CNick& Nick, CChan& Channel, CString& sMessage); - bool OnChanActionMessage(CChanAction& Message); + bool OnChanActionMessage(CActionMessage& Message); bool OnPrivMsg(CNick& Nick, CString& sMessage); bool OnPrivMessage(CPrivMessage& Message); bool OnChanMsg(CNick& Nick, CChan& Channel, CString& sMessage); bool OnChanMessage(CChanMessage& Message); bool OnPrivNotice(CNick& Nick, CString& sMessage); - bool OnPrivNoticeMessage(CPrivNotice& Message); + bool OnPrivNoticeMessage(CNoticeMessage& Message); bool OnChanNotice(CNick& Nick, CChan& Channel, CString& sMessage); - bool OnChanNoticeMessage(CChanNotice& Message); + bool OnChanNoticeMessage(CNoticeMessage& Message); bool OnTopic(CNick& Nick, CChan& Channel, CString& sTopic); bool OnTopicMessage(CTopicMessage& Message); bool OnTimerAutoJoin(CChan& Channel); diff --git a/src/IRCSock.cpp b/src/IRCSock.cpp index a10cd660..b7048df3 100644 --- a/src/IRCSock.cpp +++ b/src/IRCSock.cpp @@ -917,22 +917,22 @@ bool CIRCSock::OnCTCPReply(CNick& Nick, CString& sMessage) { } bool CIRCSock::OnPrivCTCP(CMessage& Message) { - CPrivCTCP& PrivCTCP = static_cast(Message); + CCTCPMessage& CTCP = static_cast(Message); bool bResult = false; - IRCSOCKMODULECALL(OnPrivCTCPMessage(PrivCTCP), &bResult); + IRCSOCKMODULECALL(OnPrivCTCPMessage(CTCP), &bResult); if (bResult) return true; - if (PrivCTCP.GetText().StartsWith("ACTION ")) { + if (CTCP.GetText().StartsWith("ACTION ")) { bResult = false; - CPrivAction& PrivAction = static_cast(Message); - IRCSOCKMODULECALL(OnPrivActionMessage(PrivAction), &bResult); + CActionMessage& Action = static_cast(Message); + IRCSOCKMODULECALL(OnPrivActionMessage(Action), &bResult); if (bResult) return true; if (!m_pNetwork->IsUserOnline() || !m_pNetwork->GetUser()->AutoClearQueryBuffer()) { - const CNick& Nick = PrivAction.GetNick(); + const CNick& Nick = Action.GetNick(); CQuery* pQuery = m_pNetwork->AddQuery(Nick.GetNick()); if (pQuery) { - pQuery->AddBuffer(":" + _NAMEDFMT(Nick.GetNickMask()) + " PRIVMSG {target} :\001ACTION {text}\001", PrivAction.GetText(), &PrivAction.GetTime(), PrivAction.GetTags()); + pQuery->AddBuffer(":" + _NAMEDFMT(Nick.GetNickMask()) + " PRIVMSG {target} :\001ACTION {text}\001", Action.GetText(), &Action.GetTime(), Action.GetTags()); } } } @@ -988,14 +988,14 @@ bool CIRCSock::OnGeneralCTCP(CMessage& Message) { } bool CIRCSock::OnPrivNotice(CMessage& Message) { - CPrivNotice& PrivNotice = static_cast(Message); + CNoticeMessage& Notice = static_cast(Message); bool bResult = false; - IRCSOCKMODULECALL(OnPrivNoticeMessage(PrivNotice), &bResult); + IRCSOCKMODULECALL(OnPrivNoticeMessage(Notice), &bResult); if (bResult) return true; if (!m_pNetwork->IsUserOnline()) { // If the user is detached, add to the buffer - m_pNetwork->AddNoticeBuffer(":" + _NAMEDFMT(PrivNotice.GetNick().GetNickMask()) + " NOTICE {target} :{text}", PrivNotice.GetText()); + m_pNetwork->AddNoticeBuffer(":" + _NAMEDFMT(Notice.GetNick().GetNickMask()) + " NOTICE {target} :{text}", Notice.GetText()); } return false; @@ -1039,24 +1039,24 @@ static void FixupChanNick(CNick& Nick, CChan* pChan) { } bool CIRCSock::OnChanCTCP(CMessage& Message) { - CChanCTCP& ChanCTCP = static_cast(Message); - CChan* pChan = m_pNetwork->FindChan(ChanCTCP.GetParam(0)); + CCTCPMessage& CTCP = static_cast(Message); + CChan* pChan = m_pNetwork->FindChan(CTCP.GetParam(0)); if (pChan) { FixupChanNick(Message.GetNick(), pChan); bool bResult = false; - ChanCTCP.SetChan(pChan); - IRCSOCKMODULECALL(OnChanCTCPMessage(ChanCTCP), &bResult); + CTCP.SetChan(pChan); + IRCSOCKMODULECALL(OnChanCTCPMessage(CTCP), &bResult); if (bResult) return true; // Record a /me - if (ChanCTCP.GetText().StartsWith("ACTION ")) { + if (CTCP.GetText().StartsWith("ACTION ")) { bResult = false; - CChanAction& ChanAction = static_cast(Message); - IRCSOCKMODULECALL(OnChanActionMessage(ChanAction), &bResult); + CActionMessage& Action = static_cast(Message); + IRCSOCKMODULECALL(OnChanActionMessage(Action), &bResult); if (bResult) return true; if (!pChan->AutoClearChanBuffer() || !m_pNetwork->IsUserOnline() || pChan->IsDetached()) { - pChan->AddBuffer(":" + _NAMEDFMT(Message.GetNick().GetNickMask()) + " PRIVMSG " + _NAMEDFMT(pChan->GetName()) + " :\001ACTION {text}\001", ChanAction.GetText(), &ChanAction.GetTime(), ChanAction.GetTags()); + pChan->AddBuffer(":" + _NAMEDFMT(Message.GetNick().GetNickMask()) + " PRIVMSG " + _NAMEDFMT(pChan->GetName()) + " :\001ACTION {text}\001", Action.GetText(), &Action.GetTime(), Action.GetTags()); } } } @@ -1068,18 +1068,18 @@ bool CIRCSock::OnChanCTCP(CMessage& Message) { } bool CIRCSock::OnChanNotice(CMessage& Message) { - CChanNotice& ChanNotice = static_cast(Message); - CChan* pChan = m_pNetwork->FindChan(ChanNotice.GetParam(0)); + CNoticeMessage& Notice = static_cast(Message); + CChan* pChan = m_pNetwork->FindChan(Notice.GetParam(0)); if (pChan) { FixupChanNick(Message.GetNick(), pChan); bool bResult = false; - ChanNotice.SetChan(pChan); - IRCSOCKMODULECALL(OnChanNoticeMessage(ChanNotice), &bResult); + Notice.SetChan(pChan); + IRCSOCKMODULECALL(OnChanNoticeMessage(Notice), &bResult); if (bResult) return true; if (!pChan->AutoClearChanBuffer() || !m_pNetwork->IsUserOnline() || pChan->IsDetached()) { - pChan->AddBuffer(":" + _NAMEDFMT(ChanNotice.GetNick().GetNickMask()) + " NOTICE " + _NAMEDFMT(pChan->GetName()) + " :{text}", ChanNotice.GetText(), &ChanNotice.GetTime(), ChanNotice.GetTags()); + pChan->AddBuffer(":" + _NAMEDFMT(Notice.GetNick().GetNickMask()) + " NOTICE " + _NAMEDFMT(pChan->GetName()) + " :{text}", Notice.GetText(), &Notice.GetTime(), Notice.GetTags()); } } diff --git a/src/Modules.cpp b/src/Modules.cpp index e3846545..ae711655 100644 --- a/src/Modules.cpp +++ b/src/Modules.cpp @@ -696,28 +696,28 @@ CModule::EModRet CModule::OnUserQuit(CString& sMessage) { return CONTINUE; } CModule::EModRet CModule::OnCTCPReply(CNick& Nick, CString& sMessage) { return CONTINUE; } CModule::EModRet CModule::OnPrivCTCP(CNick& Nick, CString& sMessage) { return CONTINUE; } -CModule::EModRet CModule::OnPrivCTCPMessage(CPrivCTCP& Message) { +CModule::EModRet CModule::OnPrivCTCPMessage(CCTCPMessage& Message) { CString sText = Message.GetText(); EModRet ret = OnPrivCTCP(Message.GetNick(), sText); Message.SetText(sText); return ret; } CModule::EModRet CModule::OnChanCTCP(CNick& Nick, CChan& Channel, CString& sMessage) { return CONTINUE; } -CModule::EModRet CModule::OnChanCTCPMessage(CChanCTCP& Message) { +CModule::EModRet CModule::OnChanCTCPMessage(CCTCPMessage& Message) { CString sText = Message.GetText(); EModRet ret = OnChanCTCP(Message.GetNick(), *Message.GetChan(), sText); Message.SetText(sText); return ret; } CModule::EModRet CModule::OnPrivAction(CNick& Nick, CString& sMessage) { return CONTINUE; } -CModule::EModRet CModule::OnPrivActionMessage(CPrivAction& Message) { +CModule::EModRet CModule::OnPrivActionMessage(CActionMessage& Message) { CString sText = Message.GetText(); EModRet ret = OnPrivAction(Message.GetNick(), sText); Message.SetText(sText); return ret; } CModule::EModRet CModule::OnChanAction(CNick& Nick, CChan& Channel, CString& sMessage) { return CONTINUE; } -CModule::EModRet CModule::OnChanActionMessage(CChanAction& Message) { +CModule::EModRet CModule::OnChanActionMessage(CActionMessage& Message) { CString sText = Message.GetText(); EModRet ret = OnChanAction(Message.GetNick(), *Message.GetChan(), sText); Message.SetText(sText); @@ -738,14 +738,14 @@ CModule::EModRet CModule::OnChanMessage(CChanMessage& Message) { return ret; } CModule::EModRet CModule::OnPrivNotice(CNick& Nick, CString& sMessage) { return CONTINUE; } -CModule::EModRet CModule::OnPrivNoticeMessage(CPrivNotice& Message) { +CModule::EModRet CModule::OnPrivNoticeMessage(CNoticeMessage& Message) { CString sText = Message.GetText(); EModRet ret = OnPrivNotice(Message.GetNick(), sText); Message.SetText(sText); return ret; } CModule::EModRet CModule::OnChanNotice(CNick& Nick, CChan& Channel, CString& sMessage) { return CONTINUE; } -CModule::EModRet CModule::OnChanNoticeMessage(CChanNotice& Message) { +CModule::EModRet CModule::OnChanNoticeMessage(CNoticeMessage& Message) { CString sText = Message.GetText(); EModRet ret = OnChanNotice(Message.GetNick(), *Message.GetChan(), sText); Message.SetText(sText); @@ -930,21 +930,21 @@ bool CModules::OnChanBufferPlayMessage(CMessage& Message) { MODHALTCHK(OnChanBuf bool CModules::OnPrivBufferPlayMessage(CMessage& Message) { MODHALTCHK(OnPrivBufferPlayMessage(Message)); } bool CModules::OnCTCPReply(CNick& Nick, CString& sMessage) { MODHALTCHK(OnCTCPReply(Nick, sMessage)); } bool CModules::OnPrivCTCP(CNick& Nick, CString& sMessage) { MODHALTCHK(OnPrivCTCP(Nick, sMessage)); } -bool CModules::OnPrivCTCPMessage(CPrivCTCP& Message) { MODHALTCHK(OnPrivCTCPMessage(Message)); } +bool CModules::OnPrivCTCPMessage(CCTCPMessage& Message) { MODHALTCHK(OnPrivCTCPMessage(Message)); } bool CModules::OnChanCTCP(CNick& Nick, CChan& Channel, CString& sMessage) { MODHALTCHK(OnChanCTCP(Nick, Channel, sMessage)); } -bool CModules::OnChanCTCPMessage(CChanCTCP& Message) { MODHALTCHK(OnChanCTCPMessage(Message)); } +bool CModules::OnChanCTCPMessage(CCTCPMessage& Message) { MODHALTCHK(OnChanCTCPMessage(Message)); } bool CModules::OnPrivAction(CNick& Nick, CString& sMessage) { MODHALTCHK(OnPrivAction(Nick, sMessage)); } -bool CModules::OnPrivActionMessage(CPrivAction& Message) { MODHALTCHK(OnPrivActionMessage(Message)); } +bool CModules::OnPrivActionMessage(CActionMessage& Message) { MODHALTCHK(OnPrivActionMessage(Message)); } bool CModules::OnChanAction(CNick& Nick, CChan& Channel, CString& sMessage) { MODHALTCHK(OnChanAction(Nick, Channel, sMessage)); } -bool CModules::OnChanActionMessage(CChanAction& Message) { MODHALTCHK(OnChanActionMessage(Message)); } +bool CModules::OnChanActionMessage(CActionMessage& Message) { MODHALTCHK(OnChanActionMessage(Message)); } bool CModules::OnPrivMsg(CNick& Nick, CString& sMessage) { MODHALTCHK(OnPrivMsg(Nick, sMessage)); } bool CModules::OnPrivMessage(CPrivMessage& Message) { MODHALTCHK(OnPrivMessage(Message)); } bool CModules::OnChanMsg(CNick& Nick, CChan& Channel, CString& sMessage) { MODHALTCHK(OnChanMsg(Nick, Channel, sMessage)); } bool CModules::OnChanMessage(CChanMessage& Message) { MODHALTCHK(OnChanMessage(Message)); } bool CModules::OnPrivNotice(CNick& Nick, CString& sMessage) { MODHALTCHK(OnPrivNotice(Nick, sMessage)); } -bool CModules::OnPrivNoticeMessage(CPrivNotice& Message) { MODHALTCHK(OnPrivNoticeMessage(Message)); } +bool CModules::OnPrivNoticeMessage(CNoticeMessage& Message) { MODHALTCHK(OnPrivNoticeMessage(Message)); } bool CModules::OnChanNotice(CNick& Nick, CChan& Channel, CString& sMessage) { MODHALTCHK(OnChanNotice(Nick, Channel, sMessage)); } -bool CModules::OnChanNoticeMessage(CChanNotice& Message) { MODHALTCHK(OnChanNoticeMessage(Message)); } +bool CModules::OnChanNoticeMessage(CNoticeMessage& Message) { MODHALTCHK(OnChanNoticeMessage(Message)); } bool CModules::OnTopic(CNick& Nick, CChan& Channel, CString& sTopic) { MODHALTCHK(OnTopic(Nick, Channel, sTopic)); } bool CModules::OnTopicMessage(CTopicMessage& Message) { MODHALTCHK(OnTopicMessage(Message)); } bool CModules::OnTimerAutoJoin(CChan& Channel) { MODHALTCHK(OnTimerAutoJoin(Channel)); } diff --git a/test/MessageTest.cpp b/test/MessageTest.cpp index 39e6274f..89d5838e 100644 --- a/test/MessageTest.cpp +++ b/test/MessageTest.cpp @@ -69,7 +69,7 @@ TEST(MessageTest, FormatFlags) { TEST(MessageTest, ChanAction) { CMessage msg(":sender PRIVMSG #chan :\001ACTION ACTS\001"); - CChanAction& chan = static_cast(msg); + CActionMessage& chan = static_cast(msg); EXPECT_EQ("sender", chan.GetNick().GetNick()); EXPECT_EQ("PRIVMSG", chan.GetCommand()); EXPECT_EQ("ACTS", chan.GetText()); @@ -81,7 +81,7 @@ TEST(MessageTest, ChanAction) { TEST(MessageTest, ChanCTCP) { CMessage msg(":sender PRIVMSG #chan :\001text\001"); - CChanCTCP& chan = static_cast(msg); + CCTCPMessage& chan = static_cast(msg); EXPECT_EQ("sender", chan.GetNick().GetNick()); EXPECT_EQ("PRIVMSG", chan.GetCommand()); EXPECT_EQ("text", chan.GetText()); @@ -152,7 +152,7 @@ TEST(MessageTest, Part) { TEST(MessageTest, PrivAction) { CMessage msg(":sender PRIVMSG receiver :\001ACTION ACTS\001"); - CPrivAction& priv = static_cast(msg); + CActionMessage& priv = static_cast(msg); EXPECT_EQ("sender", priv.GetNick().GetNick()); EXPECT_EQ("PRIVMSG", priv.GetCommand()); EXPECT_EQ("ACTS", priv.GetText()); @@ -164,7 +164,7 @@ TEST(MessageTest, PrivAction) { TEST(MessageTest, PrivCTCP) { CMessage msg(":sender PRIVMSG receiver :\001text\001"); - CPrivCTCP& priv = static_cast(msg); + CCTCPMessage& priv = static_cast(msg); EXPECT_EQ("sender", priv.GetNick().GetNick()); EXPECT_EQ("PRIVMSG", priv.GetCommand()); EXPECT_EQ("text", priv.GetText());