From eb067467de6777c010dbbca716f27a3f550107ce Mon Sep 17 00:00:00 2001 From: brain Date: Mon, 6 Mar 2006 00:29:02 +0000 Subject: Mode-code rewrite. Might act weird, needs proper testing (that is what svn builds are for, after all) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3474 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/channels.cpp | 28 ++++------------------------ 1 file changed, 4 insertions(+), 24 deletions(-) (limited to 'src/channels.cpp') diff --git a/src/channels.cpp b/src/channels.cpp index 3901530a6..f086b9853 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -108,32 +108,12 @@ void chanrec::SetCustomMode(char mode,bool mode_on) } else { - char* mptr = this->custom_modes; - bool shift_down = false; - /* Iterate through the string */ - while (*mptr) + if (charremove(this->custom_modes,mode)) { - /* When we find the mode we intend to remove, set the - * flag to tell the loop to start moving chars down - * one place - */ - if (*mptr == mode) - shift_down = true; - /* If we're moving chars down one place, take the current - * char, and move it down one slot, so: - * ABC\0 becomes BBC\0 then next iteration, BBC\0 becomes - * BC\0. - */ - if (shift_down) - *mptr = *(mptr+1); - *mptr++; - } - - log(DEBUG,"Custom mode %c removed: modelist='%s'",mode,this->custom_modes); - - /* Only call this if we found the mode */ - if (shift_down) + log(DEBUG,"Custom mode %c removed: modelist='%s'",mode,this->custom_modes); + /* Only call this if we found the mode */ this->SetCustomModeParam(mode,"",false); + } } } -- cgit v1.3.1-10-gc9f91