From 496ef08226f93d877d90e56076704795fa349a4b Mon Sep 17 00:00:00 2001 From: brain Date: Mon, 24 May 2004 20:56:01 +0000 Subject: Fixed perplexing bug in custom mode removal (apparent with +C and +c) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@829 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/channels.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'src/channels.cpp') diff --git a/src/channels.cpp b/src/channels.cpp index 310195679..4bec1bcdb 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -132,16 +132,13 @@ void chanrec::SetCustomMode(char mode,bool mode_on) log(DEBUG,"Custom mode %c set",mode); } else { - char temp[MAXBUF]; - int count = 0; - for (int q = 0; q < strlen(custom_modes); q++) { - if (custom_modes[q] != mode) { - temp[count++] = mode; - } - } - temp[count] = '\0'; - strncpy(custom_modes,temp,MAXMODES); - log(DEBUG,"Custom mode %c removed",mode); + + std::string a = this->custom_modes; + int pos = a.find(mode); + a.erase(pos,1); + strncpy(this->custom_modes,a.c_str(),MAXMODES); + + log(DEBUG,"Custom mode %c removed: modelist='%s'",mode,this->custom_modes); this->SetCustomModeParam(mode,"",false); } } -- cgit v1.3.1-10-gc9f91