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.
This commit is contained in:
1 parent
8f655ac179
commit
3976651c35
5 files changed
+64
-85
No files matched your search
@@ -69,7 +69,7 @@ TEST(MessageTest, FormatFlags) {
|
||||
|
||||
TEST(MessageTest, ChanAction) {
|
||||
CMessage msg(":sender PRIVMSG #chan :\001ACTION ACTS\001");
|
||||
CChanAction& chan = static_cast<CChanAction&>(msg);
|
||||
CActionMessage& chan = static_cast<CActionMessage&>(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<CChanCTCP&>(msg);
|
||||
CCTCPMessage& chan = static_cast<CCTCPMessage&>(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<CPrivAction&>(msg);
|
||||
CActionMessage& priv = static_cast<CActionMessage&>(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<CPrivCTCP&>(msg);
|
||||
CCTCPMessage& priv = static_cast<CCTCPMessage&>(msg);
|
||||
EXPECT_EQ("sender", priv.GetNick().GetNick());
|
||||
EXPECT_EQ("PRIVMSG", priv.GetCommand());
|
||||
EXPECT_EQ("text", priv.GetText());
|
||||
|
||||
Reference in new issue
Block a user