Modernize several modules to use CMessage

This commit is contained in:
Alexey Sokolov
2018-03-11 16:45:40 +00:00
parent a8d2df3852
commit 908fa96b3f
6 changed files with 48 additions and 58 deletions
+6 -8
View File
@@ -47,22 +47,20 @@ class CBlockMotd : public CModule {
}
}
EModRet OnRaw(CString& sLine) override {
const CString sCmd = sLine.Token(1);
if ((sCmd == "375" /* begin of MOTD */ || sCmd == "372" /* MOTD */) &&
EModRet OnNumericMessage(CNumericMessage& Message) override {
if ((Message.GetCode() == 375 /* begin of MOTD */ ||
Message.GetCode() == 372 /* MOTD */) &&
!ShouldTemporarilyAcceptMotd())
return HALT;
if (sCmd == "376" /* End of MOTD */) {
if (Message.GetCode() == 376 /* End of MOTD */) {
if (!ShouldTemporarilyAcceptMotd()) {
sLine = sLine.Token(0) + " 422 " + sLine.Token(2) + " :" +
t_s("MOTD blocked by ZNC");
Message.SetParam(1, t_s("MOTD blocked by ZNC"));
}
StopTemporarilyAcceptingMotd();
}
if (sCmd == "422") {
if (Message.GetCode() == 422) {
// Server has no MOTD
StopTemporarilyAcceptingMotd();
}