diff options
author | Melanie | 2010-02-09 07:05:38 +0000 |
---|---|---|
committer | Melanie | 2010-02-09 07:05:38 +0000 |
commit | 1dfcf683307c24f4810961f52e0e643a59ef8d8c (patch) | |
tree | 18bf0faf02a6296d7067a77b0004fbca088d8381 | |
parent | Add license header and change branded namespace to generic (diff) | |
download | opensim-SC-1dfcf683307c24f4810961f52e0e643a59ef8d8c.zip opensim-SC-1dfcf683307c24f4810961f52e0e643a59ef8d8c.tar.gz opensim-SC-1dfcf683307c24f4810961f52e0e643a59ef8d8c.tar.bz2 opensim-SC-1dfcf683307c24f4810961f52e0e643a59ef8d8c.tar.xz |
Add the friends service skel and correct some namespace issues
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLFriendsData.cs | 2 | ||||
-rw-r--r-- | OpenSim/Services/Friends/FriendsService.cs | 60 | ||||
-rw-r--r-- | OpenSim/Services/Friends/FriendsServiceBase.cs | 84 | ||||
-rw-r--r-- | OpenSim/Services/Interfaces/IFriendsService.cs | 2 | ||||
-rw-r--r-- | prebuild.xml | 31 |
5 files changed, 177 insertions, 2 deletions
diff --git a/OpenSim/Data/MySQL/MySQLFriendsData.cs b/OpenSim/Data/MySQL/MySQLFriendsData.cs index e416eea..7a43bb6 100644 --- a/OpenSim/Data/MySQL/MySQLFriendsData.cs +++ b/OpenSim/Data/MySQL/MySQLFriendsData.cs | |||
@@ -59,7 +59,7 @@ namespace OpenSim.Data.MySQL | |||
59 | { | 59 | { |
60 | MySqlCommand cmd = new MySqlCommand(); | 60 | MySqlCommand cmd = new MySqlCommand(); |
61 | 61 | ||
62 | cmd.CommandText = String.Format("select a.*,b.Flags as TheirFlags from {0} as a left join {0} as b on a.PrincipalID = b.Friend and a.Friend = b.PrincipalID where a.PrincipalID = ?PrincipalID", m_Realm); | 62 | cmd.CommandText = String.Format("select a.*,b.Flags as TheirFlags from {0} as a left join {0} as b on a.PrincipalID = b.Friend and a.Friend = b.PrincipalID where a.PrincipalID = ?PrincipalID and b.Flags is not null", m_Realm); |
63 | cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString()); | 63 | cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString()); |
64 | 64 | ||
65 | return DoQuery(cmd); | 65 | return DoQuery(cmd); |
diff --git a/OpenSim/Services/Friends/FriendsService.cs b/OpenSim/Services/Friends/FriendsService.cs new file mode 100644 index 0000000..8e1c6c2 --- /dev/null +++ b/OpenSim/Services/Friends/FriendsService.cs | |||
@@ -0,0 +1,60 @@ | |||
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.Collections.Generic; | ||
31 | using OpenSim.Services.Interfaces; | ||
32 | using Nini.Config; | ||
33 | using log4net; | ||
34 | using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; | ||
35 | |||
36 | namespace OpenSim.Services.Friends | ||
37 | { | ||
38 | public class FriendsService : FriendsServiceBase, IFriendsService | ||
39 | { | ||
40 | public FriendsService(IConfigSource config) : base(config) | ||
41 | { | ||
42 | } | ||
43 | |||
44 | public FriendInfo[] GetFriends(UUID PrincipalID) | ||
45 | { | ||
46 | return new FriendInfo[0]; | ||
47 | } | ||
48 | |||
49 | public bool StoreFriend(UUID PrincipalID, string Friend, int flags) | ||
50 | { | ||
51 | return false; | ||
52 | } | ||
53 | |||
54 | public bool Delete(UUID PrincipalID, string Friend) | ||
55 | { | ||
56 | return false; | ||
57 | } | ||
58 | |||
59 | } | ||
60 | } | ||
diff --git a/OpenSim/Services/Friends/FriendsServiceBase.cs b/OpenSim/Services/Friends/FriendsServiceBase.cs new file mode 100644 index 0000000..cabe944 --- /dev/null +++ b/OpenSim/Services/Friends/FriendsServiceBase.cs | |||
@@ -0,0 +1,84 @@ | |||
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 System; | ||
29 | using System.Reflection; | ||
30 | using Nini.Config; | ||
31 | using OpenSim.Framework; | ||
32 | using OpenSim.Data; | ||
33 | using OpenSim.Services.Interfaces; | ||
34 | using OpenSim.Services.Base; | ||
35 | using Nini.Config; | ||
36 | using log4net; | ||
37 | |||
38 | namespace OpenSim.Services.Friends | ||
39 | { | ||
40 | public class FriendsServiceBase : ServiceBase | ||
41 | { | ||
42 | protected IFriendsData m_Database = null; | ||
43 | |||
44 | public FriendsServiceBase(IConfigSource config) : base(config) | ||
45 | { | ||
46 | string dllName = String.Empty; | ||
47 | string connString = String.Empty; | ||
48 | |||
49 | // | ||
50 | // Try reading the [FriendsService] section first, if it exists | ||
51 | // | ||
52 | IConfig friendsConfig = config.Configs["FriendsService"]; | ||
53 | if (friendsConfig != null) | ||
54 | { | ||
55 | dllName = friendsConfig.GetString("StorageProvider", dllName); | ||
56 | connString = friendsConfig.GetString("ConnectionString", connString); | ||
57 | } | ||
58 | |||
59 | // | ||
60 | // Try reading the [DatabaseService] section, if it exists | ||
61 | // | ||
62 | IConfig dbConfig = config.Configs["DatabaseService"]; | ||
63 | if (dbConfig != null) | ||
64 | { | ||
65 | if (dllName == String.Empty) | ||
66 | dllName = dbConfig.GetString("StorageProvider", String.Empty); | ||
67 | if (connString == String.Empty) | ||
68 | connString = dbConfig.GetString("ConnectionString", String.Empty); | ||
69 | } | ||
70 | |||
71 | // | ||
72 | // We tried, but this doesn't exist. We can't proceed. | ||
73 | // | ||
74 | if (dllName.Equals(String.Empty)) | ||
75 | throw new Exception("No StorageProvider configured"); | ||
76 | |||
77 | string realm = friendsConfig.GetString("Realm", "Friends"); | ||
78 | |||
79 | m_Database = LoadPlugin<IFriendsData>(dllName, new Object[] {connString, realm}); | ||
80 | if (m_Database == null) | ||
81 | throw new Exception("Could not find a storage interface in the given module"); | ||
82 | } | ||
83 | } | ||
84 | } | ||
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; | |||
29 | using OpenSim.Framework; | 29 | using OpenSim.Framework; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | 31 | ||
32 | namespace OpenSim.Region.Framework.Interfaces | 32 | namespace OpenSim.Services.Interfaces |
33 | { | 33 | { |
34 | public struct FriendInfo | 34 | public struct FriendInfo |
35 | { | 35 | { |
diff --git a/prebuild.xml b/prebuild.xml index 1efeaf5..8835f12 100644 --- a/prebuild.xml +++ b/prebuild.xml | |||
@@ -875,6 +875,37 @@ | |||
875 | </Files> | 875 | </Files> |
876 | </Project> | 876 | </Project> |
877 | 877 | ||
878 | <Project frameworkVersion="v3_5" name="OpenSim.Services.FriendsService" path="OpenSim/Services/Friends" type="Library"> | ||
879 | <Configuration name="Debug"> | ||
880 | <Options> | ||
881 | <OutputPath>../../../bin/</OutputPath> | ||
882 | </Options> | ||
883 | </Configuration> | ||
884 | <Configuration name="Release"> | ||
885 | <Options> | ||
886 | <OutputPath>../../../bin/</OutputPath> | ||
887 | </Options> | ||
888 | </Configuration> | ||
889 | |||
890 | <ReferencePath>../../../bin/</ReferencePath> | ||
891 | <Reference name="System"/> | ||
892 | <Reference name="System.Web"/> | ||
893 | <Reference name="OpenMetaverseTypes.dll"/> | ||
894 | <Reference name="OpenMetaverse.dll"/> | ||
895 | <Reference name="OpenSim.Framework"/> | ||
896 | <Reference name="OpenSim.Framework.Console"/> | ||
897 | <Reference name="OpenSim.Framework.Servers.HttpServer"/> | ||
898 | <Reference name="OpenSim.Services.Interfaces"/> | ||
899 | <Reference name="OpenSim.Services.Base"/> | ||
900 | <Reference name="OpenSim.Data"/> | ||
901 | <Reference name="Nini.dll" /> | ||
902 | <Reference name="log4net.dll"/> | ||
903 | |||
904 | <Files> | ||
905 | <Match pattern="*.cs" recurse="true"/> | ||
906 | </Files> | ||
907 | </Project> | ||
908 | |||
878 | <Project frameworkVersion="v3_5" name="OpenSim.Services.Connectors" path="OpenSim/Services/Connectors" type="Library"> | 909 | <Project frameworkVersion="v3_5" name="OpenSim.Services.Connectors" path="OpenSim/Services/Connectors" type="Library"> |
879 | <Configuration name="Debug"> | 910 | <Configuration name="Debug"> |
880 | <Options> | 911 | <Options> |