aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/Null
diff options
context:
space:
mode:
authorMelanie2011-02-24 02:37:21 +0000
committerMelanie2011-02-24 02:37:21 +0000
commit9be1d2aef1dff06a7bfdb8da38dd6317bf5b0bb7 (patch)
tree0cf76dba6e5b7255a3d3168c1eec228def3a205f /OpenSim/Data/Null
parentMerge branch 'careminster-presence-refactor' of ssh://3dhosting.de/var/git/ca... (diff)
parentOn a Grid Handler exception, explicitly log the exception message and stack t... (diff)
downloadopensim-SC-9be1d2aef1dff06a7bfdb8da38dd6317bf5b0bb7.zip
opensim-SC-9be1d2aef1dff06a7bfdb8da38dd6317bf5b0bb7.tar.gz
opensim-SC-9be1d2aef1dff06a7bfdb8da38dd6317bf5b0bb7.tar.bz2
opensim-SC-9be1d2aef1dff06a7bfdb8da38dd6317bf5b0bb7.tar.xz
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Data/Null')
-rw-r--r--OpenSim/Data/Null/NullRegionData.cs48
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;