- if (mode_on)
- {
- char* mptr = this->custom_modes;
- int ssize = 0;
-
- /* Attempt to find the end of the mode string */
- while (*mptr++)
- {
- /* While iterating the mode string, we found that they already have
- * this mode in their list. Abort right now. */
- if (*mptr == mode)
- return;
- /* Increment the string size, saves us doing strlen */
- ssize++;
- }
-
- log(DEBUG,"ssize=%d",ssize);
-
- /* Is there room left in the buffer? If there is append the mode */
- if (ssize < MAXMODES-1)
- {
- *--mptr = mode;
- *++mptr = 0;
- }
-
- log(DEBUG,"Custom mode %c set, modes='%s'",mode,this->custom_modes);
- }
- else
- {
- if (charremove(this->custom_modes,mode))
- {
- log(DEBUG,"Custom mode %c removed: modelist='%s'",mode,this->custom_modes);
- /* Only call this if we found the mode */
- this->SetCustomModeParam(mode,"",false);
- }
- }
+ custom_modes[mode-65] = mode_on;
+ if (!mode_on)
+ this->SetCustomModeParam(mode,"",false);