diff options
Diffstat (limited to 'OpenSim/Server/Handlers/Simulation')
-rw-r--r-- | OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 11 | ||||
-rw-r--r-- | OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs | 50 |
2 files changed, 8 insertions, 53 deletions
diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 8f6fa52..d772c39 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | |||
@@ -149,13 +149,16 @@ namespace OpenSim.Server.Handlers.Simulation | |||
149 | 149 | ||
150 | responsedata["int_response_code"] = HttpStatusCode.OK; | 150 | responsedata["int_response_code"] = HttpStatusCode.OK; |
151 | 151 | ||
152 | OSDMap resp = new OSDMap(2); | 152 | OSDMap resp = new OSDMap(3); |
153 | 153 | ||
154 | resp["success"] = OSD.FromBoolean(result); | 154 | resp["success"] = OSD.FromBoolean(result); |
155 | resp["reason"] = OSD.FromString(reason); | 155 | resp["reason"] = OSD.FromString(reason); |
156 | resp["version"] = OSD.FromString(version); | 156 | resp["version"] = OSD.FromString(version); |
157 | 157 | ||
158 | responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp); | 158 | // We must preserve defaults here, otherwise a false "success" will not be put into the JSON map! |
159 | responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp, true); | ||
160 | |||
161 | // Console.WriteLine("str_response_string [{0}]", responsedata["str_response_string"]); | ||
159 | } | 162 | } |
160 | 163 | ||
161 | protected virtual void DoAgentGet(Hashtable request, Hashtable responsedata, UUID id, UUID regionID) | 164 | protected virtual void DoAgentGet(Hashtable request, Hashtable responsedata, UUID id, UUID regionID) |
@@ -569,7 +572,7 @@ namespace OpenSim.Server.Handlers.Simulation | |||
569 | AgentData agent = new AgentData(); | 572 | AgentData agent = new AgentData(); |
570 | try | 573 | try |
571 | { | 574 | { |
572 | agent.Unpack(args, m_SimulationService.GetScene(destination.RegionHandle)); | 575 | agent.Unpack(args, m_SimulationService.GetScene(destination.RegionID)); |
573 | } | 576 | } |
574 | catch (Exception ex) | 577 | catch (Exception ex) |
575 | { | 578 | { |
@@ -589,7 +592,7 @@ namespace OpenSim.Server.Handlers.Simulation | |||
589 | AgentPosition agent = new AgentPosition(); | 592 | AgentPosition agent = new AgentPosition(); |
590 | try | 593 | try |
591 | { | 594 | { |
592 | agent.Unpack(args, m_SimulationService.GetScene(destination.RegionHandle)); | 595 | agent.Unpack(args, m_SimulationService.GetScene(destination.RegionID)); |
593 | } | 596 | } |
594 | catch (Exception ex) | 597 | catch (Exception ex) |
595 | { | 598 | { |
diff --git a/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs b/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs index f0d8f69..dbb1a15 100644 --- a/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs | |||
@@ -93,11 +93,6 @@ namespace OpenSim.Server.Handlers.Simulation | |||
93 | DoObjectPost(request, responsedata, regionID); | 93 | DoObjectPost(request, responsedata, regionID); |
94 | return responsedata; | 94 | return responsedata; |
95 | } | 95 | } |
96 | else if (method.Equals("PUT")) | ||
97 | { | ||
98 | DoObjectPut(request, responsedata, regionID); | ||
99 | return responsedata; | ||
100 | } | ||
101 | //else if (method.Equals("DELETE")) | 96 | //else if (method.Equals("DELETE")) |
102 | //{ | 97 | //{ |
103 | // DoObjectDelete(request, responsedata, agentID, action, regionHandle); | 98 | // DoObjectDelete(request, responsedata, agentID, action, regionHandle); |
@@ -161,7 +156,7 @@ namespace OpenSim.Server.Handlers.Simulation | |||
161 | if (args.ContainsKey("extra") && args["extra"] != null) | 156 | if (args.ContainsKey("extra") && args["extra"] != null) |
162 | extraStr = args["extra"].AsString(); | 157 | extraStr = args["extra"].AsString(); |
163 | 158 | ||
164 | IScene s = m_SimulationService.GetScene(destination.RegionHandle); | 159 | IScene s = m_SimulationService.GetScene(destination.RegionID); |
165 | ISceneObject sog = null; | 160 | ISceneObject sog = null; |
166 | try | 161 | try |
167 | { | 162 | { |
@@ -219,48 +214,5 @@ namespace OpenSim.Server.Handlers.Simulation | |||
219 | { | 214 | { |
220 | return m_SimulationService.CreateObject(destination, newPosition, sog, false); | 215 | return m_SimulationService.CreateObject(destination, newPosition, sog, false); |
221 | } | 216 | } |
222 | |||
223 | protected virtual void DoObjectPut(Hashtable request, Hashtable responsedata, UUID regionID) | ||
224 | { | ||
225 | OSDMap args = Utils.GetOSDMap((string)request["body"]); | ||
226 | if (args == null) | ||
227 | { | ||
228 | responsedata["int_response_code"] = 400; | ||
229 | responsedata["str_response_string"] = "false"; | ||
230 | return; | ||
231 | } | ||
232 | |||
233 | // retrieve the input arguments | ||
234 | int x = 0, y = 0; | ||
235 | UUID uuid = UUID.Zero; | ||
236 | string regionname = string.Empty; | ||
237 | if (args.ContainsKey("destination_x") && args["destination_x"] != null) | ||
238 | Int32.TryParse(args["destination_x"].AsString(), out x); | ||
239 | if (args.ContainsKey("destination_y") && args["destination_y"] != null) | ||
240 | Int32.TryParse(args["destination_y"].AsString(), out y); | ||
241 | if (args.ContainsKey("destination_uuid") && args["destination_uuid"] != null) | ||
242 | UUID.TryParse(args["destination_uuid"].AsString(), out uuid); | ||
243 | if (args.ContainsKey("destination_name") && args["destination_name"] != null) | ||
244 | regionname = args["destination_name"].ToString(); | ||
245 | |||
246 | GridRegion destination = new GridRegion(); | ||
247 | destination.RegionID = uuid; | ||
248 | destination.RegionLocX = x; | ||
249 | destination.RegionLocY = y; | ||
250 | destination.RegionName = regionname; | ||
251 | |||
252 | UUID userID = UUID.Zero, itemID = UUID.Zero; | ||
253 | if (args.ContainsKey("userid") && args["userid"] != null) | ||
254 | userID = args["userid"].AsUUID(); | ||
255 | if (args.ContainsKey("itemid") && args["itemid"] != null) | ||
256 | itemID = args["itemid"].AsUUID(); | ||
257 | |||
258 | // This is the meaning of PUT object | ||
259 | bool result = m_SimulationService.CreateObject(destination, userID, itemID); | ||
260 | |||
261 | responsedata["int_response_code"] = 200; | ||
262 | responsedata["str_response_string"] = result.ToString(); | ||
263 | } | ||
264 | |||
265 | } | 217 | } |
266 | } | 218 | } |