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/InspIRCd.layout | 72 ++++++++++++++++++++++---------------------- src/channels.cpp | 17 +++++------ src/mode.cpp | 4 +-- src/modules/m_blockcolor.cpp | 1 + src/modules/m_noctcp.cpp | 1 + 5 files changed, 47 insertions(+), 48 deletions(-) (limited to 'src') diff --git a/src/InspIRCd.layout b/src/InspIRCd.layout index 2d00c4b36..2df2e5843 100644 --- a/src/InspIRCd.layout +++ b/src/InspIRCd.layout @@ -1,5 +1,5 @@ [Editors] -Focused=-1 +Focused=42 Order=2,4,6,3,7,25,5,24,39,42,43,1,46,0,49,-1 [Editor_0] @@ -37,16 +37,16 @@ LeftChar=1 [Editor_4] Open=1 Top=0 -CursorCol=13 -CursorRow=315 -TopLine=276 +CursorCol=23 +CursorRow=200 +TopLine=184 LeftChar=1 [Editor_5] Open=1 Top=0 -CursorCol=1 -CursorRow=16 +CursorCol=21 +CursorRow=41 TopLine=1 LeftChar=1 @@ -83,11 +83,11 @@ TopLine=1 LeftChar=1 [Editor_10] -Open=0 +Open=1 Top=0 -CursorCol=1 -CursorRow=16 -TopLine=1 +CursorCol=9 +CursorRow=88 +TopLine=34 LeftChar=1 [Editor_11] @@ -99,11 +99,11 @@ TopLine=1 LeftChar=1 [Editor_12] -Open=0 +Open=1 Top=0 -CursorCol=1 -CursorRow=16 -TopLine=1 +CursorCol=7 +CursorRow=171 +TopLine=134 LeftChar=1 [Editor_13] @@ -165,9 +165,9 @@ LeftChar=1 [Editor_20] Open=1 Top=0 -CursorCol=1 -CursorRow=321 -TopLine=263 +CursorCol=70 +CursorRow=485 +TopLine=440 LeftChar=1 [Editor_21] @@ -204,9 +204,9 @@ LeftChar=1 [Editor_25] Open=1 Top=0 -CursorCol=1 -CursorRow=16 -TopLine=1 +CursorCol=2 +CursorRow=184 +TopLine=146 LeftChar=1 [Editor_26] Open=0 @@ -322,11 +322,11 @@ TopLine=1 LeftChar=1 [Editor_42] Open=1 -Top=0 -CursorCol=42 -CursorRow=287 -TopLine=256 -LeftChar=1 +Top=1 +CursorCol=10 +CursorRow=849 +TopLine=811 +LeftChar=20 [Editor_43] Open=1 Top=0 @@ -358,9 +358,9 @@ LeftChar=1 [Editor_47] Open=1 Top=0 -CursorCol=1 -CursorRow=26 -TopLine=13 +CursorCol=12 +CursorRow=128 +TopLine=74 LeftChar=1 [Editor_48] Open=1 @@ -428,16 +428,16 @@ LeftChar=1 [Editor_57] Open=1 Top=0 -CursorCol=85 -CursorRow=56 -TopLine=11 +CursorCol=1 +CursorRow=81 +TopLine=44 LeftChar=1 [Editor_58] Open=1 Top=0 -CursorCol=3 -CursorRow=84 -TopLine=46 +CursorCol=27 +CursorRow=78 +TopLine=40 LeftChar=1 [Editor_59] Open=0 @@ -462,8 +462,8 @@ TopLine=41 LeftChar=1 [Editor_62] Open=1 -Top=1 +Top=0 CursorCol=29 CursorRow=57 -TopLine=55 +TopLine=57 LeftChar=1 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); } } diff --git a/src/mode.cpp b/src/mode.cpp index 4bd7c908f..5ce7c95ad 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -815,7 +815,7 @@ void process_modes(char **parameters,userrec* user,chanrec *chan,int status, int break; default: - log(DEBUG,"Preprocessing custom mode %c",modechar); + log(DEBUG,"Preprocessing custom mode %c: modelist: %s",modechar,chan->custom_modes); string_list p; p.clear(); if (((!strchr(chan->custom_modes,modechar)) && (!mdir)) || ((strchr(chan->custom_modes,modechar)) && (mdir))) @@ -843,10 +843,10 @@ void process_modes(char **parameters,userrec* user,chanrec *chan,int status, int bool handled = false; if (param>=pcnt) { - log(DEBUG,"Not enough parameters for module-mode %c",modechar); // we're supposed to have a parameter, but none was given... so dont handle the mode. if (((ModeDefinedOn(modechar,MT_CHANNEL)>0) && (mdir)) || ((ModeDefinedOff(modechar,MT_CHANNEL)>0) && (!mdir))) { + log(DEBUG,"Not enough parameters for module-mode %c",modechar); handled = true; param++; } diff --git a/src/modules/m_blockcolor.cpp b/src/modules/m_blockcolor.cpp index 7f9d8716d..fb98709a4 100644 --- a/src/modules/m_blockcolor.cpp +++ b/src/modules/m_blockcolor.cpp @@ -75,6 +75,7 @@ class ModuleBlockColor : public Module // check if this is our mode character... if ((modechar == 'c') && (type == MT_CHANNEL)) { + log(DEBUG,"Allowing c change"); return 1; } else diff --git a/src/modules/m_noctcp.cpp b/src/modules/m_noctcp.cpp index 4d58151f0..73b991f7c 100644 --- a/src/modules/m_noctcp.cpp +++ b/src/modules/m_noctcp.cpp @@ -78,6 +78,7 @@ class ModuleNoCTCP : public Module // check if this is our mode character... if ((modechar == 'C') && (type == MT_CHANNEL)) { + log(DEBUG,"Allowing C change"); return 1; } else -- cgit v1.2.3