diff options
Diffstat (limited to '')
23 files changed, 1062 insertions, 78 deletions
diff --git a/OpenSim/Services/AssetService/AssetService.cs b/OpenSim/Services/AssetService/AssetService.cs index 4f4cbf6..137a9b0 100644 --- a/OpenSim/Services/AssetService/AssetService.cs +++ b/OpenSim/Services/AssetService/AssetService.cs | |||
@@ -46,7 +46,12 @@ namespace OpenSim.Services.AssetService | |||
46 | 46 | ||
47 | protected static AssetService m_RootInstance; | 47 | protected static AssetService m_RootInstance; |
48 | 48 | ||
49 | public AssetService(IConfigSource config) : base(config) | 49 | public AssetService(IConfigSource config) |
50 | : this(config, "AssetService") | ||
51 | { | ||
52 | } | ||
53 | |||
54 | public AssetService(IConfigSource config, string configName) : base(config, configName) | ||
50 | { | 55 | { |
51 | if (m_RootInstance == null) | 56 | if (m_RootInstance == null) |
52 | { | 57 | { |
@@ -54,9 +59,9 @@ namespace OpenSim.Services.AssetService | |||
54 | 59 | ||
55 | if (m_AssetLoader != null) | 60 | if (m_AssetLoader != null) |
56 | { | 61 | { |
57 | IConfig assetConfig = config.Configs["AssetService"]; | 62 | IConfig assetConfig = config.Configs[m_ConfigName]; |
58 | if (assetConfig == null) | 63 | if (assetConfig == null) |
59 | throw new Exception("No AssetService configuration"); | 64 | throw new Exception("No " + m_ConfigName + " configuration"); |
60 | 65 | ||
61 | string loaderArgs = assetConfig.GetString("AssetLoaderArgs", | 66 | string loaderArgs = assetConfig.GetString("AssetLoaderArgs", |
62 | String.Empty); | 67 | String.Empty); |
diff --git a/OpenSim/Services/AssetService/AssetServiceBase.cs b/OpenSim/Services/AssetService/AssetServiceBase.cs index 86752f9..177c565 100644 --- a/OpenSim/Services/AssetService/AssetServiceBase.cs +++ b/OpenSim/Services/AssetService/AssetServiceBase.cs | |||
@@ -39,16 +39,25 @@ namespace OpenSim.Services.AssetService | |||
39 | { | 39 | { |
40 | protected IAssetDataPlugin m_Database = null; | 40 | protected IAssetDataPlugin m_Database = null; |
41 | protected IAssetLoader m_AssetLoader = null; | 41 | protected IAssetLoader m_AssetLoader = null; |
42 | protected string m_ConfigName = "AssetService"; | ||
42 | 43 | ||
43 | public AssetServiceBase(IConfigSource config) : base(config) | 44 | public AssetServiceBase(IConfigSource config) |
45 | : this(config, "AssetService") | ||
44 | { | 46 | { |
47 | } | ||
48 | |||
49 | public AssetServiceBase(IConfigSource config, string configName) : base(config) | ||
50 | { | ||
51 | if (configName != string.Empty) | ||
52 | m_ConfigName = configName; | ||
53 | |||
45 | string dllName = String.Empty; | 54 | string dllName = String.Empty; |
46 | string connString = String.Empty; | 55 | string connString = String.Empty; |
47 | 56 | ||
48 | // | 57 | // |
49 | // Try reading the [AssetService] section first, if it exists | 58 | // Try reading the [AssetService] section, if it exists |
50 | // | 59 | // |
51 | IConfig assetConfig = config.Configs["AssetService"]; | 60 | IConfig assetConfig = config.Configs[m_ConfigName]; |
52 | if (assetConfig != null) | 61 | if (assetConfig != null) |
53 | { | 62 | { |
54 | dllName = assetConfig.GetString("StorageProvider", dllName); | 63 | dllName = assetConfig.GetString("StorageProvider", dllName); |
diff --git a/OpenSim/Services/AssetService/XAssetService.cs b/OpenSim/Services/AssetService/XAssetService.cs new file mode 100644 index 0000000..05eb125 --- /dev/null +++ b/OpenSim/Services/AssetService/XAssetService.cs | |||
@@ -0,0 +1,213 @@ | |||
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.Collections.Generic; | ||
30 | using System.IO; | ||
31 | using System.Reflection; | ||
32 | using Nini.Config; | ||
33 | using log4net; | ||
34 | using OpenSim.Framework; | ||
35 | using OpenSim.Data; | ||
36 | using OpenSim.Services.Interfaces; | ||
37 | using OpenMetaverse; | ||
38 | |||
39 | namespace OpenSim.Services.AssetService | ||
40 | { | ||
41 | /// <summary> | ||
42 | /// This will be developed into a de-duplicating asset service. | ||
43 | /// XXX: Currently it's a just a copy of the existing AssetService. so please don't attempt to use it. | ||
44 | /// </summary> | ||
45 | public class XAssetService : XAssetServiceBase, IAssetService | ||
46 | { | ||
47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
48 | |||
49 | protected static XAssetService m_RootInstance; | ||
50 | |||
51 | public XAssetService(IConfigSource config) : base(config) | ||
52 | { | ||
53 | if (m_RootInstance == null) | ||
54 | { | ||
55 | m_RootInstance = this; | ||
56 | |||
57 | if (m_AssetLoader != null) | ||
58 | { | ||
59 | IConfig assetConfig = config.Configs["AssetService"]; | ||
60 | if (assetConfig == null) | ||
61 | throw new Exception("No AssetService configuration"); | ||
62 | |||
63 | string loaderArgs = assetConfig.GetString("AssetLoaderArgs", | ||
64 | String.Empty); | ||
65 | |||
66 | bool assetLoaderEnabled = assetConfig.GetBoolean("AssetLoaderEnabled", true); | ||
67 | |||
68 | if (assetLoaderEnabled) | ||
69 | { | ||
70 | m_log.DebugFormat("[XASSET SERVICE]: Loading default asset set from {0}", loaderArgs); | ||
71 | |||
72 | m_AssetLoader.ForEachDefaultXmlAsset( | ||
73 | loaderArgs, | ||
74 | delegate(AssetBase a) | ||
75 | { | ||
76 | AssetBase existingAsset = Get(a.ID); | ||
77 | // AssetMetadata existingMetadata = GetMetadata(a.ID); | ||
78 | |||
79 | if (existingAsset == null || Util.SHA1Hash(existingAsset.Data) != Util.SHA1Hash(a.Data)) | ||
80 | { | ||
81 | // m_log.DebugFormat("[ASSET]: Storing {0} {1}", a.Name, a.ID); | ||
82 | Store(a); | ||
83 | } | ||
84 | }); | ||
85 | } | ||
86 | |||
87 | m_log.Debug("[XASSET SERVICE]: Local asset service enabled"); | ||
88 | } | ||
89 | } | ||
90 | } | ||
91 | |||
92 | public virtual AssetBase Get(string id) | ||
93 | { | ||
94 | // m_log.DebugFormat("[ASSET SERVICE]: Get asset for {0}", id); | ||
95 | |||
96 | UUID assetID; | ||
97 | |||
98 | if (!UUID.TryParse(id, out assetID)) | ||
99 | { | ||
100 | m_log.WarnFormat("[XASSET SERVICE]: Could not parse requested asset id {0}", id); | ||
101 | return null; | ||
102 | } | ||
103 | |||
104 | try | ||
105 | { | ||
106 | return m_Database.GetAsset(assetID); | ||
107 | } | ||
108 | catch (Exception e) | ||
109 | { | ||
110 | m_log.ErrorFormat("[XASSET SERVICE]: Exception getting asset {0} {1}", assetID, e); | ||
111 | return null; | ||
112 | } | ||
113 | } | ||
114 | |||
115 | public virtual AssetBase GetCached(string id) | ||
116 | { | ||
117 | return Get(id); | ||
118 | } | ||
119 | |||
120 | public virtual AssetMetadata GetMetadata(string id) | ||
121 | { | ||
122 | // m_log.DebugFormat("[XASSET SERVICE]: Get asset metadata for {0}", id); | ||
123 | |||
124 | UUID assetID; | ||
125 | |||
126 | if (!UUID.TryParse(id, out assetID)) | ||
127 | return null; | ||
128 | |||
129 | AssetBase asset = m_Database.GetAsset(assetID); | ||
130 | if (asset != null) | ||
131 | return asset.Metadata; | ||
132 | |||
133 | return null; | ||
134 | } | ||
135 | |||
136 | public virtual byte[] GetData(string id) | ||
137 | { | ||
138 | // m_log.DebugFormat("[XASSET SERVICE]: Get asset data for {0}", id); | ||
139 | |||
140 | UUID assetID; | ||
141 | |||
142 | if (!UUID.TryParse(id, out assetID)) | ||
143 | return null; | ||
144 | |||
145 | AssetBase asset = m_Database.GetAsset(assetID); | ||
146 | return asset.Data; | ||
147 | } | ||
148 | |||
149 | public virtual bool Get(string id, Object sender, AssetRetrieved handler) | ||
150 | { | ||
151 | //m_log.DebugFormat("[XASSET SERVICE]: Get asset async {0}", id); | ||
152 | |||
153 | UUID assetID; | ||
154 | |||
155 | if (!UUID.TryParse(id, out assetID)) | ||
156 | return false; | ||
157 | |||
158 | AssetBase asset = m_Database.GetAsset(assetID); | ||
159 | |||
160 | //m_log.DebugFormat("[XASSET SERVICE]: Got asset {0}", asset); | ||
161 | |||
162 | handler(id, sender, asset); | ||
163 | |||
164 | return true; | ||
165 | } | ||
166 | |||
167 | public virtual string Store(AssetBase asset) | ||
168 | { | ||
169 | if (!m_Database.ExistsAsset(asset.FullID)) | ||
170 | { | ||
171 | // m_log.DebugFormat( | ||
172 | // "[XASSET SERVICE]: Storing asset {0} {1}, bytes {2}", asset.Name, asset.FullID, asset.Data.Length); | ||
173 | m_Database.StoreAsset(asset); | ||
174 | } | ||
175 | // else | ||
176 | // { | ||
177 | // m_log.DebugFormat( | ||
178 | // "[XASSET SERVICE]: Not storing asset {0} {1}, bytes {2} as it already exists", asset.Name, asset.FullID, asset.Data.Length); | ||
179 | // } | ||
180 | |||
181 | return asset.ID; | ||
182 | } | ||
183 | |||
184 | public bool UpdateContent(string id, byte[] data) | ||
185 | { | ||
186 | return false; | ||
187 | } | ||
188 | |||
189 | public virtual bool Delete(string id) | ||
190 | { | ||
191 | m_log.DebugFormat("[XASSET SERVICE]: Deleting asset {0}", id); | ||
192 | UUID assetID; | ||
193 | if (!UUID.TryParse(id, out assetID)) | ||
194 | return false; | ||
195 | |||
196 | AssetBase asset = m_Database.GetAsset(assetID); | ||
197 | if (asset == null) | ||
198 | return false; | ||
199 | |||
200 | if ((int)(asset.Flags & AssetFlags.Maptile) != 0) | ||
201 | { | ||
202 | return m_Database.Delete(id); | ||
203 | } | ||
204 | else | ||
205 | { | ||
206 | m_log.DebugFormat("[XASSET SERVICE]: Request to delete asset {0}, but flags are not Maptile", id); | ||
207 | } | ||
208 | |||
209 | return false; | ||
210 | } | ||
211 | } | ||
212 | } | ||
213 | |||
diff --git a/OpenSim/Services/AssetService/XAssetServiceBase.cs b/OpenSim/Services/AssetService/XAssetServiceBase.cs new file mode 100644 index 0000000..0c5c2c3 --- /dev/null +++ b/OpenSim/Services/AssetService/XAssetServiceBase.cs | |||
@@ -0,0 +1,94 @@ | |||
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 | |||
36 | namespace OpenSim.Services.AssetService | ||
37 | { | ||
38 | public class XAssetServiceBase : ServiceBase | ||
39 | { | ||
40 | protected IXAssetDataPlugin m_Database = null; | ||
41 | protected IAssetLoader m_AssetLoader = null; | ||
42 | |||
43 | public XAssetServiceBase(IConfigSource config) : base(config) | ||
44 | { | ||
45 | string dllName = String.Empty; | ||
46 | string connString = String.Empty; | ||
47 | |||
48 | // | ||
49 | // Try reading the [AssetService] section first, if it exists | ||
50 | // | ||
51 | IConfig assetConfig = config.Configs["AssetService"]; | ||
52 | if (assetConfig != null) | ||
53 | { | ||
54 | dllName = assetConfig.GetString("StorageProvider", dllName); | ||
55 | connString = assetConfig.GetString("ConnectionString", connString); | ||
56 | } | ||
57 | |||
58 | // | ||
59 | // Try reading the [DatabaseService] section, if it exists | ||
60 | // | ||
61 | IConfig dbConfig = config.Configs["DatabaseService"]; | ||
62 | if (dbConfig != null) | ||
63 | { | ||
64 | if (dllName == String.Empty) | ||
65 | dllName = dbConfig.GetString("StorageProvider", String.Empty); | ||
66 | if (connString == String.Empty) | ||
67 | connString = dbConfig.GetString("ConnectionString", String.Empty); | ||
68 | } | ||
69 | |||
70 | // | ||
71 | // We tried, but this doesn't exist. We can't proceed. | ||
72 | // | ||
73 | if (dllName.Equals(String.Empty)) | ||
74 | throw new Exception("No StorageProvider configured"); | ||
75 | |||
76 | m_Database = LoadPlugin<IXAssetDataPlugin>(dllName); | ||
77 | if (m_Database == null) | ||
78 | throw new Exception("Could not find a storage interface in the given module"); | ||
79 | |||
80 | m_Database.Initialise(connString); | ||
81 | |||
82 | string loaderName = assetConfig.GetString("DefaultAssetLoader", | ||
83 | String.Empty); | ||
84 | |||
85 | if (loaderName != String.Empty) | ||
86 | { | ||
87 | m_AssetLoader = LoadPlugin<IAssetLoader>(loaderName); | ||
88 | |||
89 | if (m_AssetLoader == null) | ||
90 | throw new Exception("Asset loader could not be loaded"); | ||
91 | } | ||
92 | } | ||
93 | } | ||
94 | } \ No newline at end of file | ||
diff --git a/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs b/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs index 48eb3f8..5f1bde1 100644 --- a/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs +++ b/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs | |||
@@ -80,7 +80,7 @@ namespace OpenSim.Services.AuthenticationService | |||
80 | { | 80 | { |
81 | string hashed = Util.Md5Hash(password + ":" + data.Data["passwordSalt"].ToString()); | 81 | string hashed = Util.Md5Hash(password + ":" + data.Data["passwordSalt"].ToString()); |
82 | 82 | ||
83 | //m_log.DebugFormat("[PASS AUTH]: got {0}; hashed = {1}; stored = {2}", password, hashed, data.Data["passwordHash"].ToString()); | 83 | m_log.DebugFormat("[PASS AUTH]: got {0}; hashed = {1}; stored = {2}", password, hashed, data.Data["passwordHash"].ToString()); |
84 | 84 | ||
85 | if (data.Data["passwordHash"].ToString() == hashed) | 85 | if (data.Data["passwordHash"].ToString() == hashed) |
86 | { | 86 | { |
diff --git a/OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs b/OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs index bb5d51f..c395178 100644 --- a/OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs +++ b/OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs | |||
@@ -45,6 +45,24 @@ namespace OpenSim.Services.Connectors | |||
45 | LogManager.GetLogger( | 45 | LogManager.GetLogger( |
46 | MethodBase.GetCurrentMethod().DeclaringType); | 46 | MethodBase.GetCurrentMethod().DeclaringType); |
47 | 47 | ||
48 | private Dictionary<IAssetService, object> m_endpointSerializer = new Dictionary<IAssetService, object>(); | ||
49 | private object EndPointLock(IAssetService connector) | ||
50 | { | ||
51 | lock (m_endpointSerializer) | ||
52 | { | ||
53 | object eplock = null; | ||
54 | |||
55 | if (! m_endpointSerializer.TryGetValue(connector, out eplock)) | ||
56 | { | ||
57 | eplock = new object(); | ||
58 | m_endpointSerializer.Add(connector, eplock); | ||
59 | // m_log.WarnFormat("[WEB UTIL] add a new host to end point serializer {0}",endpoint); | ||
60 | } | ||
61 | |||
62 | return eplock; | ||
63 | } | ||
64 | } | ||
65 | |||
48 | private Dictionary<string, IAssetService> m_connectors = new Dictionary<string, IAssetService>(); | 66 | private Dictionary<string, IAssetService> m_connectors = new Dictionary<string, IAssetService>(); |
49 | 67 | ||
50 | public HGAssetServiceConnector(IConfigSource source) | 68 | public HGAssetServiceConnector(IConfigSource source) |
@@ -197,7 +215,8 @@ namespace OpenSim.Services.Connectors | |||
197 | IAssetService connector = GetConnector(url); | 215 | IAssetService connector = GetConnector(url); |
198 | // Restore the assetID to a simple UUID | 216 | // Restore the assetID to a simple UUID |
199 | asset.ID = assetID; | 217 | asset.ID = assetID; |
200 | return connector.Store(asset); | 218 | lock (EndPointLock(connector)) |
219 | return connector.Store(asset); | ||
201 | } | 220 | } |
202 | 221 | ||
203 | return String.Empty; | 222 | return String.Empty; |
diff --git a/OpenSim/Services/Connectors/Friends/FriendsSimConnector.cs b/OpenSim/Services/Connectors/Friends/FriendsSimConnector.cs index eea9853..3fd0c53 100644 --- a/OpenSim/Services/Connectors/Friends/FriendsSimConnector.cs +++ b/OpenSim/Services/Connectors/Friends/FriendsSimConnector.cs | |||
@@ -43,8 +43,18 @@ namespace OpenSim.Services.Connectors.Friends | |||
43 | { | 43 | { |
44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
45 | 45 | ||
46 | protected virtual string ServicePath() | ||
47 | { | ||
48 | return "friends"; | ||
49 | } | ||
50 | |||
46 | public bool FriendshipOffered(GridRegion region, UUID userID, UUID friendID, string message) | 51 | public bool FriendshipOffered(GridRegion region, UUID userID, UUID friendID, string message) |
47 | { | 52 | { |
53 | return FriendshipOffered(region, userID, friendID, message, String.Empty); | ||
54 | } | ||
55 | |||
56 | public virtual bool FriendshipOffered(GridRegion region, UUID userID, UUID friendID, string message, string userName) | ||
57 | { | ||
48 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | 58 | Dictionary<string, object> sendData = new Dictionary<string, object>(); |
49 | //sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString(); | 59 | //sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString(); |
50 | //sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString(); | 60 | //sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString(); |
@@ -53,9 +63,10 @@ namespace OpenSim.Services.Connectors.Friends | |||
53 | sendData["FromID"] = userID.ToString(); | 63 | sendData["FromID"] = userID.ToString(); |
54 | sendData["ToID"] = friendID.ToString(); | 64 | sendData["ToID"] = friendID.ToString(); |
55 | sendData["Message"] = message; | 65 | sendData["Message"] = message; |
66 | if (userName != String.Empty) | ||
67 | sendData["FromName"] = userName; | ||
56 | 68 | ||
57 | return Call(region, sendData); | 69 | return Call(region, sendData); |
58 | |||
59 | } | 70 | } |
60 | 71 | ||
61 | public bool FriendshipApproved(GridRegion region, UUID userID, string userName, UUID friendID) | 72 | public bool FriendshipApproved(GridRegion region, UUID userID, string userName, UUID friendID) |
@@ -138,8 +149,11 @@ namespace OpenSim.Services.Connectors.Friends | |||
138 | if (region == null) | 149 | if (region == null) |
139 | return false; | 150 | return false; |
140 | 151 | ||
141 | m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: region: {0}", region.ExternalHostName + ":" + region.HttpPort); | 152 | string path = ServicePath(); |
142 | string uri = "http://" + region.ExternalHostName + ":" + region.HttpPort + "/friends"; | 153 | if (!region.ServerURI.EndsWith("/")) |
154 | path = "/" + path; | ||
155 | string uri = region.ServerURI + path; | ||
156 | m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: calling {0}", uri); | ||
143 | 157 | ||
144 | try | 158 | try |
145 | { | 159 | { |
diff --git a/OpenSim/Services/Connectors/Hypergrid/HGFriendsServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/HGFriendsServiceConnector.cs index af4b0da..e984a54 100644 --- a/OpenSim/Services/Connectors/Hypergrid/HGFriendsServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/HGFriendsServiceConnector.cs | |||
@@ -40,7 +40,7 @@ using OpenMetaverse; | |||
40 | 40 | ||
41 | namespace OpenSim.Services.Connectors.Hypergrid | 41 | namespace OpenSim.Services.Connectors.Hypergrid |
42 | { | 42 | { |
43 | public class HGFriendsServicesConnector | 43 | public class HGFriendsServicesConnector : FriendsSimConnector |
44 | { | 44 | { |
45 | private static readonly ILog m_log = | 45 | private static readonly ILog m_log = |
46 | LogManager.GetLogger( | 46 | LogManager.GetLogger( |
@@ -66,6 +66,11 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
66 | m_SessionID = sessionID; | 66 | m_SessionID = sessionID; |
67 | } | 67 | } |
68 | 68 | ||
69 | protected override string ServicePath() | ||
70 | { | ||
71 | return "hgfriends"; | ||
72 | } | ||
73 | |||
69 | #region IFriendsService | 74 | #region IFriendsService |
70 | 75 | ||
71 | public uint GetFriendPerms(UUID PrincipalID, UUID friendID) | 76 | public uint GetFriendPerms(UUID PrincipalID, UUID friendID) |
@@ -187,23 +192,121 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
187 | { | 192 | { |
188 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | 193 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); |
189 | 194 | ||
190 | if ((replyData != null) && replyData.ContainsKey("Result") && (replyData["Result"] != null)) | 195 | if (replyData.ContainsKey("RESULT")) |
191 | { | 196 | { |
192 | bool success = false; | 197 | if (replyData["RESULT"].ToString().ToLower() == "true") |
193 | Boolean.TryParse(replyData["Result"].ToString(), out success); | 198 | return true; |
194 | return success; | 199 | else |
200 | return false; | ||
195 | } | 201 | } |
196 | else | 202 | else |
197 | m_log.DebugFormat("[HGFRIENDS CONNECTOR]: Delete {0} {1} received null response", | 203 | m_log.DebugFormat("[HGFRIENDS CONNECTOR]: reply data does not contain result field"); |
198 | PrincipalID, Friend); | 204 | |
199 | } | 205 | } |
200 | else | 206 | else |
201 | m_log.DebugFormat("[HGFRIENDS CONNECTOR]: DeleteFriend received null reply"); | 207 | m_log.DebugFormat("[HGFRIENDS CONNECTOR]: received empty reply"); |
202 | 208 | ||
203 | return false; | 209 | return false; |
204 | 210 | ||
205 | } | 211 | } |
206 | 212 | ||
213 | public bool ValidateFriendshipOffered(UUID fromID, UUID toID) | ||
214 | { | ||
215 | FriendInfo finfo = new FriendInfo(); | ||
216 | finfo.PrincipalID = fromID; | ||
217 | finfo.Friend = toID.ToString(); | ||
218 | |||
219 | Dictionary<string, object> sendData = finfo.ToKeyValuePairs(); | ||
220 | |||
221 | sendData["METHOD"] = "validate_friendship_offered"; | ||
222 | |||
223 | string reply = string.Empty; | ||
224 | string uri = m_ServerURI + "/hgfriends"; | ||
225 | try | ||
226 | { | ||
227 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | ||
228 | uri, | ||
229 | ServerUtils.BuildQueryString(sendData)); | ||
230 | } | ||
231 | catch (Exception e) | ||
232 | { | ||
233 | m_log.DebugFormat("[HGFRIENDS CONNECTOR]: Exception when contacting friends server at {0}: {1}", uri, e.Message); | ||
234 | return false; | ||
235 | } | ||
236 | |||
237 | if (reply != string.Empty) | ||
238 | { | ||
239 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | ||
240 | |||
241 | if (replyData.ContainsKey("RESULT")) | ||
242 | { | ||
243 | if (replyData["RESULT"].ToString().ToLower() == "true") | ||
244 | return true; | ||
245 | else | ||
246 | return false; | ||
247 | } | ||
248 | else | ||
249 | m_log.DebugFormat("[HGFRIENDS CONNECTOR]: reply data does not contain result field"); | ||
250 | |||
251 | } | ||
252 | else | ||
253 | m_log.DebugFormat("[HGFRIENDS CONNECTOR]: received empty reply"); | ||
254 | |||
255 | return false; | ||
256 | |||
257 | } | ||
258 | |||
259 | public List<UUID> StatusNotification(List<string> friends, UUID userID, bool online) | ||
260 | { | ||
261 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | ||
262 | List<UUID> friendsOnline = new List<UUID>(); | ||
263 | |||
264 | sendData["METHOD"] = "statusnotification"; | ||
265 | sendData["userID"] = userID.ToString(); | ||
266 | sendData["online"] = online.ToString(); | ||
267 | int i = 0; | ||
268 | foreach (string s in friends) | ||
269 | { | ||
270 | sendData["friend_" + i.ToString()] = s; | ||
271 | i++; | ||
272 | } | ||
273 | |||
274 | string reply = string.Empty; | ||
275 | string uri = m_ServerURI + "/hgfriends"; | ||
276 | try | ||
277 | { | ||
278 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | ||
279 | uri, | ||
280 | ServerUtils.BuildQueryString(sendData)); | ||
281 | } | ||
282 | catch (Exception e) | ||
283 | { | ||
284 | m_log.DebugFormat("[HGFRIENDS CONNECTOR]: Exception when contacting friends server at {0}: {1}", uri, e.Message); | ||
285 | return friendsOnline; | ||
286 | } | ||
287 | |||
288 | if (reply != string.Empty) | ||
289 | { | ||
290 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | ||
291 | |||
292 | // Here is the actual response | ||
293 | foreach (string key in replyData.Keys) | ||
294 | { | ||
295 | if (key.StartsWith("friend_") && replyData[key] != null) | ||
296 | { | ||
297 | UUID uuid; | ||
298 | if (UUID.TryParse(replyData[key].ToString(), out uuid)) | ||
299 | friendsOnline.Add(uuid); | ||
300 | } | ||
301 | } | ||
302 | } | ||
303 | else | ||
304 | m_log.DebugFormat("[HGFRIENDS CONNECTOR]: Received empty reply from remote StatusNotify"); | ||
305 | |||
306 | return friendsOnline; | ||
307 | |||
308 | } | ||
309 | |||
207 | #endregion | 310 | #endregion |
208 | } | 311 | } |
209 | } \ No newline at end of file | 312 | } \ No newline at end of file |
diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs index 5b27cf6..2f263ae 100644 --- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs | |||
@@ -417,6 +417,7 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
417 | GetBoolResponse(request, out reason); | 417 | GetBoolResponse(request, out reason); |
418 | } | 418 | } |
419 | 419 | ||
420 | [Obsolete] | ||
420 | public List<UUID> StatusNotification(List<string> friends, UUID userID, bool online) | 421 | public List<UUID> StatusNotification(List<string> friends, UUID userID, bool online) |
421 | { | 422 | { |
422 | Hashtable hash = new Hashtable(); | 423 | Hashtable hash = new Hashtable(); |
@@ -789,13 +790,72 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
789 | } | 790 | } |
790 | catch | 791 | catch |
791 | { | 792 | { |
792 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got exception on LocateUser response."); | 793 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got exception on GetUUI response."); |
793 | // reason = "Exception: " + e.Message; | 794 | // reason = "Exception: " + e.Message; |
794 | } | 795 | } |
795 | 796 | ||
796 | return uui; | 797 | return uui; |
797 | } | 798 | } |
798 | 799 | ||
800 | public UUID GetUUID(String first, String last) | ||
801 | { | ||
802 | Hashtable hash = new Hashtable(); | ||
803 | hash["first"] = first; | ||
804 | hash["last"] = last; | ||
805 | |||
806 | IList paramList = new ArrayList(); | ||
807 | paramList.Add(hash); | ||
808 | |||
809 | XmlRpcRequest request = new XmlRpcRequest("get_uuid", paramList); | ||
810 | // string reason = string.Empty; | ||
811 | |||
812 | // Send and get reply | ||
813 | UUID uuid = UUID.Zero; | ||
814 | XmlRpcResponse response = null; | ||
815 | try | ||
816 | { | ||
817 | response = request.Send(m_ServerURL, 10000); | ||
818 | } | ||
819 | catch | ||
820 | { | ||
821 | m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0} for GetUUID", m_ServerURL); | ||
822 | // reason = "Exception: " + e.Message; | ||
823 | return uuid; | ||
824 | } | ||
825 | |||
826 | if (response.IsFault) | ||
827 | { | ||
828 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} for GetUUID returned an error: {1}", m_ServerURL, response.FaultString); | ||
829 | // reason = "XMLRPC Fault"; | ||
830 | return uuid; | ||
831 | } | ||
832 | |||
833 | hash = (Hashtable)response.Value; | ||
834 | //foreach (Object o in hash) | ||
835 | // m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value); | ||
836 | try | ||
837 | { | ||
838 | if (hash == null) | ||
839 | { | ||
840 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: GetUUDI Got null response from {0}! THIS IS BAAAAD", m_ServerURL); | ||
841 | // reason = "Internal error 1"; | ||
842 | return uuid; | ||
843 | } | ||
844 | |||
845 | // Here's the actual response | ||
846 | if (hash.ContainsKey("UUID")) | ||
847 | UUID.TryParse(hash["UUID"].ToString(), out uuid); | ||
848 | |||
849 | } | ||
850 | catch | ||
851 | { | ||
852 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got exception on UUID response."); | ||
853 | // reason = "Exception: " + e.Message; | ||
854 | } | ||
855 | |||
856 | return uuid; | ||
857 | } | ||
858 | |||
799 | private bool GetBoolResponse(XmlRpcRequest request, out string reason) | 859 | private bool GetBoolResponse(XmlRpcRequest request, out string reason) |
800 | { | 860 | { |
801 | //m_log.Debug("[USER AGENT CONNECTOR]: GetBoolResponse from/to " + m_ServerURL); | 861 | //m_log.Debug("[USER AGENT CONNECTOR]: GetBoolResponse from/to " + m_ServerURL); |
diff --git a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs index a662abb..39e983b 100644 --- a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs | |||
@@ -48,6 +48,8 @@ namespace OpenSim.Services.Connectors | |||
48 | 48 | ||
49 | private string m_ServerURI = String.Empty; | 49 | private string m_ServerURI = String.Empty; |
50 | 50 | ||
51 | private object m_Lock = new object(); | ||
52 | |||
51 | public XInventoryServicesConnector() | 53 | public XInventoryServicesConnector() |
52 | { | 54 | { |
53 | } | 55 | } |
@@ -514,9 +516,11 @@ namespace OpenSim.Services.Connectors | |||
514 | { | 516 | { |
515 | sendData["METHOD"] = method; | 517 | sendData["METHOD"] = method; |
516 | 518 | ||
517 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", | 519 | string reply = string.Empty; |
518 | m_ServerURI + "/xinventory", | 520 | lock (m_Lock) |
519 | ServerUtils.BuildQueryString(sendData)); | 521 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
522 | m_ServerURI + "/xinventory", | ||
523 | ServerUtils.BuildQueryString(sendData)); | ||
520 | 524 | ||
521 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse( | 525 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse( |
522 | reply); | 526 | reply); |
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs index 99523a1..6bfc5cc 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs | |||
@@ -477,7 +477,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
477 | // Grab the asset data from the response stream | 477 | // Grab the asset data from the response stream |
478 | using (MemoryStream stream = new MemoryStream()) | 478 | using (MemoryStream stream = new MemoryStream()) |
479 | { | 479 | { |
480 | responseStream.CopyTo(stream, 4096); | 480 | responseStream.CopyStream(stream, Int32.MaxValue); |
481 | asset.Data = stream.ToArray(); | 481 | asset.Data = stream.ToArray(); |
482 | } | 482 | } |
483 | } | 483 | } |
diff --git a/OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs b/OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs index 609dafe..6d5ce28 100644 --- a/OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs +++ b/OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs | |||
@@ -197,8 +197,15 @@ namespace OpenSim.Services.Connectors | |||
197 | 197 | ||
198 | Dictionary<string, object> structData = data.ToKeyValuePairs(); | 198 | Dictionary<string, object> structData = data.ToKeyValuePairs(); |
199 | 199 | ||
200 | foreach (KeyValuePair<string,object> kvp in structData) | 200 | foreach (KeyValuePair<string, object> kvp in structData) |
201 | { | ||
202 | if (kvp.Value == null) | ||
203 | { | ||
204 | m_log.DebugFormat("[ACCOUNTS CONNECTOR]: Null value for {0}", kvp.Key); | ||
205 | continue; | ||
206 | } | ||
201 | sendData[kvp.Key] = kvp.Value.ToString(); | 207 | sendData[kvp.Key] = kvp.Value.ToString(); |
208 | } | ||
202 | 209 | ||
203 | return SendAndGetBoolReply(sendData); | 210 | return SendAndGetBoolReply(sendData); |
204 | } | 211 | } |
diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 89f0716..3dc87bc 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs | |||
@@ -84,14 +84,14 @@ namespace OpenSim.Services.GridService | |||
84 | 84 | ||
85 | if (MainConsole.Instance != null) | 85 | if (MainConsole.Instance != null) |
86 | { | 86 | { |
87 | MainConsole.Instance.Commands.AddCommand("grid", true, | 87 | MainConsole.Instance.Commands.AddCommand("Regions", true, |
88 | "show region", | 88 | "show region", |
89 | "show region <Region name>", | 89 | "show region <Region name>", |
90 | "Show details on a region", | 90 | "Show details on a region", |
91 | String.Empty, | 91 | String.Empty, |
92 | HandleShowRegion); | 92 | HandleShowRegion); |
93 | 93 | ||
94 | MainConsole.Instance.Commands.AddCommand("grid", true, | 94 | MainConsole.Instance.Commands.AddCommand("Regions", true, |
95 | "set region flags", | 95 | "set region flags", |
96 | "set region flags <Region name> <flags>", | 96 | "set region flags <Region name> <flags>", |
97 | "Set database flags for region", | 97 | "Set database flags for region", |
diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs index 0a59f86..4e38687 100644 --- a/OpenSim/Services/HypergridService/GatekeeperService.cs +++ b/OpenSim/Services/HypergridService/GatekeeperService.cs | |||
@@ -296,9 +296,10 @@ namespace OpenSim.Services.HypergridService | |||
296 | aCircuit.firstname = account.FirstName; | 296 | aCircuit.firstname = account.FirstName; |
297 | aCircuit.lastname = account.LastName; | 297 | aCircuit.lastname = account.LastName; |
298 | } | 298 | } |
299 | if (account == null && !aCircuit.lastname.StartsWith("@")) | 299 | if (account == null) |
300 | { | 300 | { |
301 | aCircuit.firstname = aCircuit.firstname + "." + aCircuit.lastname; | 301 | if (!aCircuit.lastname.StartsWith("@")) |
302 | aCircuit.firstname = aCircuit.firstname + "." + aCircuit.lastname; | ||
302 | try | 303 | try |
303 | { | 304 | { |
304 | Uri uri = new Uri(aCircuit.ServiceURLs["HomeURI"].ToString()); | 305 | Uri uri = new Uri(aCircuit.ServiceURLs["HomeURI"].ToString()); |
diff --git a/OpenSim/Services/HypergridService/HGAssetService.cs b/OpenSim/Services/HypergridService/HGAssetService.cs index 22e233a..db98166 100644 --- a/OpenSim/Services/HypergridService/HGAssetService.cs +++ b/OpenSim/Services/HypergridService/HGAssetService.cs | |||
@@ -58,10 +58,10 @@ namespace OpenSim.Services.HypergridService | |||
58 | 58 | ||
59 | private UserAccountCache m_Cache; | 59 | private UserAccountCache m_Cache; |
60 | 60 | ||
61 | public HGAssetService(IConfigSource config) : base(config) | 61 | public HGAssetService(IConfigSource config, string configName) : base(config, configName) |
62 | { | 62 | { |
63 | m_log.Debug("[HGAsset Service]: Starting"); | 63 | m_log.Debug("[HGAsset Service]: Starting"); |
64 | IConfig assetConfig = config.Configs["HGAssetService"]; | 64 | IConfig assetConfig = config.Configs[configName]; |
65 | if (assetConfig == null) | 65 | if (assetConfig == null) |
66 | throw new Exception("No HGAssetService configuration"); | 66 | throw new Exception("No HGAssetService configuration"); |
67 | 67 | ||
diff --git a/OpenSim/Services/HypergridService/HGFriendsService.cs b/OpenSim/Services/HypergridService/HGFriendsService.cs new file mode 100644 index 0000000..39524ab --- /dev/null +++ b/OpenSim/Services/HypergridService/HGFriendsService.cs | |||
@@ -0,0 +1,408 @@ | |||
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.Collections.Generic; | ||
30 | using System.Net; | ||
31 | using System.Reflection; | ||
32 | |||
33 | using OpenSim.Framework; | ||
34 | using OpenSim.Services.Connectors.Friends; | ||
35 | using OpenSim.Services.Connectors.Hypergrid; | ||
36 | using OpenSim.Services.Interfaces; | ||
37 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | ||
38 | using OpenSim.Server.Base; | ||
39 | using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; | ||
40 | |||
41 | using OpenMetaverse; | ||
42 | using log4net; | ||
43 | using Nini.Config; | ||
44 | |||
45 | namespace OpenSim.Services.HypergridService | ||
46 | { | ||
47 | /// <summary> | ||
48 | /// W2W social networking | ||
49 | /// </summary> | ||
50 | public class HGFriendsService : IHGFriendsService | ||
51 | { | ||
52 | private static readonly ILog m_log = | ||
53 | LogManager.GetLogger( | ||
54 | MethodBase.GetCurrentMethod().DeclaringType); | ||
55 | |||
56 | static bool m_Initialized = false; | ||
57 | |||
58 | protected static IGridUserService m_GridUserService; | ||
59 | protected static IGridService m_GridService; | ||
60 | protected static IGatekeeperService m_GatekeeperService; | ||
61 | protected static IFriendsService m_FriendsService; | ||
62 | protected static IPresenceService m_PresenceService; | ||
63 | protected static IUserAccountService m_UserAccountService; | ||
64 | protected static IFriendsSimConnector m_FriendsLocalSimConnector; // standalone, points to HGFriendsModule | ||
65 | protected static FriendsSimConnector m_FriendsSimConnector; // grid | ||
66 | |||
67 | private static string m_ConfigName = "HGFriendsService"; | ||
68 | |||
69 | public HGFriendsService(IConfigSource config, String configName, IFriendsSimConnector localSimConn) | ||
70 | { | ||
71 | if (m_FriendsLocalSimConnector == null) | ||
72 | m_FriendsLocalSimConnector = localSimConn; | ||
73 | |||
74 | if (!m_Initialized) | ||
75 | { | ||
76 | m_Initialized = true; | ||
77 | |||
78 | if (configName != String.Empty) | ||
79 | m_ConfigName = configName; | ||
80 | |||
81 | Object[] args = new Object[] { config }; | ||
82 | |||
83 | IConfig serverConfig = config.Configs[m_ConfigName]; | ||
84 | if (serverConfig == null) | ||
85 | throw new Exception(String.Format("No section {0} in config file", m_ConfigName)); | ||
86 | |||
87 | string theService = serverConfig.GetString("FriendsService", string.Empty); | ||
88 | if (theService == String.Empty) | ||
89 | throw new Exception("No FriendsService in config file " + m_ConfigName); | ||
90 | m_FriendsService = ServerUtils.LoadPlugin<IFriendsService>(theService, args); | ||
91 | |||
92 | theService = serverConfig.GetString("UserAccountService", string.Empty); | ||
93 | if (theService == String.Empty) | ||
94 | throw new Exception("No UserAccountService in " + m_ConfigName); | ||
95 | m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(theService, args); | ||
96 | |||
97 | theService = serverConfig.GetString("GridService", string.Empty); | ||
98 | if (theService == String.Empty) | ||
99 | throw new Exception("No GridService in " + m_ConfigName); | ||
100 | m_GridService = ServerUtils.LoadPlugin<IGridService>(theService, args); | ||
101 | |||
102 | theService = serverConfig.GetString("PresenceService", string.Empty); | ||
103 | if (theService == String.Empty) | ||
104 | throw new Exception("No PresenceService in " + m_ConfigName); | ||
105 | m_PresenceService = ServerUtils.LoadPlugin<IPresenceService>(theService, args); | ||
106 | |||
107 | m_FriendsSimConnector = new FriendsSimConnector(); | ||
108 | |||
109 | m_log.DebugFormat("[HGFRIENDS SERVICE]: Starting..."); | ||
110 | |||
111 | } | ||
112 | } | ||
113 | |||
114 | #region IHGFriendsService | ||
115 | |||
116 | public int GetFriendPerms(UUID userID, UUID friendID) | ||
117 | { | ||
118 | FriendInfo[] friendsInfo = m_FriendsService.GetFriends(userID); | ||
119 | foreach (FriendInfo finfo in friendsInfo) | ||
120 | { | ||
121 | if (finfo.Friend.StartsWith(friendID.ToString())) | ||
122 | return finfo.TheirFlags; | ||
123 | } | ||
124 | return -1; | ||
125 | } | ||
126 | |||
127 | public bool NewFriendship(FriendInfo friend, bool verified) | ||
128 | { | ||
129 | UUID friendID; | ||
130 | string tmp = string.Empty, url = String.Empty, first = String.Empty, last = String.Empty; | ||
131 | if (!Util.ParseUniversalUserIdentifier(friend.Friend, out friendID, out url, out first, out last, out tmp)) | ||
132 | return false; | ||
133 | |||
134 | m_log.DebugFormat("[HGFRIENDS SERVICE]: New friendship {0} {1} ({2})", friend.PrincipalID, friend.Friend, verified); | ||
135 | |||
136 | // Does the friendship already exist? | ||
137 | FriendInfo[] finfos = m_FriendsService.GetFriends(friend.PrincipalID); | ||
138 | foreach (FriendInfo finfo in finfos) | ||
139 | { | ||
140 | if (finfo.Friend.StartsWith(friendID.ToString())) | ||
141 | return false; | ||
142 | } | ||
143 | // Verified user session. But the user needs to confirm friendship when he gets home | ||
144 | if (verified) | ||
145 | return m_FriendsService.StoreFriend(friend.PrincipalID.ToString(), friend.Friend, 0); | ||
146 | |||
147 | // Does the reverted friendship exist? meaning that this user initiated the request | ||
148 | finfos = m_FriendsService.GetFriends(friendID); | ||
149 | bool userInitiatedOffer = false; | ||
150 | foreach (FriendInfo finfo in finfos) | ||
151 | { | ||
152 | if (friend.Friend.StartsWith(finfo.PrincipalID.ToString()) && finfo.Friend.StartsWith(friend.PrincipalID.ToString()) && finfo.TheirFlags == -1) | ||
153 | { | ||
154 | userInitiatedOffer = true; | ||
155 | // Let's delete the existing friendship relations that was stored | ||
156 | m_FriendsService.Delete(friendID, finfo.Friend); | ||
157 | break; | ||
158 | } | ||
159 | } | ||
160 | |||
161 | if (userInitiatedOffer) | ||
162 | { | ||
163 | m_FriendsService.StoreFriend(friend.PrincipalID.ToString(), friend.Friend, 1); | ||
164 | m_FriendsService.StoreFriend(friend.Friend, friend.PrincipalID.ToString(), 1); | ||
165 | // notify the user | ||
166 | ForwardToSim("ApproveFriendshipRequest", friendID, Util.UniversalName(first, last, url), "", friend.PrincipalID, ""); | ||
167 | return true; | ||
168 | } | ||
169 | return false; | ||
170 | } | ||
171 | |||
172 | public bool DeleteFriendship(FriendInfo friend, string secret) | ||
173 | { | ||
174 | FriendInfo[] finfos = m_FriendsService.GetFriends(friend.PrincipalID); | ||
175 | foreach (FriendInfo finfo in finfos) | ||
176 | { | ||
177 | // We check the secret here. Or if the friendship request was initiated here, and was declined | ||
178 | if (finfo.Friend.StartsWith(friend.Friend) && finfo.Friend.EndsWith(secret)) | ||
179 | { | ||
180 | m_log.DebugFormat("[HGFRIENDS SERVICE]: Delete friendship {0} {1}", friend.PrincipalID, friend.Friend); | ||
181 | m_FriendsService.Delete(friend.PrincipalID, finfo.Friend); | ||
182 | m_FriendsService.Delete(finfo.Friend, friend.PrincipalID.ToString()); | ||
183 | |||
184 | return true; | ||
185 | } | ||
186 | } | ||
187 | |||
188 | return false; | ||
189 | } | ||
190 | |||
191 | public bool FriendshipOffered(UUID fromID, string fromName, UUID toID, string message) | ||
192 | { | ||
193 | UserAccount account = m_UserAccountService.GetUserAccount(UUID.Zero, toID); | ||
194 | if (account == null) | ||
195 | return false; | ||
196 | |||
197 | // OK, we have that user here. | ||
198 | // So let's send back the call, but start a thread to continue | ||
199 | // with the verification and the actual action. | ||
200 | |||
201 | Util.FireAndForget(delegate { ProcessFriendshipOffered(fromID, fromName, toID, message); }); | ||
202 | |||
203 | return true; | ||
204 | } | ||
205 | |||
206 | public bool ValidateFriendshipOffered(UUID fromID, UUID toID) | ||
207 | { | ||
208 | FriendInfo[] finfos = m_FriendsService.GetFriends(toID.ToString()); | ||
209 | foreach (FriendInfo fi in finfos) | ||
210 | { | ||
211 | if (fi.Friend.StartsWith(fromID.ToString()) && fi.TheirFlags == -1) | ||
212 | return true; | ||
213 | } | ||
214 | return false; | ||
215 | } | ||
216 | |||
217 | public List<UUID> StatusNotification(List<string> friends, UUID foreignUserID, bool online) | ||
218 | { | ||
219 | if (m_FriendsService == null || m_PresenceService == null) | ||
220 | { | ||
221 | m_log.WarnFormat("[HGFRIENDS SERVICE]: Unable to perform status notifications because friends or presence services are missing"); | ||
222 | return new List<UUID>(); | ||
223 | } | ||
224 | |||
225 | // Let's unblock the caller right now, and take it from here async | ||
226 | |||
227 | List<UUID> localFriendsOnline = new List<UUID>(); | ||
228 | |||
229 | m_log.DebugFormat("[HGFRIENDS SERVICE]: Status notification: foreign user {0} wants to notify {1} local friends of {2} status", | ||
230 | foreignUserID, friends.Count, (online ? "online" : "offline")); | ||
231 | |||
232 | // First, let's double check that the reported friends are, indeed, friends of that user | ||
233 | // And let's check that the secret matches | ||
234 | List<string> usersToBeNotified = new List<string>(); | ||
235 | foreach (string uui in friends) | ||
236 | { | ||
237 | UUID localUserID; | ||
238 | string secret = string.Empty, tmp = string.Empty; | ||
239 | if (Util.ParseUniversalUserIdentifier(uui, out localUserID, out tmp, out tmp, out tmp, out secret)) | ||
240 | { | ||
241 | FriendInfo[] friendInfos = m_FriendsService.GetFriends(localUserID); | ||
242 | foreach (FriendInfo finfo in friendInfos) | ||
243 | { | ||
244 | if (finfo.Friend.StartsWith(foreignUserID.ToString()) && finfo.Friend.EndsWith(secret)) | ||
245 | { | ||
246 | // great! | ||
247 | usersToBeNotified.Add(localUserID.ToString()); | ||
248 | } | ||
249 | } | ||
250 | } | ||
251 | } | ||
252 | |||
253 | // Now, let's send the notifications | ||
254 | //m_log.DebugFormat("[HGFRIENDS SERVICE]: Status notification: user has {0} local friends", usersToBeNotified.Count); | ||
255 | |||
256 | // First, let's send notifications to local users who are online in the home grid | ||
257 | PresenceInfo[] friendSessions = m_PresenceService.GetAgents(usersToBeNotified.ToArray()); | ||
258 | if (friendSessions != null && friendSessions.Length > 0) | ||
259 | { | ||
260 | PresenceInfo friendSession = null; | ||
261 | foreach (PresenceInfo pinfo in friendSessions) | ||
262 | if (pinfo.RegionID != UUID.Zero) // let's guard against traveling agents | ||
263 | { | ||
264 | friendSession = pinfo; | ||
265 | break; | ||
266 | } | ||
267 | |||
268 | if (friendSession != null) | ||
269 | { | ||
270 | ForwardStatusNotificationToSim(friendSession.RegionID, foreignUserID, friendSession.UserID, online); | ||
271 | usersToBeNotified.Remove(friendSession.UserID.ToString()); | ||
272 | UUID id; | ||
273 | if (UUID.TryParse(friendSession.UserID, out id)) | ||
274 | localFriendsOnline.Add(id); | ||
275 | |||
276 | } | ||
277 | } | ||
278 | |||
279 | // Lastly, let's notify the rest who may be online somewhere else | ||
280 | foreach (string user in usersToBeNotified) | ||
281 | { | ||
282 | UUID id = new UUID(user); | ||
283 | //m_UserAgentService.LocateUser(id); | ||
284 | //etc... | ||
285 | //if (m_TravelingAgents.ContainsKey(id) && m_TravelingAgents[id].GridExternalName != m_GridName) | ||
286 | //{ | ||
287 | // string url = m_TravelingAgents[id].GridExternalName; | ||
288 | // // forward | ||
289 | //} | ||
290 | //m_log.WarnFormat("[HGFRIENDS SERVICE]: User {0} is visiting another grid. HG Status notifications still not implemented.", user); | ||
291 | } | ||
292 | |||
293 | // and finally, let's send the online friends | ||
294 | if (online) | ||
295 | { | ||
296 | return localFriendsOnline; | ||
297 | } | ||
298 | else | ||
299 | return new List<UUID>(); | ||
300 | } | ||
301 | |||
302 | #endregion IHGFriendsService | ||
303 | |||
304 | #region Aux | ||
305 | |||
306 | private void ProcessFriendshipOffered(UUID fromID, String fromName, UUID toID, String message) | ||
307 | { | ||
308 | // Great, it's a genuine request. Let's proceed. | ||
309 | // But now we need to confirm that the requester is who he says he is | ||
310 | // before we act on the friendship request. | ||
311 | |||
312 | if (!fromName.Contains("@")) | ||
313 | return; | ||
314 | |||
315 | string[] parts = fromName.Split(new char[] {'@'}); | ||
316 | if (parts.Length != 2) | ||
317 | return; | ||
318 | |||
319 | string uriStr = "http://" + parts[1]; | ||
320 | try | ||
321 | { | ||
322 | new Uri(uriStr); | ||
323 | } | ||
324 | catch (UriFormatException) | ||
325 | { | ||
326 | return; | ||
327 | } | ||
328 | |||
329 | UserAgentServiceConnector uasConn = new UserAgentServiceConnector(uriStr); | ||
330 | Dictionary<string, object> servers = uasConn.GetServerURLs(fromID); | ||
331 | if (!servers.ContainsKey("FriendsServerURI")) | ||
332 | return; | ||
333 | |||
334 | HGFriendsServicesConnector friendsConn = new HGFriendsServicesConnector(servers["FriendsServerURI"].ToString()); | ||
335 | if (!friendsConn.ValidateFriendshipOffered(fromID, toID)) | ||
336 | { | ||
337 | m_log.WarnFormat("[HGFRIENDS SERVICE]: Friendship request from {0} to {1} is invalid. Impersonations?", fromID, toID); | ||
338 | return; | ||
339 | } | ||
340 | |||
341 | string fromUUI = Util.UniversalIdentifier(fromID, parts[0], "@" + parts[1], uriStr); | ||
342 | // OK, we're good! | ||
343 | ForwardToSim("FriendshipOffered", fromID, fromName, fromUUI, toID, message); | ||
344 | } | ||
345 | |||
346 | private bool ForwardToSim(string op, UUID fromID, string name, String fromUUI, UUID toID, string message) | ||
347 | { | ||
348 | PresenceInfo session = null; | ||
349 | GridRegion region = null; | ||
350 | PresenceInfo[] sessions = m_PresenceService.GetAgents(new string[] { toID.ToString() }); | ||
351 | if (sessions != null && sessions.Length > 0) | ||
352 | session = sessions[0]; | ||
353 | if (session != null) | ||
354 | region = m_GridService.GetRegionByUUID(UUID.Zero, session.RegionID); | ||
355 | |||
356 | switch (op) | ||
357 | { | ||
358 | case "FriendshipOffered": | ||
359 | // Let's store backwards | ||
360 | string secret = UUID.Random().ToString().Substring(0, 8); | ||
361 | m_FriendsService.StoreFriend(toID.ToString(), fromUUI + ";" + secret, 0); | ||
362 | if (m_FriendsLocalSimConnector != null) // standalone | ||
363 | { | ||
364 | GridInstantMessage im = new GridInstantMessage(null, fromID, name, toID, | ||
365 | (byte)InstantMessageDialog.FriendshipOffered, message, false, Vector3.Zero); | ||
366 | // !! HACK | ||
367 | im.imSessionID = im.fromAgentID; | ||
368 | return m_FriendsLocalSimConnector.LocalFriendshipOffered(toID, im); | ||
369 | } | ||
370 | else if (region != null) // grid | ||
371 | return m_FriendsSimConnector.FriendshipOffered(region, fromID, toID, message, name); | ||
372 | break; | ||
373 | case "ApproveFriendshipRequest": | ||
374 | if (m_FriendsLocalSimConnector != null) // standalone | ||
375 | return m_FriendsLocalSimConnector.LocalFriendshipApproved(fromID, name, toID); | ||
376 | else if (region != null) //grid | ||
377 | return m_FriendsSimConnector.FriendshipApproved(region, fromID, name, toID); | ||
378 | break; | ||
379 | } | ||
380 | |||
381 | return false; | ||
382 | } | ||
383 | |||
384 | protected void ForwardStatusNotificationToSim(UUID regionID, UUID foreignUserID, string user, bool online) | ||
385 | { | ||
386 | UUID userID; | ||
387 | if (UUID.TryParse(user, out userID)) | ||
388 | { | ||
389 | if (m_FriendsLocalSimConnector != null) | ||
390 | { | ||
391 | m_log.DebugFormat("[HGFRIENDS SERVICE]: Local Notify, user {0} is {1}", foreignUserID, (online ? "online" : "offline")); | ||
392 | m_FriendsLocalSimConnector.StatusNotify(foreignUserID, userID, online); | ||
393 | } | ||
394 | else | ||
395 | { | ||
396 | GridRegion region = m_GridService.GetRegionByUUID(UUID.Zero /* !!! */, regionID); | ||
397 | if (region != null) | ||
398 | { | ||
399 | m_log.DebugFormat("[HGFRIENDS SERVICE]: Remote Notify to region {0}, user {1} is {2}", region.RegionName, foreignUserID, (online ? "online" : "offline")); | ||
400 | m_FriendsSimConnector.StatusNotify(region, foreignUserID, userID, online); | ||
401 | } | ||
402 | } | ||
403 | } | ||
404 | } | ||
405 | |||
406 | #endregion Aux | ||
407 | } | ||
408 | } | ||
diff --git a/OpenSim/Services/HypergridService/HGInventoryService.cs b/OpenSim/Services/HypergridService/HGInventoryService.cs index 41d5a7a..a1287fd 100644 --- a/OpenSim/Services/HypergridService/HGInventoryService.cs +++ b/OpenSim/Services/HypergridService/HGInventoryService.cs | |||
@@ -60,36 +60,19 @@ namespace OpenSim.Services.HypergridService | |||
60 | 60 | ||
61 | private UserAccountCache m_Cache; | 61 | private UserAccountCache m_Cache; |
62 | 62 | ||
63 | public HGInventoryService(IConfigSource config) | 63 | public HGInventoryService(IConfigSource config, string configName) |
64 | : base(config) | 64 | : base(config, configName) |
65 | { | 65 | { |
66 | m_log.Debug("[HGInventory Service]: Starting"); | 66 | m_log.Debug("[HGInventory Service]: Starting"); |
67 | 67 | if (configName != string.Empty) | |
68 | string dllName = String.Empty; | 68 | m_ConfigName = configName; |
69 | string connString = String.Empty; | ||
70 | //string realm = "Inventory"; // OSG version doesn't use this | ||
71 | |||
72 | // | ||
73 | // Try reading the [DatabaseService] section, if it exists | ||
74 | // | ||
75 | IConfig dbConfig = config.Configs["DatabaseService"]; | ||
76 | if (dbConfig != null) | ||
77 | { | ||
78 | if (dllName == String.Empty) | ||
79 | dllName = dbConfig.GetString("StorageProvider", String.Empty); | ||
80 | if (connString == String.Empty) | ||
81 | connString = dbConfig.GetString("ConnectionString", String.Empty); | ||
82 | } | ||
83 | 69 | ||
84 | // | 70 | // |
85 | // Try reading the [InventoryService] section, if it exists | 71 | // Try reading the [InventoryService] section, if it exists |
86 | // | 72 | // |
87 | IConfig invConfig = config.Configs["HGInventoryService"]; | 73 | IConfig invConfig = config.Configs[m_ConfigName]; |
88 | if (invConfig != null) | 74 | if (invConfig != null) |
89 | { | 75 | { |
90 | dllName = invConfig.GetString("StorageProvider", dllName); | ||
91 | connString = invConfig.GetString("ConnectionString", connString); | ||
92 | |||
93 | // realm = authConfig.GetString("Realm", realm); | 76 | // realm = authConfig.GetString("Realm", realm); |
94 | string userAccountsDll = invConfig.GetString("UserAccountsService", string.Empty); | 77 | string userAccountsDll = invConfig.GetString("UserAccountsService", string.Empty); |
95 | if (userAccountsDll == string.Empty) | 78 | if (userAccountsDll == string.Empty) |
@@ -108,17 +91,6 @@ namespace OpenSim.Services.HypergridService | |||
108 | m_Cache = UserAccountCache.CreateUserAccountCache(m_UserAccountService); | 91 | m_Cache = UserAccountCache.CreateUserAccountCache(m_UserAccountService); |
109 | } | 92 | } |
110 | 93 | ||
111 | // | ||
112 | // We tried, but this doesn't exist. We can't proceed. | ||
113 | // | ||
114 | if (dllName == String.Empty) | ||
115 | throw new Exception("No StorageProvider configured"); | ||
116 | |||
117 | m_Database = LoadPlugin<IXInventoryData>(dllName, | ||
118 | new Object[] {connString, String.Empty}); | ||
119 | if (m_Database == null) | ||
120 | throw new Exception("Could not find a storage interface in the given module"); | ||
121 | |||
122 | m_log.Debug("[HG INVENTORY SERVICE]: Starting..."); | 94 | m_log.Debug("[HG INVENTORY SERVICE]: Starting..."); |
123 | } | 95 | } |
124 | 96 | ||
diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs index f681df4..6a5007f 100644 --- a/OpenSim/Services/HypergridService/UserAgentService.cs +++ b/OpenSim/Services/HypergridService/UserAgentService.cs | |||
@@ -334,6 +334,7 @@ namespace OpenSim.Services.HypergridService | |||
334 | return false; | 334 | return false; |
335 | } | 335 | } |
336 | 336 | ||
337 | [Obsolete] | ||
337 | public List<UUID> StatusNotification(List<string> friends, UUID foreignUserID, bool online) | 338 | public List<UUID> StatusNotification(List<string> friends, UUID foreignUserID, bool online) |
338 | { | 339 | { |
339 | if (m_FriendsService == null || m_PresenceService == null) | 340 | if (m_FriendsService == null || m_PresenceService == null) |
@@ -414,6 +415,7 @@ namespace OpenSim.Services.HypergridService | |||
414 | return new List<UUID>(); | 415 | return new List<UUID>(); |
415 | } | 416 | } |
416 | 417 | ||
418 | [Obsolete] | ||
417 | protected void ForwardStatusNotificationToSim(UUID regionID, UUID foreignUserID, string user, bool online) | 419 | protected void ForwardStatusNotificationToSim(UUID regionID, UUID foreignUserID, string user, bool online) |
418 | { | 420 | { |
419 | UUID userID; | 421 | UUID userID; |
@@ -566,6 +568,16 @@ namespace OpenSim.Services.HypergridService | |||
566 | 568 | ||
567 | return string.Empty; | 569 | return string.Empty; |
568 | } | 570 | } |
571 | |||
572 | public UUID GetUUID(String first, String last) | ||
573 | { | ||
574 | // Let's see if it's a local user | ||
575 | UserAccount account = m_UserAccountService.GetUserAccount(UUID.Zero, first, last); | ||
576 | if (account != null) | ||
577 | return account.PrincipalID; | ||
578 | else | ||
579 | return UUID.Zero; | ||
580 | } | ||
569 | } | 581 | } |
570 | 582 | ||
571 | class TravelingAgentInfo | 583 | class TravelingAgentInfo |
diff --git a/OpenSim/Services/Interfaces/IHypergridServices.cs b/OpenSim/Services/Interfaces/IHypergridServices.cs index 5b293ac..3dc877a 100644 --- a/OpenSim/Services/Interfaces/IHypergridServices.cs +++ b/OpenSim/Services/Interfaces/IHypergridServices.cs | |||
@@ -62,9 +62,11 @@ namespace OpenSim.Services.Interfaces | |||
62 | // on behalf of the userID | 62 | // on behalf of the userID |
63 | string GetUUI(UUID userID, UUID targetUserID); | 63 | string GetUUI(UUID userID, UUID targetUserID); |
64 | 64 | ||
65 | UUID GetUUID(String first, String last); | ||
66 | |||
65 | // Returns the local friends online | 67 | // Returns the local friends online |
68 | [Obsolete] | ||
66 | List<UUID> StatusNotification(List<string> friends, UUID userID, bool online); | 69 | List<UUID> StatusNotification(List<string> friends, UUID userID, bool online); |
67 | //List<UUID> GetOnlineFriends(UUID userID, List<string> friends); | ||
68 | 70 | ||
69 | bool IsAgentComingHome(UUID sessionID, string thisGridExternalName); | 71 | bool IsAgentComingHome(UUID sessionID, string thisGridExternalName); |
70 | bool VerifyAgent(UUID sessionID, string token); | 72 | bool VerifyAgent(UUID sessionID, string token); |
@@ -79,6 +81,19 @@ namespace OpenSim.Services.Interfaces | |||
79 | public interface IFriendsSimConnector | 81 | public interface IFriendsSimConnector |
80 | { | 82 | { |
81 | bool StatusNotify(UUID userID, UUID friendID, bool online); | 83 | bool StatusNotify(UUID userID, UUID friendID, bool online); |
84 | bool LocalFriendshipOffered(UUID toID, GridInstantMessage im); | ||
85 | bool LocalFriendshipApproved(UUID userID, string userName, UUID friendID); | ||
86 | } | ||
87 | |||
88 | public interface IHGFriendsService | ||
89 | { | ||
90 | int GetFriendPerms(UUID userID, UUID friendID); | ||
91 | bool NewFriendship(FriendInfo finfo, bool verified); | ||
92 | bool DeleteFriendship(FriendInfo finfo, string secret); | ||
93 | bool FriendshipOffered(UUID from, string fromName, UUID to, string message); | ||
94 | bool ValidateFriendshipOffered(UUID fromID, UUID toID); | ||
95 | // Returns the local friends online | ||
96 | List<UUID> StatusNotification(List<string> friends, UUID userID, bool online); | ||
82 | } | 97 | } |
83 | 98 | ||
84 | public interface IInstantMessageSimConnector | 99 | public interface IInstantMessageSimConnector |
diff --git a/OpenSim/Services/InventoryService/XInventoryService.cs b/OpenSim/Services/InventoryService/XInventoryService.cs index 1648b51..8c57d17 100644 --- a/OpenSim/Services/InventoryService/XInventoryService.cs +++ b/OpenSim/Services/InventoryService/XInventoryService.cs | |||
@@ -46,9 +46,17 @@ namespace OpenSim.Services.InventoryService | |||
46 | 46 | ||
47 | protected IXInventoryData m_Database; | 47 | protected IXInventoryData m_Database; |
48 | protected bool m_AllowDelete = true; | 48 | protected bool m_AllowDelete = true; |
49 | protected string m_ConfigName = "InventoryService"; | ||
49 | 50 | ||
50 | public XInventoryService(IConfigSource config) : base(config) | 51 | public XInventoryService(IConfigSource config) |
52 | : this(config, "InventoryService") | ||
51 | { | 53 | { |
54 | } | ||
55 | public XInventoryService(IConfigSource config, string configName) : base(config) | ||
56 | { | ||
57 | if (configName != string.Empty) | ||
58 | m_ConfigName = configName; | ||
59 | |||
52 | string dllName = String.Empty; | 60 | string dllName = String.Empty; |
53 | string connString = String.Empty; | 61 | string connString = String.Empty; |
54 | //string realm = "Inventory"; // OSG version doesn't use this | 62 | //string realm = "Inventory"; // OSG version doesn't use this |
@@ -56,7 +64,7 @@ namespace OpenSim.Services.InventoryService | |||
56 | // | 64 | // |
57 | // Try reading the [InventoryService] section first, if it exists | 65 | // Try reading the [InventoryService] section first, if it exists |
58 | // | 66 | // |
59 | IConfig authConfig = config.Configs["InventoryService"]; | 67 | IConfig authConfig = config.Configs[m_ConfigName]; |
60 | if (authConfig != null) | 68 | if (authConfig != null) |
61 | { | 69 | { |
62 | dllName = authConfig.GetString("StorageProvider", dllName); | 70 | dllName = authConfig.GetString("StorageProvider", dllName); |
diff --git a/OpenSim/Services/LLLoginService/LLLoginResponse.cs b/OpenSim/Services/LLLoginService/LLLoginResponse.cs index 1a874c8..844c5ae 100644 --- a/OpenSim/Services/LLLoginService/LLLoginResponse.cs +++ b/OpenSim/Services/LLLoginService/LLLoginResponse.cs | |||
@@ -168,6 +168,12 @@ namespace OpenSim.Services.LLLoginService | |||
168 | // Web map | 168 | // Web map |
169 | private string mapTileURL; | 169 | private string mapTileURL; |
170 | 170 | ||
171 | // Web Profiles | ||
172 | private string profileURL; | ||
173 | |||
174 | // OpenID | ||
175 | private string openIDURL; | ||
176 | |||
171 | private string searchURL; | 177 | private string searchURL; |
172 | 178 | ||
173 | // Error Flags | 179 | // Error Flags |
@@ -220,7 +226,7 @@ namespace OpenSim.Services.LLLoginService | |||
220 | public LLLoginResponse(UserAccount account, AgentCircuitData aCircuit, GridUserInfo pinfo, | 226 | public LLLoginResponse(UserAccount account, AgentCircuitData aCircuit, GridUserInfo pinfo, |
221 | GridRegion destination, List<InventoryFolderBase> invSkel, FriendInfo[] friendsList, ILibraryService libService, | 227 | GridRegion destination, List<InventoryFolderBase> invSkel, FriendInfo[] friendsList, ILibraryService libService, |
222 | string where, string startlocation, Vector3 position, Vector3 lookAt, List<InventoryItemBase> gestures, string message, | 228 | string where, string startlocation, Vector3 position, Vector3 lookAt, List<InventoryItemBase> gestures, string message, |
223 | GridRegion home, IPEndPoint clientIP, string mapTileURL, string searchURL, string currency) | 229 | GridRegion home, IPEndPoint clientIP, string mapTileURL, string profileURL, string openIDURL, string searchURL, string currency) |
224 | : this() | 230 | : this() |
225 | { | 231 | { |
226 | FillOutInventoryData(invSkel, libService); | 232 | FillOutInventoryData(invSkel, libService); |
@@ -237,6 +243,9 @@ namespace OpenSim.Services.LLLoginService | |||
237 | BuddList = ConvertFriendListItem(friendsList); | 243 | BuddList = ConvertFriendListItem(friendsList); |
238 | StartLocation = where; | 244 | StartLocation = where; |
239 | MapTileURL = mapTileURL; | 245 | MapTileURL = mapTileURL; |
246 | ProfileURL = profileURL; | ||
247 | OpenIDURL = openIDURL; | ||
248 | |||
240 | SearchURL = searchURL; | 249 | SearchURL = searchURL; |
241 | Currency = currency; | 250 | Currency = currency; |
242 | 251 | ||
@@ -384,6 +393,8 @@ namespace OpenSim.Services.LLLoginService | |||
384 | InitialOutfitHash["gender"] = "female"; | 393 | InitialOutfitHash["gender"] = "female"; |
385 | initialOutfit.Add(InitialOutfitHash); | 394 | initialOutfit.Add(InitialOutfitHash); |
386 | mapTileURL = String.Empty; | 395 | mapTileURL = String.Empty; |
396 | profileURL = String.Empty; | ||
397 | openIDURL = String.Empty; | ||
387 | searchURL = String.Empty; | 398 | searchURL = String.Empty; |
388 | 399 | ||
389 | currency = String.Empty; | 400 | currency = String.Empty; |
@@ -456,6 +467,13 @@ namespace OpenSim.Services.LLLoginService | |||
456 | if (mapTileURL != String.Empty) | 467 | if (mapTileURL != String.Empty) |
457 | responseData["map-server-url"] = mapTileURL; | 468 | responseData["map-server-url"] = mapTileURL; |
458 | 469 | ||
470 | if (profileURL != String.Empty) | ||
471 | responseData["profile-server-url"] = profileURL; | ||
472 | |||
473 | // We need to send an openid_token back in the response too | ||
474 | if (openIDURL != String.Empty) | ||
475 | responseData["openid_url"] = openIDURL; | ||
476 | |||
459 | if (m_buddyList != null) | 477 | if (m_buddyList != null) |
460 | { | 478 | { |
461 | responseData["buddy-list"] = m_buddyList.ToArray(); | 479 | responseData["buddy-list"] = m_buddyList.ToArray(); |
@@ -561,6 +579,12 @@ namespace OpenSim.Services.LLLoginService | |||
561 | if (mapTileURL != String.Empty) | 579 | if (mapTileURL != String.Empty) |
562 | map["map-server-url"] = OSD.FromString(mapTileURL); | 580 | map["map-server-url"] = OSD.FromString(mapTileURL); |
563 | 581 | ||
582 | if (profileURL != String.Empty) | ||
583 | map["profile-server-url"] = OSD.FromString(profileURL); | ||
584 | |||
585 | if (openIDURL != String.Empty) | ||
586 | map["openid_url"] = OSD.FromString(openIDURL); | ||
587 | |||
564 | if (searchURL != String.Empty) | 588 | if (searchURL != String.Empty) |
565 | map["search"] = OSD.FromString(searchURL); | 589 | map["search"] = OSD.FromString(searchURL); |
566 | 590 | ||
@@ -933,6 +957,18 @@ namespace OpenSim.Services.LLLoginService | |||
933 | set { mapTileURL = value; } | 957 | set { mapTileURL = value; } |
934 | } | 958 | } |
935 | 959 | ||
960 | public string ProfileURL | ||
961 | { | ||
962 | get { return profileURL; } | ||
963 | set { profileURL = value; } | ||
964 | } | ||
965 | |||
966 | public string OpenIDURL | ||
967 | { | ||
968 | get { return openIDURL; } | ||
969 | set { openIDURL = value; } | ||
970 | } | ||
971 | |||
936 | public string SearchURL | 972 | public string SearchURL |
937 | { | 973 | { |
938 | get { return searchURL; } | 974 | get { return searchURL; } |
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index 5dff512..db8a9cb 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs | |||
@@ -74,6 +74,8 @@ namespace OpenSim.Services.LLLoginService | |||
74 | protected string m_GatekeeperURL; | 74 | protected string m_GatekeeperURL; |
75 | protected bool m_AllowRemoteSetLoginLevel; | 75 | protected bool m_AllowRemoteSetLoginLevel; |
76 | protected string m_MapTileURL; | 76 | protected string m_MapTileURL; |
77 | protected string m_ProfileURL; | ||
78 | protected string m_OpenIDURL; | ||
77 | protected string m_SearchURL; | 79 | protected string m_SearchURL; |
78 | protected string m_Currency; | 80 | protected string m_Currency; |
79 | 81 | ||
@@ -108,6 +110,8 @@ namespace OpenSim.Services.LLLoginService | |||
108 | m_MinLoginLevel = m_LoginServerConfig.GetInt("MinLoginLevel", 0); | 110 | m_MinLoginLevel = m_LoginServerConfig.GetInt("MinLoginLevel", 0); |
109 | m_GatekeeperURL = m_LoginServerConfig.GetString("GatekeeperURI", string.Empty); | 111 | m_GatekeeperURL = m_LoginServerConfig.GetString("GatekeeperURI", string.Empty); |
110 | m_MapTileURL = m_LoginServerConfig.GetString("MapTileURL", string.Empty); | 112 | m_MapTileURL = m_LoginServerConfig.GetString("MapTileURL", string.Empty); |
113 | m_ProfileURL = m_LoginServerConfig.GetString("ProfileServerURL", string.Empty); | ||
114 | m_OpenIDURL = m_LoginServerConfig.GetString("OpenIDServerURL", String.Empty); | ||
111 | m_SearchURL = m_LoginServerConfig.GetString("SearchURL", string.Empty); | 115 | m_SearchURL = m_LoginServerConfig.GetString("SearchURL", string.Empty); |
112 | m_Currency = m_LoginServerConfig.GetString("Currency", string.Empty); | 116 | m_Currency = m_LoginServerConfig.GetString("Currency", string.Empty); |
113 | 117 | ||
@@ -413,7 +417,7 @@ namespace OpenSim.Services.LLLoginService | |||
413 | // Finally, fill out the response and return it | 417 | // Finally, fill out the response and return it |
414 | // | 418 | // |
415 | LLLoginResponse response = new LLLoginResponse(account, aCircuit, guinfo, destination, inventorySkel, friendsList, m_LibraryService, | 419 | LLLoginResponse response = new LLLoginResponse(account, aCircuit, guinfo, destination, inventorySkel, friendsList, m_LibraryService, |
416 | where, startLocation, position, lookAt, gestures, m_WelcomeMessage, home, clientIP, m_MapTileURL, m_SearchURL, m_Currency); | 420 | where, startLocation, position, lookAt, gestures, m_WelcomeMessage, home, clientIP, m_MapTileURL, m_ProfileURL, m_OpenIDURL, m_SearchURL, m_Currency); |
417 | 421 | ||
418 | m_log.DebugFormat("[LLOGIN SERVICE]: All clear. Sending login response to client."); | 422 | m_log.DebugFormat("[LLOGIN SERVICE]: All clear. Sending login response to client."); |
419 | return response; | 423 | return response; |
@@ -889,16 +893,16 @@ namespace OpenSim.Services.LLLoginService | |||
889 | private void RegisterCommands() | 893 | private void RegisterCommands() |
890 | { | 894 | { |
891 | //MainConsole.Instance.Commands.AddCommand | 895 | //MainConsole.Instance.Commands.AddCommand |
892 | MainConsole.Instance.Commands.AddCommand("loginservice", false, "login level", | 896 | MainConsole.Instance.Commands.AddCommand("Users", false, "login level", |
893 | "login level <level>", | 897 | "login level <level>", |
894 | "Set the minimum user level to log in", HandleLoginCommand); | 898 | "Set the minimum user level to log in", HandleLoginCommand); |
895 | 899 | ||
896 | MainConsole.Instance.Commands.AddCommand("loginservice", false, "login reset", | 900 | MainConsole.Instance.Commands.AddCommand("Users", false, "login reset", |
897 | "login reset", | 901 | "login reset", |
898 | "Reset the login level to allow all users", | 902 | "Reset the login level to allow all users", |
899 | HandleLoginCommand); | 903 | HandleLoginCommand); |
900 | 904 | ||
901 | MainConsole.Instance.Commands.AddCommand("loginservice", false, "login text", | 905 | MainConsole.Instance.Commands.AddCommand("Users", false, "login text", |
902 | "login text <text>", | 906 | "login text <text>", |
903 | "Set the text users will see on login", HandleLoginCommand); | 907 | "Set the text users will see on login", HandleLoginCommand); |
904 | 908 | ||
diff --git a/OpenSim/Services/UserAccountService/UserAccountService.cs b/OpenSim/Services/UserAccountService/UserAccountService.cs index 4a29690..a281b3b 100644 --- a/OpenSim/Services/UserAccountService/UserAccountService.cs +++ b/OpenSim/Services/UserAccountService/UserAccountService.cs | |||
@@ -89,17 +89,17 @@ namespace OpenSim.Services.UserAccountService | |||
89 | if (m_RootInstance == null && MainConsole.Instance != null) | 89 | if (m_RootInstance == null && MainConsole.Instance != null) |
90 | { | 90 | { |
91 | m_RootInstance = this; | 91 | m_RootInstance = this; |
92 | MainConsole.Instance.Commands.AddCommand("UserService", false, | 92 | MainConsole.Instance.Commands.AddCommand("Users", false, |
93 | "create user", | 93 | "create user", |
94 | "create user [<first> [<last> [<pass> [<email> [<user id>]]]]]", | 94 | "create user [<first> [<last> [<pass> [<email> [<user id>]]]]]", |
95 | "Create a new user", HandleCreateUser); | 95 | "Create a new user", HandleCreateUser); |
96 | 96 | ||
97 | MainConsole.Instance.Commands.AddCommand("UserService", false, | 97 | MainConsole.Instance.Commands.AddCommand("Users", false, |
98 | "reset user password", | 98 | "reset user password", |
99 | "reset user password [<first> [<last> [<password>]]]", | 99 | "reset user password [<first> [<last> [<password>]]]", |
100 | "Reset a user password", HandleResetUserPassword); | 100 | "Reset a user password", HandleResetUserPassword); |
101 | 101 | ||
102 | MainConsole.Instance.Commands.AddCommand("UserService", false, | 102 | MainConsole.Instance.Commands.AddCommand("Users", false, |
103 | "set user level", | 103 | "set user level", |
104 | "set user level [<first> [<last> [<level>]]]", | 104 | "set user level [<first> [<last> [<level>]]]", |
105 | "Set user level. If >= 200 and 'allow_grid_gods = true' in OpenSim.ini, " | 105 | "Set user level. If >= 200 and 'allow_grid_gods = true' in OpenSim.ini, " |
@@ -107,7 +107,7 @@ namespace OpenSim.Services.UserAccountService | |||
107 | + "It will also affect the 'login level' command. ", | 107 | + "It will also affect the 'login level' command. ", |
108 | HandleSetUserLevel); | 108 | HandleSetUserLevel); |
109 | 109 | ||
110 | MainConsole.Instance.Commands.AddCommand("UserService", false, | 110 | MainConsole.Instance.Commands.AddCommand("Users", false, |
111 | "show account", | 111 | "show account", |
112 | "show account <first> <last>", | 112 | "show account <first> <last>", |
113 | "Show account details for the given user", HandleShowAccount); | 113 | "Show account details for the given user", HandleShowAccount); |
@@ -521,7 +521,7 @@ namespace OpenSim.Services.UserAccountService | |||
521 | else | 521 | else |
522 | { | 522 | { |
523 | m_log.DebugFormat( | 523 | m_log.DebugFormat( |
524 | "[USER ACCOUNT SERVICE]; Created user inventory for {0} {1}", firstName, lastName); | 524 | "[USER ACCOUNT SERVICE]: Created user inventory for {0} {1}", firstName, lastName); |
525 | } | 525 | } |
526 | 526 | ||
527 | if (m_CreateDefaultAvatarEntries) | 527 | if (m_CreateDefaultAvatarEntries) |