Permalink
Browse files

Remove a useless lookup

All the places that add entries to the CTCPReplies map use CString::Token(0) to
split the first token away. This means it is impossible for this to contain
spaces. Now this means that it is pointless to look up the full CTCP request in
the CTCPReplies map because it can't contain any matching item.

Signed-off-by: Uli Schlachter <psychon@znc.in>
  • Loading branch information...
1 parent 7784492 commit 4ed833abbd73773a4cb0a5c825d6056edf7562f8 @psychon psychon committed Feb 18, 2011
Showing with 1 addition and 5 deletions.
  1. +1 −5 IRCSock.cpp
View
@@ -822,15 +822,11 @@ bool CIRCSock::OnPrivCTCP(CNick& Nick, CString& sMessage) {
bool CIRCSock::OnGeneralCTCP(CNick& Nick, CString& sMessage) {
const MCString& mssCTCPReplies = m_pUser->GetCTCPReplies();
- MCString::const_iterator it = mssCTCPReplies.find(sMessage.AsUpper());
CString sQuery = sMessage.Token(0).AsUpper();
+ MCString::const_iterator it = mssCTCPReplies.find(sQuery);
bool bHaveReply = false;
CString sReply;
- if (it == mssCTCPReplies.end()) {
- it = mssCTCPReplies.find(sQuery);
- }
-
if (it != mssCTCPReplies.end()) {
sReply = m_pUser->ExpandString(it->second);
bHaveReply = true;

0 comments on commit 4ed833a

Please sign in to comment.