}
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);
+ }
}
}