diff options
Diffstat (limited to 'OpenSim/Region/DataSnapshot/EstateSnapshot.cs')
-rw-r--r-- | OpenSim/Region/DataSnapshot/EstateSnapshot.cs | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/OpenSim/Region/DataSnapshot/EstateSnapshot.cs b/OpenSim/Region/DataSnapshot/EstateSnapshot.cs new file mode 100644 index 0000000..76fed59 --- /dev/null +++ b/OpenSim/Region/DataSnapshot/EstateSnapshot.cs | |||
@@ -0,0 +1,68 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using System.Xml; | ||
5 | using OpenSim.Region.Environment.Scenes; | ||
6 | using OpenSim.Region.Environment.Modules.LandManagement; | ||
7 | using OpenSim.Framework; | ||
8 | using OpenSim.Framework.Console; | ||
9 | using OpenSim.Framework.Communications; | ||
10 | using libsecondlife; | ||
11 | using libsecondlife.Packets; | ||
12 | |||
13 | namespace OpenSim.Region.DataSnapshot | ||
14 | { | ||
15 | public class EstateSnapshot : IDataSnapshotProvider | ||
16 | { | ||
17 | private Scene m_scene = null; | ||
18 | private DataSnapshotManager m_parent = null; | ||
19 | |||
20 | #region IDataSnapshotProvider Members | ||
21 | |||
22 | public XmlNode RequestSnapshotData(XmlDocument factory) | ||
23 | { | ||
24 | //Estate data section - contains who owns a set of sims and the name of the set. | ||
25 | //In Opensim all the estate names are the same as the Master Avatar (owner of the sim) | ||
26 | //Now in DataSnapshotProvider module form! | ||
27 | XmlNode estatedata = factory.CreateNode(XmlNodeType.Element, "estate", ""); | ||
28 | |||
29 | LLUUID ownerid = m_scene.RegionInfo.MasterAvatarAssignedUUID; | ||
30 | |||
31 | //TODO: Change to query userserver about the master avatar UUID ? | ||
32 | String firstname = m_scene.RegionInfo.MasterAvatarFirstName; | ||
33 | String lastname = m_scene.RegionInfo.MasterAvatarLastName; | ||
34 | |||
35 | //TODO: Fix the marshalling system to have less copypasta gruntwork | ||
36 | XmlNode user = factory.CreateNode(XmlNodeType.Element, "user", ""); | ||
37 | XmlAttribute type = (XmlAttribute)factory.CreateNode(XmlNodeType.Attribute, "type", ""); | ||
38 | type.Value = "owner"; | ||
39 | user.Attributes.Append(type); | ||
40 | |||
41 | //TODO: Create more TODOs | ||
42 | XmlNode username = factory.CreateNode(XmlNodeType.Element, "name", ""); | ||
43 | username.InnerText = firstname + " " + lastname; | ||
44 | user.AppendChild(username); | ||
45 | |||
46 | XmlNode useruuid = factory.CreateNode(XmlNodeType.Element, "uuid", ""); | ||
47 | useruuid.InnerText = ownerid.ToString(); | ||
48 | user.AppendChild(useruuid); | ||
49 | |||
50 | estatedata.AppendChild(user); | ||
51 | |||
52 | return estatedata; | ||
53 | } | ||
54 | |||
55 | public void Initialize(Scene scene, DataSnapshotManager parent) | ||
56 | { | ||
57 | m_scene = scene; | ||
58 | m_parent = parent; | ||
59 | } | ||
60 | |||
61 | public Scene GetParentScene | ||
62 | { | ||
63 | get { return m_scene; } | ||
64 | } | ||
65 | |||
66 | #endregion | ||
67 | } | ||
68 | } | ||