diff options
author | Homer Horwitz | 2008-10-03 23:00:42 +0000 |
---|---|---|
committer | Homer Horwitz | 2008-10-03 23:00:42 +0000 |
commit | 16d68749a457acf079a6737f4ca9a9adb9e53e2f (patch) | |
tree | 901b2c31e53eeb97f30ac46f2b7f406a01e1755a /OpenSim/Region/Environment/Modules | |
parent | Fix: Mantis#2326: Fix: privilege escalation through attach from ground (diff) | |
download | opensim-SC-16d68749a457acf079a6737f4ca9a9adb9e53e2f.zip opensim-SC-16d68749a457acf079a6737f4ca9a9adb9e53e2f.tar.gz opensim-SC-16d68749a457acf079a6737f4ca9a9adb9e53e2f.tar.bz2 opensim-SC-16d68749a457acf079a6737f4ca9a9adb9e53e2f.tar.xz |
Add the missing bits for the new region-search:
- Added lookup in the data-layer
- MySQL works
- SQLite doesn't have a grid-db, so it won't work there
- I added MSSQL-code to the best of my knowledge; but I don't know MSSQL :-)
- Added the plumbing up to OGS1GridServices. This speaks with the grid-server
via XMLRPC.
- Modified MapSearchModule to use the new data. It's backward compatible; if
used with an old grid-server, it just returns one found region instead of a
list.
- Refactored a bit.
Note: This updates data, grid-server and region code. No new files.
Diffstat (limited to 'OpenSim/Region/Environment/Modules')
-rw-r--r-- | OpenSim/Region/Environment/Modules/World/WorldMap/MapSearchModule.cs | 57 |
1 files changed, 33 insertions, 24 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/WorldMap/MapSearchModule.cs b/OpenSim/Region/Environment/Modules/World/WorldMap/MapSearchModule.cs index 1a15585..8cc707c 100644 --- a/OpenSim/Region/Environment/Modules/World/WorldMap/MapSearchModule.cs +++ b/OpenSim/Region/Environment/Modules/World/WorldMap/MapSearchModule.cs | |||
@@ -78,35 +78,44 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap | |||
78 | 78 | ||
79 | private void OnMapNameRequest(IClientAPI remoteClient, string mapName) | 79 | private void OnMapNameRequest(IClientAPI remoteClient, string mapName) |
80 | { | 80 | { |
81 | m_log.DebugFormat("[MAPSEARCH]: looking for region {0}", mapName); | 81 | if (mapName.Length < 3) |
82 | 82 | { | |
83 | // TODO currently, this only returns one region per name. LL servers will return all starting with the provided name. | 83 | remoteClient.SendAlertMessage("Use a search string with at least 3 characters"); |
84 | RegionInfo info = m_scene.SceneGridService.RequestClosestRegion(mapName); | 84 | return; |
85 | // fetch the mapblock of the named sim. We need this anyway (we have the map open, and just jumped to the sim), | 85 | } |
86 | // so there shouldn't be any penalty for that. | 86 | |
87 | if (info == null) | 87 | // try to fetch from GridServer |
88 | { | 88 | List<RegionInfo> regionInfos = m_scene.SceneGridService.RequestNamedRegions(mapName, 20); |
89 | m_log.Warn("[MAPSEARCHMODULE]: Got Null Region Question!"); | 89 | if (regionInfos == null) |
90 | return; | 90 | { |
91 | m_log.Warn("[MAPSEARCHMODULE]: RequestNamedRegions returned null. Old gridserver?"); | ||
92 | // service wasn't available; maybe still an old GridServer. Try the old API, though it will return only one region | ||
93 | regionInfos = new List<RegionInfo>(); | ||
94 | RegionInfo info = m_scene.SceneGridService.RequestClosestRegion(mapName); | ||
95 | if (info != null) regionInfos.Add(info); | ||
91 | } | 96 | } |
92 | List<MapBlockData> mapBlocks = m_scene.SceneGridService.RequestNeighbourMapBlocks((int)info.RegionLocX, | ||
93 | (int)info.RegionLocY, | ||
94 | (int)info.RegionLocX, | ||
95 | (int)info.RegionLocY); | ||
96 | 97 | ||
97 | List<MapBlockData> blocks = new List<MapBlockData>(); | 98 | List<MapBlockData> blocks = new List<MapBlockData>(); |
98 | 99 | ||
99 | MapBlockData data = new MapBlockData(); | 100 | MapBlockData data; |
100 | data.Agents = 3; // TODO set to number of agents in region | 101 | if (regionInfos.Count > 0) |
101 | data.Access = 21; // TODO what's this? | 102 | { |
102 | data.MapImageId = mapBlocks.Count == 0 ? UUID.Zero : mapBlocks[0].MapImageId; | 103 | foreach (RegionInfo info in regionInfos) |
103 | data.Name = info.RegionName; | 104 | { |
104 | data.RegionFlags = 0; // TODO fix this | 105 | data = new MapBlockData(); |
105 | data.WaterHeight = 0; // not used | 106 | data.Agents = 0; |
106 | data.X = (ushort)info.RegionLocX; | 107 | data.Access = 21; // TODO what's this? |
107 | data.Y = (ushort)info.RegionLocY; | 108 | data.MapImageId = info.RegionSettings.TerrainImageID; |
108 | blocks.Add(data); | 109 | data.Name = info.RegionName; |
110 | data.RegionFlags = 0; // TODO not used? | ||
111 | data.WaterHeight = 0; // not used | ||
112 | data.X = (ushort)info.RegionLocX; | ||
113 | data.Y = (ushort)info.RegionLocY; | ||
114 | blocks.Add(data); | ||
115 | } | ||
116 | } | ||
109 | 117 | ||
118 | // final block, closing the search result | ||
110 | data = new MapBlockData(); | 119 | data = new MapBlockData(); |
111 | data.Agents = 0; | 120 | data.Agents = 0; |
112 | data.Access = 255; | 121 | data.Access = 255; |