diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2004-04-03 17:24:37 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2004-04-03 17:24:37 +0000 |
commit | e0f00618c3c7440de7ed091a93e016175dc8c3b5 (patch) | |
tree | e24e382f3f138745102d2b64c2af7c6fffdf655a | |
parent | 788ea878270b31773db65c8925e3ab5194fba094 (diff) |
Fixed command parser to tidy up malformed commands (xchat inserts extra spaces)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@364 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | src/InspIRCd.layout | 8 | ||||
-rw-r--r-- | src/inspircd.cpp | 39 |
2 files changed, 43 insertions, 4 deletions
diff --git a/src/InspIRCd.layout b/src/InspIRCd.layout index 48ccce82f..17b5e7918 100644 --- a/src/InspIRCd.layout +++ b/src/InspIRCd.layout @@ -13,10 +13,10 @@ LeftChar=1 [Editor_1] Open=1 Top=1 -CursorCol=16 -CursorRow=2043 -TopLine=1993 -LeftChar=19 +CursorCol=2 +CursorRow=217 +TopLine=190 +LeftChar=1 [Editor_2] Open=1 diff --git a/src/inspircd.cpp b/src/inspircd.cpp index a515ab212..62cdffd09 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -206,6 +206,44 @@ void safedelete(chanrec *p) } +void tidystring(char* str) +{ + // strips out double spaces before a : parameter + char temp[MAXBUF]; + bool go_again = true; + + while (go_again) + { + bool noparse = false; + int t = 0, a = 0; + go_again = false; + while (a < strlen(str)) + { + if ((a<strlen(str)-1) && (noparse==false)) + { + if ((str[a] == ' ') && (str[a+1] == ' ')) + { + log(DEBUG,"Tidied extra space out of string: %s",str); + go_again = true; + a++; + } + } + + if (a<strlen(str)-1) + { + if ((str[a] == ' ') && (str[a+1] == ':')) + { + noparse = true; + } + } + + temp[t++] = str[a++]; + } + temp[t] = '\0'; + strncpy(str,temp,MAXBUF); + } +} + /* chop a string down to 512 characters and preserve linefeed (irc max * line length) */ @@ -4333,6 +4371,7 @@ void process_buffer(userrec *user) return; } log(DEBUG,"InspIRCd: processing: %s %s",user->nick,cmd); + tidystring(cmd); process_command(user,cmd); } |