diff options
Diffstat (limited to 'src/channels.cpp')
-rw-r--r-- | src/channels.cpp | 28 |
1 files changed, 4 insertions, 24 deletions
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); + } } } |