diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 77 |
1 files changed, 50 insertions, 27 deletions
diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 9b34298..c62f256 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | |||
@@ -351,31 +351,16 @@ namespace OpenSim.Server.Handlers.Simulation | |||
351 | return; | 351 | return; |
352 | } | 352 | } |
353 | 353 | ||
354 | // retrieve the input arguments | 354 | AgentDestinationData data = CreateAgentDestinationData(); |
355 | int x = 0, y = 0; | 355 | UnpackData(args, data, request); |
356 | UUID uuid = UUID.Zero; | ||
357 | string regionname = string.Empty; | ||
358 | uint teleportFlags = 0; | ||
359 | if (args.ContainsKey("destination_x") && args["destination_x"] != null) | ||
360 | Int32.TryParse(args["destination_x"].AsString(), out x); | ||
361 | else | ||
362 | m_log.WarnFormat(" -- request didn't have destination_x"); | ||
363 | if (args.ContainsKey("destination_y") && args["destination_y"] != null) | ||
364 | Int32.TryParse(args["destination_y"].AsString(), out y); | ||
365 | else | ||
366 | m_log.WarnFormat(" -- request didn't have destination_y"); | ||
367 | if (args.ContainsKey("destination_uuid") && args["destination_uuid"] != null) | ||
368 | UUID.TryParse(args["destination_uuid"].AsString(), out uuid); | ||
369 | if (args.ContainsKey("destination_name") && args["destination_name"] != null) | ||
370 | regionname = args["destination_name"].ToString(); | ||
371 | if (args.ContainsKey("teleport_flags") && args["teleport_flags"] != null) | ||
372 | teleportFlags = args["teleport_flags"].AsUInteger(); | ||
373 | 356 | ||
374 | GridRegion destination = new GridRegion(); | 357 | GridRegion destination = new GridRegion(); |
375 | destination.RegionID = uuid; | 358 | destination.RegionID = data.uuid; |
376 | destination.RegionLocX = x; | 359 | destination.RegionLocX = data.x; |
377 | destination.RegionLocY = y; | 360 | destination.RegionLocY = data.y; |
378 | destination.RegionName = regionname; | 361 | destination.RegionName = data.name; |
362 | |||
363 | GridRegion gatekeeper = ExtractGatekeeper(data); | ||
379 | 364 | ||
380 | AgentCircuitData aCircuit = new AgentCircuitData(); | 365 | AgentCircuitData aCircuit = new AgentCircuitData(); |
381 | try | 366 | try |
@@ -396,7 +381,7 @@ namespace OpenSim.Server.Handlers.Simulation | |||
396 | // This is the meaning of POST agent | 381 | // This is the meaning of POST agent |
397 | //m_regionClient.AdjustUserInformation(aCircuit); | 382 | //m_regionClient.AdjustUserInformation(aCircuit); |
398 | //bool result = m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason); | 383 | //bool result = m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason); |
399 | bool result = CreateAgent(destination, aCircuit, teleportFlags, out reason); | 384 | bool result = CreateAgent(gatekeeper, destination, aCircuit, data.flags, data.fromLogin, out reason); |
400 | 385 | ||
401 | resp["reason"] = OSD.FromString(reason); | 386 | resp["reason"] = OSD.FromString(reason); |
402 | resp["success"] = OSD.FromBoolean(result); | 387 | resp["success"] = OSD.FromBoolean(result); |
@@ -408,7 +393,36 @@ namespace OpenSim.Server.Handlers.Simulation | |||
408 | responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp); | 393 | responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp); |
409 | } | 394 | } |
410 | 395 | ||
411 | private string GetCallerIP(Hashtable request) | 396 | protected virtual AgentDestinationData CreateAgentDestinationData() |
397 | { | ||
398 | return new AgentDestinationData(); | ||
399 | } | ||
400 | |||
401 | protected virtual void UnpackData(OSDMap args, AgentDestinationData data, Hashtable request) | ||
402 | { | ||
403 | // retrieve the input arguments | ||
404 | if (args.ContainsKey("destination_x") && args["destination_x"] != null) | ||
405 | Int32.TryParse(args["destination_x"].AsString(), out data.x); | ||
406 | else | ||
407 | m_log.WarnFormat(" -- request didn't have destination_x"); | ||
408 | if (args.ContainsKey("destination_y") && args["destination_y"] != null) | ||
409 | Int32.TryParse(args["destination_y"].AsString(), out data.y); | ||
410 | else | ||
411 | m_log.WarnFormat(" -- request didn't have destination_y"); | ||
412 | if (args.ContainsKey("destination_uuid") && args["destination_uuid"] != null) | ||
413 | UUID.TryParse(args["destination_uuid"].AsString(), out data.uuid); | ||
414 | if (args.ContainsKey("destination_name") && args["destination_name"] != null) | ||
415 | data.name = args["destination_name"].ToString(); | ||
416 | if (args.ContainsKey("teleport_flags") && args["teleport_flags"] != null) | ||
417 | data.flags = args["teleport_flags"].AsUInteger(); | ||
418 | } | ||
419 | |||
420 | protected virtual GridRegion ExtractGatekeeper(AgentDestinationData data) | ||
421 | { | ||
422 | return null; | ||
423 | } | ||
424 | |||
425 | protected string GetCallerIP(Hashtable request) | ||
412 | { | 426 | { |
413 | if (!m_Proxy) | 427 | if (!m_Proxy) |
414 | return Util.GetCallerIP(request); | 428 | return Util.GetCallerIP(request); |
@@ -441,7 +455,7 @@ namespace OpenSim.Server.Handlers.Simulation | |||
441 | } | 455 | } |
442 | 456 | ||
443 | // subclasses can override this | 457 | // subclasses can override this |
444 | protected virtual bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, out string reason) | 458 | protected virtual bool CreateAgent(GridRegion gatekeeper, GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, bool fromLogin, out string reason) |
445 | { | 459 | { |
446 | reason = String.Empty; | 460 | reason = String.Empty; |
447 | 461 | ||
@@ -593,7 +607,6 @@ namespace OpenSim.Server.Handlers.Simulation | |||
593 | //agent.Dump(); | 607 | //agent.Dump(); |
594 | // This is one of the meanings of PUT agent | 608 | // This is one of the meanings of PUT agent |
595 | result = UpdateAgent(destination, agent); | 609 | result = UpdateAgent(destination, agent); |
596 | |||
597 | } | 610 | } |
598 | else if ("AgentPosition".Equals(messageType)) | 611 | else if ("AgentPosition".Equals(messageType)) |
599 | { | 612 | { |
@@ -624,4 +637,14 @@ namespace OpenSim.Server.Handlers.Simulation | |||
624 | return m_SimulationService.UpdateAgent(destination, agent); | 637 | return m_SimulationService.UpdateAgent(destination, agent); |
625 | } | 638 | } |
626 | } | 639 | } |
640 | |||
641 | public class AgentDestinationData | ||
642 | { | ||
643 | public int x; | ||
644 | public int y; | ||
645 | public string name; | ||
646 | public UUID uuid; | ||
647 | public uint flags; | ||
648 | public bool fromLogin; | ||
649 | } | ||
627 | } | 650 | } |