aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/Null/NullFriendsData.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/Null/NullFriendsData.cs (renamed from OpenSim/Grid/MessagingServer.Modules/UserDataBaseService.cs)73
1 files changed, 45 insertions, 28 deletions
diff --git a/OpenSim/Grid/MessagingServer.Modules/UserDataBaseService.cs b/OpenSim/Data/Null/NullFriendsData.cs
index 76c4899..e7f7fd3 100644
--- a/OpenSim/Grid/MessagingServer.Modules/UserDataBaseService.cs
+++ b/OpenSim/Data/Null/NullFriendsData.cs
@@ -25,51 +25,68 @@
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;
30using System.Collections.Generic;
28using OpenMetaverse; 31using OpenMetaverse;
29using OpenSim.Framework; 32using OpenSim.Framework;
30using OpenSim.Framework.Communications; 33using OpenSim.Data;
31 34
32namespace OpenSim.Grid.MessagingServer.Modules 35namespace OpenSim.Data.Null
33{ 36{
34 public class UserDataBaseService : UserManagerBase 37 public class NullFriendsData : IFriendsData
35 { 38 {
36 /// <summary> 39 private static List<FriendsData> m_Data = new List<FriendsData>();
37 /// Constructor. 40
38 /// </summary> 41 public NullFriendsData(string connectionString, string realm)
39 /// Passing null to parent because we never use any function that requires an interservice inventory call.
40 public UserDataBaseService()
41 : base(null)
42 { 42 {
43 } 43 }
44
45 public UserAgentData GetUserAgentData(UUID AgentID)
46 {
47 UserProfileData userProfile = GetUserProfile(AgentID);
48 44
49 if (userProfile != null) 45 /// <summary>
46 /// Tries to implement the Get [] semantics, but it cuts corners.
47 /// Specifically, it gets all friendships even if they weren't accepted yet.
48 /// </summary>
49 /// <param name="fields"></param>
50 /// <param name="values"></param>
51 /// <returns></returns>
52 public FriendsData[] GetFriends(UUID userID)
53 {
54 List<FriendsData> lst = m_Data.FindAll(delegate (FriendsData fdata)
50 { 55 {
51 return userProfile.CurrentAgent; 56 return fdata.PrincipalID == userID;
52 } 57 });
53 58
54 return null; 59 if (lst != null)
55 } 60 return lst.ToArray();
56 61
57 public override UserProfileData SetupMasterUser(string firstName, string lastName) 62 return new FriendsData[0];
58 {
59 //throw new Exception("The method or operation is not implemented.");
60 return null;
61 } 63 }
62 64
63 public override UserProfileData SetupMasterUser(string firstName, string lastName, string password) 65 public bool Store(FriendsData data)
64 { 66 {
65 //throw new Exception("The method or operation is not implemented."); 67 if (data == null)
66 return null; 68 return false;
69
70 m_Data.Add(data);
71
72 return true;
67 } 73 }
68 74
69 public override UserProfileData SetupMasterUser(UUID uuid) 75 public bool Delete(UUID userID, string friendID)
70 { 76 {
71 //throw new Exception("The method or operation is not implemented."); 77 List<FriendsData> lst = m_Data.FindAll(delegate(FriendsData fdata) { return fdata.PrincipalID == userID; });
72 return null; 78 if (lst != null)
79 {
80 FriendsData friend = lst.Find(delegate(FriendsData fdata) { return fdata.Friend == friendID; });
81 if (friendID != null)
82 {
83 m_Data.Remove(friend);
84 return true;
85 }
86 }
87
88 return false;
73 } 89 }
90
74 } 91 }
75} 92}