diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs | 161 |
1 files changed, 82 insertions, 79 deletions
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs index f37dd94..2417b1a 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs | |||
@@ -86,90 +86,93 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
86 | 86 | ||
87 | private void OnMapNameRequest(IClientAPI remoteClient, string mapName, uint flags) | 87 | private void OnMapNameRequest(IClientAPI remoteClient, string mapName, uint flags) |
88 | { | 88 | { |
89 | if (mapName.Length < 3) | 89 | Util.FireAndForget(x => |
90 | { | 90 | { |
91 | remoteClient.SendAlertMessage("Use a search string with at least 3 characters"); | 91 | if (mapName.Length < 2) |
92 | return; | 92 | { |
93 | } | 93 | remoteClient.SendAlertMessage("Use a search string with at least 2 characters"); |
94 | return; | ||
95 | } | ||
94 | 96 | ||
95 | //m_log.DebugFormat("MAP NAME=({0})", mapName); | 97 | //m_log.DebugFormat("MAP NAME=({0})", mapName); |
96 | 98 | ||
97 | // Hack to get around the fact that ll V3 now drops the port from the | 99 | // Hack to get around the fact that ll V3 now drops the port from the |
98 | // map name. See https://jira.secondlife.com/browse/VWR-28570 | 100 | // map name. See https://jira.secondlife.com/browse/VWR-28570 |
99 | // | 101 | // |
100 | // Caller, use this magic form instead: | 102 | // Caller, use this magic form instead: |
101 | // secondlife://http|!!mygrid.com|8002|Region+Name/128/128 | 103 | // secondlife://http|!!mygrid.com|8002|Region+Name/128/128 |
102 | // or url encode if possible. | 104 | // or url encode if possible. |
103 | // the hacks we do with this viewer... | 105 | // the hacks we do with this viewer... |
104 | // | 106 | // |
105 | string mapNameOrig = mapName; | 107 | string mapNameOrig = mapName; |
106 | if (mapName.Contains("|")) | 108 | if (mapName.Contains("|")) |
107 | mapName = mapName.Replace('|', ':'); | 109 | mapName = mapName.Replace('|', ':'); |
108 | if (mapName.Contains("+")) | 110 | if (mapName.Contains("+")) |
109 | mapName = mapName.Replace('+', ' '); | 111 | mapName = mapName.Replace('+', ' '); |
110 | if (mapName.Contains("!")) | 112 | if (mapName.Contains("!")) |
111 | mapName = mapName.Replace('!', '/'); | 113 | mapName = mapName.Replace('!', '/'); |
112 | 114 | ||
113 | // try to fetch from GridServer | 115 | // try to fetch from GridServer |
114 | List<GridRegion> regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20); | 116 | List<GridRegion> regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20); |
115 | if (regionInfos.Count == 0) | 117 | // if (regionInfos.Count == 0) |
116 | remoteClient.SendAlertMessage("Hyperlink could not be established."); | 118 | // remoteClient.SendAlertMessage("Hyperlink could not be established."); |
117 | 119 | ||
118 | m_log.DebugFormat("[MAPSEARCHMODULE]: search {0} returned {1} regions. Flags={2}", mapName, regionInfos.Count, flags); | 120 | //m_log.DebugFormat("[MAPSEARCHMODULE]: search {0} returned {1} regions", mapName, regionInfos.Count); |
119 | List<MapBlockData> blocks = new List<MapBlockData>(); | 121 | List<MapBlockData> blocks = new List<MapBlockData>(); |
120 | 122 | ||
121 | MapBlockData data; | 123 | MapBlockData data; |
122 | if (regionInfos.Count > 0) | 124 | if (regionInfos.Count > 0) |
123 | { | ||
124 | foreach (GridRegion info in regionInfos) | ||
125 | { | 125 | { |
126 | data = new MapBlockData(); | 126 | foreach (GridRegion info in regionInfos) |
127 | data.Agents = 0; | 127 | { |
128 | data.Access = info.Access; | 128 | data = new MapBlockData(); |
129 | if (flags == 2) // V2 sends this | 129 | data.Agents = 0; |
130 | data.MapImageId = UUID.Zero; | 130 | data.Access = info.Access; |
131 | else | 131 | if (flags == 2) // V2 sends this |
132 | data.MapImageId = info.TerrainImage; | 132 | data.MapImageId = UUID.Zero; |
133 | // ugh! V2-3 is very sensitive about the result being | 133 | else |
134 | // exactly the same as the requested name | 134 | data.MapImageId = info.TerrainImage; |
135 | if (regionInfos.Count == 1 && mapNameOrig.Contains("|") || mapNameOrig.Contains("+")) | 135 | // ugh! V2-3 is very sensitive about the result being |
136 | data.Name = mapNameOrig; | 136 | // exactly the same as the requested name |
137 | else | 137 | if (regionInfos.Count == 1 && mapNameOrig.Contains("|") || mapNameOrig.Contains("+")) |
138 | data.Name = info.RegionName; | 138 | data.Name = mapNameOrig; |
139 | data.RegionFlags = 0; // TODO not used? | 139 | else |
140 | data.WaterHeight = 0; // not used | 140 | data.Name = info.RegionName; |
141 | data.X = (ushort)(info.RegionLocX / Constants.RegionSize); | 141 | data.RegionFlags = 0; // TODO not used? |
142 | data.Y = (ushort)(info.RegionLocY / Constants.RegionSize); | 142 | data.WaterHeight = 0; // not used |
143 | blocks.Add(data); | 143 | data.X = (ushort)(info.RegionLocX / Constants.RegionSize); |
144 | data.Y = (ushort)(info.RegionLocY / Constants.RegionSize); | ||
145 | blocks.Add(data); | ||
146 | } | ||
144 | } | 147 | } |
145 | } | ||
146 | 148 | ||
147 | // final block, closing the search result | 149 | // final block, closing the search result |
148 | data = new MapBlockData(); | 150 | data = new MapBlockData(); |
149 | data.Agents = 0; | 151 | data.Agents = 0; |
150 | data.Access = 255; | 152 | data.Access = 255; |
151 | data.MapImageId = UUID.Zero; | 153 | data.MapImageId = UUID.Zero; |
152 | data.Name = ""; // mapName; | 154 | data.Name = mapName; |
153 | data.RegionFlags = 0; | 155 | data.RegionFlags = 0; |
154 | data.WaterHeight = 0; // not used | 156 | data.WaterHeight = 0; // not used |
155 | data.X = 0; | 157 | data.X = 0; |
156 | data.Y = 0; | 158 | data.Y = 0; |
157 | blocks.Add(data); | 159 | blocks.Add(data); |
158 | 160 | ||
159 | // flags are agent flags sent from the viewer. | 161 | // flags are agent flags sent from the viewer. |
160 | // they have different values depending on different viewers, apparently | 162 | // they have different values depending on different viewers, apparently |
161 | remoteClient.SendMapBlock(blocks, flags); | 163 | remoteClient.SendMapBlock(blocks, flags); |
162 | 164 | ||
163 | // send extra user messages for V3 | 165 | // send extra user messages for V3 |
164 | // because the UI is very confusing | 166 | // because the UI is very confusing |
165 | // while we don't fix the hard-coded urls | 167 | // while we don't fix the hard-coded urls |
166 | if (flags == 2) | 168 | if (flags == 2) |
167 | { | 169 | { |
168 | if (regionInfos.Count == 0) | 170 | if (regionInfos.Count == 0) |
169 | remoteClient.SendAgentAlertMessage("No regions found with that name.", true); | 171 | remoteClient.SendAgentAlertMessage("No regions found with that name.", true); |
170 | else if (regionInfos.Count == 1) | 172 | else if (regionInfos.Count == 1) |
171 | remoteClient.SendAgentAlertMessage("Region found!", false); | 173 | remoteClient.SendAgentAlertMessage("Region found!", false); |
172 | } | 174 | } |
175 | }); | ||
173 | } | 176 | } |
174 | 177 | ||
175 | // private Scene GetClientScene(IClientAPI client) | 178 | // private Scene GetClientScene(IClientAPI client) |