* Allow for lowercase searching in standalone mode, when case sensitive

search fails. This allows compability to libOMV bots, that always lowercase
region names.
* Uncertain if this should/could propagate to grids
0.6.6-post-fixes
Arthur Valadares 2009-06-01 20:51:40 +00:00
parent 8e011ecbbb
commit 63a499c569
1 changed files with 15 additions and 1 deletions

View File

@ -379,18 +379,32 @@ namespace OpenSim.Region.Communications.Local
public List<RegionInfo> RequestNamedRegions (string name, int maxNumber) public List<RegionInfo> RequestNamedRegions (string name, int maxNumber)
{ {
List<RegionInfo> lowercase_regions = new List<RegionInfo>();
List<RegionInfo> regions = new List<RegionInfo>(); List<RegionInfo> regions = new List<RegionInfo>();
foreach (RegionInfo info in m_regions.Values) foreach (RegionInfo info in m_regions.Values)
{ {
// Prioritizes exact match
if (info.RegionName.StartsWith(name)) if (info.RegionName.StartsWith(name))
{ {
regions.Add(info); regions.Add(info);
if (regions.Count >= maxNumber) break; if (regions.Count >= maxNumber) break;
} }
// But still saves lower case matches
else if (info.RegionName.ToLower().StartsWith(name))
{
if (lowercase_regions.Count < maxNumber)
{
lowercase_regions.Add(info);
}
}
} }
// If no exact matches found, return lowercase matches (libOMV compatiblity)
if (regions.Count == 0 && lowercase_regions.Count != 0)
{
return lowercase_regions;
}
return regions; return regions;
} }
} }
} }