mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
@@ -1180,10 +1180,32 @@ char* ChatHandler::extractQuotedArg(char* args)
|
||||
return strtok(args+1, "\"");
|
||||
else
|
||||
{
|
||||
char* space = strtok(args, "\"");
|
||||
if (!space)
|
||||
// skip spaces
|
||||
while (*args == ' ')
|
||||
{
|
||||
args += 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
// return NULL if we reached the end of the string
|
||||
if (!*args)
|
||||
return NULL;
|
||||
|
||||
// since we skipped all spaces, we expect another token now
|
||||
if (*args == '"')
|
||||
{
|
||||
// return an empty string if there are 2 "" in a row.
|
||||
// strtok doesn't handle this case
|
||||
if (*(args + 1) == '"')
|
||||
{
|
||||
strtok(args, " ");
|
||||
return "";
|
||||
}
|
||||
else
|
||||
return strtok(args + 1, "\"");
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
return strtok(NULL, "\"");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user