From 77ddb3c420bec1f427de07f73c1a9876d5e57ed8 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Sat, 5 Sep 2015 01:32:08 +0200 Subject: [PATCH] CClient::ReadLine(): use CMessage::GetType() --- src/Client.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Client.cpp b/src/Client.cpp index 0d6ad6f2..02db4f17 100644 --- a/src/Client.cpp +++ b/src/Client.cpp @@ -158,7 +158,7 @@ void CClient::ReadLine(const CString& sData) { } } - if (sCommand.Equals("CAP")) { + if (Message.GetType() == CMessage::Type::Capability) { HandleCap(Message); // Don't let the client talk to the server directly about CAP, @@ -194,17 +194,17 @@ void CClient::ReadLine(const CString& sData) { CALLMOD(sTarget, this, m_pUser, m_pNetwork, OnModCommand(sModCommand)) } return; - } else if (sCommand.Equals("PING")) { + } else if (Message.GetType() == CMessage::Type::Ping) { // All PONGs are generated by ZNC. We will still forward this to // the ircd, but all PONGs from irc will be blocked. if (!Message.GetParams().empty()) PutClient(":irc.znc.in PONG irc.znc.in " + Message.GetParams(0)); else PutClient(":irc.znc.in PONG irc.znc.in"); - } else if (sCommand.Equals("PONG")) { + } else if (Message.GetType() == CMessage::Type::Pong) { // Block PONGs, we already responded to the pings return; - } else if (sCommand.Equals("QUIT")) { + } else if (Message.GetType() == CMessage::Type::Quit) { CQuitMessage& QuitMsg = static_cast(Message); NETWORKMODULECALL(OnUserQuitMessage(QuitMsg), m_pUser, m_pNetwork, this, &bReturn); if (bReturn) return; @@ -383,7 +383,7 @@ void CClient::ReadLine(const CString& sData) { PutStatusNotice("Detached [" + CString(uDetached) + "] channels"); return; - } else if (sCommand.Equals("JOIN")) { + } else if (Message.GetType() == CMessage::Type::Join) { CJoinMessage& JoinMsg = static_cast(Message); CString sChans = JoinMsg.GetTarget(); CString sKeys = JoinMsg.GetKey(); @@ -430,7 +430,7 @@ void CClient::ReadLine(const CString& sData) { JoinMsg.SetTarget(sChans); JoinMsg.SetKey(sKeys); - } else if (sCommand.Equals("PART")) { + } else if (Message.GetType() == CMessage::Type::Part) { CPartMessage& PartMsg = static_cast(Message); CString sChans = PartMsg.GetTarget(); @@ -461,7 +461,7 @@ void CClient::ReadLine(const CString& sData) { } PartMsg.SetTarget(sChans); - } else if (sCommand.Equals("TOPIC")) { + } else if (Message.GetType() == CMessage::Type::Topic) { CTopicMessage& TopicMsg = static_cast(Message); CString sChan = TopicMsg.GetTarget(); CString sTopic = TopicMsg.GetTopic(); @@ -474,7 +474,7 @@ void CClient::ReadLine(const CString& sData) { if (bReturn) return; TopicMsg.SetTarget(sChan); } - } else if (sCommand.Equals("MODE")) { + } else if (Message.GetType() == CMessage::Type::Mode) { // TODO: introduce CModeMessage? CString sTarget = Message.GetParam(0); CString sModes = Message.GetParams(1); @@ -1044,7 +1044,7 @@ void CClient::AddBuffer(const T& Message) if (pChan && (!pChan->AutoClearChanBuffer() || !m_pNetwork->IsUserOnline())) { pChan->AddBuffer(Format.ToString(CMessage::ExcludeTags), Message.GetText(), &Message.GetTime(), Message.GetTags()); } - } else if (Message.GetCommand().Equals("PRIVMSG")) { + } else if (Message.GetType() != CMessage::Type::Notice) { if (!m_pUser->AutoClearQueryBuffer() || !m_pNetwork->IsUserOnline()) { CQuery* pQuery = m_pNetwork->AddQuery(sTarget); if (pQuery) {