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) if (m_scene.RegionInfo.EstateSettings.EstateOwner != UUID.Zero)
ownerid = m_scene.RegionInfo.EstateSettings.EstateOwner; 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); UserProfileData userProfile = m_scene.CommsManager.UserService.GetUserProfile(ownerid);
//TODO: Change to query userserver about the master avatar UUID ? //TODO: Change to query userserver about the master avatar UUID ?
String firstname = userProfile.FirstName; String firstname;
String lastname = userProfile.SurName; String lastname;
//TODO: Fix the marshalling system to have less copypasta gruntwork if (userProfile != null)
XmlNode user = factory.CreateNode(XmlNodeType.Element, "user", ""); {
XmlAttribute type = (XmlAttribute)factory.CreateNode(XmlNodeType.Attribute, "type", ""); firstname = userProfile.FirstName;
type.Value = "owner"; lastname = userProfile.SurName;
user.Attributes.Append(type);
//TODO: Create more TODOs //TODO: Fix the marshalling system to have less copypasta gruntwork
XmlNode username = factory.CreateNode(XmlNodeType.Element, "name", ""); XmlNode user = factory.CreateNode(XmlNodeType.Element, "user", "");
username.InnerText = firstname + " " + lastname; XmlAttribute type = (XmlAttribute)factory.CreateNode(XmlNodeType.Attribute, "type", "");
user.AppendChild(username); type.Value = "owner";
user.Attributes.Append(type);
XmlNode useruuid = factory.CreateNode(XmlNodeType.Element, "uuid", ""); //TODO: Create more TODOs
useruuid.InnerText = ownerid.ToString(); XmlNode username = factory.CreateNode(XmlNodeType.Element, "name", "");
user.AppendChild(useruuid); 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; this.Stale = false;
return estatedata; return estatedata;

View File

@ -145,11 +145,20 @@ namespace OpenSim.Region.DataSnapshot.Providers
// Attributes of the parcel node // Attributes of the parcel node
XmlAttribute scripts_attr = nodeFactory.CreateAttribute("scripts"); XmlAttribute scripts_attr = nodeFactory.CreateAttribute("scripts");
scripts_attr.Value = GetScriptsPermissions(parcel); 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"); XmlAttribute category_attr = nodeFactory.CreateAttribute("category");
category_attr.Value = parcel.Category.ToString(); category_attr.Value = parcel.Category.ToString();
//XmlAttribute entities_attr = nodeFactory.CreateAttribute("entities"); //XmlAttribute entities_attr = nodeFactory.CreateAttribute("entities");
//entities_attr.Value = land.primsOverMe.Count.ToString(); //entities_attr.Value = land.primsOverMe.Count.ToString();
xmlparcel.Attributes.Append(scripts_attr); xmlparcel.Attributes.Append(scripts_attr);
xmlparcel.Attributes.Append(build_attr);
xmlparcel.Attributes.Append(public_attr);
xmlparcel.Attributes.Append(category_attr); xmlparcel.Attributes.Append(category_attr);
//xmlparcel.Attributes.Append(entities_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 #endregion
#region Change detection hooks #region Change detection hooks

View File

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