From 04838648d28f799ca853debf1e3a7c1e835ff353 Mon Sep 17 00:00:00 2001 From: psychon Date: Tue, 22 Jun 2010 16:14:31 +0000 Subject: [PATCH] Correctly handle large CAP lists from the IRCd As DarthGandalf noticed, the spec asks for an "*" to be prepended if the reply needs to be split up into multiple lines. It doesn't really matter for the current code, but let's make this future-proof. :) git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2041 726aef4b-f618-498e-8847-2d620e286838 --- IRCSock.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/IRCSock.cpp b/IRCSock.cpp index d6be8450..a3421804 100644 --- a/IRCSock.cpp +++ b/IRCSock.cpp @@ -645,7 +645,16 @@ void CIRCSock::ReadLine(const CString& sData) { // CAP spec don't mention this, but all implementations // I've seen add this extra asterisk CString sSubCmd = sRest.Token(1); - CString sArgs = sRest.Token(2, true).TrimPrefix_n(":"); + + // If the caplist of a reply is too long, it's split + // into multiple replies. A "*" is prepended to show + // that the list was split into multiple replies. + CString sArgs; + if (sRest.Token(2) == "*") { + sArgs = sRest.Token(3, true).TrimPrefix_n(":"); + } else { + sArgs = sRest.Token(2, true).TrimPrefix_n(":"); + } if (sSubCmd == "LS" && !m_bAuthed) { VCString vsTokens;