diff options
author | Justin Clark-Casey (justincc) | 2012-03-30 00:40:19 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-03-30 00:42:55 +0100 |
commit | 59157d9d63c0e038ca0a619bfae1be3ed6f77677 (patch) | |
tree | 76e7ba7de91aedad887a6ac0633598d53ce30df3 /OpenSim/Data | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC_OLD-59157d9d63c0e038ca0a619bfae1be3ed6f77677.zip opensim-SC_OLD-59157d9d63c0e038ca0a619bfae1be3ed6f77677.tar.gz opensim-SC_OLD-59157d9d63c0e038ca0a619bfae1be3ed6f77677.tar.bz2 opensim-SC_OLD-59157d9d63c0e038ca0a619bfae1be3ed6f77677.tar.xz |
Add simple login test with online friends. Add IFriendsModule.GrantRights() for granting rights via a module call.
Rename IFriendsModule.GetFriendPerms() -> GetRightsGrantedByFriend() to be more self-documenting and consistent with friends module terminology.
Add some method doc.
Diffstat (limited to 'OpenSim/Data')
-rw-r--r-- | OpenSim/Data/Null/NullFriendsData.cs | 31 | ||||
-rw-r--r-- | OpenSim/Data/Null/NullPresenceData.cs | 1 |
2 files changed, 30 insertions, 2 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 @@ | |||
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 log4net; | ||
31 | using OpenMetaverse; | 33 | using OpenMetaverse; |
32 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
33 | using OpenSim.Data; | 35 | using 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 | } |
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) |