aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/AgentCircuitData.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/AgentCircuitData.cs')
-rw-r--r--OpenSim/Framework/AgentCircuitData.cs133
1 files changed, 69 insertions, 64 deletions
diff --git a/OpenSim/Framework/AgentCircuitData.cs b/OpenSim/Framework/AgentCircuitData.cs
index 330a41e..ebb00d2 100644
--- a/OpenSim/Framework/AgentCircuitData.cs
+++ b/OpenSim/Framework/AgentCircuitData.cs
@@ -267,16 +267,17 @@ namespace OpenSim.Framework
267 /// <param name="args"></param> 267 /// <param name="args"></param>
268 public void UnpackAgentCircuitData(OSDMap args) 268 public void UnpackAgentCircuitData(OSDMap args)
269 { 269 {
270 if (args["agent_id"] != null) 270 OSD tmpOSD;
271 AgentID = args["agent_id"].AsUUID(); 271 if (args.TryGetValue("agent_id", out tmpOSD))
272 if (args["base_folder"] != null) 272 AgentID = tmpOSD.AsUUID();
273 BaseFolder = args["base_folder"].AsUUID(); 273 if (args.TryGetValue("base_folder", out tmpOSD))
274 if (args["caps_path"] != null) 274 BaseFolder =tmpOSD.AsUUID();
275 CapsPath = args["caps_path"].AsString(); 275 if (args.TryGetValue("caps_path", out tmpOSD))
276 276 CapsPath = tmpOSD.AsString();
277 if ((args["children_seeds"] != null) && (args["children_seeds"].Type == OSDType.Array)) 277
278 if ((args.TryGetValue("children_seeds", out tmpOSD) && tmpOSD is OSDArray))
278 { 279 {
279 OSDArray childrenSeeds = (OSDArray)(args["children_seeds"]); 280 OSDArray childrenSeeds = (OSDArray)tmpOSD;
280 ChildrenCapSeeds = new Dictionary<ulong, string>(); 281 ChildrenCapSeeds = new Dictionary<ulong, string>();
281 foreach (OSD o in childrenSeeds) 282 foreach (OSD o in childrenSeeds)
282 { 283 {
@@ -285,53 +286,59 @@ namespace OpenSim.Framework
285 ulong handle = 0; 286 ulong handle = 0;
286 string seed = ""; 287 string seed = "";
287 OSDMap pair = (OSDMap)o; 288 OSDMap pair = (OSDMap)o;
288 if (pair["handle"] != null) 289 if (pair.TryGetValue("handle", out tmpOSD))
289 if (!UInt64.TryParse(pair["handle"].AsString(), out handle)) 290 {
291 if (!UInt64.TryParse(tmpOSD.AsString(), out handle))
290 continue; 292 continue;
291 if (pair["seed"] != null) 293 }
292 seed = pair["seed"].AsString();
293 if (!ChildrenCapSeeds.ContainsKey(handle)) 294 if (!ChildrenCapSeeds.ContainsKey(handle))
294 ChildrenCapSeeds.Add(handle, seed); 295 {
296 if (pair.TryGetValue("seed", out tmpOSD))
297 {
298 seed = tmpOSD.AsString();
299 ChildrenCapSeeds.Add(handle, seed);
300 }
301 }
295 } 302 }
296 } 303 }
297 } 304 }
298 else 305 else
299 ChildrenCapSeeds = new Dictionary<ulong, string>(); 306 ChildrenCapSeeds = new Dictionary<ulong, string>();
300 307
301 if (args["child"] != null) 308 if (args.TryGetValue("child", out tmpOSD))
302 child = args["child"].AsBoolean(); 309 child = tmpOSD.AsBoolean();
303 if (args["circuit_code"] != null) 310 if (args.TryGetValue("circuit_code", out tmpOSD))
304 UInt32.TryParse(args["circuit_code"].AsString(), out circuitcode); 311 UInt32.TryParse(tmpOSD.AsString(), out circuitcode);
305 if (args["first_name"] != null) 312 if (args.TryGetValue("first_name", out tmpOSD))
306 firstname = args["first_name"].AsString(); 313 firstname = tmpOSD.AsString();
307 if (args["last_name"] != null) 314 if (args.TryGetValue("last_name", out tmpOSD))
308 lastname = args["last_name"].AsString(); 315 lastname = tmpOSD.AsString();
309 if (args["inventory_folder"] != null) 316 if (args.TryGetValue("inventory_folder", out tmpOSD))
310 InventoryFolder = args["inventory_folder"].AsUUID(); 317 InventoryFolder = tmpOSD.AsUUID();
311 if (args["secure_session_id"] != null) 318 if (args.TryGetValue("secure_session_id", out tmpOSD))
312 SecureSessionID = args["secure_session_id"].AsUUID(); 319 SecureSessionID = tmpOSD.AsUUID();
313 if (args["session_id"] != null) 320 if (args.TryGetValue("session_id", out tmpOSD))
314 SessionID = args["session_id"].AsUUID(); 321 SessionID = tmpOSD.AsUUID();
315 if (args["service_session_id"] != null) 322 if (args.TryGetValue("service_session_id", out tmpOSD))
316 ServiceSessionID = args["service_session_id"].AsString(); 323 ServiceSessionID = tmpOSD.AsString();
317 if (args["client_ip"] != null) 324 if (args.TryGetValue("client_ip", out tmpOSD))
318 IPAddress = args["client_ip"].AsString(); 325 IPAddress = tmpOSD.AsString();
319 if (args["viewer"] != null) 326 if (args.TryGetValue("viewer", out tmpOSD))
320 Viewer = args["viewer"].AsString(); 327 Viewer = tmpOSD.AsString();
321 if (args["channel"] != null) 328 if (args.TryGetValue("channel", out tmpOSD))
322 Channel = args["channel"].AsString(); 329 Channel = tmpOSD.AsString();
323 if (args["mac"] != null) 330 if (args.TryGetValue("mac", out tmpOSD))
324 Mac = args["mac"].AsString(); 331 Mac = tmpOSD.AsString();
325 if (args["id0"] != null) 332 if (args.TryGetValue("id0", out tmpOSD))
326 Id0 = args["id0"].AsString(); 333 Id0 = tmpOSD.AsString();
327 if (args["teleport_flags"] != null) 334 if (args.TryGetValue("teleport_flags", out tmpOSD))
328 teleportFlags = args["teleport_flags"].AsUInteger(); 335 teleportFlags = tmpOSD.AsUInteger();
329 336
330 if (args["start_pos"] != null) 337 if (args.TryGetValue("start_pos", out tmpOSD))
331 Vector3.TryParse(args["start_pos"].AsString(), out startpos); 338 Vector3.TryParse(tmpOSD.AsString(), out startpos);
332 339
333 if(args["far"] != null) 340 if(args.TryGetValue("far", out tmpOSD))
334 startfar = (float)args["far"].AsReal(); 341 startfar = (float)tmpOSD.AsReal();
335 342
336 //m_log.InfoFormat("[AGENTCIRCUITDATA]: agentid={0}, child={1}, startpos={2}", AgentID, child, startpos); 343 //m_log.InfoFormat("[AGENTCIRCUITDATA]: agentid={0}, child={1}, startpos={2}", AgentID, child, startpos);
337 344
@@ -342,12 +349,12 @@ namespace OpenSim.Framework
342 349
343 // Eventually this code should be deprecated, use full appearance 350 // Eventually this code should be deprecated, use full appearance
344 // packing in packed_appearance 351 // packing in packed_appearance
345 if (args["appearance_serial"] != null) 352 if (args.TryGetValue("appearance_serial", out tmpOSD))
346 Appearance.Serial = args["appearance_serial"].AsInteger(); 353 Appearance.Serial = tmpOSD.AsInteger();
347 354
348 if (args.ContainsKey("packed_appearance") && (args["packed_appearance"].Type == OSDType.Map)) 355 if (args.TryGetValue("packed_appearance", out tmpOSD) && (tmpOSD is OSDMap))
349 { 356 {
350 Appearance.Unpack((OSDMap)args["packed_appearance"]); 357 Appearance.Unpack((OSDMap)tmpOSD);
351// m_log.InfoFormat("[AGENTCIRCUITDATA] unpacked appearance"); 358// m_log.InfoFormat("[AGENTCIRCUITDATA] unpacked appearance");
352 } 359 }
353 else 360 else
@@ -362,31 +369,29 @@ namespace OpenSim.Framework
362 369
363 ServiceURLs = new Dictionary<string, object>(); 370 ServiceURLs = new Dictionary<string, object>();
364 // Try parse the new way, OSDMap 371 // Try parse the new way, OSDMap
365 if (args.ContainsKey("serviceurls") && args["serviceurls"] != null && (args["serviceurls"]).Type == OSDType.Map) 372 if (args.TryGetValue("serviceurls", out tmpOSD) && (tmpOSD is OSDMap))
366 { 373 {
367 OSDMap urls = (OSDMap)(args["serviceurls"]); 374 OSDMap urls = (OSDMap)tmpOSD;
368 foreach (KeyValuePair<String, OSD> kvp in urls) 375 foreach (KeyValuePair<String, OSD> kvp in urls)
369 { 376 {
370 ServiceURLs[kvp.Key] = kvp.Value.AsString(); 377 ServiceURLs[kvp.Key] = kvp.Value;
371 //System.Console.WriteLine("XXX " + kvp.Key + "=" + ServiceURLs[kvp.Key]); 378 //System.Console.WriteLine("XXX " + kvp.Key + "=" + ServiceURLs[kvp.Key]);
372
373 } 379 }
374 } 380 }
375 // else try the old way, OSDArray 381 // else try the old way, OSDArray
376 // OBSOLETE -- soon to be deleted 382 // OBSOLETE -- soon to be deleted
377 else if (args.ContainsKey("service_urls") && args["service_urls"] != null && (args["service_urls"]).Type == OSDType.Array) 383 else if (args.TryGetValue("service_urls", out tmpOSD) && (tmpOSD is OSDArray))
378 { 384 {
379 OSDArray urls = (OSDArray)(args["service_urls"]); 385 OSDArray urls = (OSDArray)tmpOSD;
380 for (int i = 0; i < urls.Count / 2; i++) 386 OSD tmpOSDb;
387 for (int i = 0; i < urls.Count - 1; i += 2)
381 { 388 {
382 ServiceURLs[urls[i * 2].AsString()] = urls[(i * 2) + 1].AsString(); 389 tmpOSD = urls[i];
390 tmpOSDb = urls[i + 1];
391 ServiceURLs[tmpOSD.AsString()] = tmpOSDb.AsString();
383 //System.Console.WriteLine("XXX " + urls[i * 2].AsString() + "=" + urls[(i * 2) + 1].AsString()); 392 //System.Console.WriteLine("XXX " + urls[i * 2].AsString() + "=" + urls[(i * 2) + 1].AsString());
384
385 } 393 }
386 } 394 }
387 } 395 }
388
389 } 396 }
390
391
392} 397}