diff options
Diffstat (limited to 'OpenSim/Server/Handlers/Simulation/AgentHandlers.cs')
-rw-r--r-- | OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 0c098d9..ab3250d 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | |||
@@ -52,6 +52,8 @@ namespace OpenSim.Server.Handlers.Simulation | |||
52 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 52 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
53 | private ISimulationService m_SimulationService; | 53 | private ISimulationService m_SimulationService; |
54 | 54 | ||
55 | public AgentHandler() { } | ||
56 | |||
55 | public AgentHandler(ISimulationService sim) | 57 | public AgentHandler(ISimulationService sim) |
56 | { | 58 | { |
57 | m_SimulationService = sim; | 59 | m_SimulationService = sim; |
@@ -117,7 +119,7 @@ namespace OpenSim.Server.Handlers.Simulation | |||
117 | 119 | ||
118 | } | 120 | } |
119 | 121 | ||
120 | protected virtual void DoAgentPost(Hashtable request, Hashtable responsedata, UUID id) | 122 | protected void DoAgentPost(Hashtable request, Hashtable responsedata, UUID id) |
121 | { | 123 | { |
122 | OSDMap args = Utils.GetOSDMap((string)request["body"]); | 124 | OSDMap args = Utils.GetOSDMap((string)request["body"]); |
123 | if (args == null) | 125 | if (args == null) |
@@ -171,7 +173,8 @@ namespace OpenSim.Server.Handlers.Simulation | |||
171 | 173 | ||
172 | // This is the meaning of POST agent | 174 | // This is the meaning of POST agent |
173 | //m_regionClient.AdjustUserInformation(aCircuit); | 175 | //m_regionClient.AdjustUserInformation(aCircuit); |
174 | bool result = m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason); | 176 | //bool result = m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason); |
177 | bool result = CreateAgent(destination, aCircuit, teleportFlags, out reason); | ||
175 | 178 | ||
176 | resp["reason"] = OSD.FromString(reason); | 179 | resp["reason"] = OSD.FromString(reason); |
177 | resp["success"] = OSD.FromBoolean(result); | 180 | resp["success"] = OSD.FromBoolean(result); |
@@ -181,7 +184,13 @@ namespace OpenSim.Server.Handlers.Simulation | |||
181 | responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp); | 184 | responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp); |
182 | } | 185 | } |
183 | 186 | ||
184 | protected virtual void DoAgentPut(Hashtable request, Hashtable responsedata) | 187 | // subclasses can override this |
188 | protected virtual bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, out string reason) | ||
189 | { | ||
190 | return m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason); | ||
191 | } | ||
192 | |||
193 | protected void DoAgentPut(Hashtable request, Hashtable responsedata) | ||
185 | { | 194 | { |
186 | OSDMap args = Utils.GetOSDMap((string)request["body"]); | 195 | OSDMap args = Utils.GetOSDMap((string)request["body"]); |
187 | if (args == null) | 196 | if (args == null) |
@@ -237,7 +246,7 @@ namespace OpenSim.Server.Handlers.Simulation | |||
237 | 246 | ||
238 | //agent.Dump(); | 247 | //agent.Dump(); |
239 | // This is one of the meanings of PUT agent | 248 | // This is one of the meanings of PUT agent |
240 | result = m_SimulationService.UpdateAgent(destination, agent); | 249 | result = UpdateAgent(destination, agent); |
241 | 250 | ||
242 | } | 251 | } |
243 | else if ("AgentPosition".Equals(messageType)) | 252 | else if ("AgentPosition".Equals(messageType)) |
@@ -263,6 +272,12 @@ namespace OpenSim.Server.Handlers.Simulation | |||
263 | //responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp); ??? instead | 272 | //responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp); ??? instead |
264 | } | 273 | } |
265 | 274 | ||
275 | // subclasses cab override this | ||
276 | protected virtual bool UpdateAgent(GridRegion destination, AgentData agent) | ||
277 | { | ||
278 | return m_SimulationService.UpdateAgent(destination, agent); | ||
279 | } | ||
280 | |||
266 | protected virtual void DoAgentGet(Hashtable request, Hashtable responsedata, UUID id, UUID regionID) | 281 | protected virtual void DoAgentGet(Hashtable request, Hashtable responsedata, UUID id, UUID regionID) |
267 | { | 282 | { |
268 | GridRegion destination = new GridRegion(); | 283 | GridRegion destination = new GridRegion(); |
@@ -305,7 +320,7 @@ namespace OpenSim.Server.Handlers.Simulation | |||
305 | } | 320 | } |
306 | } | 321 | } |
307 | 322 | ||
308 | protected virtual void DoAgentDelete(Hashtable request, Hashtable responsedata, UUID id, string action, UUID regionID) | 323 | protected void DoAgentDelete(Hashtable request, Hashtable responsedata, UUID id, string action, UUID regionID) |
309 | { | 324 | { |
310 | m_log.Debug(" >>> DoDelete action:" + action + "; RegionID:" + regionID); | 325 | m_log.Debug(" >>> DoDelete action:" + action + "; RegionID:" + regionID); |
311 | 326 | ||
@@ -313,7 +328,7 @@ namespace OpenSim.Server.Handlers.Simulation | |||
313 | destination.RegionID = regionID; | 328 | destination.RegionID = regionID; |
314 | 329 | ||
315 | if (action.Equals("release")) | 330 | if (action.Equals("release")) |
316 | m_SimulationService.ReleaseAgent(regionID, id, ""); | 331 | ReleaseAgent(regionID, id); |
317 | else | 332 | else |
318 | m_SimulationService.CloseAgent(destination, id); | 333 | m_SimulationService.CloseAgent(destination, id); |
319 | 334 | ||
@@ -322,6 +337,11 @@ namespace OpenSim.Server.Handlers.Simulation | |||
322 | 337 | ||
323 | m_log.Debug("[AGENT HANDLER]: Agent Released/Deleted."); | 338 | m_log.Debug("[AGENT HANDLER]: Agent Released/Deleted."); |
324 | } | 339 | } |
340 | |||
341 | protected virtual void ReleaseAgent(UUID regionID, UUID id) | ||
342 | { | ||
343 | m_SimulationService.ReleaseAgent(regionID, id, ""); | ||
344 | } | ||
325 | } | 345 | } |
326 | 346 | ||
327 | } | 347 | } |