diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-11-04 16:54:43 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-11-04 16:54:43 +0000 |
commit | 6a582ef38e897dd04269c33cbe883c17cc94084a (patch) | |
tree | ae29eed24f57ea90920f9bc95d6f59c19e387d41 | |
parent | 026c55cafc2c8e33f4119cec3dbdd04ecdc897cd (diff) |
Fix comma-seperated list handling by CommandParser::LoopCall, should fix /amsg etc.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5644 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | src/command_parse.cpp | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/src/command_parse.cpp b/src/command_parse.cpp index e413bc4ac..10f760e40 100644 --- a/src/command_parse.cpp +++ b/src/command_parse.cpp @@ -214,7 +214,7 @@ int CommandParser::LoopCall(userrec* user, command_t* CommandObj, const char** p */ irc::commasepstream items1(parameters[splithere]); irc::commasepstream items2(parameters[extra]); - std::string item = ""; + std::string item = "*"; unsigned int max = 0; /* Attempt to iterate these lists and call the command objech @@ -223,10 +223,17 @@ int CommandParser::LoopCall(userrec* user, command_t* CommandObj, const char** p */ while (((item = items1.GetToken()) != "") && (max++ < ServerInstance->Config->MaxTargets)) { + const char* new_parameters[127]; + + for (int t = 0; (t < pcnt) && (t < 127); t++) + new_parameters[t] = parameters[t]; + std::string extrastuff = items2.GetToken(); - parameters[splithere] = item.c_str(); - parameters[extra] = extrastuff.c_str(); - CommandObj->Handle(parameters,pcnt,user); + + new_parameters[splithere] = item.c_str(); + new_parameters[extra] = extrastuff.c_str(); + + CommandObj->Handle(new_parameters,pcnt,user); } return 1; } @@ -240,8 +247,9 @@ int CommandParser::LoopCall(userrec* user, command_t* CommandObj, const char** p return 0; /* Only one commasepstream here */ + ServerInstance->Log(DEBUG,"Splitting '%s'",parameters[splithere]); irc::commasepstream items1(parameters[splithere]); - std::string item = ""; + std::string item = "*"; unsigned int max = 0; /* Parse the commasepstream until there are no tokens remaining. @@ -250,8 +258,15 @@ int CommandParser::LoopCall(userrec* user, command_t* CommandObj, const char** p */ while (((item = items1.GetToken()) != "") && (max++ < ServerInstance->Config->MaxTargets)) { + const char* new_parameters[127]; + + for (int t = 0; (t < pcnt) && (t < 127); t++) + new_parameters[t] = parameters[t]; + + new_parameters[splithere] = item.c_str(); + parameters[splithere] = item.c_str(); - CommandObj->Handle(parameters,pcnt,user); + CommandObj->Handle(new_parameters,pcnt,user); } /* By returning 1 we tell our caller that nothing is to be done, * as all the previous calls handled the data. This makes the parent |