diff options
author | Melanie | 2012-03-31 02:18:02 +0100 |
---|---|---|
committer | Melanie | 2012-03-31 02:18:02 +0100 |
commit | f3132c45d98af7bb38251ad95013c433b5eda9e5 (patch) | |
tree | efc3d6c0529678c0a56f5a505a52944012ea607a /OpenSim/Data/Null | |
parent | Merge branch 'master' into careminster (diff) | |
parent | refactor: Rename SOG.GetChildPart() to GetPart() since it can also return the... (diff) | |
download | opensim-SC_OLD-f3132c45d98af7bb38251ad95013c433b5eda9e5.zip opensim-SC_OLD-f3132c45d98af7bb38251ad95013c433b5eda9e5.tar.gz opensim-SC_OLD-f3132c45d98af7bb38251ad95013c433b5eda9e5.tar.bz2 opensim-SC_OLD-f3132c45d98af7bb38251ad95013c433b5eda9e5.tar.xz |
Merge branch 'master' into careminster
Conflicts:
OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
OpenSim/Tests/Common/Mock/TestClient.cs
Diffstat (limited to 'OpenSim/Data/Null')
-rw-r--r-- | OpenSim/Data/Null/NullFriendsData.cs | 74 | ||||
-rw-r--r-- | OpenSim/Data/Null/NullPresenceData.cs | 1 |
2 files changed, 56 insertions, 19 deletions
diff --git a/OpenSim/Data/Null/NullFriendsData.cs b/OpenSim/Data/Null/NullFriendsData.cs index 0a4b242..473999f 100644 --- a/OpenSim/Data/Null/NullFriendsData.cs +++ b/OpenSim/Data/Null/NullFriendsData.cs | |||
@@ -28,6 +28,9 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Reflection; | ||
32 | using System.Threading; | ||
33 | using log4net; | ||
31 | using OpenMetaverse; | 34 | using OpenMetaverse; |
32 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
33 | using OpenSim.Data; | 36 | using OpenSim.Data; |
@@ -36,12 +39,26 @@ namespace OpenSim.Data.Null | |||
36 | { | 39 | { |
37 | public class NullFriendsData : IFriendsData | 40 | public class NullFriendsData : IFriendsData |
38 | { | 41 | { |
42 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
43 | |||
39 | private static List<FriendsData> m_Data = new List<FriendsData>(); | 44 | private static List<FriendsData> m_Data = new List<FriendsData>(); |
40 | 45 | ||
41 | public NullFriendsData(string connectionString, string realm) | 46 | public NullFriendsData(string connectionString, string realm) |
42 | { | 47 | { |
43 | } | 48 | } |
44 | 49 | ||
50 | /// <summary> | ||
51 | /// Clear all friends data | ||
52 | /// </summary> | ||
53 | /// <remarks> | ||
54 | /// This is required by unit tests to clear the static data between test runs. | ||
55 | /// </remarks> | ||
56 | public static void Clear() | ||
57 | { | ||
58 | lock (m_Data) | ||
59 | m_Data.Clear(); | ||
60 | } | ||
61 | |||
45 | public FriendsData[] GetFriends(UUID principalID) | 62 | public FriendsData[] GetFriends(UUID principalID) |
46 | { | 63 | { |
47 | return GetFriends(principalID.ToString()); | 64 | return GetFriends(principalID.ToString()); |
@@ -56,20 +73,30 @@ namespace OpenSim.Data.Null | |||
56 | /// <returns></returns> | 73 | /// <returns></returns> |
57 | public FriendsData[] GetFriends(string userID) | 74 | public FriendsData[] GetFriends(string userID) |
58 | { | 75 | { |
59 | List<FriendsData> lst = m_Data.FindAll(fdata => | 76 | lock (m_Data) |
60 | { | 77 | { |
61 | return fdata.PrincipalID == userID.ToString(); | 78 | List<FriendsData> lst = m_Data.FindAll(fdata => |
62 | }); | ||
63 | |||
64 | if (lst != null) | ||
65 | { | ||
66 | lst.ForEach(f => | ||
67 | { | 79 | { |
68 | FriendsData f2 = m_Data.Find(candidateF2 => f.Friend == candidateF2.PrincipalID); | 80 | return fdata.PrincipalID == userID.ToString(); |
69 | if (f2 != null) { f.Data["TheirFlags"] = f2.Data["Flags"]; } | ||
70 | }); | 81 | }); |
71 | 82 | ||
72 | return lst.ToArray(); | 83 | if (lst != null) |
84 | { | ||
85 | lst.ForEach(f => | ||
86 | { | ||
87 | FriendsData f2 = m_Data.Find(candidateF2 => f.Friend == candidateF2.PrincipalID); | ||
88 | if (f2 != null) | ||
89 | f.Data["TheirFlags"] = f2.Data["Flags"]; | ||
90 | |||
91 | // m_log.DebugFormat( | ||
92 | // "[NULL FRIENDS DATA]: Got {0} {1} {2} for {3}", | ||
93 | // f.Friend, f.Data["Flags"], f2 != null ? f.Data["TheirFlags"] : "not found!", f.PrincipalID); | ||
94 | }); | ||
95 | |||
96 | // m_log.DebugFormat("[NULL FRIENDS DATA]: Got {0} friends for {1}", lst.Count, userID); | ||
97 | |||
98 | return lst.ToArray(); | ||
99 | } | ||
73 | } | 100 | } |
74 | 101 | ||
75 | return new FriendsData[0]; | 102 | return new FriendsData[0]; |
@@ -80,7 +107,11 @@ namespace OpenSim.Data.Null | |||
80 | if (data == null) | 107 | if (data == null) |
81 | return false; | 108 | return false; |
82 | 109 | ||
83 | m_Data.Add(data); | 110 | // m_log.DebugFormat( |
111 | // "[NULL FRIENDS DATA]: Storing {0} {1} {2}", data.PrincipalID, data.Friend, data.Data["Flags"]); | ||
112 | |||
113 | lock (m_Data) | ||
114 | m_Data.Add(data); | ||
84 | 115 | ||
85 | return true; | 116 | return true; |
86 | } | 117 | } |
@@ -92,14 +123,21 @@ namespace OpenSim.Data.Null | |||
92 | 123 | ||
93 | public bool Delete(string userID, string friendID) | 124 | public bool Delete(string userID, string friendID) |
94 | { | 125 | { |
95 | List<FriendsData> lst = m_Data.FindAll(delegate(FriendsData fdata) { return fdata.PrincipalID == userID.ToString(); }); | 126 | lock (m_Data) |
96 | if (lst != null) | ||
97 | { | 127 | { |
98 | FriendsData friend = lst.Find(delegate(FriendsData fdata) { return fdata.Friend == friendID; }); | 128 | List<FriendsData> lst = m_Data.FindAll(delegate(FriendsData fdata) { return fdata.PrincipalID == userID.ToString(); }); |
99 | if (friendID != null) | 129 | if (lst != null) |
100 | { | 130 | { |
101 | m_Data.Remove(friend); | 131 | FriendsData friend = lst.Find(delegate(FriendsData fdata) { return fdata.Friend == friendID; }); |
102 | return true; | 132 | if (friendID != null) |
133 | { | ||
134 | // m_log.DebugFormat( | ||
135 | // "[NULL FRIENDS DATA]: Deleting friend {0} {1} for {2}", | ||
136 | // friend.Friend, friend.Data["Flags"], friend.PrincipalID); | ||
137 | |||
138 | m_Data.Remove(friend); | ||
139 | return true; | ||
140 | } | ||
103 | } | 141 | } |
104 | } | 142 | } |
105 | 143 | ||
diff --git a/OpenSim/Data/Null/NullPresenceData.cs b/OpenSim/Data/Null/NullPresenceData.cs index 91f1cc5..c06c223 100644 --- a/OpenSim/Data/Null/NullPresenceData.cs +++ b/OpenSim/Data/Null/NullPresenceData.cs | |||
@@ -110,7 +110,6 @@ namespace OpenSim.Data.Null | |||
110 | return false; | 110 | return false; |
111 | } | 111 | } |
112 | 112 | ||
113 | |||
114 | public PresenceData[] Get(string field, string data) | 113 | public PresenceData[] Get(string field, string data) |
115 | { | 114 | { |
116 | if (Instance != this) | 115 | if (Instance != this) |