Make the text mode remote console really work. It can now be used to send

multi-word commands with proper quoting, handles arguments with spaces
and allows interactive use, e.g. user creation.
This commit is contained in:
Melanie Thielker
2010-06-08 22:03:08 +02:00
committed by Melanie
parent a246cbce8d
commit a791689ceb
3 changed files with 62 additions and 27 deletions

View File

@@ -106,8 +106,15 @@ namespace OpenSim.Framework.Console
public override string ReadLine(string p, bool isCommand, bool e)
{
if (isCommand)
Output("+++"+p);
else
Output("-++"+p);
m_DataEvent.WaitOne();
string cmdinput;
lock (m_InputData)
{
if (m_InputData.Count == 0)
@@ -116,29 +123,30 @@ namespace OpenSim.Framework.Console
return "";
}
string cmdinput = m_InputData[0];
cmdinput = m_InputData[0];
m_InputData.RemoveAt(0);
if (m_InputData.Count == 0)
m_DataEvent.Reset();
if (isCommand)
{
string[] cmd = Commands.Resolve(Parser.Parse(cmdinput));
if (cmd.Length != 0)
{
int i;
for (i=0 ; i < cmd.Length ; i++)
{
if (cmd[i].Contains(" "))
cmd[i] = "\"" + cmd[i] + "\"";
}
return String.Empty;
}
}
return cmdinput;
}
if (isCommand)
{
string[] cmd = Commands.Resolve(Parser.Parse(cmdinput));
if (cmd.Length != 0)
{
int i;
for (i=0 ; i < cmd.Length ; i++)
{
if (cmd[i].Contains(" "))
cmd[i] = "\"" + cmd[i] + "\"";
}
return String.Empty;
}
}
return cmdinput;
}
private void DoExpire()
@@ -308,7 +316,7 @@ namespace OpenSim.Framework.Console
return reply;
}
if (post["COMMAND"] == null || post["COMMAND"].ToString() == String.Empty)
if (post["COMMAND"] == null)
return reply;
lock (m_InputData)