aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Server
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Server')
-rw-r--r--OpenSim/Server/Handlers/Simulation/AgentHandlers.cs124
1 files changed, 66 insertions, 58 deletions
diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
index 1c1930a..788bd3d 100644
--- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
+++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
@@ -115,15 +115,10 @@ namespace OpenSim.Server.Handlers.Simulation
115 115
116 return responsedata; 116 return responsedata;
117 } 117 }
118
119 } 118 }
120 119
121 protected virtual void DoQueryAccess(Hashtable request, Hashtable responsedata, UUID agentID, UUID regionID) 120 protected virtual void DoQueryAccess(Hashtable request, Hashtable responsedata, UUID agentID, UUID regionID)
122 { 121 {
123 Culture.SetCurrentCulture();
124
125 EntityTransferContext ctx = new EntityTransferContext();
126
127 if (m_SimulationService == null) 122 if (m_SimulationService == null)
128 { 123 {
129 m_log.Debug("[AGENT HANDLER]: Agent QUERY called. Harmless but useless."); 124 m_log.Debug("[AGENT HANDLER]: Agent QUERY called. Harmless but useless.");
@@ -134,33 +129,37 @@ namespace OpenSim.Server.Handlers.Simulation
134 return; 129 return;
135 } 130 }
136 131
132 Culture.SetCurrentCulture();
133
137 // m_log.DebugFormat("[AGENT HANDLER]: Received QUERYACCESS with {0}", (string)request["body"]); 134 // m_log.DebugFormat("[AGENT HANDLER]: Received QUERYACCESS with {0}", (string)request["body"]);
138 OSDMap args = Utils.GetOSDMap((string)request["body"]); 135 OSDMap args = Utils.GetOSDMap((string)request["body"]);
139 136
140 bool viaTeleport = true; 137 bool viaTeleport = true;
141 if (args.ContainsKey("viaTeleport")) 138 OSD tmpOSD;
142 viaTeleport = args["viaTeleport"].AsBoolean(); 139 if (args.TryGetValue("viaTeleport",out tmpOSD))
140 viaTeleport = tmpOSD.AsBoolean();
143 141
144 Vector3 position = Vector3.Zero; 142 Vector3 position = Vector3.Zero;
145 if (args.ContainsKey("position")) 143 if (args.TryGetValue("position", out tmpOSD))
146 position = Vector3.Parse(args["position"].AsString()); 144 position = Vector3.Parse(tmpOSD.AsString());
147 145
148 string agentHomeURI = null; 146 string agentHomeURI = null;
149 if (args.ContainsKey("agent_home_uri")) 147 if (args.TryGetValue("agent_home_uri", out tmpOSD))
150 agentHomeURI = args["agent_home_uri"].AsString(); 148 agentHomeURI = tmpOSD.AsString();
151 149
152 // Decode the legacy (string) version and extract the number 150 // Decode the legacy (string) version and extract the number
153 float theirVersion = 0f; 151 float theirVersion = 0f;
154 if (args.ContainsKey("my_version")) 152 if (args.TryGetValue("my_version", out tmpOSD))
155 { 153 {
156 string theirVersionStr = args["my_version"].AsString(); 154 string theirVersionStr = tmpOSD.AsString();
157 string[] parts = theirVersionStr.Split(new char[] {'/'}); 155 string[] parts = theirVersionStr.Split(new char[] {'/'});
158 if (parts.Length > 1) 156 if (parts.Length > 1)
159 theirVersion = float.Parse(parts[1], Culture.FormatProvider); 157 theirVersion = float.Parse(parts[1], Culture.FormatProvider);
160 } 158 }
161 159
162 if (args.ContainsKey("context")) 160 EntityTransferContext ctx = new EntityTransferContext();
163 ctx.Unpack((OSDMap)args["context"]); 161 if (args.TryGetValue("context", out tmpOSD) && tmpOSD is OSDMap)
162 ctx.Unpack((OSDMap)tmpOSD);
164 163
165 // Decode the new versioning data 164 // Decode the new versioning data
166 float minVersionRequired = 0f; 165 float minVersionRequired = 0f;
@@ -168,15 +167,15 @@ namespace OpenSim.Server.Handlers.Simulation
168 float minVersionProvided = 0f; 167 float minVersionProvided = 0f;
169 float maxVersionProvided = 0f; 168 float maxVersionProvided = 0f;
170 169
171 if (args.ContainsKey("simulation_service_supported_min")) 170 if (args.TryGetValue("simulation_service_supported_min", out tmpOSD))
172 minVersionProvided = (float)args["simulation_service_supported_min"].AsReal(); 171 minVersionProvided = (float)tmpOSD.AsReal();
173 if (args.ContainsKey("simulation_service_supported_max")) 172 if (args.TryGetValue("simulation_service_supported_max", out tmpOSD))
174 maxVersionProvided = (float)args["simulation_service_supported_max"].AsReal(); 173 maxVersionProvided = (float)tmpOSD.AsReal();
175 174
176 if (args.ContainsKey("simulation_service_accepted_min")) 175 if (args.TryGetValue("simulation_service_accepted_min", out tmpOSD))
177 minVersionRequired = (float)args["simulation_service_accepted_min"].AsReal(); 176 minVersionRequired = (float)tmpOSD.AsReal();
178 if (args.ContainsKey("simulation_service_accepted_max")) 177 if (args.TryGetValue("simulation_service_accepted_max", out tmpOSD))
179 maxVersionRequired = (float)args["simulation_service_accepted_max"].AsReal(); 178 maxVersionRequired = (float)tmpOSD.AsReal();
180 179
181 responsedata["int_response_code"] = HttpStatusCode.OK; 180 responsedata["int_response_code"] = HttpStatusCode.OK;
182 OSDMap resp = new OSDMap(3); 181 OSDMap resp = new OSDMap(3);
@@ -239,9 +238,9 @@ namespace OpenSim.Server.Handlers.Simulation
239 238
240 List<UUID> features = new List<UUID>(); 239 List<UUID> features = new List<UUID>();
241 240
242 if (args.ContainsKey("features")) 241 if (args.TryGetValue("features", out tmpOSD) && tmpOSD is OSDArray)
243 { 242 {
244 OSDArray array = (OSDArray)args["features"]; 243 OSDArray array = (OSDArray)tmpOSD;
245 244
246 foreach (OSD o in array) 245 foreach (OSD o in array)
247 features.Add(new UUID(o.AsString())); 246 features.Add(new UUID(o.AsString()));
@@ -414,8 +413,6 @@ namespace OpenSim.Server.Handlers.Simulation
414 413
415 protected void DoAgentPost(Hashtable request, Hashtable responsedata, UUID id) 414 protected void DoAgentPost(Hashtable request, Hashtable responsedata, UUID id)
416 { 415 {
417 EntityTransferContext ctx = new EntityTransferContext();
418
419 OSDMap args = Utils.GetOSDMap((string)request["body"]); 416 OSDMap args = Utils.GetOSDMap((string)request["body"]);
420 if (args == null) 417 if (args == null)
421 { 418 {
@@ -424,8 +421,10 @@ namespace OpenSim.Server.Handlers.Simulation
424 return; 421 return;
425 } 422 }
426 423
427 if (args.ContainsKey("context")) 424 OSD tmpOSD;
428 ctx.Unpack((OSDMap)args["context"]); 425 EntityTransferContext ctx = new EntityTransferContext();
426 if (args.TryGetValue("context", out tmpOSD) && tmpOSD is OSDMap)
427 ctx.Unpack((OSDMap)tmpOSD);
429 428
430 AgentDestinationData data = CreateAgentDestinationData(); 429 AgentDestinationData data = CreateAgentDestinationData();
431 UnpackData(args, data, request); 430 UnpackData(args, data, request);
@@ -453,16 +452,19 @@ namespace OpenSim.Server.Handlers.Simulation
453 452
454 GridRegion source = null; 453 GridRegion source = null;
455 454
456 if (args.ContainsKey("source_uuid")) 455 if (args.TryGetValue("source_uuid", out tmpOSD))
457 { 456 {
458 source = new GridRegion(); 457 source = new GridRegion();
459 source.RegionLocX = Int32.Parse(args["source_x"].AsString()); 458 source.RegionID = UUID.Parse(tmpOSD.AsString());
460 source.RegionLocY = Int32.Parse(args["source_y"].AsString()); 459 tmpOSD = args["source_x"];
461 source.RegionName = args["source_name"].AsString(); 460 source.RegionLocX = Int32.Parse(tmpOSD.AsString());
462 source.RegionID = UUID.Parse(args["source_uuid"].AsString()); 461 tmpOSD = args["source_y"];
463 462 source.RegionLocY = Int32.Parse(tmpOSD.AsString());
464 if (args.ContainsKey("source_server_uri")) 463 tmpOSD = args["source_name"];
465 source.RawServerURI = args["source_server_uri"].AsString(); 464 source.RegionName = tmpOSD.AsString();
465
466 if (args.TryGetValue("source_server_uri", out tmpOSD))
467 source.RawServerURI = tmpOSD.AsString();
466 else 468 else
467 source.RawServerURI = null; 469 source.RawServerURI = null;
468 } 470 }
@@ -493,21 +495,26 @@ namespace OpenSim.Server.Handlers.Simulation
493 495
494 protected virtual void UnpackData(OSDMap args, AgentDestinationData data, Hashtable request) 496 protected virtual void UnpackData(OSDMap args, AgentDestinationData data, Hashtable request)
495 { 497 {
498 OSD tmpOSD;
496 // retrieve the input arguments 499 // retrieve the input arguments
497 if (args.ContainsKey("destination_x") && args["destination_x"] != null) 500 if (args.TryGetValue("destination_x", out tmpOSD) && tmpOSD != null)
498 Int32.TryParse(args["destination_x"].AsString(), out data.x); 501 Int32.TryParse(tmpOSD.AsString(), out data.x);
499 else 502 else
500 m_log.WarnFormat(" -- request didn't have destination_x"); 503 m_log.WarnFormat(" -- request didn't have destination_x");
501 if (args.ContainsKey("destination_y") && args["destination_y"] != null) 504
502 Int32.TryParse(args["destination_y"].AsString(), out data.y); 505 if (args.TryGetValue("destination_y", out tmpOSD) && tmpOSD != null)
506 Int32.TryParse(tmpOSD.AsString(), out data.y);
503 else 507 else
504 m_log.WarnFormat(" -- request didn't have destination_y"); 508 m_log.WarnFormat(" -- request didn't have destination_y");
505 if (args.ContainsKey("destination_uuid") && args["destination_uuid"] != null) 509
506 UUID.TryParse(args["destination_uuid"].AsString(), out data.uuid); 510 if (args.TryGetValue("destination_uuid", out tmpOSD) && tmpOSD != null)
507 if (args.ContainsKey("destination_name") && args["destination_name"] != null) 511 UUID.TryParse(tmpOSD.AsString(), out data.uuid);
508 data.name = args["destination_name"].ToString(); 512
509 if (args.ContainsKey("teleport_flags") && args["teleport_flags"] != null) 513 if (args.TryGetValue("destination_name", out tmpOSD) && tmpOSD != null)
510 data.flags = args["teleport_flags"].AsUInteger(); 514 data.name = tmpOSD.ToString();
515
516 if (args.TryGetValue("teleport_flags", out tmpOSD) && tmpOSD != null)
517 data.flags = tmpOSD.AsUInteger();
511 } 518 }
512 519
513 protected virtual GridRegion ExtractGatekeeper(AgentDestinationData data) 520 protected virtual GridRegion ExtractGatekeeper(AgentDestinationData data)
@@ -674,7 +681,6 @@ namespace OpenSim.Server.Handlers.Simulation
674 protected void DoAgentPut(Hashtable request, Hashtable responsedata) 681 protected void DoAgentPut(Hashtable request, Hashtable responsedata)
675 { 682 {
676 // TODO: Encode the ENtityTransferContext 683 // TODO: Encode the ENtityTransferContext
677 EntityTransferContext ctx = new EntityTransferContext();
678 684
679 OSDMap args = Utils.GetOSDMap((string)request["body"]); 685 OSDMap args = Utils.GetOSDMap((string)request["body"]);
680 if (args == null) 686 if (args == null)
@@ -685,19 +691,21 @@ namespace OpenSim.Server.Handlers.Simulation
685 } 691 }
686 692
687 // retrieve the input arguments 693 // retrieve the input arguments
694 OSD tmpOSD;
695 EntityTransferContext ctx = new EntityTransferContext();
688 int x = 0, y = 0; 696 int x = 0, y = 0;
689 UUID uuid = UUID.Zero; 697 UUID uuid = UUID.Zero;
690 string regionname = string.Empty; 698 string regionname = string.Empty;
691 if (args.ContainsKey("destination_x") && args["destination_x"] != null) 699 if (args.TryGetValue("destination_x", out tmpOSD) && tmpOSD != null)
692 Int32.TryParse(args["destination_x"].AsString(), out x); 700 Int32.TryParse(tmpOSD.AsString(), out x);
693 if (args.ContainsKey("destination_y") && args["destination_y"] != null) 701 if (args.TryGetValue("destination_y", out tmpOSD) && tmpOSD != null)
694 Int32.TryParse(args["destination_y"].AsString(), out y); 702 Int32.TryParse(tmpOSD.AsString(), out y);
695 if (args.ContainsKey("destination_uuid") && args["destination_uuid"] != null) 703 if (args.TryGetValue("destination_uuid", out tmpOSD) && tmpOSD != null)
696 UUID.TryParse(args["destination_uuid"].AsString(), out uuid); 704 UUID.TryParse(tmpOSD.AsString(), out uuid);
697 if (args.ContainsKey("destination_name") && args["destination_name"] != null) 705 if (args.TryGetValue("destination_name", out tmpOSD) && tmpOSD != null)
698 regionname = args["destination_name"].ToString(); 706 regionname = tmpOSD.ToString();
699 if (args.ContainsKey("context")) 707 if (args.TryGetValue("context", out tmpOSD) && tmpOSD is OSDMap)
700 ctx.Unpack((OSDMap)args["context"]); 708 ctx.Unpack((OSDMap)tmpOSD);
701 709
702 GridRegion destination = new GridRegion(); 710 GridRegion destination = new GridRegion();
703 destination.RegionID = uuid; 711 destination.RegionID = uuid;