diff options
Diffstat (limited to 'OpenSim/Server/Handlers/Simulation/AgentHandlers.cs')
-rw-r--r-- | OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 76 |
1 files changed, 50 insertions, 26 deletions
diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index ae37ca7..334d313 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | |||
@@ -328,31 +328,16 @@ namespace OpenSim.Server.Handlers.Simulation | |||
328 | return; | 328 | return; |
329 | } | 329 | } |
330 | 330 | ||
331 | // retrieve the input arguments | 331 | AgentDestinationData data = CreateAgentDestinationData(); |
332 | int x = 0, y = 0; | 332 | UnpackData(args, data, request); |
333 | UUID uuid = UUID.Zero; | ||
334 | string regionname = string.Empty; | ||
335 | uint teleportFlags = 0; | ||
336 | if (args.ContainsKey("destination_x") && args["destination_x"] != null) | ||
337 | Int32.TryParse(args["destination_x"].AsString(), out x); | ||
338 | else | ||
339 | m_log.WarnFormat(" -- request didn't have destination_x"); | ||
340 | if (args.ContainsKey("destination_y") && args["destination_y"] != null) | ||
341 | Int32.TryParse(args["destination_y"].AsString(), out y); | ||
342 | else | ||
343 | m_log.WarnFormat(" -- request didn't have destination_y"); | ||
344 | if (args.ContainsKey("destination_uuid") && args["destination_uuid"] != null) | ||
345 | UUID.TryParse(args["destination_uuid"].AsString(), out uuid); | ||
346 | if (args.ContainsKey("destination_name") && args["destination_name"] != null) | ||
347 | regionname = args["destination_name"].ToString(); | ||
348 | if (args.ContainsKey("teleport_flags") && args["teleport_flags"] != null) | ||
349 | teleportFlags = args["teleport_flags"].AsUInteger(); | ||
350 | 333 | ||
351 | GridRegion destination = new GridRegion(); | 334 | GridRegion destination = new GridRegion(); |
352 | destination.RegionID = uuid; | 335 | destination.RegionID = data.uuid; |
353 | destination.RegionLocX = x; | 336 | destination.RegionLocX = data.x; |
354 | destination.RegionLocY = y; | 337 | destination.RegionLocY = data.y; |
355 | destination.RegionName = regionname; | 338 | destination.RegionName = data.name; |
339 | |||
340 | GridRegion gatekeeper = ExtractGatekeeper(data); | ||
356 | 341 | ||
357 | AgentCircuitData aCircuit = new AgentCircuitData(); | 342 | AgentCircuitData aCircuit = new AgentCircuitData(); |
358 | try | 343 | try |
@@ -373,7 +358,7 @@ namespace OpenSim.Server.Handlers.Simulation | |||
373 | // This is the meaning of POST agent | 358 | // This is the meaning of POST agent |
374 | //m_regionClient.AdjustUserInformation(aCircuit); | 359 | //m_regionClient.AdjustUserInformation(aCircuit); |
375 | //bool result = m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason); | 360 | //bool result = m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason); |
376 | bool result = CreateAgent(destination, aCircuit, teleportFlags, out reason); | 361 | bool result = CreateAgent(gatekeeper, destination, aCircuit, data.flags, data.fromLogin, out reason); |
377 | 362 | ||
378 | resp["reason"] = OSD.FromString(reason); | 363 | resp["reason"] = OSD.FromString(reason); |
379 | resp["success"] = OSD.FromBoolean(result); | 364 | resp["success"] = OSD.FromBoolean(result); |
@@ -385,7 +370,36 @@ namespace OpenSim.Server.Handlers.Simulation | |||
385 | responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp); | 370 | responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp); |
386 | } | 371 | } |
387 | 372 | ||
388 | private string GetCallerIP(Hashtable request) | 373 | protected virtual AgentDestinationData CreateAgentDestinationData() |
374 | { | ||
375 | return new AgentDestinationData(); | ||
376 | } | ||
377 | |||
378 | protected virtual void UnpackData(OSDMap args, AgentDestinationData data, Hashtable request) | ||
379 | { | ||
380 | // retrieve the input arguments | ||
381 | if (args.ContainsKey("destination_x") && args["destination_x"] != null) | ||
382 | Int32.TryParse(args["destination_x"].AsString(), out data.x); | ||
383 | else | ||
384 | m_log.WarnFormat(" -- request didn't have destination_x"); | ||
385 | if (args.ContainsKey("destination_y") && args["destination_y"] != null) | ||
386 | Int32.TryParse(args["destination_y"].AsString(), out data.y); | ||
387 | else | ||
388 | m_log.WarnFormat(" -- request didn't have destination_y"); | ||
389 | if (args.ContainsKey("destination_uuid") && args["destination_uuid"] != null) | ||
390 | UUID.TryParse(args["destination_uuid"].AsString(), out data.uuid); | ||
391 | if (args.ContainsKey("destination_name") && args["destination_name"] != null) | ||
392 | data.name = args["destination_name"].ToString(); | ||
393 | if (args.ContainsKey("teleport_flags") && args["teleport_flags"] != null) | ||
394 | data.flags = args["teleport_flags"].AsUInteger(); | ||
395 | } | ||
396 | |||
397 | protected virtual GridRegion ExtractGatekeeper(AgentDestinationData data) | ||
398 | { | ||
399 | return null; | ||
400 | } | ||
401 | |||
402 | protected string GetCallerIP(Hashtable request) | ||
389 | { | 403 | { |
390 | if (!m_Proxy) | 404 | if (!m_Proxy) |
391 | return Util.GetCallerIP(request); | 405 | return Util.GetCallerIP(request); |
@@ -418,7 +432,7 @@ namespace OpenSim.Server.Handlers.Simulation | |||
418 | } | 432 | } |
419 | 433 | ||
420 | // subclasses can override this | 434 | // subclasses can override this |
421 | protected virtual bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, out string reason) | 435 | protected virtual bool CreateAgent(GridRegion gatekeeper, GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, bool fromLogin, out string reason) |
422 | { | 436 | { |
423 | return m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason); | 437 | return m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason); |
424 | } | 438 | } |
@@ -593,4 +607,14 @@ namespace OpenSim.Server.Handlers.Simulation | |||
593 | return m_SimulationService.UpdateAgent(destination, agent); | 607 | return m_SimulationService.UpdateAgent(destination, agent); |
594 | } | 608 | } |
595 | } | 609 | } |
610 | |||
611 | public class AgentDestinationData | ||
612 | { | ||
613 | public int x; | ||
614 | public int y; | ||
615 | public string name; | ||
616 | public UUID uuid; | ||
617 | public uint flags; | ||
618 | public bool fromLogin; | ||
619 | } | ||
596 | } | 620 | } |