autoreply: Modernize and add test.

This commit is contained in:
RealKindOne authored and Alexey Sokolov committed 2026-09-13 11:27:31 +01:00
1 parent a75612dd15
commit 0832094976
2 files changed
+26 -2

No files matched your search

+2 -2
View File
@@ -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;
}
+24
View File
@@ -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