From 194837853854c91f22a27b3e2e557c3b5c6848a5 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 9 Feb 2010 17:08:36 +0000 Subject: Implement the methods needed for the login service to populate the friendslist on the friends service --- OpenSim/Services/Friends/FriendsService.cs | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) (limited to 'OpenSim/Services/Friends/FriendsService.cs') diff --git a/OpenSim/Services/Friends/FriendsService.cs b/OpenSim/Services/Friends/FriendsService.cs index 8e1c6c2..dc1e228 100644 --- a/OpenSim/Services/Friends/FriendsService.cs +++ b/OpenSim/Services/Friends/FriendsService.cs @@ -27,8 +27,10 @@ using OpenMetaverse; using OpenSim.Framework; +using System; using System.Collections.Generic; using OpenSim.Services.Interfaces; +using OpenSim.Data; using Nini.Config; using log4net; using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; @@ -43,12 +45,35 @@ namespace OpenSim.Services.Friends public FriendInfo[] GetFriends(UUID PrincipalID) { - return new FriendInfo[0]; + FriendsData[] data = m_Database.GetFriends(PrincipalID); + + List info = new List(); + + foreach (FriendsData d in data) + { + FriendInfo i = new FriendInfo(); + + i.PrincipalID = d.PrincipalID; + i.Friend = d.Friend; + i.MyFlags = Convert.ToInt32(d.Data["Flags"]); + i.TheirFlags = Convert.ToInt32(d.Data["TheirFlags"]); + + info.Add(i); + } + + return info.ToArray(); } public bool StoreFriend(UUID PrincipalID, string Friend, int flags) { - return false; + FriendsData d = new FriendsData(); + + d.PrincipalID = PrincipalID; + d.Friend = Friend; + d.Data = new Dictionary(); + d.Data["Flags"] = flags.ToString(); + + return m_Database.Store(d); } public bool Delete(UUID PrincipalID, string Friend) -- cgit v1.1