From ffe92a4b66b8abf4fac0c07626caf04db4781095 Mon Sep 17 00:00:00 2001 From: psychon Date: Fri, 29 May 2009 20:26:37 +0000 Subject: [PATCH] Some minor optimizations I doubt this makes much of a difference, but some callgrind run with one hour of #ubuntu pointed to this stuff. Let's hope it's at least a little little little bit faster now git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1527 726aef4b-f618-498e-8847-2d620e286838 --- Chan.cpp | 10 +++++++--- IRCSock.cpp | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Chan.cpp b/Chan.cpp index e6fef8b0..2e8f0c85 100644 --- a/Chan.cpp +++ b/Chan.cpp @@ -401,9 +401,13 @@ bool CChan::AddNick(const CString& sNick) { } sTmp = p; - sIdent = sTmp.Token(1, true, "!").Token(0, false, "@"); - sHost = sTmp.Token(1, true, "@"); - sTmp = sTmp.Token(0, false, "!"); + + // The UHNames extension gets us nick!ident@host instead of just plain nick + sIdent = sTmp.Token(1, true, "!"); + sHost = sIdent.Token(1, true, "@"); + sIdent = sIdent.Token(0, false, "@"); + // Get the nick + sTmp = sTmp.Token(0, false, "!"); CNick* pNick = FindNick(sTmp); if (!pNick) { diff --git a/IRCSock.cpp b/IRCSock.cpp index 064c79a6..aaf0b6fd 100644 --- a/IRCSock.cpp +++ b/IRCSock.cpp @@ -79,7 +79,7 @@ void CIRCSock::ReadLine(const CString& sData) { if (sLine.Equals("PING ", false, 5)) { PutIRC("PONG " + sLine.substr(5)); - } else if (sLine.Token(1).Equals("PONG") && sLine.Token(3).Equals(":ZNC")) { + } else if (sLine.Equals("PONG ", false, 5) && sLine.Token(3).Equals(":ZNC")) { // We asked for this so don't forward the reply to clients. return; } else if (sLine.Equals("ERROR ", false, 6)) {