diff options
author | UbitUmarov | 2016-11-28 04:29:57 +0000 |
---|---|---|
committer | UbitUmarov | 2016-11-28 04:29:57 +0000 |
commit | 1aa4dbdb3fd5c3c8382dad53d6b7c105fb7cec85 (patch) | |
tree | 46738fbb9799ffeb47a7b6f3eb574c4c5c463302 /OpenSim/Region | |
parent | HG on links request build the URI in http format with a / at end, this should... (diff) | |
download | opensim-SC-1aa4dbdb3fd5c3c8382dad53d6b7c105fb7cec85.zip opensim-SC-1aa4dbdb3fd5c3c8382dad53d6b7c105fb7cec85.tar.gz opensim-SC-1aa4dbdb3fd5c3c8382dad53d6b7c105fb7cec85.tar.bz2 opensim-SC-1aa4dbdb3fd5c3c8382dad53d6b7c105fb7cec85.tar.xz |
increase HG mapsearch spargetti; add more flexibility on input uri formats. To find regions in memory for a grid the http format needs to be used, because aditional compares made by viewers
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs | 156 |
1 files changed, 78 insertions, 78 deletions
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs index 7370156..b1234fe 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs | |||
@@ -128,104 +128,104 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
128 | m_Clients.Add(remoteClient.AgentId); | 128 | m_Clients.Add(remoteClient.AgentId); |
129 | } | 129 | } |
130 | 130 | ||
131 | try | 131 | OnMapNameRequest(remoteClient, mapName, flags); |
132 | { | ||
133 | OnMapNameRequest(remoteClient, mapName, flags); | ||
134 | } | ||
135 | finally | ||
136 | { | ||
137 | lock (m_Clients) | ||
138 | m_Clients.Remove(remoteClient.AgentId); | ||
139 | } | ||
140 | } | 132 | } |
141 | 133 | ||
142 | private void OnMapNameRequest(IClientAPI remoteClient, string mapName, uint flags) | 134 | private void OnMapNameRequest(IClientAPI remoteClient, string mapName, uint flags) |
143 | { | 135 | { |
144 | Util.FireAndForget(x => | 136 | Util.FireAndForget(x => |
145 | { | 137 | { |
146 | List<MapBlockData> blocks = new List<MapBlockData>(); | 138 | try |
147 | if (mapName.Length < 3 || (mapName.EndsWith("#") && mapName.Length < 4)) | ||
148 | { | 139 | { |
149 | // final block, closing the search result | 140 | List<MapBlockData> blocks = new List<MapBlockData>(); |
150 | AddFinalBlock(blocks,mapName); | 141 | if (mapName.Length < 3 || (mapName.EndsWith("#") && mapName.Length < 4)) |
142 | { | ||
143 | // final block, closing the search result | ||
144 | AddFinalBlock(blocks,mapName); | ||
151 | 145 | ||
152 | // flags are agent flags sent from the viewer. | 146 | // flags are agent flags sent from the viewer. |
153 | // they have different values depending on different viewers, apparently | 147 | // they have different values depending on different viewers, apparently |
154 | remoteClient.SendMapBlock(blocks, flags); | 148 | remoteClient.SendMapBlock(blocks, flags); |
155 | remoteClient.SendAlertMessage("Use a search string with at least 3 characters"); | 149 | remoteClient.SendAlertMessage("Use a search string with at least 3 characters"); |
156 | return; | 150 | return; |
157 | } | 151 | } |
158 | 152 | ||
159 | //m_log.DebugFormat("MAP NAME=({0})", mapName); | 153 | //m_log.DebugFormat("MAP NAME=({0})", mapName); |
160 | 154 | ||
161 | // Hack to get around the fact that ll V3 now drops the port from the | 155 | // Hack to get around the fact that ll V3 now drops the port from the |
162 | // map name. See https://jira.secondlife.com/browse/VWR-28570 | 156 | // map name. See https://jira.secondlife.com/browse/VWR-28570 |
163 | // | 157 | // |
164 | // Caller, use this magic form instead: | 158 | // Caller, use this magic form instead: |
165 | // secondlife://http|!!mygrid.com|8002|Region+Name/128/128 | 159 | // secondlife://http|!!mygrid.com|8002|Region+Name/128/128 |
166 | // or url encode if possible. | 160 | // or url encode if possible. |
167 | // the hacks we do with this viewer... | 161 | // the hacks we do with this viewer... |
168 | // | 162 | // |
169 | bool needOriginalName = false; | 163 | bool needOriginalName = false; |
170 | string mapNameOrig = mapName; | 164 | string mapNameOrig = mapName; |
171 | if (mapName.Contains("|")) | 165 | if (mapName.Contains("|")) |
172 | { | 166 | { |
173 | mapName = mapName.Replace('|', ':'); | 167 | mapName = mapName.Replace('|', ':'); |
174 | needOriginalName = true; | 168 | needOriginalName = true; |
175 | } | 169 | } |
176 | if (mapName.Contains("+")) | 170 | if (mapName.Contains("+")) |
177 | { | 171 | { |
178 | mapName = mapName.Replace('+', ' '); | 172 | mapName = mapName.Replace('+', ' '); |
179 | needOriginalName = true; | 173 | needOriginalName = true; |
180 | } | 174 | } |
181 | if (mapName.Contains("!")) | 175 | if (mapName.Contains("!")) |
182 | { | 176 | { |
183 | mapName = mapName.Replace('!', '/'); | 177 | mapName = mapName.Replace('!', '/'); |
184 | needOriginalName = true; | 178 | needOriginalName = true; |
185 | } | 179 | } |
186 | if (mapName.Contains(".")) | 180 | if (mapName.Contains(".")) |
187 | needOriginalName = true; | 181 | needOriginalName = true; |
188 | 182 | ||
189 | // try to fetch from GridServer | 183 | // try to fetch from GridServer |
190 | List<GridRegion> regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20); | 184 | List<GridRegion> regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20); |
191 | // if (regionInfos.Count == 0) | 185 | // if (regionInfos.Count == 0) |
192 | // remoteClient.SendAlertMessage("Hyperlink could not be established."); | 186 | // remoteClient.SendAlertMessage("Hyperlink could not be established."); |
193 | 187 | ||
194 | //m_log.DebugFormat("[MAPSEARCHMODULE]: search {0} returned {1} regions", mapName, regionInfos.Count); | 188 | //m_log.DebugFormat("[MAPSEARCHMODULE]: search {0} returned {1} regions", mapName, regionInfos.Count); |
195 | 189 | ||
196 | MapBlockData data; | 190 | MapBlockData data; |
197 | if (regionInfos.Count > 0) | 191 | if (regionInfos.Count > 0) |
198 | { | ||
199 | foreach (GridRegion info in regionInfos) | ||
200 | { | 192 | { |
201 | data = new MapBlockData(); | 193 | foreach (GridRegion info in regionInfos) |
202 | data.Agents = 0; | 194 | { |
203 | data.Access = info.Access; | 195 | data = new MapBlockData(); |
204 | MapBlockData block = new MapBlockData(); | 196 | data.Agents = 0; |
205 | WorldMap.MapBlockFromGridRegion(block, info, flags); | 197 | data.Access = info.Access; |
198 | MapBlockData block = new MapBlockData(); | ||
199 | WorldMap.MapBlockFromGridRegion(block, info, flags); | ||
206 | 200 | ||
207 | if (flags == 2 && regionInfos.Count == 1 && needOriginalName) | 201 | if (flags == 2 && regionInfos.Count == 1 && needOriginalName) |
208 | block.Name = mapNameOrig; | 202 | block.Name = mapNameOrig; |
209 | blocks.Add(block); | 203 | blocks.Add(block); |
204 | } | ||
210 | } | 205 | } |
211 | } | ||
212 | 206 | ||
213 | // final block, closing the search result | 207 | // final block, closing the search result |
214 | AddFinalBlock(blocks,mapNameOrig); | 208 | AddFinalBlock(blocks,mapNameOrig); |
215 | 209 | ||
216 | // flags are agent flags sent from the viewer. | 210 | // flags are agent flags sent from the viewer. |
217 | // they have different values depending on different viewers, apparently | 211 | // they have different values depending on different viewers, apparently |
218 | remoteClient.SendMapBlock(blocks, flags); | 212 | remoteClient.SendMapBlock(blocks, flags); |
219 | 213 | ||
220 | // send extra user messages for V3 | 214 | // send extra user messages for V3 |
221 | // because the UI is very confusing | 215 | // because the UI is very confusing |
222 | // while we don't fix the hard-coded urls | 216 | // while we don't fix the hard-coded urls |
223 | if (flags == 2) | 217 | if (flags == 2) |
218 | { | ||
219 | if (regionInfos.Count == 0) | ||
220 | remoteClient.SendAgentAlertMessage("No regions found with that name.", true); | ||
221 | // else if (regionInfos.Count == 1) | ||
222 | // remoteClient.SendAgentAlertMessage("Region found!", false); | ||
223 | } | ||
224 | } | ||
225 | finally | ||
224 | { | 226 | { |
225 | if (regionInfos.Count == 0) | 227 | lock (m_Clients) |
226 | remoteClient.SendAgentAlertMessage("No regions found with that name.", true); | 228 | m_Clients.Remove(remoteClient.AgentId); |
227 | // else if (regionInfos.Count == 1) | ||
228 | // remoteClient.SendAgentAlertMessage("Region found!", false); | ||
229 | } | 229 | } |
230 | }); | 230 | }); |
231 | } | 231 | } |