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").
0.6.0-stable
Melanie Thielker 2008-09-17 23:08:46 +00:00
parent 7e8320bada
commit 386c3e41f0
3 changed files with 78 additions and 17 deletions

View File

@ -58,30 +58,60 @@ namespace OpenSim.Region.DataSnapshot.Providers
if (m_scene.RegionInfo.EstateSettings.EstateOwner != UUID.Zero)
ownerid = m_scene.RegionInfo.EstateSettings.EstateOwner;
// Can't fail because if it weren't in cache, we wouldn't be here
//
UserProfileData userProfile = m_scene.CommsManager.UserService.GetUserProfile(ownerid);
//TODO: Change to query userserver about the master avatar UUID ?
String firstname = userProfile.FirstName;
String lastname = userProfile.SurName;
String firstname;
String lastname;
//TODO: Fix the marshalling system to have less copypasta gruntwork
XmlNode user = factory.CreateNode(XmlNodeType.Element, "user", "");
XmlAttribute type = (XmlAttribute)factory.CreateNode(XmlNodeType.Attribute, "type", "");
type.Value = "owner";
user.Attributes.Append(type);
if (userProfile != null)
{
firstname = userProfile.FirstName;
lastname = userProfile.SurName;
//TODO: Create more TODOs
XmlNode username = factory.CreateNode(XmlNodeType.Element, "name", "");
username.InnerText = firstname + " " + lastname;
user.AppendChild(username);
//TODO: Fix the marshalling system to have less copypasta gruntwork
XmlNode user = factory.CreateNode(XmlNodeType.Element, "user", "");
XmlAttribute type = (XmlAttribute)factory.CreateNode(XmlNodeType.Attribute, "type", "");
type.Value = "owner";
user.Attributes.Append(type);
XmlNode useruuid = factory.CreateNode(XmlNodeType.Element, "uuid", "");
useruuid.InnerText = ownerid.ToString();
user.AppendChild(useruuid);
//TODO: Create more TODOs
XmlNode username = factory.CreateNode(XmlNodeType.Element, "name", "");
username.InnerText = firstname + " " + lastname;
user.AppendChild(username);
XmlNode useruuid = factory.CreateNode(XmlNodeType.Element, "uuid", "");
useruuid.InnerText = ownerid.ToString();
user.AppendChild(useruuid);
estatedata.AppendChild(user);
}
XmlNode estatename = factory.CreateNode(XmlNodeType.Element, "name", "");
estatename.InnerText = m_scene.RegionInfo.EstateSettings.EstateName.ToString();
estatedata.AppendChild(estatename);
XmlNode estateid = factory.CreateNode(XmlNodeType.Element, "id", "");
estateid.InnerText = m_scene.RegionInfo.EstateSettings.EstateID.ToString();
estatedata.AppendChild(estateid);
XmlNode parentid = factory.CreateNode(XmlNodeType.Element, "parentid", "");
parentid.InnerText = m_scene.RegionInfo.EstateSettings.ParentEstateID.ToString();
estatedata.AppendChild(parentid);
XmlNode flags = factory.CreateNode(XmlNodeType.Element, "flags", "");
XmlAttribute teleport = (XmlAttribute)factory.CreateNode(XmlNodeType.Attribute, "teleport", "");
teleport.Value = m_scene.RegionInfo.EstateSettings.AllowDirectTeleport.ToString();
flags.Attributes.Append(teleport);
XmlAttribute publicaccess = (XmlAttribute)factory.CreateNode(XmlNodeType.Attribute, "public", "");
publicaccess.Value = m_scene.RegionInfo.EstateSettings.PublicAccess.ToString();
flags.Attributes.Append(publicaccess);
estatedata.AppendChild(flags);
estatedata.AppendChild(user);
this.Stale = false;
return estatedata;

View File

@ -145,11 +145,20 @@ namespace OpenSim.Region.DataSnapshot.Providers
// Attributes of the parcel node
XmlAttribute scripts_attr = nodeFactory.CreateAttribute("scripts");
scripts_attr.Value = GetScriptsPermissions(parcel);
XmlAttribute build_attr = nodeFactory.CreateAttribute("build");
build_attr.Value = GetBuildPermissions(parcel);
XmlAttribute public_attr = nodeFactory.CreateAttribute("public");
public_attr.Value = GetPublicPermissions(parcel);
// Check the category of the Parcel
XmlAttribute category_attr = nodeFactory.CreateAttribute("category");
category_attr.Value = parcel.Category.ToString();
//XmlAttribute entities_attr = nodeFactory.CreateAttribute("entities");
//entities_attr.Value = land.primsOverMe.Count.ToString();
xmlparcel.Attributes.Append(scripts_attr);
xmlparcel.Attributes.Append(build_attr);
xmlparcel.Attributes.Append(public_attr);
xmlparcel.Attributes.Append(category_attr);
//xmlparcel.Attributes.Append(entities_attr);
@ -279,6 +288,24 @@ namespace OpenSim.Region.DataSnapshot.Providers
}
private string GetPublicPermissions(LandData parcel)
{
if ((parcel.Flags & (uint)Parcel.ParcelFlags.UseAccessList) == (uint)Parcel.ParcelFlags.UseAccessList)
return "yes";
else
return "no";
}
private string GetBuildPermissions(LandData parcel)
{
if ((parcel.Flags & (uint)Parcel.ParcelFlags.CreateObjects) == (uint)Parcel.ParcelFlags.CreateObjects)
return "yes";
else
return "no";
}
#endregion
#region Change detection hooks

View File

@ -245,6 +245,10 @@ namespace OpenSim.Region.DataSnapshot
infopiece.InnerText = scene.RegionInfo.RegionName;
infoblock.AppendChild(infopiece);
infopiece = basedoc.CreateNode(XmlNodeType.Element, "handle", "");
infopiece.InnerText = scene.RegionInfo.RegionHandle.ToString();
infoblock.AppendChild(infopiece);
docElement.AppendChild(infoblock);
m_log.Debug("[DATASNAPSHOT]: Generated region node");