123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Reflection;
- using System.Threading;
- using log4net;
- using OpenMetaverse;
- using OpenSim.Framework;
- using OpenSim.Data;
- namespace OpenSim.Data.Null
- {
- public class NullFriendsData : IFriendsData
- {
- private static List<FriendsData> m_Data = new List<FriendsData>();
- public NullFriendsData(string connectionString, string realm)
- {
- }
-
-
-
-
-
-
- public static void Clear()
- {
- lock (m_Data)
- m_Data.Clear();
- }
- public FriendsData[] GetFriends(UUID principalID)
- {
- return GetFriends(principalID.ToString());
- }
-
-
-
-
-
-
-
- public FriendsData[] GetFriends(string userID)
- {
- lock (m_Data)
- {
- List<FriendsData> lst = m_Data.FindAll(fdata =>
- {
- return fdata.PrincipalID == userID.ToString();
- });
-
- if (lst != null)
- {
- lst.ForEach(f =>
- {
- FriendsData f2 = m_Data.Find(candidateF2 => f.Friend == candidateF2.PrincipalID);
- if (f2 != null)
- f.Data["TheirFlags"] = f2.Data["Flags"];
-
-
-
-
- });
-
-
-
- return lst.ToArray();
- }
- }
- return new FriendsData[0];
- }
- public bool Store(FriendsData data)
- {
- if (data == null)
- return false;
- lock (m_Data)
- m_Data.Add(data);
- return true;
- }
- public bool Delete(UUID principalID, string friend)
- {
- return Delete(principalID.ToString(), friend);
- }
- public bool Delete(string userID, string friendID)
- {
- lock (m_Data)
- {
- List<FriendsData> lst = m_Data.FindAll(delegate(FriendsData fdata) { return fdata.PrincipalID == userID.ToString(); });
- if (lst != null)
- {
- FriendsData friend = lst.Find(delegate(FriendsData fdata) { return fdata.Friend == friendID; });
- if (friendID != null)
- {
-
-
-
-
- m_Data.Remove(friend);
- return true;
- }
- }
- }
- return false;
- }
- }
- }
|