aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/Null/NullFriendsData.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Data/Null/NullFriendsData.cs')
-rw-r--r--OpenSim/Data/Null/NullFriendsData.cs31
1 files changed, 30 insertions, 1 deletions
diff --git a/OpenSim/Data/Null/NullFriendsData.cs b/OpenSim/Data/Null/NullFriendsData.cs
index 0a4b242..0be32a4 100644
--- a/OpenSim/Data/Null/NullFriendsData.cs
+++ b/OpenSim/Data/Null/NullFriendsData.cs
@@ -28,6 +28,8 @@
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Reflection;
32using log4net;
31using OpenMetaverse; 33using OpenMetaverse;
32using OpenSim.Framework; 34using OpenSim.Framework;
33using OpenSim.Data; 35using OpenSim.Data;
@@ -36,12 +38,25 @@ namespace OpenSim.Data.Null
36{ 38{
37 public class NullFriendsData : IFriendsData 39 public class NullFriendsData : IFriendsData
38 { 40 {
41// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
42
39 private static List<FriendsData> m_Data = new List<FriendsData>(); 43 private static List<FriendsData> m_Data = new List<FriendsData>();
40 44
41 public NullFriendsData(string connectionString, string realm) 45 public NullFriendsData(string connectionString, string realm)
42 { 46 {
43 } 47 }
44 48
49 /// <summary>
50 /// Clear all friends data
51 /// </summary>
52 /// <remarks>
53 /// This is required by unit tests to clear the static data between test runs.
54 /// </remarks>
55 public static void Clear()
56 {
57 m_Data.Clear();
58 }
59
45 public FriendsData[] GetFriends(UUID principalID) 60 public FriendsData[] GetFriends(UUID principalID)
46 { 61 {
47 return GetFriends(principalID.ToString()); 62 return GetFriends(principalID.ToString());
@@ -66,9 +81,16 @@ namespace OpenSim.Data.Null
66 lst.ForEach(f => 81 lst.ForEach(f =>
67 { 82 {
68 FriendsData f2 = m_Data.Find(candidateF2 => f.Friend == candidateF2.PrincipalID); 83 FriendsData f2 = m_Data.Find(candidateF2 => f.Friend == candidateF2.PrincipalID);
69 if (f2 != null) { f.Data["TheirFlags"] = f2.Data["Flags"]; } 84 if (f2 != null)
85 f.Data["TheirFlags"] = f2.Data["Flags"];
86
87// m_log.DebugFormat(
88// "[NULL FRIENDS DATA]: Got {0} {1} {2} for {3}",
89// f.Friend, f.Data["Flags"], f2 != null ? f.Data["TheirFlags"] : "not found!", f.PrincipalID);
70 }); 90 });
71 91
92// m_log.DebugFormat("[NULL FRIENDS DATA]: Got {0} friends for {1}", lst.Count, userID);
93
72 return lst.ToArray(); 94 return lst.ToArray();
73 } 95 }
74 96
@@ -80,6 +102,9 @@ namespace OpenSim.Data.Null
80 if (data == null) 102 if (data == null)
81 return false; 103 return false;
82 104
105// m_log.DebugFormat(
106// "[NULL FRIENDS DATA]: Storing {0} {1} {2}", data.PrincipalID, data.Friend, data.Data["Flags"]);
107
83 m_Data.Add(data); 108 m_Data.Add(data);
84 109
85 return true; 110 return true;
@@ -98,6 +123,10 @@ namespace OpenSim.Data.Null
98 FriendsData friend = lst.Find(delegate(FriendsData fdata) { return fdata.Friend == friendID; }); 123 FriendsData friend = lst.Find(delegate(FriendsData fdata) { return fdata.Friend == friendID; });
99 if (friendID != null) 124 if (friendID != null)
100 { 125 {
126// m_log.DebugFormat(
127// "[NULL FRIENDS DATA]: Deleting friend {0} {1} for {2}",
128// friend.Friend, friend.Data["Flags"], friend.PrincipalID);
129
101 m_Data.Remove(friend); 130 m_Data.Remove(friend);
102 return true; 131 return true;
103 } 132 }