mirror of
https://github.com/znc/znc.git
synced 2026-05-05 04:52:31 +02:00
CClient::ReadLine(): use CMessage::GetType()
This commit is contained in:
@@ -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<CQuitMessage&>(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<CJoinMessage&>(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<CPartMessage&>(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<CTopicMessage&>(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) {
|
||||
|
||||
Reference in New Issue
Block a user