From 0ab8dd61d787e2ed04cf0fd473be8ea6a97ec8d0 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 4 Feb 2010 12:21:14 +0000 Subject: Finally cutting the gordian knot. Friends needs to be both a module and a service, and never the twain shall meet. This finally opens up the path to a working friends implementation --- OpenSim/Services/Interfaces/IFriendsService.cs | 49 ++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 OpenSim/Services/Interfaces/IFriendsService.cs (limited to 'OpenSim/Services/Interfaces/IFriendsService.cs') diff --git a/OpenSim/Services/Interfaces/IFriendsService.cs b/OpenSim/Services/Interfaces/IFriendsService.cs new file mode 100644 index 0000000..ed77c1a --- /dev/null +++ b/OpenSim/Services/Interfaces/IFriendsService.cs @@ -0,0 +1,49 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using OpenMetaverse; +using OpenSim.Framework; +using System.Collections.Generic; + +namespace OpenSim.Region.Framework.Interfaces +{ + public struct FriendInfo + { + public UUID PrincipalID; + public string Friend; + int MyRights; + int TheirRights; + } + + public interface IFriendsService + { + FriendInfo[] GetFriends(UUID PrincipalID); + bool StoreFriend(UUID PrincipalID, string Friend, int flags); + bool SetFlags(UUID PrincipalID, int flags); + bool Delete(UUID PrincipalID, string Friend); + } +} -- cgit v1.1 From 1b44711ceb6f84c6eaa503d5d08ce30cb49a01e8 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 5 Feb 2010 13:11:33 +0000 Subject: Clarify some names --- OpenSim/Services/Interfaces/IFriendsService.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'OpenSim/Services/Interfaces/IFriendsService.cs') diff --git a/OpenSim/Services/Interfaces/IFriendsService.cs b/OpenSim/Services/Interfaces/IFriendsService.cs index ed77c1a..4e665cd 100644 --- a/OpenSim/Services/Interfaces/IFriendsService.cs +++ b/OpenSim/Services/Interfaces/IFriendsService.cs @@ -35,15 +35,14 @@ namespace OpenSim.Region.Framework.Interfaces { public UUID PrincipalID; public string Friend; - int MyRights; - int TheirRights; + int MyFlags; + int TheirFlags; } public interface IFriendsService { FriendInfo[] GetFriends(UUID PrincipalID); bool StoreFriend(UUID PrincipalID, string Friend, int flags); - bool SetFlags(UUID PrincipalID, int flags); bool Delete(UUID PrincipalID, string Friend); } } -- cgit v1.1 From 1dfcf683307c24f4810961f52e0e643a59ef8d8c Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 9 Feb 2010 07:05:38 +0000 Subject: Add the friends service skel and correct some namespace issues --- OpenSim/Services/Interfaces/IFriendsService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Services/Interfaces/IFriendsService.cs') diff --git a/OpenSim/Services/Interfaces/IFriendsService.cs b/OpenSim/Services/Interfaces/IFriendsService.cs index 4e665cd..dc5a812 100644 --- a/OpenSim/Services/Interfaces/IFriendsService.cs +++ b/OpenSim/Services/Interfaces/IFriendsService.cs @@ -29,7 +29,7 @@ using OpenMetaverse; using OpenSim.Framework; using System.Collections.Generic; -namespace OpenSim.Region.Framework.Interfaces +namespace OpenSim.Services.Interfaces { public struct FriendInfo { -- cgit v1.1 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/Interfaces/IFriendsService.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Services/Interfaces/IFriendsService.cs') 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 { public UUID PrincipalID; public string Friend; - int MyFlags; - int TheirFlags; + public int MyFlags; + public int TheirFlags; } public interface IFriendsService -- cgit v1.1 From c745df007d1730e59fbdb4ebf8440654d1675ade Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 25 Feb 2010 17:42:51 -0800 Subject: Added server-side Friends in connector. Untested. --- OpenSim/Services/Interfaces/IFriendsService.cs | 28 ++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'OpenSim/Services/Interfaces/IFriendsService.cs') diff --git a/OpenSim/Services/Interfaces/IFriendsService.cs b/OpenSim/Services/Interfaces/IFriendsService.cs index 811203c..fc20224 100644 --- a/OpenSim/Services/Interfaces/IFriendsService.cs +++ b/OpenSim/Services/Interfaces/IFriendsService.cs @@ -25,6 +25,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +using System; using OpenMetaverse; using OpenSim.Framework; using System.Collections.Generic; @@ -37,6 +38,33 @@ namespace OpenSim.Services.Interfaces public string Friend; public int MyFlags; public int TheirFlags; + + public FriendInfo(Dictionary kvp) + { + PrincipalID = UUID.Zero; + if (kvp.ContainsKey("PrincipalID") && kvp["PrincipalID"] != null) + UUID.TryParse(kvp["PrincipalID"].ToString(), out PrincipalID); + Friend = string.Empty; + if (kvp.ContainsKey("Friend") && kvp["Friend"] != null) + Friend = kvp["Friend"].ToString(); + MyFlags = 0; + if (kvp.ContainsKey("MyFlags") && kvp["MyFlags"] != null) + Int32.TryParse(kvp["MyFlags"].ToString(), out MyFlags); + TheirFlags = 0; + if (kvp.ContainsKey("TheirFlags") && kvp["TheirFlags"] != null) + Int32.TryParse(kvp["TheirFlags"].ToString(), out TheirFlags); + } + + public Dictionary ToKeyValuePairs() + { + Dictionary result = new Dictionary(); + result["PricipalID"] = PrincipalID.ToString(); + result["Friend"] = Friend; + result["MyFlags"] = MyFlags.ToString(); + result["TheirFlags"] = TheirFlags.ToString(); + + return result; + } } public interface IFriendsService -- cgit v1.1 From c6a5ff26fff6a1d0c3ab916a526cf0dd4e4142bc Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 1 Mar 2010 21:32:55 -0800 Subject: Friends rights under control. --- OpenSim/Services/Interfaces/IFriendsService.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'OpenSim/Services/Interfaces/IFriendsService.cs') diff --git a/OpenSim/Services/Interfaces/IFriendsService.cs b/OpenSim/Services/Interfaces/IFriendsService.cs index fc20224..2692c48 100644 --- a/OpenSim/Services/Interfaces/IFriendsService.cs +++ b/OpenSim/Services/Interfaces/IFriendsService.cs @@ -32,13 +32,17 @@ using System.Collections.Generic; namespace OpenSim.Services.Interfaces { - public struct FriendInfo + public class FriendInfo { public UUID PrincipalID; public string Friend; public int MyFlags; public int TheirFlags; + public FriendInfo() + { + } + public FriendInfo(Dictionary kvp) { PrincipalID = UUID.Zero; -- cgit v1.1