From 08dc6b94f774f8f836354c8ac1c1945ddf35ad48 Mon Sep 17 00:00:00 2001 From: brain Date: Sat, 20 Jan 2007 16:07:02 +0000 Subject: Better way even than suggested. We need one counter, nonlistmodes_found, and start with it at 0. In the while loop, if we find any modes that arent of list mode type we inc the counter, and if the counter is zero after the end of the loop, we can just return (we processed everything already and nothing is left) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6401 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/mode.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/mode.cpp b/src/mode.cpp index 5e9dc1233..a7effa642 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -282,6 +282,7 @@ void ModeParser::Process(const char** parameters, int pcnt, userrec *user, bool if ((targetchannel) && (pcnt == 2)) { const char* mode = parameters[1]; + int nonlistmodes_found = 0; mask = MASK_CHANNEL; @@ -313,9 +314,15 @@ void ModeParser::Process(const char** parameters, int pcnt, userrec *user, bool if (display) mh->DisplayList(user, targetchannel); } + else + nonlistmodes_found++; mode++; } + + /* We didnt have any modes that were non-list, we can return here */ + if (!nonlistmodes_found) + return; } if (pcnt == 1) -- cgit v1.2.3