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

View File

@@ -138,18 +138,16 @@ class CKeepNickMod : public CModule {
m_pTimer = nullptr;
}
EModRet OnUserRaw(CString& sLine) override {
EModRet OnUserRawMessage(CMessage& Message) override {
// We don't care if we are not connected to IRC
if (!GetNetwork()->IsIRCConnected()) return CONTINUE;
// We are trying to get the config nick and this is a /nick?
if (!m_pTimer || !sLine.Token(0).Equals("NICK")) return CONTINUE;
if (!m_pTimer || Message.GetType() != CMessage::Type::Nick)
return CONTINUE;
// Is the nick change for the nick we are trying to get?
CString sNick = sLine.Token(1);
// Don't even think of using spaces in your nick!
if (sNick.Left(1) == ":") sNick.LeftChomp();
const CString sNick = Message.As<CNickMessage>().GetNewNick();
if (!sNick.Equals(GetNick())) return CONTINUE;