aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/DataSnapshot
diff options
context:
space:
mode:
authorMelanie Thielker2008-10-10 20:23:49 +0000
committerMelanie Thielker2008-10-10 20:23:49 +0000
commit85ae8e3e946924fae4ea56cdb70397753a460868 (patch)
tree68af0ef0121b09de29fafa592c9d05388e8ed464 /OpenSim/Region/DataSnapshot
parentadded a list of SurfaceTouchEventArgs to the IClientAPI.OnGrab event, for the... (diff)
downloadopensim-SC_OLD-85ae8e3e946924fae4ea56cdb70397753a460868.zip
opensim-SC_OLD-85ae8e3e946924fae4ea56cdb70397753a460868.tar.gz
opensim-SC_OLD-85ae8e3e946924fae4ea56cdb70397753a460868.tar.bz2
opensim-SC_OLD-85ae8e3e946924fae4ea56cdb70397753a460868.tar.xz
Committing diva's LandSnapshot update patch. Also included is a small
fix for the LandManagementModule. I changed LandSnapshot to use CachedUserInfo to take a load off the user server. Also, missing owner profiles are legit, warning removed.
Diffstat (limited to 'OpenSim/Region/DataSnapshot')
-rw-r--r--OpenSim/Region/DataSnapshot/LandSnapshot.cs265
1 files changed, 134 insertions, 131 deletions
diff --git a/OpenSim/Region/DataSnapshot/LandSnapshot.cs b/OpenSim/Region/DataSnapshot/LandSnapshot.cs
index 1ea70a9..562cd8a 100644
--- a/OpenSim/Region/DataSnapshot/LandSnapshot.cs
+++ b/OpenSim/Region/DataSnapshot/LandSnapshot.cs
@@ -37,6 +37,7 @@ using OpenSim.Region.Environment.Interfaces;
37using OpenSim.Region.Environment.Modules.World.Land; 37using OpenSim.Region.Environment.Modules.World.Land;
38using OpenSim.Region.Environment.Scenes; 38using OpenSim.Region.Environment.Scenes;
39using OpenMetaverse.Packets; 39using OpenMetaverse.Packets;
40using OpenSim.Framework.Communications.Cache;
40 41
41namespace OpenSim.Region.DataSnapshot.Providers 42namespace OpenSim.Region.DataSnapshot.Providers
42{ 43{
@@ -136,134 +137,135 @@ namespace OpenSim.Region.DataSnapshot.Providers
136 LandObject land = (LandObject)parcel_interface; 137 LandObject land = (LandObject)parcel_interface;
137 138
138 LandData parcel = land.landData; 139 LandData parcel = land.landData;
139// if ((parcel.Flags & (uint)Parcel.ParcelFlags.ShowDirectory) == (uint)Parcel.ParcelFlags.ShowDirectory) 140 // if ((parcel.Flags & (uint)Parcel.ParcelFlags.ShowDirectory) == (uint)Parcel.ParcelFlags.ShowDirectory)
140// { 141 // {
141 142
142 //TODO: make better method of marshalling data from LandData to XmlNode 143 //TODO: make better method of marshalling data from LandData to XmlNode
143 XmlNode xmlparcel = nodeFactory.CreateNode(XmlNodeType.Element, "parcel", ""); 144 XmlNode xmlparcel = nodeFactory.CreateNode(XmlNodeType.Element, "parcel", "");
144 145
145 // Attributes of the parcel node 146 // Attributes of the parcel node
146 XmlAttribute scripts_attr = nodeFactory.CreateAttribute("scripts"); 147 XmlAttribute scripts_attr = nodeFactory.CreateAttribute("scripts");
147 scripts_attr.Value = GetScriptsPermissions(parcel); 148 scripts_attr.Value = GetScriptsPermissions(parcel);
148 XmlAttribute build_attr = nodeFactory.CreateAttribute("build"); 149 XmlAttribute build_attr = nodeFactory.CreateAttribute("build");
149 build_attr.Value = GetBuildPermissions(parcel); 150 build_attr.Value = GetBuildPermissions(parcel);
150 XmlAttribute public_attr = nodeFactory.CreateAttribute("public"); 151 XmlAttribute public_attr = nodeFactory.CreateAttribute("public");
151 public_attr.Value = GetPublicPermissions(parcel); 152 public_attr.Value = GetPublicPermissions(parcel);
152 // Check the category of the Parcel 153 // Check the category of the Parcel
153 XmlAttribute category_attr = nodeFactory.CreateAttribute("category"); 154 XmlAttribute category_attr = nodeFactory.CreateAttribute("category");
154 category_attr.Value = ((int)parcel.Category).ToString(); 155 category_attr.Value = ((int)parcel.Category).ToString();
155 // Check if the parcel is for sale 156 // Check if the parcel is for sale
156 XmlAttribute forsale_attr = nodeFactory.CreateAttribute("forsale"); 157 XmlAttribute forsale_attr = nodeFactory.CreateAttribute("forsale");
157 forsale_attr.Value = CheckForSale(parcel); 158 forsale_attr.Value = CheckForSale(parcel);
158 XmlAttribute sales_attr = nodeFactory.CreateAttribute("salesprice"); 159 XmlAttribute sales_attr = nodeFactory.CreateAttribute("salesprice");
159 sales_attr.Value = parcel.SalePrice.ToString(); 160 sales_attr.Value = parcel.SalePrice.ToString();
160 161
161 XmlAttribute directory_attr = nodeFactory.CreateAttribute("show_directory"); 162 XmlAttribute directory_attr = nodeFactory.CreateAttribute("show_directory");
162 directory_attr.Value = GetShowInSearch(parcel); 163 directory_attr.Value = GetShowInSearch(parcel);
163 //XmlAttribute entities_attr = nodeFactory.CreateAttribute("entities"); 164 //XmlAttribute entities_attr = nodeFactory.CreateAttribute("entities");
164 //entities_attr.Value = land.primsOverMe.Count.ToString(); 165 //entities_attr.Value = land.primsOverMe.Count.ToString();
165 xmlparcel.Attributes.Append(scripts_attr); 166 xmlparcel.Attributes.Append(directory_attr);
166 xmlparcel.Attributes.Append(build_attr); 167 xmlparcel.Attributes.Append(scripts_attr);
167 xmlparcel.Attributes.Append(public_attr); 168 xmlparcel.Attributes.Append(build_attr);
168 xmlparcel.Attributes.Append(category_attr); 169 xmlparcel.Attributes.Append(public_attr);
169 xmlparcel.Attributes.Append(forsale_attr); 170 xmlparcel.Attributes.Append(category_attr);
170 xmlparcel.Attributes.Append(sales_attr); 171 xmlparcel.Attributes.Append(forsale_attr);
171 //xmlparcel.Attributes.Append(entities_attr); 172 xmlparcel.Attributes.Append(sales_attr);
172 173 //xmlparcel.Attributes.Append(entities_attr);
173 174
174 //name, description, area, and UUID 175
175 XmlNode name = nodeFactory.CreateNode(XmlNodeType.Element, "name", ""); 176 //name, description, area, and UUID
176 name.InnerText = parcel.Name; 177 XmlNode name = nodeFactory.CreateNode(XmlNodeType.Element, "name", "");
177 xmlparcel.AppendChild(name); 178 name.InnerText = parcel.Name;
178 179 xmlparcel.AppendChild(name);
179 XmlNode desc = nodeFactory.CreateNode(XmlNodeType.Element, "description", ""); 180
180 desc.InnerText = parcel.Description; 181 XmlNode desc = nodeFactory.CreateNode(XmlNodeType.Element, "description", "");
181 xmlparcel.AppendChild(desc); 182 desc.InnerText = parcel.Description;
182 183 xmlparcel.AppendChild(desc);
183 XmlNode uuid = nodeFactory.CreateNode(XmlNodeType.Element, "uuid", ""); 184
184 uuid.InnerText = parcel.GlobalID.ToString(); 185 XmlNode uuid = nodeFactory.CreateNode(XmlNodeType.Element, "uuid", "");
185 xmlparcel.AppendChild(uuid); 186 uuid.InnerText = parcel.GlobalID.ToString();
186 187 xmlparcel.AppendChild(uuid);
187 XmlNode area = nodeFactory.CreateNode(XmlNodeType.Element, "area", ""); 188
188 area.InnerText = parcel.Area.ToString(); 189 XmlNode area = nodeFactory.CreateNode(XmlNodeType.Element, "area", "");
189 xmlparcel.AppendChild(area); 190 area.InnerText = parcel.Area.ToString();
190 191 xmlparcel.AppendChild(area);
191 //default location 192
192 XmlNode tpLocation = nodeFactory.CreateNode(XmlNodeType.Element, "location", ""); 193 //default location
193 Vector3 loc = parcel.UserLocation; 194 XmlNode tpLocation = nodeFactory.CreateNode(XmlNodeType.Element, "location", "");
194 if (loc.Equals(Vector3.Zero)) // This test is moot at this point: the location is wrong by default 195 Vector3 loc = parcel.UserLocation;
195 loc = new Vector3((parcel.AABBMax.X + parcel.AABBMin.X) / 2, (parcel.AABBMax.Y + parcel.AABBMin.Y) / 2, (parcel.AABBMax.Z + parcel.AABBMin.Z) / 2); 196 if (loc.Equals(Vector3.Zero)) // This test is moot at this point: the location is wrong by default
196 tpLocation.InnerText = loc.X.ToString() + "/" + loc.Y.ToString() + "/" + loc.Z.ToString(); 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);
197 xmlparcel.AppendChild(tpLocation); 198 tpLocation.InnerText = loc.X.ToString() + "/" + loc.Y.ToString() + "/" + loc.Z.ToString();
198 199 xmlparcel.AppendChild(tpLocation);
199 XmlNode infouuid = nodeFactory.CreateNode(XmlNodeType.Element, "infouuid", ""); 200
200 uint x = (uint)loc.X, y = (uint)loc.Y; 201 XmlNode infouuid = nodeFactory.CreateNode(XmlNodeType.Element, "infouuid", "");
201 findPointInParcel(land, ref x, ref y); // find a suitable spot 202 uint x = (uint)loc.X, y = (uint)loc.Y;
202 infouuid.InnerText = Util.BuildFakeParcelID( 203 findPointInParcel(land, ref x, ref y); // find a suitable spot
203 m_scene.RegionInfo.RegionHandle, x, y).ToString(); 204 infouuid.InnerText = Util.BuildFakeParcelID(
204 xmlparcel.AppendChild(infouuid); 205 m_scene.RegionInfo.RegionHandle, x, y).ToString();
205 206 xmlparcel.AppendChild(infouuid);
206 XmlNode dwell = nodeFactory.CreateNode(XmlNodeType.Element, "dwell", ""); 207
207 dwell.InnerText = "0"; 208 XmlNode dwell = nodeFactory.CreateNode(XmlNodeType.Element, "dwell", "");
208 xmlparcel.AppendChild(dwell); 209 dwell.InnerText = "0";
209 210 xmlparcel.AppendChild(dwell);
210 //TODO: figure how to figure out teleport system landData.landingType 211
211 212 //TODO: figure how to figure out teleport system landData.landingType
212 //land texture snapshot uuid 213
213 if (parcel.SnapshotID != UUID.Zero) 214 //land texture snapshot uuid
214 { 215 if (parcel.SnapshotID != UUID.Zero)
215 XmlNode textureuuid = nodeFactory.CreateNode(XmlNodeType.Element, "image", ""); 216 {
216 textureuuid.InnerText = parcel.SnapshotID.ToString(); 217 XmlNode textureuuid = nodeFactory.CreateNode(XmlNodeType.Element, "image", "");
217 xmlparcel.AppendChild(textureuuid); 218 textureuuid.InnerText = parcel.SnapshotID.ToString();
218 } 219 xmlparcel.AppendChild(textureuuid);
220 }
219 221
220 //attached user and group 222 //attached user and group
221 if (parcel.GroupID != UUID.Zero) 223 if (parcel.GroupID != UUID.Zero)
222 { 224 {
223 XmlNode groupblock = nodeFactory.CreateNode(XmlNodeType.Element, "group", ""); 225 XmlNode groupblock = nodeFactory.CreateNode(XmlNodeType.Element, "group", "");
224 XmlNode groupuuid = nodeFactory.CreateNode(XmlNodeType.Element, "uuid", ""); 226 XmlNode groupuuid = nodeFactory.CreateNode(XmlNodeType.Element, "uuid", "");
225 groupuuid.InnerText = parcel.GroupID.ToString(); 227 groupuuid.InnerText = parcel.GroupID.ToString();
226 groupblock.AppendChild(groupuuid); 228 groupblock.AppendChild(groupuuid);
227 229
228 //No name yet, there's no way to get a group name since they don't exist yet. 230 //No name yet, there's no way to get a group name since they don't exist yet.
229 //TODO: When groups are supported, add the group handling code. 231 //TODO: When groups are supported, add the group handling code.
230 232
231 xmlparcel.AppendChild(groupblock); 233 xmlparcel.AppendChild(groupblock);
232 } 234 }
235
236 if (!parcel.IsGroupOwned)
237 {
238 XmlNode userblock = nodeFactory.CreateNode(XmlNodeType.Element, "owner", "");
239
240 UUID userOwnerUUID = parcel.OwnerID;
233 241
234 if (!parcel.IsGroupOwned) 242 XmlNode useruuid = nodeFactory.CreateNode(XmlNodeType.Element, "uuid", "");
243 useruuid.InnerText = userOwnerUUID.ToString();
244 userblock.AppendChild(useruuid);
245
246 try
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 }
253 catch (Exception)
235 { 254 {
236 XmlNode userblock = nodeFactory.CreateNode(XmlNodeType.Element, "owner", ""); 255 //m_log.Info("[DATASNAPSHOT]: Cannot find owner name; ignoring this parcel");
237
238 UUID userOwnerUUID = parcel.OwnerID;
239
240 XmlNode useruuid = nodeFactory.CreateNode(XmlNodeType.Element, "uuid", "");
241 useruuid.InnerText = userOwnerUUID.ToString();
242 userblock.AppendChild(useruuid);
243
244 try
245 {
246 XmlNode username = nodeFactory.CreateNode(XmlNodeType.Element, "name", "");
247 UserProfileData userProfile = m_scene.CommsManager.UserService.GetUserProfile(userOwnerUUID);
248 username.InnerText = userProfile.FirstName + " " + userProfile.SurName;
249 userblock.AppendChild(username);
250 }
251 catch (Exception)
252 {
253 m_log.Info("[DATASNAPSHOT]: Cannot find owner name; ignoring this parcel");
254 }
255
256 xmlparcel.AppendChild(userblock);
257 } 256 }
258 //else 257
259 //{ 258 xmlparcel.AppendChild(userblock);
260 // XmlAttribute type = (XmlAttribute)nodeFactory.CreateNode(XmlNodeType.Attribute, "type", ""); 259 }
261 // type.InnerText = "owner"; 260 //else
262 // groupblock.Attributes.Append(type); 261 //{
263 //} 262 // XmlAttribute type = (XmlAttribute)nodeFactory.CreateNode(XmlNodeType.Attribute, "type", "");
264 263 // type.InnerText = "owner";
265 parent.AppendChild(xmlparcel); 264 // groupblock.Attributes.Append(type);
266// } 265 //}
266
267 parent.AppendChild(xmlparcel);
268 // }
267 } 269 }
268 //snap.AppendChild(parent); 270 //snap.AppendChild(parent);
269 } 271 }
@@ -327,7 +329,7 @@ namespace OpenSim.Region.DataSnapshot.Providers
327 329
328 private string CheckForSale(LandData parcel) 330 private string CheckForSale(LandData parcel)
329 { 331 {
330 if (parcel.SalePrice > 0) 332 if ((parcel.Flags & (uint)Parcel.ParcelFlags.ForSale) == (uint)Parcel.ParcelFlags.ForSale)
331 return "true"; 333 return "true";
332 else 334 else
333 return "false"; 335 return "false";
@@ -349,15 +351,15 @@ namespace OpenSim.Region.DataSnapshot.Providers
349 public void OnNewClient(IClientAPI client) 351 public void OnNewClient(IClientAPI client)
350 { 352 {
351 //Land hooks 353 //Land hooks
352 client.OnParcelDivideRequest += delegate (int west, int south, int east, int north, 354 client.OnParcelDivideRequest += delegate(int west, int south, int east, int north,
353 IClientAPI remote_client) { this.Stale = true; }; 355 IClientAPI remote_client) { this.Stale = true; };
354 client.OnParcelJoinRequest += delegate (int west, int south, int east, int north, 356 client.OnParcelJoinRequest += delegate(int west, int south, int east, int north,
355 IClientAPI remote_client) { this.Stale = true; }; 357 IClientAPI remote_client) { this.Stale = true; };
356 client.OnParcelPropertiesUpdateRequest += delegate(LandUpdateArgs args, int local_id, 358 client.OnParcelPropertiesUpdateRequest += delegate(LandUpdateArgs args, int local_id,
357 IClientAPI remote_client) { this.Stale = true; }; 359 IClientAPI remote_client) { this.Stale = true; };
358 client.OnParcelBuy += delegate (UUID agentId, UUID groupId, bool final, bool groupOwned, 360 client.OnParcelBuy += delegate(UUID agentId, UUID groupId, bool final, bool groupOwned,
359 bool removeContribution, int parcelLocalID, int parcelArea, int parcelPrice, bool authenticated) 361 bool removeContribution, int parcelLocalID, int parcelArea, int parcelPrice, bool authenticated)
360 { this.Stale = true; }; 362 { this.Stale = true; };
361 } 363 }
362 364
363 public void ParcelSplitHook(int west, int south, int east, int north, IClientAPI remote_client) 365 public void ParcelSplitHook(int west, int south, int east, int north, IClientAPI remote_client)
@@ -371,7 +373,7 @@ namespace OpenSim.Region.DataSnapshot.Providers
371 } 373 }
372 374
373 #endregion 375 #endregion
374 376
375 // this is needed for non-convex parcels (example: rectangular parcel, and in the exact center 377 // this is needed for non-convex parcels (example: rectangular parcel, and in the exact center
376 // another, smaller rectangular parcel). Both will have the same initial coordinates. 378 // another, smaller rectangular parcel). Both will have the same initial coordinates.
377 private void findPointInParcel(ILandObject land, ref uint refX, ref uint refY) 379 private void findPointInParcel(ILandObject land, ref uint refX, ref uint refY)
@@ -379,19 +381,19 @@ namespace OpenSim.Region.DataSnapshot.Providers
379 m_log.DebugFormat("[LAND] trying {0}, {1}", refX, refY); 381 m_log.DebugFormat("[LAND] trying {0}, {1}", refX, refY);
380 // the point we started with already is in the parcel 382 // the point we started with already is in the parcel
381 if (land.containsPoint((int)refX, (int)refY)) return; 383 if (land.containsPoint((int)refX, (int)refY)) return;
382 384
383 // ... otherwise, we have to search for a point within the parcel 385 // ... otherwise, we have to search for a point within the parcel
384 uint startX = (uint)land.landData.AABBMin.X; 386 uint startX = (uint)land.landData.AABBMin.X;
385 uint startY = (uint)land.landData.AABBMin.Y; 387 uint startY = (uint)land.landData.AABBMin.Y;
386 uint endX = (uint)land.landData.AABBMax.X; 388 uint endX = (uint)land.landData.AABBMax.X;
387 uint endY = (uint)land.landData.AABBMax.Y; 389 uint endY = (uint)land.landData.AABBMax.Y;
388 390
389 // default: center of the parcel 391 // default: center of the parcel
390 refX = (startX + endX) / 2; 392 refX = (startX + endX) / 2;
391 refY = (startY + endY) / 2; 393 refY = (startY + endY) / 2;
392 // If the center point is within the parcel, take that one 394 // If the center point is within the parcel, take that one
393 if (land.containsPoint((int)refX, (int)refY)) return; 395 if (land.containsPoint((int)refX, (int)refY)) return;
394 396
395 // otherwise, go the long way. 397 // otherwise, go the long way.
396 for (uint y = startY; y <= endY; ++y) 398 for (uint y = startY; y <= endY; ++y)
397 { 399 {
@@ -409,3 +411,4 @@ namespace OpenSim.Region.DataSnapshot.Providers
409 } 411 }
410 } 412 }
411} 413}
414