diff options
Diffstat (limited to 'OpenSim/Services/HypergridService')
-rw-r--r-- | OpenSim/Services/HypergridService/HGFriendsService.cs | 86 |
1 files changed, 0 insertions, 86 deletions
diff --git a/OpenSim/Services/HypergridService/HGFriendsService.cs b/OpenSim/Services/HypergridService/HGFriendsService.cs deleted file mode 100644 index 1829ae3..0000000 --- a/OpenSim/Services/HypergridService/HGFriendsService.cs +++ /dev/null | |||
@@ -1,86 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using OpenMetaverse; | ||
29 | using OpenSim.Framework; | ||
30 | using System; | ||
31 | using System.Collections.Generic; | ||
32 | using OpenSim.Services.Interfaces; | ||
33 | using OpenSim.Services.Friends; | ||
34 | using OpenSim.Data; | ||
35 | using Nini.Config; | ||
36 | using log4net; | ||
37 | using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; | ||
38 | |||
39 | namespace OpenSim.Services.HypergridService | ||
40 | { | ||
41 | public class HGFriendsService : FriendsService, IFriendsService | ||
42 | { | ||
43 | public HGFriendsService(IConfigSource config) : base(config) | ||
44 | { | ||
45 | } | ||
46 | |||
47 | /// <summary> | ||
48 | /// Overrides base. | ||
49 | /// Storing new friendships from the outside is a tricky, sensitive operation, and it | ||
50 | /// needs to be done under certain restrictions. | ||
51 | /// First of all, if the friendship already exists, this is a no-op. In other words, | ||
52 | /// we cannot change just the flags, it needs to be a new friendship. | ||
53 | /// Second, we store it as flags=0 always, independent of what the caller sends. The | ||
54 | /// owner of the friendship needs to confirm when it gets back home. | ||
55 | /// </summary> | ||
56 | /// <param name="PrincipalID"></param> | ||
57 | /// <param name="Friend"></param> | ||
58 | /// <param name="flags"></param> | ||
59 | /// <returns></returns> | ||
60 | public override bool StoreFriend(string PrincipalID, string Friend, int flags) | ||
61 | { | ||
62 | UUID userID; | ||
63 | if (UUID.TryParse(PrincipalID, out userID)) | ||
64 | { | ||
65 | FriendsData[] friendsData = m_Database.GetFriends(userID.ToString()); | ||
66 | List<FriendsData> fList = new List<FriendsData>(friendsData); | ||
67 | if (fList.Find(delegate(FriendsData fdata) | ||
68 | { | ||
69 | return fdata.Friend == Friend; | ||
70 | }) != null) | ||
71 | return false; | ||
72 | } | ||
73 | else | ||
74 | return false; | ||
75 | |||
76 | FriendsData d = new FriendsData(); | ||
77 | d.PrincipalID = PrincipalID; | ||
78 | d.Friend = Friend; | ||
79 | d.Data = new Dictionary<string, string>(); | ||
80 | d.Data["Flags"] = "0"; | ||
81 | |||
82 | return m_Database.Store(d); | ||
83 | } | ||
84 | |||
85 | } | ||
86 | } | ||