aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs')
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs99
1 files changed, 95 insertions, 4 deletions
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs
index d862f18..553d057 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs
@@ -141,20 +141,98 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
141 141
142 private void OnMapNameRequest(IClientAPI remoteClient, string mapName, uint flags) 142 private void OnMapNameRequest(IClientAPI remoteClient, string mapName, uint flags)
143 { 143 {
144<<<<<<< HEAD
144 List<MapBlockData> blocks = new List<MapBlockData>(); 145 List<MapBlockData> blocks = new List<MapBlockData>();
145 if (mapName.Length < 3 || (mapName.EndsWith("#") && mapName.Length < 4)) 146 if (mapName.Length < 3 || (mapName.EndsWith("#") && mapName.Length < 4))
147=======
148 Util.FireAndForget(x =>
149>>>>>>> avn/ubitvar
146 { 150 {
151 List<MapBlockData> blocks = new List<MapBlockData>();
152 if (mapName.Length < 3 || (mapName.EndsWith("#") && mapName.Length < 4))
153 {
154 // final block, closing the search result
155 AddFinalBlock(blocks);
156
157 // flags are agent flags sent from the viewer.
158 // they have different values depending on different viewers, apparently
159 remoteClient.SendMapBlock(blocks, flags);
160 remoteClient.SendAlertMessage("Use a search string with at least 3 characters");
161 return;
162 }
163
164 //m_log.DebugFormat("MAP NAME=({0})", mapName);
165
166 // Hack to get around the fact that ll V3 now drops the port from the
167 // map name. See https://jira.secondlife.com/browse/VWR-28570
168 //
169 // Caller, use this magic form instead:
170 // secondlife://http|!!mygrid.com|8002|Region+Name/128/128
171 // or url encode if possible.
172 // the hacks we do with this viewer...
173 //
174 string mapNameOrig = mapName;
175 if (mapName.Contains("|"))
176 mapName = mapName.Replace('|', ':');
177 if (mapName.Contains("+"))
178 mapName = mapName.Replace('+', ' ');
179 if (mapName.Contains("!"))
180 mapName = mapName.Replace('!', '/');
181
182 // try to fetch from GridServer
183 List<GridRegion> regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20);
184 // if (regionInfos.Count == 0)
185 // remoteClient.SendAlertMessage("Hyperlink could not be established.");
186
187 //m_log.DebugFormat("[MAPSEARCHMODULE]: search {0} returned {1} regions", mapName, regionInfos.Count);
188
189 MapBlockData data;
190 if (regionInfos.Count > 0)
191 {
192 foreach (GridRegion info in regionInfos)
193 {
194 data = new MapBlockData();
195 data.Agents = 0;
196 data.Access = info.Access;
197 if (flags == 2) // V2 sends this
198 {
199 List<MapBlockData> datas = WorldMap.Map2BlockFromGridRegion(info, flags);
200 // ugh! V2-3 is very sensitive about the result being
201 // exactly the same as the requested name
202
203 if (regionInfos.Count == 1 && (mapName != mapNameOrig))
204 datas.ForEach(d => d.Name = mapNameOrig);
205
206 blocks.AddRange(datas);
207 }
208 else
209 {
210 MapBlockData block = new MapBlockData();
211 WorldMap.MapBlockFromGridRegion(block,info, flags);
212 blocks.Add(block);
213 }
214 // ugh! V2-3 is very sensitive about the result being
215 // exactly the same as the requested name
216 if (regionInfos.Count == 1 && mapNameOrig.Contains("|") || mapNameOrig.Contains("+"))
217 data.Name = mapNameOrig;
218 else
219 data.Name = info.RegionName;
220 data.RegionFlags = 0; // TODO not used?
221 data.WaterHeight = 0; // not used
222 data.X = (ushort)(info.RegionLocX / Constants.RegionSize);
223 data.Y = (ushort)(info.RegionLocY / Constants.RegionSize);
224 blocks.Add(data);
225 }
226 }
227
147 // final block, closing the search result 228 // final block, closing the search result
148 AddFinalBlock(blocks); 229 AddFinalBlock(blocks);
149 230
150 // flags are agent flags sent from the viewer. 231 // flags are agent flags sent from the viewer.
151 // they have different values depending on different viewers, apparently 232 // they have different values depending on different viewers, apparently
152 remoteClient.SendMapBlock(blocks, flags); 233 remoteClient.SendMapBlock(blocks, flags);
153 remoteClient.SendAlertMessage("Use a search string with at least 3 characters");
154 return;
155 }
156
157 234
235<<<<<<< HEAD
158 List<GridRegion> regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20); 236 List<GridRegion> regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20);
159 237
160 string mapNameOrig = mapName; 238 string mapNameOrig = mapName;
@@ -221,6 +299,19 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
221 //else if (regionInfos.Count == 1) 299 //else if (regionInfos.Count == 1)
222 // remoteClient.SendAlertMessage("Region found!"); 300 // remoteClient.SendAlertMessage("Region found!");
223 } 301 }
302=======
303 // send extra user messages for V3
304 // because the UI is very confusing
305 // while we don't fix the hard-coded urls
306 if (flags == 2)
307 {
308 if (regionInfos.Count == 0)
309 remoteClient.SendAgentAlertMessage("No regions found with that name.", true);
310// else if (regionInfos.Count == 1)
311// remoteClient.SendAgentAlertMessage("Region found!", false);
312 }
313 });
314>>>>>>> avn/ubitvar
224 } 315 }
225 316
226 private void AddFinalBlock(List<MapBlockData> blocks) 317 private void AddFinalBlock(List<MapBlockData> blocks)