autoreply: Modernize and add test.
This commit is contained in:
1 parent
a75612dd15
commit
0832094976
2 files changed
+26
-2
No files matched your search
@@ -65,8 +65,8 @@ class CAutoReplyMod : public CModule {
|
||||
PutIRC("NOTICE " + sNick + " :" + GetReply());
|
||||
}
|
||||
|
||||
EModRet OnPrivMsg(CNick& Nick, CString& sMessage) override {
|
||||
Handle(Nick.GetNick());
|
||||
EModRet OnPrivTextMessage(CTextMessage& Message) override {
|
||||
Handle(Message.GetNick().GetNick());
|
||||
return CONTINUE;
|
||||
}
|
||||
|
||||
|
||||
@@ -628,5 +628,29 @@ TEST_F(ZNCTest, StripControlsModule) {
|
||||
|
||||
}
|
||||
|
||||
TEST_F(ZNCTest, AutoReplyModule) {
|
||||
auto znc = Run();
|
||||
auto ircd = ConnectIRCd();
|
||||
auto client = LoginClient();
|
||||
|
||||
client.Write("znc loadmod autoreply I'm currently away");
|
||||
client.ReadUntil("Loaded module");
|
||||
|
||||
ircd.Write(":server 001 nick :Hello");
|
||||
|
||||
client.Write("QUIT :Going away");
|
||||
client.Close();
|
||||
|
||||
ircd.Write(":testuser!test@host PRIVMSG nick :Hello there");
|
||||
ircd.ReadUntil("NOTICE testuser :I'm currently away");
|
||||
|
||||
ircd.Write(":testuser!test@host PRIVMSG nick :Another message");
|
||||
ircd.Write(":otheruser!other@host PRIVMSG nick :Hi nick");
|
||||
ircd.ReadUntil("NOTICE otheruser :I'm currently away");
|
||||
|
||||
auto client2 = LoginClient();
|
||||
ircd.Write(":thirduser!third@host PRIVMSG nick :Are you there?");
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace znc_inttest
|
||||
Reference in new issue
Block a user