diff options
author | Sean McNamara | 2011-02-28 15:08:35 -0500 |
---|---|---|
committer | Sean McNamara | 2011-02-28 15:08:35 -0500 |
commit | 60989521a6a60bb5610784936797df0683a55527 (patch) | |
tree | 51fd99afe41459221ff74a78be965001ff680df9 /OpenSim/Data | |
parent | Fix small bug with remove region; update settings docs. (diff) | |
parent | Fix a few little things (diff) | |
download | opensim-SC_OLD-60989521a6a60bb5610784936797df0683a55527.zip opensim-SC_OLD-60989521a6a60bb5610784936797df0683a55527.tar.gz opensim-SC_OLD-60989521a6a60bb5610784936797df0683a55527.tar.bz2 opensim-SC_OLD-60989521a6a60bb5610784936797df0683a55527.tar.xz |
Merge git://opensimulator.org/git/opensim
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Data/Null/NullRegionData.cs | 48 |
1 files changed, 38 insertions, 10 deletions
diff --git a/OpenSim/Data/Null/NullRegionData.cs b/OpenSim/Data/Null/NullRegionData.cs index 2065355..53e5207 100644 --- a/OpenSim/Data/Null/NullRegionData.cs +++ b/OpenSim/Data/Null/NullRegionData.cs | |||
@@ -51,28 +51,56 @@ namespace OpenSim.Data.Null | |||
51 | //Console.WriteLine("[XXX] NullRegionData constructor"); | 51 | //Console.WriteLine("[XXX] NullRegionData constructor"); |
52 | } | 52 | } |
53 | 53 | ||
54 | private delegate bool Matcher(string value); | ||
55 | |||
54 | public List<RegionData> Get(string regionName, UUID scopeID) | 56 | public List<RegionData> Get(string regionName, UUID scopeID) |
55 | { | 57 | { |
56 | if (Instance != this) | 58 | if (Instance != this) |
57 | return Instance.Get(regionName, scopeID); | 59 | return Instance.Get(regionName, scopeID); |
58 | 60 | ||
59 | List<RegionData> ret = new List<RegionData>(); | 61 | string cleanName = regionName.ToLower(); |
60 | 62 | ||
61 | foreach (RegionData r in m_regionData.Values) | 63 | // Handle SQL wildcards |
64 | const string wildcard = "%"; | ||
65 | bool wildcardPrefix = false; | ||
66 | bool wildcardSuffix = false; | ||
67 | if (cleanName.Equals(wildcard)) | ||
62 | { | 68 | { |
63 | if (regionName.Contains("%")) | 69 | wildcardPrefix = wildcardSuffix = true; |
70 | cleanName = string.Empty; | ||
71 | } | ||
72 | else | ||
73 | { | ||
74 | if (cleanName.StartsWith(wildcard)) | ||
64 | { | 75 | { |
65 | string cleanname = regionName.Replace("%", ""); | 76 | wildcardPrefix = true; |
66 | m_log.DebugFormat("[NULL REGION DATA]: comparing {0} to {1}", cleanname.ToLower(), r.RegionName.ToLower()); | 77 | cleanName = cleanName.Substring(1); |
67 | if (r.RegionName.ToLower().Contains(cleanname.ToLower())) | ||
68 | ret.Add(r); | ||
69 | } | 78 | } |
70 | else | 79 | if (regionName.EndsWith(wildcard)) |
71 | { | 80 | { |
72 | if (r.RegionName.ToLower() == regionName.ToLower()) | 81 | wildcardSuffix = true; |
73 | ret.Add(r); | 82 | cleanName = cleanName.Remove(cleanName.Length - 1); |
74 | } | 83 | } |
75 | } | 84 | } |
85 | Matcher queryMatch; | ||
86 | if (wildcardPrefix && wildcardSuffix) | ||
87 | queryMatch = delegate(string s) { return s.Contains(cleanName); }; | ||
88 | else if (wildcardSuffix) | ||
89 | queryMatch = delegate(string s) { return s.StartsWith(cleanName); }; | ||
90 | else if (wildcardPrefix) | ||
91 | queryMatch = delegate(string s) { return s.EndsWith(cleanName); }; | ||
92 | else | ||
93 | queryMatch = delegate(string s) { return s.Equals(cleanName); }; | ||
94 | |||
95 | // Find region data | ||
96 | List<RegionData> ret = new List<RegionData>(); | ||
97 | |||
98 | foreach (RegionData r in m_regionData.Values) | ||
99 | { | ||
100 | m_log.DebugFormat("[NULL REGION DATA]: comparing {0} to {1}", cleanName, r.RegionName.ToLower()); | ||
101 | if (queryMatch(r.RegionName.ToLower())) | ||
102 | ret.Add(r); | ||
103 | } | ||
76 | 104 | ||
77 | if (ret.Count > 0) | 105 | if (ret.Count > 0) |
78 | return ret; | 106 | return ret; |