diff options
Diffstat (limited to 'OpenSim/Services/Friends/FriendsService.cs')
-rw-r--r-- | OpenSim/Services/Friends/FriendsService.cs | 38 |
1 files changed, 34 insertions, 4 deletions
diff --git a/OpenSim/Services/Friends/FriendsService.cs b/OpenSim/Services/Friends/FriendsService.cs index 3c64ecc..e2033ac 100644 --- a/OpenSim/Services/Friends/FriendsService.cs +++ b/OpenSim/Services/Friends/FriendsService.cs | |||
@@ -43,17 +43,42 @@ namespace OpenSim.Services.Friends | |||
43 | { | 43 | { |
44 | } | 44 | } |
45 | 45 | ||
46 | public FriendInfo[] GetFriends(UUID PrincipalID) | 46 | public virtual FriendInfo[] GetFriends(UUID PrincipalID) |
47 | { | 47 | { |
48 | FriendsData[] data = m_Database.GetFriends(PrincipalID); | 48 | FriendsData[] data = m_Database.GetFriends(PrincipalID); |
49 | List<FriendInfo> info = new List<FriendInfo>(); | ||
50 | |||
51 | foreach (FriendsData d in data) | ||
52 | { | ||
53 | FriendInfo i = new FriendInfo(); | ||
54 | |||
55 | i.PrincipalID = new UUID(d.PrincipalID); | ||
56 | i.Friend = d.Friend; | ||
57 | i.MyFlags = Convert.ToInt32(d.Data["Flags"]); | ||
58 | i.TheirFlags = Convert.ToInt32(d.Data["TheirFlags"]); | ||
59 | |||
60 | info.Add(i); | ||
61 | } | ||
62 | |||
63 | return info.ToArray(); | ||
64 | } | ||
49 | 65 | ||
66 | public virtual FriendInfo[] GetFriends(string PrincipalID) | ||
67 | { | ||
68 | FriendsData[] data = m_Database.GetFriends(PrincipalID); | ||
50 | List<FriendInfo> info = new List<FriendInfo>(); | 69 | List<FriendInfo> info = new List<FriendInfo>(); |
51 | 70 | ||
52 | foreach (FriendsData d in data) | 71 | foreach (FriendsData d in data) |
53 | { | 72 | { |
54 | FriendInfo i = new FriendInfo(); | 73 | FriendInfo i = new FriendInfo(); |
55 | 74 | ||
56 | i.PrincipalID = d.PrincipalID; | 75 | if (!UUID.TryParse(d.PrincipalID, out i.PrincipalID)) |
76 | { | ||
77 | string tmp = string.Empty; | ||
78 | if (!Util.ParseUniversalUserIdentifier(d.PrincipalID, out i.PrincipalID, out tmp, out tmp, out tmp, out tmp)) | ||
79 | // bad record. ignore this entry | ||
80 | continue; | ||
81 | } | ||
57 | i.Friend = d.Friend; | 82 | i.Friend = d.Friend; |
58 | i.MyFlags = Convert.ToInt32(d.Data["Flags"]); | 83 | i.MyFlags = Convert.ToInt32(d.Data["Flags"]); |
59 | i.TheirFlags = Convert.ToInt32(d.Data["TheirFlags"]); | 84 | i.TheirFlags = Convert.ToInt32(d.Data["TheirFlags"]); |
@@ -64,7 +89,7 @@ namespace OpenSim.Services.Friends | |||
64 | return info.ToArray(); | 89 | return info.ToArray(); |
65 | } | 90 | } |
66 | 91 | ||
67 | public bool StoreFriend(UUID PrincipalID, string Friend, int flags) | 92 | public virtual bool StoreFriend(string PrincipalID, string Friend, int flags) |
68 | { | 93 | { |
69 | FriendsData d = new FriendsData(); | 94 | FriendsData d = new FriendsData(); |
70 | 95 | ||
@@ -76,7 +101,12 @@ namespace OpenSim.Services.Friends | |||
76 | return m_Database.Store(d); | 101 | return m_Database.Store(d); |
77 | } | 102 | } |
78 | 103 | ||
79 | public bool Delete(UUID PrincipalID, string Friend) | 104 | public bool Delete(string principalID, string friend) |
105 | { | ||
106 | return m_Database.Delete(principalID, friend); | ||
107 | } | ||
108 | |||
109 | public virtual bool Delete(UUID PrincipalID, string Friend) | ||
80 | { | 110 | { |
81 | return m_Database.Delete(PrincipalID, Friend); | 111 | return m_Database.Delete(PrincipalID, Friend); |
82 | } | 112 | } |