diff options
Diffstat (limited to 'OpenSim/Server/Handlers')
-rw-r--r-- | OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs index d99b791..1601575 100644 --- a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs | |||
@@ -103,6 +103,12 @@ namespace OpenSim.Server.Handlers.Grid | |||
103 | case "get_region_range": | 103 | case "get_region_range": |
104 | return GetRegionRange(request); | 104 | return GetRegionRange(request); |
105 | 105 | ||
106 | case "get_default_regions": | ||
107 | return GetDefaultRegions(request); | ||
108 | |||
109 | case "get_fallback_regions": | ||
110 | return GetFallbackRegions(request); | ||
111 | |||
106 | } | 112 | } |
107 | m_log.DebugFormat("[GRID HANDLER]: unknown method {0} request {1}", method.Length, method); | 113 | m_log.DebugFormat("[GRID HANDLER]: unknown method {0} request {1}", method.Length, method); |
108 | } | 114 | } |
@@ -404,6 +410,77 @@ namespace OpenSim.Server.Handlers.Grid | |||
404 | return encoding.GetBytes(xmlString); | 410 | return encoding.GetBytes(xmlString); |
405 | } | 411 | } |
406 | 412 | ||
413 | byte[] GetDefaultRegions(Dictionary<string, object> request) | ||
414 | { | ||
415 | //m_log.DebugFormat("[GRID HANDLER]: GetDefaultRegions"); | ||
416 | UUID scopeID = UUID.Zero; | ||
417 | if (request.ContainsKey("SCOPEID")) | ||
418 | UUID.TryParse(request["SCOPEID"].ToString(), out scopeID); | ||
419 | else | ||
420 | m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get region range"); | ||
421 | |||
422 | List<GridRegion> rinfos = m_GridService.GetDefaultRegions(scopeID); | ||
423 | |||
424 | Dictionary<string, object> result = new Dictionary<string, object>(); | ||
425 | if ((rinfos == null) || ((rinfos != null) && (rinfos.Count == 0))) | ||
426 | result["result"] = "null"; | ||
427 | else | ||
428 | { | ||
429 | int i = 0; | ||
430 | foreach (GridRegion rinfo in rinfos) | ||
431 | { | ||
432 | Dictionary<string, object> rinfoDict = rinfo.ToKeyValuePairs(); | ||
433 | result["region" + i] = rinfoDict; | ||
434 | i++; | ||
435 | } | ||
436 | } | ||
437 | string xmlString = ServerUtils.BuildXmlResponse(result); | ||
438 | //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); | ||
439 | UTF8Encoding encoding = new UTF8Encoding(); | ||
440 | return encoding.GetBytes(xmlString); | ||
441 | } | ||
442 | |||
443 | byte[] GetFallbackRegions(Dictionary<string, object> request) | ||
444 | { | ||
445 | //m_log.DebugFormat("[GRID HANDLER]: GetRegionRange"); | ||
446 | UUID scopeID = UUID.Zero; | ||
447 | if (request.ContainsKey("SCOPEID")) | ||
448 | UUID.TryParse(request["SCOPEID"].ToString(), out scopeID); | ||
449 | else | ||
450 | m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get fallback regions"); | ||
451 | |||
452 | int x = 0, y = 0; | ||
453 | if (request.ContainsKey("X")) | ||
454 | Int32.TryParse(request["X"].ToString(), out x); | ||
455 | else | ||
456 | m_log.WarnFormat("[GRID HANDLER]: no X in request to get fallback regions"); | ||
457 | if (request.ContainsKey("Y")) | ||
458 | Int32.TryParse(request["Y"].ToString(), out y); | ||
459 | else | ||
460 | m_log.WarnFormat("[GRID HANDLER]: no Y in request to get fallback regions"); | ||
461 | |||
462 | |||
463 | List<GridRegion> rinfos = m_GridService.GetFallbackRegions(scopeID, x, y); | ||
464 | |||
465 | Dictionary<string, object> result = new Dictionary<string, object>(); | ||
466 | if ((rinfos == null) || ((rinfos != null) && (rinfos.Count == 0))) | ||
467 | result["result"] = "null"; | ||
468 | else | ||
469 | { | ||
470 | int i = 0; | ||
471 | foreach (GridRegion rinfo in rinfos) | ||
472 | { | ||
473 | Dictionary<string, object> rinfoDict = rinfo.ToKeyValuePairs(); | ||
474 | result["region" + i] = rinfoDict; | ||
475 | i++; | ||
476 | } | ||
477 | } | ||
478 | string xmlString = ServerUtils.BuildXmlResponse(result); | ||
479 | //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); | ||
480 | UTF8Encoding encoding = new UTF8Encoding(); | ||
481 | return encoding.GetBytes(xmlString); | ||
482 | } | ||
483 | |||
407 | #endregion | 484 | #endregion |
408 | 485 | ||
409 | #region Misc | 486 | #region Misc |