aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/Null/NullAvatarData.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/Null/NullAvatarData.cs (renamed from OpenSim/Grid/MessagingServer.Modules/PresenceBackreferenceEntry.cs)77
1 files changed, 37 insertions, 40 deletions
diff --git a/OpenSim/Grid/MessagingServer.Modules/PresenceBackreferenceEntry.cs b/OpenSim/Data/Null/NullAvatarData.cs
index 67dde6d..c81ba43 100644
--- a/OpenSim/Grid/MessagingServer.Modules/PresenceBackreferenceEntry.cs
+++ b/OpenSim/Data/Null/NullAvatarData.cs
@@ -25,72 +25,69 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System;
29using System.Collections;
28using System.Collections.Generic; 30using System.Collections.Generic;
29using OpenMetaverse; 31using OpenMetaverse;
32using OpenSim.Framework;
33using OpenSim.Data;
30 34
31namespace OpenSim.Grid.MessagingServer.Modules 35namespace OpenSim.Data.Null
32{ 36{
33 // This is a wrapper for a List<UUID> so it can be happily stored in a hashtable. 37 public class NullAvatarData : IAvatarData
34 public class PresenceBackreferenceEntry
35 { 38 {
36 List<UUID> AgentList = new List<UUID>(); 39 private static Dictionary<UUID, AvatarBaseData> m_DataByUUID = new Dictionary<UUID, AvatarBaseData>();
37 40
38 public PresenceBackreferenceEntry() 41 public NullAvatarData(string connectionString, string realm)
39 { 42 {
40
41 } 43 }
42 44
43 public void Add(UUID item) 45 public AvatarBaseData[] Get(string field, string val)
44 { 46 {
45 lock (AgentList) 47 if (field == "PrincipalID")
46 { 48 {
47 AgentList.Add(item); 49 UUID id = UUID.Zero;
50 if (UUID.TryParse(val, out id))
51 if (m_DataByUUID.ContainsKey(id))
52 return new AvatarBaseData[] { m_DataByUUID[id] };
48 } 53 }
49 }
50 54
51 public UUID getitem(int index) 55 // Fail
52 { 56 return new AvatarBaseData[0];
53 UUID result = UUID.Zero;
54 lock (AgentList)
55 {
56 if (index > 0 && index < AgentList.Count)
57 {
58 result = AgentList[index];
59 }
60 }
61 return result;
62 } 57 }
63 58
64 public int Count 59 public bool Store(AvatarBaseData data)
65 { 60 {
66 get 61 m_DataByUUID[data.PrincipalID] = data;
67 { 62 return true;
68 int count = 0;
69 lock (AgentList)
70 {
71 count = AgentList.Count;
72 }
73 return count;
74 }
75 } 63 }
76 64
77 public void Remove(UUID item) 65 public bool Delete(UUID principalID, string name)
78 { 66 {
79 lock (AgentList) 67 if (m_DataByUUID.ContainsKey(principalID) && m_DataByUUID[principalID].Data.ContainsKey(name))
80 { 68 {
81 if (AgentList.Contains(item)) 69 m_DataByUUID[principalID].Data.Remove(name);
82 AgentList.Remove(item); 70 return true;
83 } 71 }
72
73 return false;
84 } 74 }
85 75
86 public bool contains(UUID item) 76 public bool Delete(string field, string val)
87 { 77 {
88 bool result = false; 78 if (field == "PrincipalID")
89 lock (AgentList)
90 { 79 {
91 result = AgentList.Contains(item); 80 UUID id = UUID.Zero;
81 if (UUID.TryParse(val, out id))
82 if (m_DataByUUID.ContainsKey(id))
83 {
84 m_DataByUUID.Remove(id);
85 return true;
86 }
92 } 87 }
93 return result; 88
89 return false;
94 } 90 }
91
95 } 92 }
96} 93}