aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Console/RemoteConsole.cs
diff options
context:
space:
mode:
authorMelanie Thielker2010-06-08 22:03:08 +0200
committerMelanie Thielker2010-06-08 22:03:08 +0200
commit4921d5ac2dc1f439b7820a22c89fd8239ff33bbc (patch)
tree914f310d161af0a67a86a4a440e06018dc1f18ae /OpenSim/Framework/Console/RemoteConsole.cs
parentMerge branch 'master' into careminster-presence-refactor (diff)
downloadopensim-SC-4921d5ac2dc1f439b7820a22c89fd8239ff33bbc.zip
opensim-SC-4921d5ac2dc1f439b7820a22c89fd8239ff33bbc.tar.gz
opensim-SC-4921d5ac2dc1f439b7820a22c89fd8239ff33bbc.tar.bz2
opensim-SC-4921d5ac2dc1f439b7820a22c89fd8239ff33bbc.tar.xz
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.
Diffstat (limited to 'OpenSim/Framework/Console/RemoteConsole.cs')
-rw-r--r--OpenSim/Framework/Console/RemoteConsole.cs36
1 files changed, 22 insertions, 14 deletions
diff --git a/OpenSim/Framework/Console/RemoteConsole.cs b/OpenSim/Framework/Console/RemoteConsole.cs
index 6f8348d..a46a6cb 100644
--- a/OpenSim/Framework/Console/RemoteConsole.cs
+++ b/OpenSim/Framework/Console/RemoteConsole.cs
@@ -106,8 +106,15 @@ namespace OpenSim.Framework.Console
106 106
107 public override string ReadLine(string p, bool isCommand, bool e) 107 public override string ReadLine(string p, bool isCommand, bool e)
108 { 108 {
109 if (isCommand)
110 Output("+++"+p);
111 else
112 Output("-++"+p);
113
109 m_DataEvent.WaitOne(); 114 m_DataEvent.WaitOne();
110 115
116 string cmdinput;
117
111 lock (m_InputData) 118 lock (m_InputData)
112 { 119 {
113 if (m_InputData.Count == 0) 120 if (m_InputData.Count == 0)
@@ -116,29 +123,30 @@ namespace OpenSim.Framework.Console
116 return ""; 123 return "";
117 } 124 }
118 125
119 string cmdinput = m_InputData[0]; 126 cmdinput = m_InputData[0];
120 m_InputData.RemoveAt(0); 127 m_InputData.RemoveAt(0);
121 if (m_InputData.Count == 0) 128 if (m_InputData.Count == 0)
122 m_DataEvent.Reset(); 129 m_DataEvent.Reset();
123 130
124 if (isCommand) 131 }
132
133 if (isCommand)
134 {
135 string[] cmd = Commands.Resolve(Parser.Parse(cmdinput));
136
137 if (cmd.Length != 0)
125 { 138 {
126 string[] cmd = Commands.Resolve(Parser.Parse(cmdinput)); 139 int i;
127 140
128 if (cmd.Length != 0) 141 for (i=0 ; i < cmd.Length ; i++)
129 { 142 {
130 int i; 143 if (cmd[i].Contains(" "))
131 144 cmd[i] = "\"" + cmd[i] + "\"";
132 for (i=0 ; i < cmd.Length ; i++)
133 {
134 if (cmd[i].Contains(" "))
135 cmd[i] = "\"" + cmd[i] + "\"";
136 }
137 return String.Empty;
138 } 145 }
146 return String.Empty;
139 } 147 }
140 return cmdinput;
141 } 148 }
149 return cmdinput;
142 } 150 }
143 151
144 private void DoExpire() 152 private void DoExpire()
@@ -308,7 +316,7 @@ namespace OpenSim.Framework.Console
308 return reply; 316 return reply;
309 } 317 }
310 318
311 if (post["COMMAND"] == null || post["COMMAND"].ToString() == String.Empty) 319 if (post["COMMAND"] == null)
312 return reply; 320 return reply;
313 321
314 lock (m_InputData) 322 lock (m_InputData)