diff options
author | Diva Canto | 2011-02-05 08:20:13 -0800 |
---|---|---|
committer | Diva Canto | 2011-02-05 08:20:13 -0800 |
commit | 3a2a48a8cad9914862b6804cb46b21bc2c8d6bf7 (patch) | |
tree | 8214eb500ed4a1c560c1ba7bb2602e3ea1d0d9b6 /OpenSim | |
parent | Amend to yesterday's deletions: forgot to delete the RemoteInventory module i... (diff) | |
download | opensim-SC_OLD-3a2a48a8cad9914862b6804cb46b21bc2c8d6bf7.zip opensim-SC_OLD-3a2a48a8cad9914862b6804cb46b21bc2c8d6bf7.tar.gz opensim-SC_OLD-3a2a48a8cad9914862b6804cb46b21bc2c8d6bf7.tar.bz2 opensim-SC_OLD-3a2a48a8cad9914862b6804cb46b21bc2c8d6bf7.tar.xz |
Add sane packing of ServiceURLs -- OSDMap. The old way (OSDArray) is still supported for backwards compatibility, but will be removed in the future.
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Framework/AgentCircuitData.cs | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/OpenSim/Framework/AgentCircuitData.cs b/OpenSim/Framework/AgentCircuitData.cs index 1600bdc..3dbc215 100644 --- a/OpenSim/Framework/AgentCircuitData.cs +++ b/OpenSim/Framework/AgentCircuitData.cs | |||
@@ -220,6 +220,8 @@ namespace OpenSim.Framework | |||
220 | args["packed_appearance"] = appmap; | 220 | args["packed_appearance"] = appmap; |
221 | } | 221 | } |
222 | 222 | ||
223 | // Old, bad way. Keeping it fow now for backwards compatibility | ||
224 | // OBSOLETE -- soon to be deleted | ||
223 | if (ServiceURLs != null && ServiceURLs.Count > 0) | 225 | if (ServiceURLs != null && ServiceURLs.Count > 0) |
224 | { | 226 | { |
225 | OSDArray urls = new OSDArray(ServiceURLs.Count * 2); | 227 | OSDArray urls = new OSDArray(ServiceURLs.Count * 2); |
@@ -232,6 +234,19 @@ namespace OpenSim.Framework | |||
232 | args["service_urls"] = urls; | 234 | args["service_urls"] = urls; |
233 | } | 235 | } |
234 | 236 | ||
237 | // again, this time the right way | ||
238 | if (ServiceURLs != null && ServiceURLs.Count > 0) | ||
239 | { | ||
240 | OSDMap urls = new OSDMap(); | ||
241 | foreach (KeyValuePair<string, object> kvp in ServiceURLs) | ||
242 | { | ||
243 | //System.Console.WriteLine("XXX " + kvp.Key + "=" + kvp.Value); | ||
244 | urls[kvp.Key] = OSD.FromString((kvp.Value == null) ? string.Empty : kvp.Value.ToString()); | ||
245 | } | ||
246 | args["serviceurls"] = urls; | ||
247 | } | ||
248 | |||
249 | |||
235 | return args; | 250 | return args; |
236 | } | 251 | } |
237 | 252 | ||
@@ -327,7 +342,20 @@ namespace OpenSim.Framework | |||
327 | } | 342 | } |
328 | 343 | ||
329 | ServiceURLs = new Dictionary<string, object>(); | 344 | ServiceURLs = new Dictionary<string, object>(); |
330 | if (args.ContainsKey("service_urls") && args["service_urls"] != null && (args["service_urls"]).Type == OSDType.Array) | 345 | // Try parse the new way, OSDMap |
346 | if (args.ContainsKey("serviceurls") && args["serviceurls"] != null && (args["serviceurls"]).Type == OSDType.Map) | ||
347 | { | ||
348 | OSDMap urls = (OSDMap)(args["serviceurls"]); | ||
349 | foreach (KeyValuePair<String, OSD> kvp in urls) | ||
350 | { | ||
351 | ServiceURLs[kvp.Key] = kvp.Value.AsString(); | ||
352 | //System.Console.WriteLine("XXX " + kvp.Key + "=" + ServiceURLs[kvp.Key]); | ||
353 | |||
354 | } | ||
355 | } | ||
356 | // else try the old way, OSDArray | ||
357 | // OBSOLETE -- soon to be deleted | ||
358 | else if (args.ContainsKey("service_urls") && args["service_urls"] != null && (args["service_urls"]).Type == OSDType.Array) | ||
331 | { | 359 | { |
332 | OSDArray urls = (OSDArray)(args["service_urls"]); | 360 | OSDArray urls = (OSDArray)(args["service_urls"]); |
333 | for (int i = 0; i < urls.Count / 2; i++) | 361 | for (int i = 0; i < urls.Count / 2; i++) |