aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMelanie2010-02-09 17:08:36 +0000
committerMelanie2010-02-09 17:08:36 +0000
commit194837853854c91f22a27b3e2e557c3b5c6848a5 (patch)
tree15aa60a40b349dfe2a487aff097ba9333a0bea9c
parentAdd the friends service skel and correct some namespace issues (diff)
downloadopensim-SC_OLD-194837853854c91f22a27b3e2e557c3b5c6848a5.zip
opensim-SC_OLD-194837853854c91f22a27b3e2e557c3b5c6848a5.tar.gz
opensim-SC_OLD-194837853854c91f22a27b3e2e557c3b5c6848a5.tar.bz2
opensim-SC_OLD-194837853854c91f22a27b3e2e557c3b5c6848a5.tar.xz
Implement the methods needed for the login service to populate the friendslist
on the friends service
-rw-r--r--OpenSim/Services/Friends/FriendsService.cs29
-rw-r--r--OpenSim/Services/Interfaces/IFriendsService.cs4
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
28using OpenMetaverse; 28using OpenMetaverse;
29using OpenSim.Framework; 29using OpenSim.Framework;
30using System;
30using System.Collections.Generic; 31using System.Collections.Generic;
31using OpenSim.Services.Interfaces; 32using OpenSim.Services.Interfaces;
33using OpenSim.Data;
32using Nini.Config; 34using Nini.Config;
33using log4net; 35using log4net;
34using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; 36using 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