aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/DataSnapshot/LandSnapshot.cs
diff options
context:
space:
mode:
authorMelanie Thielker2008-10-11 00:39:43 +0000
committerMelanie Thielker2008-10-11 00:39:43 +0000
commit2214b2f5783a4015f9fcfba6b2e7265c6bb01020 (patch)
treee284886cdef1f8d297955bc54b2faf31d96dd10c /OpenSim/Region/DataSnapshot/LandSnapshot.cs
parentEliminate some unnecessary polygons (diff)
downloadopensim-SC-2214b2f5783a4015f9fcfba6b2e7265c6bb01020.zip
opensim-SC-2214b2f5783a4015f9fcfba6b2e7265c6bb01020.tar.gz
opensim-SC-2214b2f5783a4015f9fcfba6b2e7265c6bb01020.tar.bz2
opensim-SC-2214b2f5783a4015f9fcfba6b2e7265c6bb01020.tar.xz
Commit Diva's new patch for the DataSnapshot. Comment the default
metaverseink search provider to prevent accidental data exposure.
Diffstat (limited to 'OpenSim/Region/DataSnapshot/LandSnapshot.cs')
-rw-r--r--OpenSim/Region/DataSnapshot/LandSnapshot.cs248
1 files changed, 125 insertions, 123 deletions
diff --git a/OpenSim/Region/DataSnapshot/LandSnapshot.cs b/OpenSim/Region/DataSnapshot/LandSnapshot.cs
index 562cd8a..e6b8e82 100644
--- a/OpenSim/Region/DataSnapshot/LandSnapshot.cs
+++ b/OpenSim/Region/DataSnapshot/LandSnapshot.cs
@@ -44,7 +44,7 @@ namespace OpenSim.Region.DataSnapshot.Providers
44 public class LandSnapshot : IDataSnapshotProvider 44 public class LandSnapshot : IDataSnapshotProvider
45 { 45 {
46 private Scene m_scene = null; 46 private Scene m_scene = null;
47 // private DataSnapshotManager m_parent = null; 47 private DataSnapshotManager m_parent = null;
48 //private Dictionary<int, Land> m_landIndexed = new Dictionary<int, Land>(); 48 //private Dictionary<int, Land> m_landIndexed = new Dictionary<int, Land>();
49 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 49 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
50 private bool m_stale = true; 50 private bool m_stale = true;
@@ -107,7 +107,7 @@ namespace OpenSim.Region.DataSnapshot.Providers
107 public void Initialize(Scene scene, DataSnapshotManager parent) 107 public void Initialize(Scene scene, DataSnapshotManager parent)
108 { 108 {
109 m_scene = scene; 109 m_scene = scene;
110 // m_parent = parent; 110 m_parent = parent;
111 111
112 //Brought back from the dead for staleness checks. 112 //Brought back from the dead for staleness checks.
113 m_scene.EventManager.OnNewClient += OnNewClient; 113 m_scene.EventManager.OnNewClient += OnNewClient;
@@ -137,135 +137,137 @@ namespace OpenSim.Region.DataSnapshot.Providers
137 LandObject land = (LandObject)parcel_interface; 137 LandObject land = (LandObject)parcel_interface;
138 138
139 LandData parcel = land.landData; 139 LandData parcel = land.landData;
140 // if ((parcel.Flags & (uint)Parcel.ParcelFlags.ShowDirectory) == (uint)Parcel.ParcelFlags.ShowDirectory) 140 if (m_parent.ExposureLevel.Equals("all") ||
141 // { 141 (m_parent.ExposureLevel.Equals("minimum") &&
142 142 (parcel.Flags & (uint)Parcel.ParcelFlags.ShowDirectory) == (uint)Parcel.ParcelFlags.ShowDirectory))
143 //TODO: make better method of marshalling data from LandData to XmlNode
144 XmlNode xmlparcel = nodeFactory.CreateNode(XmlNodeType.Element, "parcel", "");
145
146 // Attributes of the parcel node
147 XmlAttribute scripts_attr = nodeFactory.CreateAttribute("scripts");
148 scripts_attr.Value = GetScriptsPermissions(parcel);
149 XmlAttribute build_attr = nodeFactory.CreateAttribute("build");
150 build_attr.Value = GetBuildPermissions(parcel);
151 XmlAttribute public_attr = nodeFactory.CreateAttribute("public");
152 public_attr.Value = GetPublicPermissions(parcel);
153 // Check the category of the Parcel
154 XmlAttribute category_attr = nodeFactory.CreateAttribute("category");
155 category_attr.Value = ((int)parcel.Category).ToString();
156 // Check if the parcel is for sale
157 XmlAttribute forsale_attr = nodeFactory.CreateAttribute("forsale");
158 forsale_attr.Value = CheckForSale(parcel);
159 XmlAttribute sales_attr = nodeFactory.CreateAttribute("salesprice");
160 sales_attr.Value = parcel.SalePrice.ToString();
161
162 XmlAttribute directory_attr = nodeFactory.CreateAttribute("show_directory");
163 directory_attr.Value = GetShowInSearch(parcel);
164 //XmlAttribute entities_attr = nodeFactory.CreateAttribute("entities");
165 //entities_attr.Value = land.primsOverMe.Count.ToString();
166 xmlparcel.Attributes.Append(directory_attr);
167 xmlparcel.Attributes.Append(scripts_attr);
168 xmlparcel.Attributes.Append(build_attr);
169 xmlparcel.Attributes.Append(public_attr);
170 xmlparcel.Attributes.Append(category_attr);
171 xmlparcel.Attributes.Append(forsale_attr);
172 xmlparcel.Attributes.Append(sales_attr);
173 //xmlparcel.Attributes.Append(entities_attr);
174
175
176 //name, description, area, and UUID
177 XmlNode name = nodeFactory.CreateNode(XmlNodeType.Element, "name", "");
178 name.InnerText = parcel.Name;
179 xmlparcel.AppendChild(name);
180
181 XmlNode desc = nodeFactory.CreateNode(XmlNodeType.Element, "description", "");
182 desc.InnerText = parcel.Description;
183 xmlparcel.AppendChild(desc);
184
185 XmlNode uuid = nodeFactory.CreateNode(XmlNodeType.Element, "uuid", "");
186 uuid.InnerText = parcel.GlobalID.ToString();
187 xmlparcel.AppendChild(uuid);
188
189 XmlNode area = nodeFactory.CreateNode(XmlNodeType.Element, "area", "");
190 area.InnerText = parcel.Area.ToString();
191 xmlparcel.AppendChild(area);
192
193 //default location
194 XmlNode tpLocation = nodeFactory.CreateNode(XmlNodeType.Element, "location", "");
195 Vector3 loc = parcel.UserLocation;
196 if (loc.Equals(Vector3.Zero)) // This test is moot at this point: the location is wrong by default
197 loc = new Vector3((parcel.AABBMax.X + parcel.AABBMin.X) / 2, (parcel.AABBMax.Y + parcel.AABBMin.Y) / 2, (parcel.AABBMax.Z + parcel.AABBMin.Z) / 2);
198 tpLocation.InnerText = loc.X.ToString() + "/" + loc.Y.ToString() + "/" + loc.Z.ToString();
199 xmlparcel.AppendChild(tpLocation);
200
201 XmlNode infouuid = nodeFactory.CreateNode(XmlNodeType.Element, "infouuid", "");
202 uint x = (uint)loc.X, y = (uint)loc.Y;
203 findPointInParcel(land, ref x, ref y); // find a suitable spot
204 infouuid.InnerText = Util.BuildFakeParcelID(
205 m_scene.RegionInfo.RegionHandle, x, y).ToString();
206 xmlparcel.AppendChild(infouuid);
207
208 XmlNode dwell = nodeFactory.CreateNode(XmlNodeType.Element, "dwell", "");
209 dwell.InnerText = "0";
210 xmlparcel.AppendChild(dwell);
211
212 //TODO: figure how to figure out teleport system landData.landingType
213
214 //land texture snapshot uuid
215 if (parcel.SnapshotID != UUID.Zero)
216 { 143 {
217 XmlNode textureuuid = nodeFactory.CreateNode(XmlNodeType.Element, "image", "");
218 textureuuid.InnerText = parcel.SnapshotID.ToString();
219 xmlparcel.AppendChild(textureuuid);
220 }
221
222 //attached user and group
223 if (parcel.GroupID != UUID.Zero)
224 {
225 XmlNode groupblock = nodeFactory.CreateNode(XmlNodeType.Element, "group", "");
226 XmlNode groupuuid = nodeFactory.CreateNode(XmlNodeType.Element, "uuid", "");
227 groupuuid.InnerText = parcel.GroupID.ToString();
228 groupblock.AppendChild(groupuuid);
229
230 //No name yet, there's no way to get a group name since they don't exist yet.
231 //TODO: When groups are supported, add the group handling code.
232 144
233 xmlparcel.AppendChild(groupblock); 145 //TODO: make better method of marshalling data from LandData to XmlNode
234 } 146 XmlNode xmlparcel = nodeFactory.CreateNode(XmlNodeType.Element, "parcel", "");
235 147
236 if (!parcel.IsGroupOwned) 148 // Attributes of the parcel node
237 { 149 XmlAttribute scripts_attr = nodeFactory.CreateAttribute("scripts");
238 XmlNode userblock = nodeFactory.CreateNode(XmlNodeType.Element, "owner", ""); 150 scripts_attr.Value = GetScriptsPermissions(parcel);
151 XmlAttribute build_attr = nodeFactory.CreateAttribute("build");
152 build_attr.Value = GetBuildPermissions(parcel);
153 XmlAttribute public_attr = nodeFactory.CreateAttribute("public");
154 public_attr.Value = GetPublicPermissions(parcel);
155 // Check the category of the Parcel
156 XmlAttribute category_attr = nodeFactory.CreateAttribute("category");
157 category_attr.Value = ((int)parcel.Category).ToString();
158 // Check if the parcel is for sale
159 XmlAttribute forsale_attr = nodeFactory.CreateAttribute("forsale");
160 forsale_attr.Value = CheckForSale(parcel);
161 XmlAttribute sales_attr = nodeFactory.CreateAttribute("salesprice");
162 sales_attr.Value = parcel.SalePrice.ToString();
163
164 XmlAttribute directory_attr = nodeFactory.CreateAttribute("showinsearch");
165 directory_attr.Value = GetShowInSearch(parcel);
166 //XmlAttribute entities_attr = nodeFactory.CreateAttribute("entities");
167 //entities_attr.Value = land.primsOverMe.Count.ToString();
168 xmlparcel.Attributes.Append(directory_attr);
169 xmlparcel.Attributes.Append(scripts_attr);
170 xmlparcel.Attributes.Append(build_attr);
171 xmlparcel.Attributes.Append(public_attr);
172 xmlparcel.Attributes.Append(category_attr);
173 xmlparcel.Attributes.Append(forsale_attr);
174 xmlparcel.Attributes.Append(sales_attr);
175 //xmlparcel.Attributes.Append(entities_attr);
176
177
178 //name, description, area, and UUID
179 XmlNode name = nodeFactory.CreateNode(XmlNodeType.Element, "name", "");
180 name.InnerText = parcel.Name;
181 xmlparcel.AppendChild(name);
182
183 XmlNode desc = nodeFactory.CreateNode(XmlNodeType.Element, "description", "");
184 desc.InnerText = parcel.Description;
185 xmlparcel.AppendChild(desc);
186
187 XmlNode uuid = nodeFactory.CreateNode(XmlNodeType.Element, "uuid", "");
188 uuid.InnerText = parcel.GlobalID.ToString();
189 xmlparcel.AppendChild(uuid);
190
191 XmlNode area = nodeFactory.CreateNode(XmlNodeType.Element, "area", "");
192 area.InnerText = parcel.Area.ToString();
193 xmlparcel.AppendChild(area);
194
195 //default location
196 XmlNode tpLocation = nodeFactory.CreateNode(XmlNodeType.Element, "location", "");
197 Vector3 loc = parcel.UserLocation;
198 if (loc.Equals(Vector3.Zero)) // This test is moot at this point: the location is wrong by default
199 loc = new Vector3((parcel.AABBMax.X + parcel.AABBMin.X) / 2, (parcel.AABBMax.Y + parcel.AABBMin.Y) / 2, (parcel.AABBMax.Z + parcel.AABBMin.Z) / 2);
200 tpLocation.InnerText = loc.X.ToString() + "/" + loc.Y.ToString() + "/" + loc.Z.ToString();
201 xmlparcel.AppendChild(tpLocation);
202
203 XmlNode infouuid = nodeFactory.CreateNode(XmlNodeType.Element, "infouuid", "");
204 uint x = (uint)loc.X, y = (uint)loc.Y;
205 findPointInParcel(land, ref x, ref y); // find a suitable spot
206 infouuid.InnerText = Util.BuildFakeParcelID(
207 m_scene.RegionInfo.RegionHandle, x, y).ToString();
208 xmlparcel.AppendChild(infouuid);
209
210 XmlNode dwell = nodeFactory.CreateNode(XmlNodeType.Element, "dwell", "");
211 dwell.InnerText = "0";
212 xmlparcel.AppendChild(dwell);
213
214 //TODO: figure how to figure out teleport system landData.landingType
215
216 //land texture snapshot uuid
217 if (parcel.SnapshotID != UUID.Zero)
218 {
219 XmlNode textureuuid = nodeFactory.CreateNode(XmlNodeType.Element, "image", "");
220 textureuuid.InnerText = parcel.SnapshotID.ToString();
221 xmlparcel.AppendChild(textureuuid);
222 }
239 223
240 UUID userOwnerUUID = parcel.OwnerID; 224 //attached user and group
225 if (parcel.GroupID != UUID.Zero)
226 {
227 XmlNode groupblock = nodeFactory.CreateNode(XmlNodeType.Element, "group", "");
228 XmlNode groupuuid = nodeFactory.CreateNode(XmlNodeType.Element, "uuid", "");
229 groupuuid.InnerText = parcel.GroupID.ToString();
230 groupblock.AppendChild(groupuuid);
241 231
242 XmlNode useruuid = nodeFactory.CreateNode(XmlNodeType.Element, "uuid", ""); 232 //No name yet, there's no way to get a group name since they don't exist yet.
243 useruuid.InnerText = userOwnerUUID.ToString(); 233 //TODO: When groups are supported, add the group handling code.
244 userblock.AppendChild(useruuid);
245 234
246 try 235 xmlparcel.AppendChild(groupblock);
247 {
248 XmlNode username = nodeFactory.CreateNode(XmlNodeType.Element, "name", "");
249 CachedUserInfo profile = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(userOwnerUUID);
250 username.InnerText = profile.UserProfile.FirstName + " " + profile.UserProfile.SurName;
251 userblock.AppendChild(username);
252 } 236 }
253 catch (Exception) 237
238 if (!parcel.IsGroupOwned)
254 { 239 {
255 //m_log.Info("[DATASNAPSHOT]: Cannot find owner name; ignoring this parcel"); 240 XmlNode userblock = nodeFactory.CreateNode(XmlNodeType.Element, "owner", "");
241
242 UUID userOwnerUUID = parcel.OwnerID;
243
244 XmlNode useruuid = nodeFactory.CreateNode(XmlNodeType.Element, "uuid", "");
245 useruuid.InnerText = userOwnerUUID.ToString();
246 userblock.AppendChild(useruuid);
247
248 try
249 {
250 XmlNode username = nodeFactory.CreateNode(XmlNodeType.Element, "name", "");
251 CachedUserInfo profile = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(userOwnerUUID);
252 username.InnerText = profile.UserProfile.FirstName + " " + profile.UserProfile.SurName;
253 userblock.AppendChild(username);
254 }
255 catch (Exception)
256 {
257 //m_log.Info("[DATASNAPSHOT]: Cannot find owner name; ignoring this parcel");
258 }
259
260 xmlparcel.AppendChild(userblock);
256 } 261 }
257 262 //else
258 xmlparcel.AppendChild(userblock); 263 //{
264 // XmlAttribute type = (XmlAttribute)nodeFactory.CreateNode(XmlNodeType.Attribute, "type", "");
265 // type.InnerText = "owner";
266 // groupblock.Attributes.Append(type);
267 //}
268
269 parent.AppendChild(xmlparcel);
259 } 270 }
260 //else
261 //{
262 // XmlAttribute type = (XmlAttribute)nodeFactory.CreateNode(XmlNodeType.Attribute, "type", "");
263 // type.InnerText = "owner";
264 // groupblock.Attributes.Append(type);
265 //}
266
267 parent.AppendChild(xmlparcel);
268 // }
269 } 271 }
270 //snap.AppendChild(parent); 272 //snap.AppendChild(parent);
271 } 273 }
@@ -378,7 +380,7 @@ namespace OpenSim.Region.DataSnapshot.Providers
378 // another, smaller rectangular parcel). Both will have the same initial coordinates. 380 // another, smaller rectangular parcel). Both will have the same initial coordinates.
379 private void findPointInParcel(ILandObject land, ref uint refX, ref uint refY) 381 private void findPointInParcel(ILandObject land, ref uint refX, ref uint refY)
380 { 382 {
381 m_log.DebugFormat("[LAND] trying {0}, {1}", refX, refY); 383 m_log.DebugFormat("[DATASNAPSHOT] trying {0}, {1}", refX, refY);
382 // the point we started with already is in the parcel 384 // the point we started with already is in the parcel
383 if (land.containsPoint((int)refX, (int)refY)) return; 385 if (land.containsPoint((int)refX, (int)refY)) return;
384 386