]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/channels.cpp
Optimisation of optimisation :P ty w00tie
[user/henk/code/inspircd.git] / src / channels.cpp
index 3901530a6f8fe11cd14e09a8b792cde9b477b97d..f086b9853ac0b521187ecd8d6d4c9f69fe4b19fb 100644 (file)
@@ -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);
+               }
        }
 }