diff options
author | Melanie | 2010-02-09 17:08:36 +0000 |
---|---|---|
committer | Melanie | 2010-02-09 17:08:36 +0000 |
commit | 194837853854c91f22a27b3e2e557c3b5c6848a5 (patch) | |
tree | 15aa60a40b349dfe2a487aff097ba9333a0bea9c /OpenSim/Services | |
parent | Add the friends service skel and correct some namespace issues (diff) | |
download | opensim-SC-194837853854c91f22a27b3e2e557c3b5c6848a5.zip opensim-SC-194837853854c91f22a27b3e2e557c3b5c6848a5.tar.gz opensim-SC-194837853854c91f22a27b3e2e557c3b5c6848a5.tar.bz2 opensim-SC-194837853854c91f22a27b3e2e557c3b5c6848a5.tar.xz |
Implement the methods needed for the login service to populate the friendslist
on the friends service
Diffstat (limited to 'OpenSim/Services')
-rw-r--r-- | OpenSim/Services/Friends/FriendsService.cs | 29 | ||||
-rw-r--r-- | OpenSim/Services/Interfaces/IFriendsService.cs | 4 |
2 files changed, 29 insertions, 4 deletions
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 @@ | |||
27 | 27 | ||
28 | using OpenMetaverse; | 28 | using OpenMetaverse; |
29 | using OpenSim.Framework; | 29 | using OpenSim.Framework; |
30 | using System; | ||
30 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
31 | using OpenSim.Services.Interfaces; | 32 | using OpenSim.Services.Interfaces; |
33 | using OpenSim.Data; | ||
32 | using Nini.Config; | 34 | using Nini.Config; |
33 | using log4net; | 35 | using log4net; |
34 | using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; | 36 | using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; |
@@ -43,12 +45,35 @@ namespace OpenSim.Services.Friends | |||
43 | 45 | ||
44 | public FriendInfo[] GetFriends(UUID PrincipalID) | 46 | public FriendInfo[] GetFriends(UUID PrincipalID) |
45 | { | 47 | { |
46 | return new FriendInfo[0]; | 48 | FriendsData[] data = m_Database.GetFriends(PrincipalID); |
49 | |||
50 | List<FriendInfo> info = new List<FriendInfo>(); | ||
51 | |||
52 | foreach (FriendsData d in data) | ||
53 | { | ||
54 | FriendInfo i = new FriendInfo(); | ||
55 | |||
56 | i.PrincipalID = d.PrincipalID; | ||
57 | i.Friend = d.Friend; | ||
58 | i.MyFlags = Convert.ToInt32(d.Data["Flags"]); | ||
59 | i.TheirFlags = Convert.ToInt32(d.Data["TheirFlags"]); | ||
60 | |||
61 | info.Add(i); | ||
62 | } | ||
63 | |||
64 | return info.ToArray(); | ||
47 | } | 65 | } |
48 | 66 | ||
49 | public bool StoreFriend(UUID PrincipalID, string Friend, int flags) | 67 | public bool StoreFriend(UUID PrincipalID, string Friend, int flags) |
50 | { | 68 | { |
51 | return false; | 69 | FriendsData d = new FriendsData(); |
70 | |||
71 | d.PrincipalID = PrincipalID; | ||
72 | d.Friend = Friend; | ||
73 | d.Data = new Dictionary<string, string>(); | ||
74 | d.Data["Flags"] = flags.ToString(); | ||
75 | |||
76 | return m_Database.Store(d); | ||
52 | } | 77 | } |
53 | 78 | ||
54 | public bool Delete(UUID PrincipalID, string Friend) | 79 | public bool Delete(UUID PrincipalID, string Friend) |
diff --git a/OpenSim/Services/Interfaces/IFriendsService.cs b/OpenSim/Services/Interfaces/IFriendsService.cs index dc5a812..811203c 100644 --- a/OpenSim/Services/Interfaces/IFriendsService.cs +++ b/OpenSim/Services/Interfaces/IFriendsService.cs | |||
@@ -35,8 +35,8 @@ namespace OpenSim.Services.Interfaces | |||
35 | { | 35 | { |
36 | public UUID PrincipalID; | 36 | public UUID PrincipalID; |
37 | public string Friend; | 37 | public string Friend; |
38 | int MyFlags; | 38 | public int MyFlags; |
39 | int TheirFlags; | 39 | public int TheirFlags; |
40 | } | 40 | } |
41 | 41 | ||
42 | public interface IFriendsService | 42 | public interface IFriendsService |