diff options
Diffstat (limited to 'OpenSim/Data')
-rw-r--r-- | OpenSim/Data/MSSQL/MSSQLManager.cs | 5 | ||||
-rw-r--r-- | OpenSim/Data/Null/NullFriendsData.cs | 74 | ||||
-rw-r--r-- | OpenSim/Data/Null/NullPresenceData.cs | 1 | ||||
-rw-r--r-- | OpenSim/Data/Tests/RegionTests.cs | 8 |
4 files changed, 65 insertions, 23 deletions
diff --git a/OpenSim/Data/MSSQL/MSSQLManager.cs b/OpenSim/Data/MSSQL/MSSQLManager.cs index 575fd21..62c38d3 100644 --- a/OpenSim/Data/MSSQL/MSSQLManager.cs +++ b/OpenSim/Data/MSSQL/MSSQLManager.cs | |||
@@ -104,6 +104,11 @@ namespace OpenSim.Data.MSSQL | |||
104 | { | 104 | { |
105 | return SqlDbType.BigInt; | 105 | return SqlDbType.BigInt; |
106 | } | 106 | } |
107 | if (type == typeof(DateTime)) | ||
108 | { | ||
109 | return SqlDbType.DateTime; | ||
110 | } | ||
111 | |||
107 | return SqlDbType.VarChar; | 112 | return SqlDbType.VarChar; |
108 | } | 113 | } |
109 | 114 | ||
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) |
diff --git a/OpenSim/Data/Tests/RegionTests.cs b/OpenSim/Data/Tests/RegionTests.cs index 1d806fc..1f03ec5 100644 --- a/OpenSim/Data/Tests/RegionTests.cs +++ b/OpenSim/Data/Tests/RegionTests.cs | |||
@@ -244,10 +244,10 @@ namespace OpenSim.Data.Tests | |||
244 | SceneObjectPart[] newparts = newsog.Parts; | 244 | SceneObjectPart[] newparts = newsog.Parts; |
245 | Assert.That(newparts.Length,Is.EqualTo(4), "Assert.That(newparts.Length,Is.EqualTo(4))"); | 245 | Assert.That(newparts.Length,Is.EqualTo(4), "Assert.That(newparts.Length,Is.EqualTo(4))"); |
246 | 246 | ||
247 | Assert.That(newsog.HasChildPrim(tmp0), "Assert.That(newsog.HasChildPrim(tmp0))"); | 247 | Assert.That(newsog.ContainsPart(tmp0), "Assert.That(newsog.ContainsPart(tmp0))"); |
248 | Assert.That(newsog.HasChildPrim(tmp1), "Assert.That(newsog.HasChildPrim(tmp1))"); | 248 | Assert.That(newsog.ContainsPart(tmp1), "Assert.That(newsog.ContainsPart(tmp1))"); |
249 | Assert.That(newsog.HasChildPrim(tmp2), "Assert.That(newsog.HasChildPrim(tmp2))"); | 249 | Assert.That(newsog.ContainsPart(tmp2), "Assert.That(newsog.ContainsPart(tmp2))"); |
250 | Assert.That(newsog.HasChildPrim(tmp3), "Assert.That(newsog.HasChildPrim(tmp3))"); | 250 | Assert.That(newsog.ContainsPart(tmp3), "Assert.That(newsog.ContainsPart(tmp3))"); |
251 | } | 251 | } |
252 | 252 | ||
253 | [Test] | 253 | [Test] |