diff options
author | Melanie Thielker | 2008-09-17 23:08:46 +0000 |
---|---|---|
committer | Melanie Thielker | 2008-09-17 23:08:46 +0000 |
commit | 386c3e41f0e92737f0478cf789438e8fb3c3c1e3 (patch) | |
tree | 0c59cfa1bcd57fb2c03029bf0a549fc248a1baf6 | |
parent | Kan-Ed fix series. Fix llTakeControls to behave as documented. (diff) | |
download | opensim-SC_OLD-386c3e41f0e92737f0478cf789438e8fb3c3c1e3.zip opensim-SC_OLD-386c3e41f0e92737f0478cf789438e8fb3c3c1e3.tar.gz opensim-SC_OLD-386c3e41f0e92737f0478cf789438e8fb3c3c1e3.tar.bz2 opensim-SC_OLD-386c3e41f0e92737f0478cf789438e8fb3c3c1e3.tar.xz |
Add various XML elements to the data snapshot. Changes by Fly-Man and
myself. Fix a crash in DataSnapshot when no master avatar and no
estate owner is set (e.g. "Mainland").
-rw-r--r-- | OpenSim/Region/DataSnapshot/EstateSnapshot.cs | 64 | ||||
-rw-r--r-- | OpenSim/Region/DataSnapshot/LandSnapshot.cs | 27 | ||||
-rw-r--r-- | OpenSim/Region/DataSnapshot/SnapshotStore.cs | 4 |
3 files changed, 78 insertions, 17 deletions
diff --git a/OpenSim/Region/DataSnapshot/EstateSnapshot.cs b/OpenSim/Region/DataSnapshot/EstateSnapshot.cs index f25aad4..dea5cb1 100644 --- a/OpenSim/Region/DataSnapshot/EstateSnapshot.cs +++ b/OpenSim/Region/DataSnapshot/EstateSnapshot.cs | |||
@@ -58,30 +58,60 @@ namespace OpenSim.Region.DataSnapshot.Providers | |||
58 | if (m_scene.RegionInfo.EstateSettings.EstateOwner != UUID.Zero) | 58 | if (m_scene.RegionInfo.EstateSettings.EstateOwner != UUID.Zero) |
59 | ownerid = m_scene.RegionInfo.EstateSettings.EstateOwner; | 59 | ownerid = m_scene.RegionInfo.EstateSettings.EstateOwner; |
60 | 60 | ||
61 | // Can't fail because if it weren't in cache, we wouldn't be here | ||
62 | // | ||
63 | UserProfileData userProfile = m_scene.CommsManager.UserService.GetUserProfile(ownerid); | 61 | UserProfileData userProfile = m_scene.CommsManager.UserService.GetUserProfile(ownerid); |
64 | 62 | ||
65 | //TODO: Change to query userserver about the master avatar UUID ? | 63 | //TODO: Change to query userserver about the master avatar UUID ? |
66 | String firstname = userProfile.FirstName; | 64 | String firstname; |
67 | String lastname = userProfile.SurName; | 65 | String lastname; |
66 | |||
67 | if (userProfile != null) | ||
68 | { | ||
69 | firstname = userProfile.FirstName; | ||
70 | lastname = userProfile.SurName; | ||
71 | |||
72 | //TODO: Fix the marshalling system to have less copypasta gruntwork | ||
73 | XmlNode user = factory.CreateNode(XmlNodeType.Element, "user", ""); | ||
74 | XmlAttribute type = (XmlAttribute)factory.CreateNode(XmlNodeType.Attribute, "type", ""); | ||
75 | type.Value = "owner"; | ||
76 | user.Attributes.Append(type); | ||
77 | |||
78 | //TODO: Create more TODOs | ||
79 | XmlNode username = factory.CreateNode(XmlNodeType.Element, "name", ""); | ||
80 | username.InnerText = firstname + " " + lastname; | ||
81 | user.AppendChild(username); | ||
82 | |||
83 | XmlNode useruuid = factory.CreateNode(XmlNodeType.Element, "uuid", ""); | ||
84 | useruuid.InnerText = ownerid.ToString(); | ||
85 | user.AppendChild(useruuid); | ||
86 | |||
87 | estatedata.AppendChild(user); | ||
88 | } | ||
89 | |||
90 | XmlNode estatename = factory.CreateNode(XmlNodeType.Element, "name", ""); | ||
91 | estatename.InnerText = m_scene.RegionInfo.EstateSettings.EstateName.ToString(); | ||
92 | estatedata.AppendChild(estatename); | ||
93 | |||
94 | XmlNode estateid = factory.CreateNode(XmlNodeType.Element, "id", ""); | ||
95 | estateid.InnerText = m_scene.RegionInfo.EstateSettings.EstateID.ToString(); | ||
96 | estatedata.AppendChild(estateid); | ||
97 | |||
98 | XmlNode parentid = factory.CreateNode(XmlNodeType.Element, "parentid", ""); | ||
99 | parentid.InnerText = m_scene.RegionInfo.EstateSettings.ParentEstateID.ToString(); | ||
100 | estatedata.AppendChild(parentid); | ||
101 | |||
102 | XmlNode flags = factory.CreateNode(XmlNodeType.Element, "flags", ""); | ||
103 | |||
104 | XmlAttribute teleport = (XmlAttribute)factory.CreateNode(XmlNodeType.Attribute, "teleport", ""); | ||
105 | teleport.Value = m_scene.RegionInfo.EstateSettings.AllowDirectTeleport.ToString(); | ||
106 | flags.Attributes.Append(teleport); | ||
68 | 107 | ||
69 | //TODO: Fix the marshalling system to have less copypasta gruntwork | 108 | XmlAttribute publicaccess = (XmlAttribute)factory.CreateNode(XmlNodeType.Attribute, "public", ""); |
70 | XmlNode user = factory.CreateNode(XmlNodeType.Element, "user", ""); | 109 | publicaccess.Value = m_scene.RegionInfo.EstateSettings.PublicAccess.ToString(); |
71 | XmlAttribute type = (XmlAttribute)factory.CreateNode(XmlNodeType.Attribute, "type", ""); | 110 | flags.Attributes.Append(publicaccess); |
72 | type.Value = "owner"; | ||
73 | user.Attributes.Append(type); | ||
74 | 111 | ||
75 | //TODO: Create more TODOs | ||
76 | XmlNode username = factory.CreateNode(XmlNodeType.Element, "name", ""); | ||
77 | username.InnerText = firstname + " " + lastname; | ||
78 | user.AppendChild(username); | ||
79 | 112 | ||
80 | XmlNode useruuid = factory.CreateNode(XmlNodeType.Element, "uuid", ""); | 113 | estatedata.AppendChild(flags); |
81 | useruuid.InnerText = ownerid.ToString(); | ||
82 | user.AppendChild(useruuid); | ||
83 | 114 | ||
84 | estatedata.AppendChild(user); | ||
85 | 115 | ||
86 | this.Stale = false; | 116 | this.Stale = false; |
87 | return estatedata; | 117 | return estatedata; |
diff --git a/OpenSim/Region/DataSnapshot/LandSnapshot.cs b/OpenSim/Region/DataSnapshot/LandSnapshot.cs index dc7ef8c..a06c64f 100644 --- a/OpenSim/Region/DataSnapshot/LandSnapshot.cs +++ b/OpenSim/Region/DataSnapshot/LandSnapshot.cs | |||
@@ -145,11 +145,20 @@ namespace OpenSim.Region.DataSnapshot.Providers | |||
145 | // Attributes of the parcel node | 145 | // Attributes of the parcel node |
146 | XmlAttribute scripts_attr = nodeFactory.CreateAttribute("scripts"); | 146 | XmlAttribute scripts_attr = nodeFactory.CreateAttribute("scripts"); |
147 | scripts_attr.Value = GetScriptsPermissions(parcel); | 147 | scripts_attr.Value = GetScriptsPermissions(parcel); |
148 | XmlAttribute build_attr = nodeFactory.CreateAttribute("build"); | ||
149 | build_attr.Value = GetBuildPermissions(parcel); | ||
150 | XmlAttribute public_attr = nodeFactory.CreateAttribute("public"); | ||
151 | public_attr.Value = GetPublicPermissions(parcel); | ||
152 | // Check the category of the Parcel | ||
148 | XmlAttribute category_attr = nodeFactory.CreateAttribute("category"); | 153 | XmlAttribute category_attr = nodeFactory.CreateAttribute("category"); |
149 | category_attr.Value = parcel.Category.ToString(); | 154 | category_attr.Value = parcel.Category.ToString(); |
155 | |||
156 | |||
150 | //XmlAttribute entities_attr = nodeFactory.CreateAttribute("entities"); | 157 | //XmlAttribute entities_attr = nodeFactory.CreateAttribute("entities"); |
151 | //entities_attr.Value = land.primsOverMe.Count.ToString(); | 158 | //entities_attr.Value = land.primsOverMe.Count.ToString(); |
152 | xmlparcel.Attributes.Append(scripts_attr); | 159 | xmlparcel.Attributes.Append(scripts_attr); |
160 | xmlparcel.Attributes.Append(build_attr); | ||
161 | xmlparcel.Attributes.Append(public_attr); | ||
153 | xmlparcel.Attributes.Append(category_attr); | 162 | xmlparcel.Attributes.Append(category_attr); |
154 | //xmlparcel.Attributes.Append(entities_attr); | 163 | //xmlparcel.Attributes.Append(entities_attr); |
155 | 164 | ||
@@ -279,6 +288,24 @@ namespace OpenSim.Region.DataSnapshot.Providers | |||
279 | 288 | ||
280 | } | 289 | } |
281 | 290 | ||
291 | private string GetPublicPermissions(LandData parcel) | ||
292 | { | ||
293 | if ((parcel.Flags & (uint)Parcel.ParcelFlags.UseAccessList) == (uint)Parcel.ParcelFlags.UseAccessList) | ||
294 | return "yes"; | ||
295 | else | ||
296 | return "no"; | ||
297 | |||
298 | } | ||
299 | |||
300 | private string GetBuildPermissions(LandData parcel) | ||
301 | { | ||
302 | if ((parcel.Flags & (uint)Parcel.ParcelFlags.CreateObjects) == (uint)Parcel.ParcelFlags.CreateObjects) | ||
303 | return "yes"; | ||
304 | else | ||
305 | return "no"; | ||
306 | |||
307 | } | ||
308 | |||
282 | #endregion | 309 | #endregion |
283 | 310 | ||
284 | #region Change detection hooks | 311 | #region Change detection hooks |
diff --git a/OpenSim/Region/DataSnapshot/SnapshotStore.cs b/OpenSim/Region/DataSnapshot/SnapshotStore.cs index e169a86..311350d 100644 --- a/OpenSim/Region/DataSnapshot/SnapshotStore.cs +++ b/OpenSim/Region/DataSnapshot/SnapshotStore.cs | |||
@@ -245,6 +245,10 @@ namespace OpenSim.Region.DataSnapshot | |||
245 | infopiece.InnerText = scene.RegionInfo.RegionName; | 245 | infopiece.InnerText = scene.RegionInfo.RegionName; |
246 | infoblock.AppendChild(infopiece); | 246 | infoblock.AppendChild(infopiece); |
247 | 247 | ||
248 | infopiece = basedoc.CreateNode(XmlNodeType.Element, "handle", ""); | ||
249 | infopiece.InnerText = scene.RegionInfo.RegionHandle.ToString(); | ||
250 | infoblock.AppendChild(infopiece); | ||
251 | |||
248 | docElement.AppendChild(infoblock); | 252 | docElement.AppendChild(infoblock); |
249 | 253 | ||
250 | m_log.Debug("[DATASNAPSHOT]: Generated region node"); | 254 | m_log.Debug("[DATASNAPSHOT]: Generated region node"); |