diff options
Diffstat (limited to 'OpenSim/ApplicationPlugins/Rest/Inventory/tests/Remote.cs')
-rw-r--r-- | OpenSim/ApplicationPlugins/Rest/Inventory/tests/Remote.cs | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/tests/Remote.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/tests/Remote.cs index b15b337..4333ef1 100644 --- a/OpenSim/ApplicationPlugins/Rest/Inventory/tests/Remote.cs +++ b/OpenSim/ApplicationPlugins/Rest/Inventory/tests/Remote.cs | |||
@@ -123,10 +123,15 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory.Tests | |||
123 | 123 | ||
124 | private void DoMove(RequestData rdata) | 124 | private void DoMove(RequestData rdata) |
125 | { | 125 | { |
126 | if (rdata.Parameters.Length >= 6) | 126 | if (rdata.Parameters.Length < 6) |
127 | { | ||
128 | Rest.Log.WarnFormat("{0} Move: No movement information provided", MsgId); | ||
129 | rdata.Fail(Rest.HttpStatusCodeBadRequest, "no movement information provided"); | ||
130 | } | ||
131 | else | ||
127 | { | 132 | { |
128 | string[] names = rdata.Parameters[PARM_MOVE_AVATAR].Split(Rest.CA_SPACE); | 133 | string[] names = rdata.Parameters[PARM_MOVE_AVATAR].Split(Rest.CA_SPACE); |
129 | ScenePresence avatar = null; | 134 | ScenePresence presence = null; |
130 | Scene scene = null; | 135 | Scene scene = null; |
131 | 136 | ||
132 | if (names.Length != 2) | 137 | if (names.Length != 2) |
@@ -141,21 +146,19 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory.Tests | |||
141 | // The first parameter should be an avatar name, look for the | 146 | // The first parameter should be an avatar name, look for the |
142 | // avatar in the known regions first. | 147 | // avatar in the known regions first. |
143 | 148 | ||
144 | foreach (Scene cs in Rest.main.SceneManager.Scenes) | 149 | Rest.main.SceneManager.ForEachScene(delegate(Scene s) |
145 | { | 150 | { |
146 | foreach (ScenePresence presence in cs.GetAvatars()) | 151 | s.ForEachScenePresence(delegate(ScenePresence sp) |
147 | { | 152 | { |
148 | if (presence.Firstname == names[0] && | 153 | if (sp.Firstname == names[0] && sp.Lastname == names[1]) |
149 | presence.Lastname == names[1]) | ||
150 | { | 154 | { |
151 | scene = cs; | 155 | scene = s; |
152 | avatar = presence; | 156 | presence = sp; |
153 | break; | ||
154 | } | 157 | } |
155 | } | 158 | }); |
156 | } | 159 | }); |
157 | 160 | ||
158 | if (avatar != null) | 161 | if (presence != null) |
159 | { | 162 | { |
160 | Rest.Log.DebugFormat("{0} Move : Avatar {1} located in region {2}", | 163 | Rest.Log.DebugFormat("{0} Move : Avatar {1} located in region {2}", |
161 | MsgId, rdata.Parameters[PARM_MOVE_AVATAR], scene.RegionInfo.RegionName); | 164 | MsgId, rdata.Parameters[PARM_MOVE_AVATAR], scene.RegionInfo.RegionName); |
@@ -166,14 +169,13 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory.Tests | |||
166 | float y = Convert.ToSingle(rdata.Parameters[PARM_MOVE_Y]); | 169 | float y = Convert.ToSingle(rdata.Parameters[PARM_MOVE_Y]); |
167 | float z = Convert.ToSingle(rdata.Parameters[PARM_MOVE_Z]); | 170 | float z = Convert.ToSingle(rdata.Parameters[PARM_MOVE_Z]); |
168 | Vector3 vector = new Vector3(x,y,z); | 171 | Vector3 vector = new Vector3(x,y,z); |
169 | avatar.DoAutoPilot(0,vector,avatar.ControllingClient); | 172 | presence.DoAutoPilot(0,vector,presence.ControllingClient); |
170 | } | 173 | } |
171 | catch (Exception e) | 174 | catch (Exception e) |
172 | { | 175 | { |
173 | rdata.Fail(Rest.HttpStatusCodeBadRequest, | 176 | rdata.Fail(Rest.HttpStatusCodeBadRequest, |
174 | String.Format("invalid parameters: {0}", e.Message)); | 177 | String.Format("invalid parameters: {0}", e.Message)); |
175 | } | 178 | } |
176 | |||
177 | } | 179 | } |
178 | else | 180 | else |
179 | { | 181 | { |
@@ -183,12 +185,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory.Tests | |||
183 | 185 | ||
184 | rdata.Complete(); | 186 | rdata.Complete(); |
185 | rdata.Respond("OK"); | 187 | rdata.Respond("OK"); |
186 | |||
187 | } | ||
188 | else | ||
189 | { | ||
190 | Rest.Log.WarnFormat("{0} Move: No movement information provided", MsgId); | ||
191 | rdata.Fail(Rest.HttpStatusCodeBadRequest, "no movement information provided"); | ||
192 | } | 188 | } |
193 | } | 189 | } |
194 | 190 | ||