diff options
Diffstat (limited to 'OpenSim/Services')
86 files changed, 4578 insertions, 1154 deletions
diff --git a/OpenSim/Services/AssetService/AssetService.cs b/OpenSim/Services/AssetService/AssetService.cs index 90c30c8..c57db48 100644 --- a/OpenSim/Services/AssetService/AssetService.cs +++ b/OpenSim/Services/AssetService/AssetService.cs | |||
@@ -153,9 +153,24 @@ namespace OpenSim.Services.AssetService | |||
153 | return true; | 153 | return true; |
154 | } | 154 | } |
155 | 155 | ||
156 | public virtual bool[] AssetsExist(string[] ids) | ||
157 | { | ||
158 | try | ||
159 | { | ||
160 | UUID[] uuid = Array.ConvertAll(ids, id => UUID.Parse(id)); | ||
161 | return m_Database.AssetsExist(uuid); | ||
162 | } | ||
163 | catch (Exception e) | ||
164 | { | ||
165 | m_log.Error("[ASSET SERVICE]: Exception getting assets ", e); | ||
166 | return new bool[ids.Length]; | ||
167 | } | ||
168 | } | ||
169 | |||
156 | public virtual string Store(AssetBase asset) | 170 | public virtual string Store(AssetBase asset) |
157 | { | 171 | { |
158 | if (!m_Database.ExistsAsset(asset.FullID)) | 172 | bool exists = m_Database.AssetsExist(new[] { asset.FullID })[0]; |
173 | if (!exists) | ||
159 | { | 174 | { |
160 | // m_log.DebugFormat( | 175 | // m_log.DebugFormat( |
161 | // "[ASSET SERVICE]: Storing asset {0} {1}, bytes {2}", asset.Name, asset.FullID, asset.Data.Length); | 176 | // "[ASSET SERVICE]: Storing asset {0} {1}, bytes {2}", asset.Name, asset.FullID, asset.Data.Length); |
@@ -189,4 +204,4 @@ namespace OpenSim.Services.AssetService | |||
189 | return m_Database.Delete(id); | 204 | return m_Database.Delete(id); |
190 | } | 205 | } |
191 | } | 206 | } |
192 | } \ No newline at end of file | 207 | } |
diff --git a/OpenSim/Services/AssetService/Properties/AssemblyInfo.cs b/OpenSim/Services/AssetService/Properties/AssemblyInfo.cs index 72c2ac4..9717319 100644 --- a/OpenSim/Services/AssetService/Properties/AssemblyInfo.cs +++ b/OpenSim/Services/AssetService/Properties/AssemblyInfo.cs | |||
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices; | |||
29 | // Build Number | 29 | // Build Number |
30 | // Revision | 30 | // Revision |
31 | // | 31 | // |
32 | [assembly: AssemblyVersion("0.8.0.*")] | 32 | [assembly: AssemblyVersion("0.8.2.*")] |
33 | 33 | ||
diff --git a/OpenSim/Services/AssetService/XAssetService.cs b/OpenSim/Services/AssetService/XAssetService.cs index 6047616..f58b769 100644 --- a/OpenSim/Services/AssetService/XAssetService.cs +++ b/OpenSim/Services/AssetService/XAssetService.cs | |||
@@ -175,9 +175,16 @@ namespace OpenSim.Services.AssetService | |||
175 | return true; | 175 | return true; |
176 | } | 176 | } |
177 | 177 | ||
178 | public virtual bool[] AssetsExist(string[] ids) | ||
179 | { | ||
180 | UUID[] uuid = Array.ConvertAll(ids, id => UUID.Parse(id)); | ||
181 | return m_Database.AssetsExist(uuid); | ||
182 | } | ||
183 | |||
178 | public virtual string Store(AssetBase asset) | 184 | public virtual string Store(AssetBase asset) |
179 | { | 185 | { |
180 | if (!m_Database.ExistsAsset(asset.FullID)) | 186 | bool exists = m_Database.AssetsExist(new[] { asset.FullID })[0]; |
187 | if (!exists) | ||
181 | { | 188 | { |
182 | // m_log.DebugFormat( | 189 | // m_log.DebugFormat( |
183 | // "[XASSET SERVICE]: Storing asset {0} {1}, bytes {2}", asset.Name, asset.FullID, asset.Data.Length); | 190 | // "[XASSET SERVICE]: Storing asset {0} {1}, bytes {2}", asset.Name, asset.FullID, asset.Data.Length); |
@@ -217,4 +224,4 @@ namespace OpenSim.Services.AssetService | |||
217 | m_ChainedAssetService.Delete(asset.ID); | 224 | m_ChainedAssetService.Delete(asset.ID); |
218 | } | 225 | } |
219 | } | 226 | } |
220 | } \ No newline at end of file | 227 | } |
diff --git a/OpenSim/Services/AuthenticationService/Properties/AssemblyInfo.cs b/OpenSim/Services/AuthenticationService/Properties/AssemblyInfo.cs index 8ffeeca..8c63adc 100644 --- a/OpenSim/Services/AuthenticationService/Properties/AssemblyInfo.cs +++ b/OpenSim/Services/AuthenticationService/Properties/AssemblyInfo.cs | |||
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices; | |||
29 | // Build Number | 29 | // Build Number |
30 | // Revision | 30 | // Revision |
31 | // | 31 | // |
32 | [assembly: AssemblyVersion("0.8.0.*")] | 32 | [assembly: AssemblyVersion("0.8.2.*")] |
33 | 33 | ||
diff --git a/OpenSim/Services/AuthorizationService/Properties/AssemblyInfo.cs b/OpenSim/Services/AuthorizationService/Properties/AssemblyInfo.cs index e51d2ca..ce91b56 100644 --- a/OpenSim/Services/AuthorizationService/Properties/AssemblyInfo.cs +++ b/OpenSim/Services/AuthorizationService/Properties/AssemblyInfo.cs | |||
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices; | |||
29 | // Build Number | 29 | // Build Number |
30 | // Revision | 30 | // Revision |
31 | // | 31 | // |
32 | [assembly: AssemblyVersion("0.8.0.*")] | 32 | [assembly: AssemblyVersion("0.8.2.*")] |
33 | 33 | ||
diff --git a/OpenSim/Services/AvatarService/Properties/AssemblyInfo.cs b/OpenSim/Services/AvatarService/Properties/AssemblyInfo.cs index 3800e62..1778863 100644 --- a/OpenSim/Services/AvatarService/Properties/AssemblyInfo.cs +++ b/OpenSim/Services/AvatarService/Properties/AssemblyInfo.cs | |||
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices; | |||
29 | // Build Number | 29 | // Build Number |
30 | // Revision | 30 | // Revision |
31 | // | 31 | // |
32 | [assembly: AssemblyVersion("0.8.0.*")] | 32 | [assembly: AssemblyVersion("0.8.2.*")] |
33 | 33 | ||
diff --git a/OpenSim/Services/Base/Properties/AssemblyInfo.cs b/OpenSim/Services/Base/Properties/AssemblyInfo.cs index 959670c..a3fb11b 100644 --- a/OpenSim/Services/Base/Properties/AssemblyInfo.cs +++ b/OpenSim/Services/Base/Properties/AssemblyInfo.cs | |||
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices; | |||
29 | // Build Number | 29 | // Build Number |
30 | // Revision | 30 | // Revision |
31 | // | 31 | // |
32 | [assembly: AssemblyVersion("0.8.0.*")] | 32 | [assembly: AssemblyVersion("0.8.2.*")] |
33 | 33 | ||
diff --git a/OpenSim/Services/Base/ServiceBase.cs b/OpenSim/Services/Base/ServiceBase.cs index 22f27e0..09dcbef 100644 --- a/OpenSim/Services/Base/ServiceBase.cs +++ b/OpenSim/Services/Base/ServiceBase.cs | |||
@@ -28,6 +28,7 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.IO; | 29 | using System.IO; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.IO; | ||
31 | using System.Reflection; | 32 | using System.Reflection; |
32 | using log4net; | 33 | using log4net; |
33 | using Nini.Config; | 34 | using Nini.Config; |
@@ -46,9 +47,19 @@ namespace OpenSim.Services.Base | |||
46 | 47 | ||
47 | public T LoadPlugin<T>(string dllName, Object[] args) where T:class | 48 | public T LoadPlugin<T>(string dllName, Object[] args) where T:class |
48 | { | 49 | { |
50 | <<<<<<< HEAD | ||
51 | // The path:type separator : is unfortunate because it collides | ||
52 | // with Windows paths like C:\... | ||
53 | // When the path provided includes the drive, this fails. | ||
54 | // Hence the root/noroot thing going on here. | ||
55 | string pathRoot = Path.GetPathRoot(dllName); | ||
56 | string noRoot = dllName.Substring(pathRoot.Length); | ||
57 | string[] parts = noRoot.Split(new char[] {':'}); | ||
58 | ======= | ||
49 | string pathRoot = Path.GetPathRoot(dllName); | 59 | string pathRoot = Path.GetPathRoot(dllName); |
50 | string noRoot = dllName.Substring(pathRoot.Length); | 60 | string noRoot = dllName.Substring(pathRoot.Length); |
51 | string[] parts = noRoot.Split(new char[] { ':' }); | 61 | string[] parts = noRoot.Split(new char[] { ':' }); |
62 | >>>>>>> avn/ubitvar | ||
52 | 63 | ||
53 | dllName = pathRoot + parts[0]; | 64 | dllName = pathRoot + parts[0]; |
54 | 65 | ||
@@ -82,7 +93,7 @@ namespace OpenSim.Services.Base | |||
82 | continue; | 93 | continue; |
83 | 94 | ||
84 | Type typeInterface = | 95 | Type typeInterface = |
85 | pluginType.GetInterface(interfaceName, true); | 96 | pluginType.GetInterface(interfaceName); |
86 | if (typeInterface != null) | 97 | if (typeInterface != null) |
87 | { | 98 | { |
88 | T plug = (T)Activator.CreateInstance(pluginType, | 99 | T plug = (T)Activator.CreateInstance(pluginType, |
diff --git a/OpenSim/Services/Connectors/AgentPreferences/AgentPreferencesConnector.cs b/OpenSim/Services/Connectors/AgentPreferences/AgentPreferencesConnector.cs new file mode 100644 index 0000000..1dbc0c8 --- /dev/null +++ b/OpenSim/Services/Connectors/AgentPreferences/AgentPreferencesConnector.cs | |||
@@ -0,0 +1,230 @@ | |||
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 log4net; | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.IO; | ||
32 | using System.Reflection; | ||
33 | using Nini.Config; | ||
34 | using OpenSim.Framework; | ||
35 | using OpenSim.Framework.ServiceAuth; | ||
36 | using OpenSim.Services.Interfaces; | ||
37 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | ||
38 | using IAvatarService = OpenSim.Services.Interfaces.IAvatarService; | ||
39 | using OpenSim.Server.Base; | ||
40 | using OpenMetaverse; | ||
41 | |||
42 | namespace OpenSim.Services.Connectors | ||
43 | { | ||
44 | public class AgentPreferencesServicesConnector : BaseServiceConnector, IAgentPreferencesService | ||
45 | { | ||
46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
47 | |||
48 | private string m_ServerURI = String.Empty; | ||
49 | |||
50 | public AgentPreferencesServicesConnector() | ||
51 | { | ||
52 | } | ||
53 | |||
54 | public AgentPreferencesServicesConnector(string serverURI) | ||
55 | { | ||
56 | m_ServerURI = serverURI.TrimEnd('/'); | ||
57 | } | ||
58 | |||
59 | public AgentPreferencesServicesConnector(IConfigSource source) | ||
60 | : base(source, "AgentPreferencesService") | ||
61 | { | ||
62 | Initialise(source); | ||
63 | } | ||
64 | |||
65 | public virtual void Initialise(IConfigSource source) | ||
66 | { | ||
67 | IConfig gridConfig = source.Configs["AgentPreferencesService"]; | ||
68 | if (gridConfig == null) | ||
69 | { | ||
70 | m_log.Error("[AGENT PREFERENCES CONNECTOR]: AgentPreferencesService missing from OpenSim.ini"); | ||
71 | throw new Exception("Agent Preferences connector init error"); | ||
72 | } | ||
73 | |||
74 | string serviceURI = gridConfig.GetString("AgentPreferencesServerURI", String.Empty); | ||
75 | |||
76 | if (serviceURI == String.Empty) | ||
77 | { | ||
78 | m_log.Error("[AGENT PREFERENCES CONNECTOR]: No Server URI named in section AgentPreferences"); | ||
79 | throw new Exception("Agent Preferences connector init error"); | ||
80 | } | ||
81 | m_ServerURI = serviceURI; | ||
82 | |||
83 | base.Initialise(source, "AgentPreferencesService"); | ||
84 | } | ||
85 | |||
86 | #region IAgentPreferencesService | ||
87 | |||
88 | public AgentPrefs GetAgentPreferences(UUID principalID) | ||
89 | { | ||
90 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | ||
91 | |||
92 | string reply = string.Empty; | ||
93 | string uri = String.Concat(m_ServerURI, "/agentprefs"); | ||
94 | |||
95 | sendData["METHOD"] = "getagentprefs"; | ||
96 | sendData["UserID"] = principalID; | ||
97 | string reqString = ServerUtils.BuildQueryString(sendData); | ||
98 | // m_log.DebugFormat("[AGENT PREFS CONNECTOR]: queryString = {0}", reqString); | ||
99 | |||
100 | try | ||
101 | { | ||
102 | reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth); | ||
103 | if (String.IsNullOrEmpty(reply)) | ||
104 | { | ||
105 | m_log.DebugFormat("[AGENT PREFERENCES CONNECTOR]: GetAgentPreferences received null or empty reply"); | ||
106 | return null; | ||
107 | } | ||
108 | } | ||
109 | catch (Exception e) | ||
110 | { | ||
111 | m_log.DebugFormat("[AGENT PREFERENCES CONNECTOR]: Exception when contacting agent preferences server at {0}: {1}", uri, e.Message); | ||
112 | } | ||
113 | |||
114 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | ||
115 | if (replyData != null) | ||
116 | { | ||
117 | if (replyData.ContainsKey("result") && | ||
118 | (replyData["result"].ToString() == "null" || replyData["result"].ToString() == "Failure")) | ||
119 | { | ||
120 | m_log.DebugFormat("[AGENT PREFERENCES CONNECTOR]: GetAgentPreferences received Failure response"); | ||
121 | return null; | ||
122 | } | ||
123 | } | ||
124 | else | ||
125 | { | ||
126 | m_log.DebugFormat("[AGENT PREFERENCES CONNECTOR]: GetAgentPreferences received null response"); | ||
127 | return null; | ||
128 | } | ||
129 | AgentPrefs prefs = new AgentPrefs(replyData); | ||
130 | return prefs; | ||
131 | } | ||
132 | |||
133 | public bool StoreAgentPreferences(AgentPrefs data) | ||
134 | { | ||
135 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | ||
136 | |||
137 | sendData["METHOD"] = "setagentprefs"; | ||
138 | |||
139 | sendData["PrincipalID"] = data.PrincipalID.ToString(); | ||
140 | sendData["AccessPrefs"] = data.AccessPrefs; | ||
141 | sendData["HoverHeight"] = data.HoverHeight.ToString(); | ||
142 | sendData["Language"] = data.Language; | ||
143 | sendData["LanguageIsPublic"] = data.LanguageIsPublic.ToString(); | ||
144 | sendData["PermEveryone"] = data.PermEveryone.ToString(); | ||
145 | sendData["PermGroup"] = data.PermGroup.ToString(); | ||
146 | sendData["PermNextOwner"] = data.PermNextOwner.ToString(); | ||
147 | |||
148 | string uri = String.Concat(m_ServerURI, "/agentprefs"); | ||
149 | string reqString = ServerUtils.BuildQueryString(sendData); | ||
150 | // m_log.DebugFormat("[AGENT PREFS CONNECTOR]: queryString = {0}", reqString); | ||
151 | |||
152 | try | ||
153 | { | ||
154 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth); | ||
155 | if (reply != string.Empty) | ||
156 | { | ||
157 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | ||
158 | |||
159 | if (replyData.ContainsKey("result")) | ||
160 | { | ||
161 | if (replyData["result"].ToString().ToLower() == "success") | ||
162 | return true; | ||
163 | else | ||
164 | return false; | ||
165 | } | ||
166 | else | ||
167 | { | ||
168 | m_log.DebugFormat("[AGENT PREFERENCES CONNECTOR]: StoreAgentPreferences reply data does not contain result field"); | ||
169 | } | ||
170 | |||
171 | } | ||
172 | else | ||
173 | m_log.DebugFormat("[AGENT PREFERENCES CONNECTOR]: StoreAgentPreferences received empty reply"); | ||
174 | } | ||
175 | catch (Exception e) | ||
176 | { | ||
177 | m_log.DebugFormat("[AGENT PREFERENCES CONNECTOR]: Exception when contacting agent preferences server at {0}: {1}", uri, e.Message); | ||
178 | } | ||
179 | |||
180 | return false; | ||
181 | } | ||
182 | |||
183 | public string GetLang(UUID principalID) | ||
184 | { | ||
185 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | ||
186 | string reply = string.Empty; | ||
187 | |||
188 | sendData["METHOD"] = "getagentlang"; | ||
189 | sendData["UserID"] = principalID.ToString(); | ||
190 | |||
191 | string uri = String.Concat(m_ServerURI, "/agentprefs"); | ||
192 | string reqString = ServerUtils.BuildQueryString(sendData); | ||
193 | |||
194 | try | ||
195 | { | ||
196 | reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth); | ||
197 | if (String.IsNullOrEmpty(reply)) | ||
198 | { | ||
199 | m_log.DebugFormat("[AGENT PREFERENCES CONNECTOR]: GetLang received null or empty reply"); | ||
200 | return "en-us"; // I guess? Gotta return somethin'! | ||
201 | } | ||
202 | } | ||
203 | catch (Exception e) | ||
204 | { | ||
205 | m_log.DebugFormat("[AGENT PREFERENCES CONNECTOR]: Exception when contacting agent preferences server at {0}: {1}", uri, e.Message); | ||
206 | } | ||
207 | |||
208 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | ||
209 | if (replyData != null) | ||
210 | { | ||
211 | if (replyData.ContainsKey("result") && | ||
212 | (replyData["result"].ToString() == "null" || replyData["result"].ToString() == "Failure")) | ||
213 | { | ||
214 | m_log.DebugFormat("[AGENT PREFERENCES CONNECTOR]: GetLang received Failure response"); | ||
215 | return "en-us"; | ||
216 | } | ||
217 | if (replyData.ContainsKey("Language")) | ||
218 | return replyData["Language"].ToString(); | ||
219 | } | ||
220 | else | ||
221 | { | ||
222 | m_log.DebugFormat("[AGENT PREFERENCES CONNECTOR]: GetLang received null response"); | ||
223 | |||
224 | } | ||
225 | return "en-us"; | ||
226 | } | ||
227 | |||
228 | #endregion IAgentPreferencesService | ||
229 | } | ||
230 | } | ||
diff --git a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs index 2c1d946..795ca2e 100644 --- a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs +++ b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs | |||
@@ -41,7 +41,7 @@ using OpenMetaverse; | |||
41 | 41 | ||
42 | namespace OpenSim.Services.Connectors | 42 | namespace OpenSim.Services.Connectors |
43 | { | 43 | { |
44 | public class AssetServicesConnector : IAssetService | 44 | public class AssetServicesConnector : BaseServiceConnector, IAssetService |
45 | { | 45 | { |
46 | private static readonly ILog m_log = | 46 | private static readonly ILog m_log = |
47 | LogManager.GetLogger( | 47 | LogManager.GetLogger( |
@@ -82,6 +82,7 @@ namespace OpenSim.Services.Connectors | |||
82 | } | 82 | } |
83 | 83 | ||
84 | public AssetServicesConnector(IConfigSource source) | 84 | public AssetServicesConnector(IConfigSource source) |
85 | : base(source, "AssetService") | ||
85 | { | 86 | { |
86 | Initialise(source); | 87 | Initialise(source); |
87 | } | 88 | } |
@@ -221,8 +222,16 @@ namespace OpenSim.Services.Connectors | |||
221 | 222 | ||
222 | if (asset == null || asset.Data == null || asset.Data.Length == 0) | 223 | if (asset == null || asset.Data == null || asset.Data.Length == 0) |
223 | { | 224 | { |
224 | asset = SynchronousRestObjectRequester. | 225 | // XXX: Commented out for now since this has either never been properly operational or not for some time |
225 | MakeRequest<int, AssetBase>("GET", uri, 0, m_maxAssetRequestConcurrency); | 226 | // as m_maxAssetRequestConcurrency was being passed as the timeout, not a concurrency limiting option. |
227 | // Wasn't noticed before because timeout wasn't actually used. | ||
228 | // Not attempting concurrency setting for now as this omission was discovered in release candidate | ||
229 | // phase for OpenSimulator 0.8. Need to revisit afterwards. | ||
230 | // asset | ||
231 | // = SynchronousRestObjectRequester.MakeRequest<int, AssetBase>( | ||
232 | // "GET", uri, 0, m_maxAssetRequestConcurrency); | ||
233 | |||
234 | asset = SynchronousRestObjectRequester.MakeRequest<int, AssetBase>("GET", uri, 0, m_Auth); | ||
226 | 235 | ||
227 | if (m_Cache != null) | 236 | if (m_Cache != null) |
228 | m_Cache.Cache(asset); | 237 | m_Cache.Cache(asset); |
@@ -252,8 +261,7 @@ namespace OpenSim.Services.Connectors | |||
252 | 261 | ||
253 | string uri = MapServer(id) + "/assets/" + id + "/metadata"; | 262 | string uri = MapServer(id) + "/assets/" + id + "/metadata"; |
254 | 263 | ||
255 | AssetMetadata asset = SynchronousRestObjectRequester. | 264 | AssetMetadata asset = SynchronousRestObjectRequester.MakeRequest<int, AssetMetadata>("GET", uri, 0, m_Auth); |
256 | MakeRequest<int, AssetMetadata>("GET", uri, 0); | ||
257 | return asset; | 265 | return asset; |
258 | } | 266 | } |
259 | 267 | ||
@@ -267,29 +275,45 @@ namespace OpenSim.Services.Connectors | |||
267 | return fullAsset.Data; | 275 | return fullAsset.Data; |
268 | } | 276 | } |
269 | 277 | ||
278 | <<<<<<< HEAD | ||
279 | using (RestClient rc = new RestClient(m_ServerURI)) | ||
280 | { | ||
281 | rc.AddResourcePath("assets"); | ||
282 | rc.AddResourcePath(id); | ||
283 | rc.AddResourcePath("data"); | ||
284 | ======= | ||
270 | RestClient rc = new RestClient(MapServer(id)); | 285 | RestClient rc = new RestClient(MapServer(id)); |
271 | rc.AddResourcePath("assets"); | 286 | rc.AddResourcePath("assets"); |
272 | rc.AddResourcePath(id); | 287 | rc.AddResourcePath(id); |
273 | rc.AddResourcePath("data"); | 288 | rc.AddResourcePath("data"); |
289 | >>>>>>> avn/ubitvar | ||
274 | 290 | ||
275 | rc.RequestMethod = "GET"; | 291 | rc.RequestMethod = "GET"; |
276 | 292 | ||
277 | Stream s = rc.Request(); | 293 | Stream s = rc.Request(m_Auth); |
278 | 294 | ||
279 | if (s == null) | 295 | if (s == null) |
280 | return null; | 296 | return null; |
281 | 297 | ||
282 | if (s.Length > 0) | 298 | if (s.Length > 0) |
283 | { | 299 | { |
284 | byte[] ret = new byte[s.Length]; | 300 | byte[] ret = new byte[s.Length]; |
285 | s.Read(ret, 0, (int)s.Length); | 301 | s.Read(ret, 0, (int)s.Length); |
286 | 302 | ||
303 | <<<<<<< HEAD | ||
304 | return ret; | ||
305 | } | ||
306 | |||
307 | return null; | ||
308 | } | ||
309 | ======= | ||
287 | s.Close(); | 310 | s.Close(); |
288 | return ret; | 311 | return ret; |
289 | } | 312 | } |
290 | 313 | ||
291 | s.Close(); | 314 | s.Close(); |
292 | return null; | 315 | return null; |
316 | >>>>>>> avn/ubitvar | ||
293 | } | 317 | } |
294 | 318 | ||
295 | private class QueuedAssetRequest | 319 | private class QueuedAssetRequest |
@@ -324,12 +348,24 @@ namespace OpenSim.Services.Connectors | |||
324 | List<AssetRetrievedEx> handlers; | 348 | List<AssetRetrievedEx> handlers; |
325 | lock (m_AssetHandlers) | 349 | lock (m_AssetHandlers) |
326 | { | 350 | { |
351 | <<<<<<< HEAD | ||
352 | if (a != null && m_Cache != null) | ||
353 | m_Cache.Cache(a); | ||
354 | ======= | ||
327 | handlers = m_AssetHandlers[id]; | 355 | handlers = m_AssetHandlers[id]; |
328 | m_AssetHandlers.Remove(id); | 356 | m_AssetHandlers.Remove(id); |
329 | } | 357 | } |
358 | >>>>>>> avn/ubitvar | ||
330 | 359 | ||
331 | Util.FireAndForget(x => | 360 | Util.FireAndForget(x => |
332 | { | 361 | { |
362 | <<<<<<< HEAD | ||
363 | handlers = m_AssetHandlers[id]; | ||
364 | m_AssetHandlers.Remove(id); | ||
365 | } | ||
366 | handlers.Invoke(a); | ||
367 | }, m_maxAssetRequestConcurrency, m_Auth); | ||
368 | ======= | ||
333 | foreach (AssetRetrievedEx h in handlers) | 369 | foreach (AssetRetrievedEx h in handlers) |
334 | { | 370 | { |
335 | // Util.FireAndForget(x => | 371 | // Util.FireAndForget(x => |
@@ -346,6 +382,7 @@ namespace OpenSim.Services.Connectors | |||
346 | 382 | ||
347 | // if (handlers != null) | 383 | // if (handlers != null) |
348 | // handlers.Clear(); | 384 | // handlers.Clear(); |
385 | >>>>>>> avn/ubitvar | ||
349 | 386 | ||
350 | success = true; | 387 | success = true; |
351 | } | 388 | } |
@@ -413,6 +450,27 @@ namespace OpenSim.Services.Connectors | |||
413 | return true; | 450 | return true; |
414 | } | 451 | } |
415 | 452 | ||
453 | public virtual bool[] AssetsExist(string[] ids) | ||
454 | { | ||
455 | string uri = m_ServerURI + "/get_assets_exist"; | ||
456 | |||
457 | bool[] exist = null; | ||
458 | try | ||
459 | { | ||
460 | exist = SynchronousRestObjectRequester.MakeRequest<string[], bool[]>("POST", uri, ids, m_Auth); | ||
461 | } | ||
462 | catch (Exception) | ||
463 | { | ||
464 | // This is most likely to happen because the server doesn't support this function, | ||
465 | // so just silently return "doesn't exist" for all the assets. | ||
466 | } | ||
467 | |||
468 | if (exist == null) | ||
469 | exist = new bool[ids.Length]; | ||
470 | |||
471 | return exist; | ||
472 | } | ||
473 | |||
416 | public string Store(AssetBase asset) | 474 | public string Store(AssetBase asset) |
417 | { | 475 | { |
418 | // Have to assign the asset ID here. This isn't likely to | 476 | // Have to assign the asset ID here. This isn't likely to |
@@ -449,9 +507,35 @@ namespace OpenSim.Services.Connectors | |||
449 | 507 | ||
450 | string uri = MapServer(asset.FullID.ToString()) + "/assets/"; | 508 | string uri = MapServer(asset.FullID.ToString()) + "/assets/"; |
451 | 509 | ||
452 | string newID = string.Empty; | 510 | string newID; |
453 | try | 511 | try |
454 | { | 512 | { |
513 | <<<<<<< HEAD | ||
514 | newID = SynchronousRestObjectRequester.MakeRequest<AssetBase, string>("POST", uri, asset, m_Auth); | ||
515 | } | ||
516 | catch (Exception e) | ||
517 | { | ||
518 | m_log.Warn(string.Format("[ASSET CONNECTOR]: Unable to send asset {0} to asset server. Reason: {1} ", asset.ID, e.Message), e); | ||
519 | return string.Empty; | ||
520 | } | ||
521 | |||
522 | // TEMPORARY: SRAS returns 'null' when it's asked to store existing assets | ||
523 | if (newID == null) | ||
524 | { | ||
525 | m_log.DebugFormat("[ASSET CONNECTOR]: Storing of asset {0} returned null; assuming the asset already exists", asset.ID); | ||
526 | return asset.ID; | ||
527 | } | ||
528 | |||
529 | if (string.IsNullOrEmpty(newID)) | ||
530 | return string.Empty; | ||
531 | |||
532 | asset.ID = newID; | ||
533 | |||
534 | if (m_Cache != null) | ||
535 | m_Cache.Cache(asset); | ||
536 | |||
537 | return newID; | ||
538 | ======= | ||
455 | newID = SynchronousRestObjectRequester. | 539 | newID = SynchronousRestObjectRequester. |
456 | MakeRequest<AssetBase, string>("POST", uri, asset, 25); | 540 | MakeRequest<AssetBase, string>("POST", uri, asset, 25); |
457 | if (newID == null || newID == "") | 541 | if (newID == null || newID == "") |
@@ -504,6 +588,7 @@ namespace OpenSim.Services.Connectors | |||
504 | } | 588 | } |
505 | } | 589 | } |
506 | return asset.ID; | 590 | return asset.ID; |
591 | >>>>>>> avn/ubitvar | ||
507 | } | 592 | } |
508 | 593 | ||
509 | public bool UpdateContent(string id, byte[] data) | 594 | public bool UpdateContent(string id, byte[] data) |
@@ -526,8 +611,7 @@ namespace OpenSim.Services.Connectors | |||
526 | 611 | ||
527 | string uri = MapServer(id) + "/assets/" + id; | 612 | string uri = MapServer(id) + "/assets/" + id; |
528 | 613 | ||
529 | if (SynchronousRestObjectRequester. | 614 | if (SynchronousRestObjectRequester.MakeRequest<AssetBase, bool>("POST", uri, asset, m_Auth)) |
530 | MakeRequest<AssetBase, bool>("POST", uri, asset)) | ||
531 | { | 615 | { |
532 | if (m_Cache != null) | 616 | if (m_Cache != null) |
533 | m_Cache.Cache(asset); | 617 | m_Cache.Cache(asset); |
@@ -541,8 +625,7 @@ namespace OpenSim.Services.Connectors | |||
541 | { | 625 | { |
542 | string uri = MapServer(id) + "/assets/" + id; | 626 | string uri = MapServer(id) + "/assets/" + id; |
543 | 627 | ||
544 | if (SynchronousRestObjectRequester. | 628 | if (SynchronousRestObjectRequester.MakeRequest<int, bool>("DELETE", uri, 0, m_Auth)) |
545 | MakeRequest<int, bool>("DELETE", uri, 0)) | ||
546 | { | 629 | { |
547 | if (m_Cache != null) | 630 | if (m_Cache != null) |
548 | m_Cache.Expire(id); | 631 | m_Cache.Expire(id); |
diff --git a/OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs b/OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs index c395178..3710c86 100644 --- a/OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs +++ b/OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs | |||
@@ -36,6 +36,7 @@ using OpenSim.Framework; | |||
36 | using OpenSim.Services.Interfaces; | 36 | using OpenSim.Services.Interfaces; |
37 | using OpenSim.Services.Connectors.Hypergrid; | 37 | using OpenSim.Services.Connectors.Hypergrid; |
38 | using OpenSim.Services.Connectors.SimianGrid; | 38 | using OpenSim.Services.Connectors.SimianGrid; |
39 | using OpenMetaverse; | ||
39 | 40 | ||
40 | namespace OpenSim.Services.Connectors | 41 | namespace OpenSim.Services.Connectors |
41 | { | 42 | { |
@@ -83,39 +84,6 @@ namespace OpenSim.Services.Connectors | |||
83 | } | 84 | } |
84 | } | 85 | } |
85 | 86 | ||
86 | private bool StringToUrlAndAssetID(string id, out string url, out string assetID) | ||
87 | { | ||
88 | url = String.Empty; | ||
89 | assetID = String.Empty; | ||
90 | |||
91 | Uri assetUri; | ||
92 | |||
93 | if (Uri.TryCreate(id, UriKind.Absolute, out assetUri) && | ||
94 | assetUri.Scheme == Uri.UriSchemeHttp) | ||
95 | { | ||
96 | // Simian | ||
97 | if (assetUri.Query != string.Empty) | ||
98 | { | ||
99 | NameValueCollection qscoll = HttpUtility.ParseQueryString(assetUri.Query); | ||
100 | assetID = qscoll["id"]; | ||
101 | if (assetID != null) | ||
102 | url = id.Replace(assetID, ""); // Malformed again, as simian expects | ||
103 | else | ||
104 | url = id; // !!! best effort | ||
105 | } | ||
106 | else // robust | ||
107 | { | ||
108 | url = "http://" + assetUri.Authority; | ||
109 | assetID = assetUri.LocalPath.Trim(new char[] { '/' }); | ||
110 | } | ||
111 | |||
112 | return true; | ||
113 | } | ||
114 | |||
115 | m_log.DebugFormat("[HG ASSET SERVICE]: Malformed URL {0}", id); | ||
116 | return false; | ||
117 | } | ||
118 | |||
119 | private IAssetService GetConnector(string url) | 87 | private IAssetService GetConnector(string url) |
120 | { | 88 | { |
121 | IAssetService connector = null; | 89 | IAssetService connector = null; |
@@ -149,7 +117,7 @@ namespace OpenSim.Services.Connectors | |||
149 | string url = string.Empty; | 117 | string url = string.Empty; |
150 | string assetID = string.Empty; | 118 | string assetID = string.Empty; |
151 | 119 | ||
152 | if (StringToUrlAndAssetID(id, out url, out assetID)) | 120 | if (Util.ParseForeignAssetID(id, out url, out assetID)) |
153 | { | 121 | { |
154 | IAssetService connector = GetConnector(url); | 122 | IAssetService connector = GetConnector(url); |
155 | return connector.Get(assetID); | 123 | return connector.Get(assetID); |
@@ -163,7 +131,7 @@ namespace OpenSim.Services.Connectors | |||
163 | string url = string.Empty; | 131 | string url = string.Empty; |
164 | string assetID = string.Empty; | 132 | string assetID = string.Empty; |
165 | 133 | ||
166 | if (StringToUrlAndAssetID(id, out url, out assetID)) | 134 | if (Util.ParseForeignAssetID(id, out url, out assetID)) |
167 | { | 135 | { |
168 | IAssetService connector = GetConnector(url); | 136 | IAssetService connector = GetConnector(url); |
169 | return connector.GetCached(assetID); | 137 | return connector.GetCached(assetID); |
@@ -177,7 +145,7 @@ namespace OpenSim.Services.Connectors | |||
177 | string url = string.Empty; | 145 | string url = string.Empty; |
178 | string assetID = string.Empty; | 146 | string assetID = string.Empty; |
179 | 147 | ||
180 | if (StringToUrlAndAssetID(id, out url, out assetID)) | 148 | if (Util.ParseForeignAssetID(id, out url, out assetID)) |
181 | { | 149 | { |
182 | IAssetService connector = GetConnector(url); | 150 | IAssetService connector = GetConnector(url); |
183 | return connector.GetMetadata(assetID); | 151 | return connector.GetMetadata(assetID); |
@@ -196,7 +164,7 @@ namespace OpenSim.Services.Connectors | |||
196 | string url = string.Empty; | 164 | string url = string.Empty; |
197 | string assetID = string.Empty; | 165 | string assetID = string.Empty; |
198 | 166 | ||
199 | if (StringToUrlAndAssetID(id, out url, out assetID)) | 167 | if (Util.ParseForeignAssetID(id, out url, out assetID)) |
200 | { | 168 | { |
201 | IAssetService connector = GetConnector(url); | 169 | IAssetService connector = GetConnector(url); |
202 | return connector.Get(assetID, sender, handler); | 170 | return connector.Get(assetID, sender, handler); |
@@ -205,12 +173,72 @@ namespace OpenSim.Services.Connectors | |||
205 | return false; | 173 | return false; |
206 | } | 174 | } |
207 | 175 | ||
176 | |||
177 | private struct AssetAndIndex | ||
178 | { | ||
179 | public UUID assetID; | ||
180 | public int index; | ||
181 | |||
182 | public AssetAndIndex(UUID assetID, int index) | ||
183 | { | ||
184 | this.assetID = assetID; | ||
185 | this.index = index; | ||
186 | } | ||
187 | } | ||
188 | |||
189 | public virtual bool[] AssetsExist(string[] ids) | ||
190 | { | ||
191 | // This method is a bit complicated because it works even if the assets belong to different | ||
192 | // servers; that requires sending separate requests to each server. | ||
193 | |||
194 | // Group the assets by the server they belong to | ||
195 | |||
196 | var url2assets = new Dictionary<string, List<AssetAndIndex>>(); | ||
197 | |||
198 | for (int i = 0; i < ids.Length; i++) | ||
199 | { | ||
200 | string url = string.Empty; | ||
201 | string assetID = string.Empty; | ||
202 | |||
203 | if (Util.ParseForeignAssetID(ids[i], out url, out assetID)) | ||
204 | { | ||
205 | if (!url2assets.ContainsKey(url)) | ||
206 | url2assets.Add(url, new List<AssetAndIndex>()); | ||
207 | url2assets[url].Add(new AssetAndIndex(UUID.Parse(assetID), i)); | ||
208 | } | ||
209 | } | ||
210 | |||
211 | // Query each of the servers in turn | ||
212 | |||
213 | bool[] exist = new bool[ids.Length]; | ||
214 | |||
215 | foreach (string url in url2assets.Keys) | ||
216 | { | ||
217 | IAssetService connector = GetConnector(url); | ||
218 | lock (EndPointLock(connector)) | ||
219 | { | ||
220 | List<AssetAndIndex> curAssets = url2assets[url]; | ||
221 | string[] assetIDs = curAssets.ConvertAll(a => a.assetID.ToString()).ToArray(); | ||
222 | bool[] curExist = connector.AssetsExist(assetIDs); | ||
223 | |||
224 | int i = 0; | ||
225 | foreach (AssetAndIndex ai in curAssets) | ||
226 | { | ||
227 | exist[ai.index] = curExist[i]; | ||
228 | ++i; | ||
229 | } | ||
230 | } | ||
231 | } | ||
232 | |||
233 | return exist; | ||
234 | } | ||
235 | |||
208 | public string Store(AssetBase asset) | 236 | public string Store(AssetBase asset) |
209 | { | 237 | { |
210 | string url = string.Empty; | 238 | string url = string.Empty; |
211 | string assetID = string.Empty; | 239 | string assetID = string.Empty; |
212 | 240 | ||
213 | if (StringToUrlAndAssetID(asset.ID, out url, out assetID)) | 241 | if (Util.ParseForeignAssetID(asset.ID, out url, out assetID)) |
214 | { | 242 | { |
215 | IAssetService connector = GetConnector(url); | 243 | IAssetService connector = GetConnector(url); |
216 | // Restore the assetID to a simple UUID | 244 | // Restore the assetID to a simple UUID |
diff --git a/OpenSim/Services/Connectors/Authentication/AuthenticationServicesConnector.cs b/OpenSim/Services/Connectors/Authentication/AuthenticationServicesConnector.cs index f996aca..0443f5a 100644 --- a/OpenSim/Services/Connectors/Authentication/AuthenticationServicesConnector.cs +++ b/OpenSim/Services/Connectors/Authentication/AuthenticationServicesConnector.cs | |||
@@ -32,14 +32,14 @@ using System.IO; | |||
32 | using System.Reflection; | 32 | using System.Reflection; |
33 | using Nini.Config; | 33 | using Nini.Config; |
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Communications; | 35 | using OpenSim.Framework.ServiceAuth; |
36 | using OpenSim.Services.Interfaces; | 36 | using OpenSim.Services.Interfaces; |
37 | using OpenSim.Server.Base; | 37 | using OpenSim.Server.Base; |
38 | using OpenMetaverse; | 38 | using OpenMetaverse; |
39 | 39 | ||
40 | namespace OpenSim.Services.Connectors | 40 | namespace OpenSim.Services.Connectors |
41 | { | 41 | { |
42 | public class AuthenticationServicesConnector : IAuthenticationService | 42 | public class AuthenticationServicesConnector : BaseServiceConnector, IAuthenticationService |
43 | { | 43 | { |
44 | private static readonly ILog m_log = | 44 | private static readonly ILog m_log = |
45 | LogManager.GetLogger( | 45 | LogManager.GetLogger( |
@@ -57,6 +57,7 @@ namespace OpenSim.Services.Connectors | |||
57 | } | 57 | } |
58 | 58 | ||
59 | public AuthenticationServicesConnector(IConfigSource source) | 59 | public AuthenticationServicesConnector(IConfigSource source) |
60 | : base(source, "AuthenticationService") | ||
60 | { | 61 | { |
61 | Initialise(source); | 62 | Initialise(source); |
62 | } | 63 | } |
@@ -79,6 +80,8 @@ namespace OpenSim.Services.Connectors | |||
79 | throw new Exception("Authentication connector init error"); | 80 | throw new Exception("Authentication connector init error"); |
80 | } | 81 | } |
81 | m_ServerURI = serviceURI; | 82 | m_ServerURI = serviceURI; |
83 | |||
84 | base.Initialise(source, "AuthenticationService"); | ||
82 | } | 85 | } |
83 | 86 | ||
84 | public string Authenticate(UUID principalID, string password, int lifetime, out UUID realID) | 87 | public string Authenticate(UUID principalID, string password, int lifetime, out UUID realID) |
@@ -99,7 +102,7 @@ namespace OpenSim.Services.Connectors | |||
99 | 102 | ||
100 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", | 103 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", |
101 | m_ServerURI + "/auth/plain", | 104 | m_ServerURI + "/auth/plain", |
102 | ServerUtils.BuildQueryString(sendData)); | 105 | ServerUtils.BuildQueryString(sendData), m_Auth); |
103 | 106 | ||
104 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse( | 107 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse( |
105 | reply); | 108 | reply); |
@@ -112,6 +115,7 @@ namespace OpenSim.Services.Connectors | |||
112 | 115 | ||
113 | public bool Verify(UUID principalID, string token, int lifetime) | 116 | public bool Verify(UUID principalID, string token, int lifetime) |
114 | { | 117 | { |
118 | // m_log.Error("[XXX]: Verify"); | ||
115 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | 119 | Dictionary<string, object> sendData = new Dictionary<string, object>(); |
116 | sendData["LIFETIME"] = lifetime.ToString(); | 120 | sendData["LIFETIME"] = lifetime.ToString(); |
117 | sendData["PRINCIPAL"] = principalID.ToString(); | 121 | sendData["PRINCIPAL"] = principalID.ToString(); |
@@ -121,7 +125,7 @@ namespace OpenSim.Services.Connectors | |||
121 | 125 | ||
122 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", | 126 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", |
123 | m_ServerURI + "/auth/plain", | 127 | m_ServerURI + "/auth/plain", |
124 | ServerUtils.BuildQueryString(sendData)); | 128 | ServerUtils.BuildQueryString(sendData), m_Auth); |
125 | 129 | ||
126 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse( | 130 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse( |
127 | reply); | 131 | reply); |
@@ -142,7 +146,7 @@ namespace OpenSim.Services.Connectors | |||
142 | 146 | ||
143 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", | 147 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", |
144 | m_ServerURI + "/auth/plain", | 148 | m_ServerURI + "/auth/plain", |
145 | ServerUtils.BuildQueryString(sendData)); | 149 | ServerUtils.BuildQueryString(sendData), m_Auth); |
146 | 150 | ||
147 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse( | 151 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse( |
148 | reply); | 152 | reply); |
diff --git a/OpenSim/Services/Connectors/Authorization/AuthorizationServicesConnector.cs b/OpenSim/Services/Connectors/Authorization/AuthorizationServicesConnector.cs index 35b7109..63730b3 100644 --- a/OpenSim/Services/Connectors/Authorization/AuthorizationServicesConnector.cs +++ b/OpenSim/Services/Connectors/Authorization/AuthorizationServicesConnector.cs | |||
@@ -105,7 +105,7 @@ namespace OpenSim.Services.Connectors | |||
105 | catch (Exception e) | 105 | catch (Exception e) |
106 | { | 106 | { |
107 | m_log.WarnFormat("[AUTHORIZATION CONNECTOR]: Unable to send authorize {0} for region {1} error thrown during comms with remote server. Reason: {2}", userID, regionID, e.Message); | 107 | m_log.WarnFormat("[AUTHORIZATION CONNECTOR]: Unable to send authorize {0} for region {1} error thrown during comms with remote server. Reason: {2}", userID, regionID, e.Message); |
108 | message = ""; | 108 | message = e.Message; |
109 | return m_ResponseOnFailure; | 109 | return m_ResponseOnFailure; |
110 | } | 110 | } |
111 | if (response == null) | 111 | if (response == null) |
diff --git a/OpenSim/Services/Connectors/Avatar/AvatarServicesConnector.cs b/OpenSim/Services/Connectors/Avatar/AvatarServicesConnector.cs index ddfca57..3f44efa 100644 --- a/OpenSim/Services/Connectors/Avatar/AvatarServicesConnector.cs +++ b/OpenSim/Services/Connectors/Avatar/AvatarServicesConnector.cs | |||
@@ -32,7 +32,7 @@ using System.IO; | |||
32 | using System.Reflection; | 32 | using System.Reflection; |
33 | using Nini.Config; | 33 | using Nini.Config; |
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Communications; | 35 | using OpenSim.Framework.ServiceAuth; |
36 | using OpenSim.Services.Interfaces; | 36 | using OpenSim.Services.Interfaces; |
37 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | 37 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; |
38 | using IAvatarService = OpenSim.Services.Interfaces.IAvatarService; | 38 | using IAvatarService = OpenSim.Services.Interfaces.IAvatarService; |
@@ -41,7 +41,7 @@ using OpenMetaverse; | |||
41 | 41 | ||
42 | namespace OpenSim.Services.Connectors | 42 | namespace OpenSim.Services.Connectors |
43 | { | 43 | { |
44 | public class AvatarServicesConnector : IAvatarService | 44 | public class AvatarServicesConnector : BaseServiceConnector, IAvatarService |
45 | { | 45 | { |
46 | private static readonly ILog m_log = | 46 | private static readonly ILog m_log = |
47 | LogManager.GetLogger( | 47 | LogManager.GetLogger( |
@@ -59,6 +59,7 @@ namespace OpenSim.Services.Connectors | |||
59 | } | 59 | } |
60 | 60 | ||
61 | public AvatarServicesConnector(IConfigSource source) | 61 | public AvatarServicesConnector(IConfigSource source) |
62 | : base(source, "AvatarService") | ||
62 | { | 63 | { |
63 | Initialise(source); | 64 | Initialise(source); |
64 | } | 65 | } |
@@ -81,6 +82,8 @@ namespace OpenSim.Services.Connectors | |||
81 | throw new Exception("Avatar connector init error"); | 82 | throw new Exception("Avatar connector init error"); |
82 | } | 83 | } |
83 | m_ServerURI = serviceURI; | 84 | m_ServerURI = serviceURI; |
85 | |||
86 | base.Initialise(source, "AvatarService"); | ||
84 | } | 87 | } |
85 | 88 | ||
86 | 89 | ||
@@ -114,7 +117,7 @@ namespace OpenSim.Services.Connectors | |||
114 | // m_log.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString); | 117 | // m_log.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString); |
115 | try | 118 | try |
116 | { | 119 | { |
117 | reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString); | 120 | reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth); |
118 | if (reply == null || (reply != null && reply == string.Empty)) | 121 | if (reply == null || (reply != null && reply == string.Empty)) |
119 | { | 122 | { |
120 | m_log.DebugFormat("[AVATAR CONNECTOR]: GetAgent received null or empty reply"); | 123 | m_log.DebugFormat("[AVATAR CONNECTOR]: GetAgent received null or empty reply"); |
@@ -162,7 +165,7 @@ namespace OpenSim.Services.Connectors | |||
162 | //m_log.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString); | 165 | //m_log.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString); |
163 | try | 166 | try |
164 | { | 167 | { |
165 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString); | 168 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth); |
166 | if (reply != string.Empty) | 169 | if (reply != string.Empty) |
167 | { | 170 | { |
168 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | 171 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); |
@@ -207,7 +210,7 @@ namespace OpenSim.Services.Connectors | |||
207 | // m_log.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString); | 210 | // m_log.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString); |
208 | try | 211 | try |
209 | { | 212 | { |
210 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString); | 213 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth); |
211 | if (reply != string.Empty) | 214 | if (reply != string.Empty) |
212 | { | 215 | { |
213 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | 216 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); |
@@ -250,7 +253,7 @@ namespace OpenSim.Services.Connectors | |||
250 | // m_log.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString); | 253 | // m_log.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString); |
251 | try | 254 | try |
252 | { | 255 | { |
253 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString); | 256 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth); |
254 | if (reply != string.Empty) | 257 | if (reply != string.Empty) |
255 | { | 258 | { |
256 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | 259 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); |
@@ -293,7 +296,7 @@ namespace OpenSim.Services.Connectors | |||
293 | // m_log.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString); | 296 | // m_log.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString); |
294 | try | 297 | try |
295 | { | 298 | { |
296 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString); | 299 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth); |
297 | if (reply != string.Empty) | 300 | if (reply != string.Empty) |
298 | { | 301 | { |
299 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | 302 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); |
diff --git a/OpenSim/Services/Connectors/BaseServiceConnector.cs b/OpenSim/Services/Connectors/BaseServiceConnector.cs new file mode 100644 index 0000000..98cd489 --- /dev/null +++ b/OpenSim/Services/Connectors/BaseServiceConnector.cs | |||
@@ -0,0 +1,33 @@ | |||
1 | using System; | ||
2 | using OpenSim.Framework; | ||
3 | using OpenSim.Framework.ServiceAuth; | ||
4 | |||
5 | using Nini.Config; | ||
6 | |||
7 | namespace OpenSim.Services.Connectors | ||
8 | { | ||
9 | public class BaseServiceConnector | ||
10 | { | ||
11 | protected IServiceAuth m_Auth; | ||
12 | |||
13 | public BaseServiceConnector() { } | ||
14 | |||
15 | public BaseServiceConnector(IConfigSource config, string section) | ||
16 | { | ||
17 | Initialise(config, section); | ||
18 | } | ||
19 | |||
20 | public void Initialise(IConfigSource config, string section) | ||
21 | { | ||
22 | string authType = Util.GetConfigVarFromSections<string>(config, "AuthType", new string[] { "Network", section }, "None"); | ||
23 | |||
24 | switch (authType) | ||
25 | { | ||
26 | case "BasicHttpAuthentication": | ||
27 | m_Auth = new BasicHttpAuthentication(config, section); | ||
28 | break; | ||
29 | } | ||
30 | |||
31 | } | ||
32 | } | ||
33 | } | ||
diff --git a/OpenSim/Services/Connectors/Estate/EstateDataConnector.cs b/OpenSim/Services/Connectors/Estate/EstateDataConnector.cs new file mode 100644 index 0000000..6412bcd --- /dev/null +++ b/OpenSim/Services/Connectors/Estate/EstateDataConnector.cs | |||
@@ -0,0 +1,338 @@ | |||
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 | using System; | ||
28 | using System.Collections.Generic; | ||
29 | using System.Net; | ||
30 | using System.Reflection; | ||
31 | |||
32 | using log4net; | ||
33 | |||
34 | using OpenMetaverse; | ||
35 | using Nini.Config; | ||
36 | |||
37 | using OpenSim.Framework; | ||
38 | using OpenSim.Framework.ServiceAuth; | ||
39 | using OpenSim.Services.Connectors; | ||
40 | using OpenSim.Services.Interfaces; | ||
41 | using OpenSim.Server.Base; | ||
42 | |||
43 | namespace OpenSim.Services.Connectors | ||
44 | { | ||
45 | public class EstateDataRemoteConnector : BaseServiceConnector, IEstateDataService | ||
46 | { | ||
47 | private static readonly ILog m_log = | ||
48 | LogManager.GetLogger( | ||
49 | MethodBase.GetCurrentMethod().DeclaringType); | ||
50 | |||
51 | private string m_ServerURI = String.Empty; | ||
52 | private ExpiringCache<string, List<EstateSettings>> m_EstateCache = new ExpiringCache<string, List<EstateSettings>>(); | ||
53 | private const int EXPIRATION = 5 * 60; // 5 minutes in secs | ||
54 | |||
55 | public EstateDataRemoteConnector(IConfigSource source) | ||
56 | { | ||
57 | Initialise(source); | ||
58 | } | ||
59 | |||
60 | public virtual void Initialise(IConfigSource source) | ||
61 | { | ||
62 | IConfig gridConfig = source.Configs["EstateService"]; | ||
63 | if (gridConfig == null) | ||
64 | { | ||
65 | m_log.Error("[ESTATE CONNECTOR]: EstateService missing from OpenSim.ini"); | ||
66 | throw new Exception("Estate connector init error"); | ||
67 | } | ||
68 | |||
69 | string serviceURI = gridConfig.GetString("EstateServerURI", | ||
70 | String.Empty); | ||
71 | |||
72 | if (serviceURI == String.Empty) | ||
73 | { | ||
74 | m_log.Error("[ESTATE CONNECTOR]: No Server URI named in section EstateService"); | ||
75 | throw new Exception("Estate connector init error"); | ||
76 | } | ||
77 | m_ServerURI = serviceURI; | ||
78 | |||
79 | base.Initialise(source, "EstateService"); | ||
80 | } | ||
81 | |||
82 | #region IEstateDataService | ||
83 | |||
84 | public List<EstateSettings> LoadEstateSettingsAll() | ||
85 | { | ||
86 | string reply = string.Empty; | ||
87 | string uri = m_ServerURI + "/estates"; | ||
88 | |||
89 | reply = MakeRequest("GET", uri, string.Empty); | ||
90 | if (String.IsNullOrEmpty(reply)) | ||
91 | return new List<EstateSettings>(); | ||
92 | |||
93 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | ||
94 | |||
95 | List<EstateSettings> estates = new List<EstateSettings>(); | ||
96 | if (replyData != null && replyData.Count > 0) | ||
97 | { | ||
98 | m_log.DebugFormat("[ESTATE CONNECTOR]: LoadEstateSettingsAll returned {0} elements", replyData.Count); | ||
99 | Dictionary<string, object>.ValueCollection estateData = replyData.Values; | ||
100 | foreach (object r in estateData) | ||
101 | { | ||
102 | if (r is Dictionary<string, object>) | ||
103 | { | ||
104 | EstateSettings es = new EstateSettings((Dictionary<string, object>)r); | ||
105 | estates.Add(es); | ||
106 | } | ||
107 | } | ||
108 | m_EstateCache.AddOrUpdate("estates", estates, EXPIRATION); | ||
109 | } | ||
110 | else | ||
111 | m_log.DebugFormat("[ESTATE CONNECTOR]: LoadEstateSettingsAll from {0} received null or zero response", uri); | ||
112 | |||
113 | return estates; | ||
114 | |||
115 | } | ||
116 | |||
117 | public List<int> GetEstatesAll() | ||
118 | { | ||
119 | List<int> eids = new List<int>(); | ||
120 | // If we don't have them, load them from the server | ||
121 | List<EstateSettings> estates = null; | ||
122 | if (!m_EstateCache.TryGetValue("estates", out estates)) | ||
123 | LoadEstateSettingsAll(); | ||
124 | |||
125 | foreach (EstateSettings es in estates) | ||
126 | eids.Add((int)es.EstateID); | ||
127 | |||
128 | return eids; | ||
129 | } | ||
130 | |||
131 | public List<int> GetEstates(string search) | ||
132 | { | ||
133 | // If we don't have them, load them from the server | ||
134 | List<EstateSettings> estates = null; | ||
135 | if (!m_EstateCache.TryGetValue("estates", out estates)) | ||
136 | LoadEstateSettingsAll(); | ||
137 | |||
138 | List<int> eids = new List<int>(); | ||
139 | foreach (EstateSettings es in estates) | ||
140 | if (es.EstateName == search) | ||
141 | eids.Add((int)es.EstateID); | ||
142 | |||
143 | return eids; | ||
144 | } | ||
145 | |||
146 | public List<int> GetEstatesByOwner(UUID ownerID) | ||
147 | { | ||
148 | // If we don't have them, load them from the server | ||
149 | List<EstateSettings> estates = null; | ||
150 | if (!m_EstateCache.TryGetValue("estates", out estates)) | ||
151 | LoadEstateSettingsAll(); | ||
152 | |||
153 | List<int> eids = new List<int>(); | ||
154 | foreach (EstateSettings es in estates) | ||
155 | if (es.EstateOwner == ownerID) | ||
156 | eids.Add((int)es.EstateID); | ||
157 | |||
158 | return eids; | ||
159 | } | ||
160 | |||
161 | public List<UUID> GetRegions(int estateID) | ||
162 | { | ||
163 | string reply = string.Empty; | ||
164 | // /estates/regions/?eid=int | ||
165 | string uri = m_ServerURI + "/estates/regions/?eid=" + estateID.ToString(); | ||
166 | |||
167 | reply = MakeRequest("GET", uri, string.Empty); | ||
168 | if (String.IsNullOrEmpty(reply)) | ||
169 | return new List<UUID>(); | ||
170 | |||
171 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | ||
172 | |||
173 | List<UUID> regions = new List<UUID>(); | ||
174 | if (replyData != null && replyData.Count > 0) | ||
175 | { | ||
176 | m_log.DebugFormat("[ESTATE CONNECTOR]: GetRegions for estate {0} returned {1} elements", estateID, replyData.Count); | ||
177 | Dictionary<string, object>.ValueCollection data = replyData.Values; | ||
178 | foreach (object r in data) | ||
179 | { | ||
180 | UUID uuid = UUID.Zero; | ||
181 | if (UUID.TryParse(r.ToString(), out uuid)) | ||
182 | regions.Add(uuid); | ||
183 | } | ||
184 | } | ||
185 | else | ||
186 | m_log.DebugFormat("[ESTATE CONNECTOR]: GetRegions from {0} received null or zero response", uri); | ||
187 | |||
188 | return regions; | ||
189 | } | ||
190 | |||
191 | public EstateSettings LoadEstateSettings(UUID regionID, bool create) | ||
192 | { | ||
193 | string reply = string.Empty; | ||
194 | // /estates/estate/?region=uuid&create=[t|f] | ||
195 | string uri = m_ServerURI + string.Format("/estates/estate/?region={0}&create={1}", regionID, create); | ||
196 | |||
197 | reply = MakeRequest("GET", uri, string.Empty); | ||
198 | if (String.IsNullOrEmpty(reply)) | ||
199 | return null; | ||
200 | |||
201 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | ||
202 | |||
203 | if (replyData != null && replyData.Count > 0) | ||
204 | { | ||
205 | m_log.DebugFormat("[ESTATE CONNECTOR]: LoadEstateSettings({0}) returned {1} elements", regionID, replyData.Count); | ||
206 | EstateSettings es = new EstateSettings(replyData); | ||
207 | return es; | ||
208 | } | ||
209 | else | ||
210 | m_log.DebugFormat("[ESTATE CONNECTOR]: LoadEstateSettings(regionID) from {0} received null or zero response", uri); | ||
211 | |||
212 | return null; | ||
213 | } | ||
214 | |||
215 | public EstateSettings LoadEstateSettings(int estateID) | ||
216 | { | ||
217 | string reply = string.Empty; | ||
218 | // /estates/estate/?eid=int | ||
219 | string uri = m_ServerURI + string.Format("/estates/estate/?eid={0}", estateID); | ||
220 | |||
221 | reply = MakeRequest("GET", uri, string.Empty); | ||
222 | if (String.IsNullOrEmpty(reply)) | ||
223 | return null; | ||
224 | |||
225 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | ||
226 | |||
227 | if (replyData != null && replyData.Count > 0) | ||
228 | { | ||
229 | m_log.DebugFormat("[ESTATE CONNECTOR]: LoadEstateSettings({0}) returned {1} elements", estateID, replyData.Count); | ||
230 | EstateSettings es = new EstateSettings(replyData); | ||
231 | return es; | ||
232 | } | ||
233 | else | ||
234 | m_log.DebugFormat("[ESTATE CONNECTOR]: LoadEstateSettings(estateID) from {0} received null or zero response", uri); | ||
235 | |||
236 | return null; | ||
237 | } | ||
238 | |||
239 | /// <summary> | ||
240 | /// Forbidden operation | ||
241 | /// </summary> | ||
242 | /// <returns></returns> | ||
243 | public EstateSettings CreateNewEstate() | ||
244 | { | ||
245 | // No can do | ||
246 | return null; | ||
247 | } | ||
248 | |||
249 | public void StoreEstateSettings(EstateSettings es) | ||
250 | { | ||
251 | // /estates/estate/ | ||
252 | string uri = m_ServerURI + ("/estates/estate"); | ||
253 | |||
254 | Dictionary<string, object> formdata = es.ToMap(); | ||
255 | formdata["OP"] = "STORE"; | ||
256 | |||
257 | PostRequest(uri, formdata); | ||
258 | } | ||
259 | |||
260 | public bool LinkRegion(UUID regionID, int estateID) | ||
261 | { | ||
262 | // /estates/estate/?eid=int®ion=uuid | ||
263 | string uri = m_ServerURI + String.Format("/estates/estate/?eid={0}®ion={1}", estateID, regionID); | ||
264 | |||
265 | Dictionary<string, object> formdata = new Dictionary<string, object>(); | ||
266 | formdata["OP"] = "LINK"; | ||
267 | return PostRequest(uri, formdata); | ||
268 | } | ||
269 | |||
270 | private bool PostRequest(string uri, Dictionary<string, object> sendData) | ||
271 | { | ||
272 | string reqString = ServerUtils.BuildQueryString(sendData); | ||
273 | |||
274 | string reply = MakeRequest("POST", uri, reqString); | ||
275 | if (String.IsNullOrEmpty(reply)) | ||
276 | return false; | ||
277 | |||
278 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | ||
279 | |||
280 | bool result = false; | ||
281 | if (replyData != null && replyData.Count > 0) | ||
282 | { | ||
283 | if (replyData.ContainsKey("Result")) | ||
284 | { | ||
285 | if (Boolean.TryParse(replyData["Result"].ToString(), out result)) | ||
286 | m_log.DebugFormat("[ESTATE CONNECTOR]: PostRequest {0} returned {1}", uri, result); | ||
287 | } | ||
288 | } | ||
289 | else | ||
290 | m_log.DebugFormat("[ESTATE CONNECTOR]: PostRequest {0} received null or zero response", uri); | ||
291 | |||
292 | return result; | ||
293 | } | ||
294 | |||
295 | /// <summary> | ||
296 | /// Forbidden operation | ||
297 | /// </summary> | ||
298 | /// <returns></returns> | ||
299 | public bool DeleteEstate(int estateID) | ||
300 | { | ||
301 | return false; | ||
302 | } | ||
303 | |||
304 | #endregion | ||
305 | |||
306 | private string MakeRequest(string verb, string uri, string formdata) | ||
307 | { | ||
308 | string reply = string.Empty; | ||
309 | try | ||
310 | { | ||
311 | reply = SynchronousRestFormsRequester.MakeRequest(verb, uri, formdata, m_Auth); | ||
312 | } | ||
313 | catch (WebException e) | ||
314 | { | ||
315 | using (HttpWebResponse hwr = (HttpWebResponse)e.Response) | ||
316 | { | ||
317 | if (hwr != null) | ||
318 | { | ||
319 | if (hwr.StatusCode == HttpStatusCode.NotFound) | ||
320 | m_log.Error(string.Format("[ESTATE CONNECTOR]: Resource {0} not found ", uri)); | ||
321 | if (hwr.StatusCode == HttpStatusCode.Unauthorized) | ||
322 | m_log.Error(string.Format("[ESTATE CONNECTOR]: Web request {0} requires authentication ", uri)); | ||
323 | } | ||
324 | else | ||
325 | m_log.Error(string.Format( | ||
326 | "[ESTATE CONNECTOR]: WebException for {0} {1} {2} ", | ||
327 | verb, uri, formdata, e)); | ||
328 | } | ||
329 | } | ||
330 | catch (Exception e) | ||
331 | { | ||
332 | m_log.DebugFormat("[ESTATE CONNECTOR]: Exception when contacting estate server at {0}: {1}", uri, e.Message); | ||
333 | } | ||
334 | |||
335 | return reply; | ||
336 | } | ||
337 | } | ||
338 | } | ||
diff --git a/OpenSim/Services/Connectors/Friends/FriendsServicesConnector.cs b/OpenSim/Services/Connectors/Friends/FriendsServicesConnector.cs index b1dd84e..74851a9 100644 --- a/OpenSim/Services/Connectors/Friends/FriendsServicesConnector.cs +++ b/OpenSim/Services/Connectors/Friends/FriendsServicesConnector.cs | |||
@@ -32,6 +32,7 @@ using System.IO; | |||
32 | using System.Reflection; | 32 | using System.Reflection; |
33 | using Nini.Config; | 33 | using Nini.Config; |
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Framework.ServiceAuth; | ||
35 | using OpenSim.Framework.Communications; | 36 | using OpenSim.Framework.Communications; |
36 | using OpenSim.Services.Interfaces; | 37 | using OpenSim.Services.Interfaces; |
37 | using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; | 38 | using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; |
@@ -40,7 +41,7 @@ using OpenMetaverse; | |||
40 | 41 | ||
41 | namespace OpenSim.Services.Connectors.Friends | 42 | namespace OpenSim.Services.Connectors.Friends |
42 | { | 43 | { |
43 | public class FriendsServicesConnector : IFriendsService | 44 | public class FriendsServicesConnector : BaseServiceConnector, IFriendsService |
44 | { | 45 | { |
45 | private static readonly ILog m_log = | 46 | private static readonly ILog m_log = |
46 | LogManager.GetLogger( | 47 | LogManager.GetLogger( |
@@ -80,6 +81,7 @@ namespace OpenSim.Services.Connectors.Friends | |||
80 | throw new Exception("Friends connector init error"); | 81 | throw new Exception("Friends connector init error"); |
81 | } | 82 | } |
82 | m_ServerURI = serviceURI; | 83 | m_ServerURI = serviceURI; |
84 | base.Initialise(source, "FriendsService"); | ||
83 | } | 85 | } |
84 | 86 | ||
85 | 87 | ||
@@ -112,7 +114,7 @@ namespace OpenSim.Services.Connectors.Friends | |||
112 | 114 | ||
113 | try | 115 | try |
114 | { | 116 | { |
115 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString); | 117 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth); |
116 | if (reply != string.Empty) | 118 | if (reply != string.Empty) |
117 | { | 119 | { |
118 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | 120 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); |
@@ -168,7 +170,7 @@ namespace OpenSim.Services.Connectors.Friends | |||
168 | string uri = m_ServerURI + "/friends"; | 170 | string uri = m_ServerURI + "/friends"; |
169 | try | 171 | try |
170 | { | 172 | { |
171 | reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData)); | 173 | reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData), m_Auth); |
172 | } | 174 | } |
173 | catch (Exception e) | 175 | catch (Exception e) |
174 | { | 176 | { |
@@ -223,7 +225,7 @@ namespace OpenSim.Services.Connectors.Friends | |||
223 | string uri = m_ServerURI + "/friends"; | 225 | string uri = m_ServerURI + "/friends"; |
224 | try | 226 | try |
225 | { | 227 | { |
226 | reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData)); | 228 | reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData), m_Auth); |
227 | } | 229 | } |
228 | catch (Exception e) | 230 | catch (Exception e) |
229 | { | 231 | { |
diff --git a/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs b/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs index af91cdb..d208f1e 100644 --- a/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs +++ b/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs | |||
@@ -33,6 +33,7 @@ using System.Reflection; | |||
33 | using Nini.Config; | 33 | using Nini.Config; |
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Communications; | 35 | using OpenSim.Framework.Communications; |
36 | using OpenSim.Framework.ServiceAuth; | ||
36 | using OpenSim.Services.Interfaces; | 37 | using OpenSim.Services.Interfaces; |
37 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | 38 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; |
38 | using OpenSim.Server.Base; | 39 | using OpenSim.Server.Base; |
@@ -40,7 +41,7 @@ using OpenMetaverse; | |||
40 | 41 | ||
41 | namespace OpenSim.Services.Connectors | 42 | namespace OpenSim.Services.Connectors |
42 | { | 43 | { |
43 | public class GridServicesConnector : IGridService | 44 | public class GridServicesConnector : BaseServiceConnector, IGridService |
44 | { | 45 | { |
45 | private static readonly ILog m_log = | 46 | private static readonly ILog m_log = |
46 | LogManager.GetLogger( | 47 | LogManager.GetLogger( |
@@ -83,6 +84,8 @@ namespace OpenSim.Services.Connectors | |||
83 | throw new Exception("Grid connector init error"); | 84 | throw new Exception("Grid connector init error"); |
84 | } | 85 | } |
85 | m_ServerURI = serviceURI; | 86 | m_ServerURI = serviceURI; |
87 | |||
88 | base.Initialise(source, "GridService"); | ||
86 | } | 89 | } |
87 | 90 | ||
88 | 91 | ||
@@ -105,7 +108,7 @@ namespace OpenSim.Services.Connectors | |||
105 | // m_log.DebugFormat("[GRID CONNECTOR]: queryString = {0}", reqString); | 108 | // m_log.DebugFormat("[GRID CONNECTOR]: queryString = {0}", reqString); |
106 | try | 109 | try |
107 | { | 110 | { |
108 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString); | 111 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth); |
109 | if (reply != string.Empty) | 112 | if (reply != string.Empty) |
110 | { | 113 | { |
111 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | 114 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); |
@@ -161,7 +164,7 @@ namespace OpenSim.Services.Connectors | |||
161 | try | 164 | try |
162 | { | 165 | { |
163 | string reply | 166 | string reply |
164 | = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData)); | 167 | = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData), m_Auth); |
165 | 168 | ||
166 | if (reply != string.Empty) | 169 | if (reply != string.Empty) |
167 | { | 170 | { |
@@ -198,7 +201,7 @@ namespace OpenSim.Services.Connectors | |||
198 | 201 | ||
199 | try | 202 | try |
200 | { | 203 | { |
201 | reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString); | 204 | reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth); |
202 | } | 205 | } |
203 | catch (Exception e) | 206 | catch (Exception e) |
204 | { | 207 | { |
@@ -241,7 +244,7 @@ namespace OpenSim.Services.Connectors | |||
241 | string uri = m_ServerURI + "/grid"; | 244 | string uri = m_ServerURI + "/grid"; |
242 | try | 245 | try |
243 | { | 246 | { |
244 | reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData)); | 247 | reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData), m_Auth); |
245 | } | 248 | } |
246 | catch (Exception e) | 249 | catch (Exception e) |
247 | { | 250 | { |
@@ -293,7 +296,7 @@ namespace OpenSim.Services.Connectors | |||
293 | { | 296 | { |
294 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 297 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
295 | uri, | 298 | uri, |
296 | ServerUtils.BuildQueryString(sendData)); | 299 | ServerUtils.BuildQueryString(sendData), m_Auth); |
297 | } | 300 | } |
298 | catch (Exception e) | 301 | catch (Exception e) |
299 | { | 302 | { |
@@ -340,7 +343,7 @@ namespace OpenSim.Services.Connectors | |||
340 | { | 343 | { |
341 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 344 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
342 | uri, | 345 | uri, |
343 | ServerUtils.BuildQueryString(sendData)); | 346 | ServerUtils.BuildQueryString(sendData), m_Auth); |
344 | } | 347 | } |
345 | catch (Exception e) | 348 | catch (Exception e) |
346 | { | 349 | { |
@@ -384,7 +387,7 @@ namespace OpenSim.Services.Connectors | |||
384 | { | 387 | { |
385 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 388 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
386 | uri, | 389 | uri, |
387 | ServerUtils.BuildQueryString(sendData)); | 390 | ServerUtils.BuildQueryString(sendData), m_Auth); |
388 | } | 391 | } |
389 | catch (Exception e) | 392 | catch (Exception e) |
390 | { | 393 | { |
@@ -438,7 +441,7 @@ namespace OpenSim.Services.Connectors | |||
438 | { | 441 | { |
439 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 442 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
440 | uri, | 443 | uri, |
441 | ServerUtils.BuildQueryString(sendData)); | 444 | ServerUtils.BuildQueryString(sendData), m_Auth); |
442 | 445 | ||
443 | //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); | 446 | //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); |
444 | } | 447 | } |
@@ -489,7 +492,7 @@ namespace OpenSim.Services.Connectors | |||
489 | { | 492 | { |
490 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 493 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
491 | uri, | 494 | uri, |
492 | ServerUtils.BuildQueryString(sendData)); | 495 | ServerUtils.BuildQueryString(sendData), m_Auth); |
493 | 496 | ||
494 | //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); | 497 | //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); |
495 | } | 498 | } |
@@ -540,7 +543,7 @@ namespace OpenSim.Services.Connectors | |||
540 | { | 543 | { |
541 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 544 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
542 | uri, | 545 | uri, |
543 | ServerUtils.BuildQueryString(sendData)); | 546 | ServerUtils.BuildQueryString(sendData), m_Auth); |
544 | 547 | ||
545 | //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); | 548 | //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); |
546 | } | 549 | } |
@@ -593,7 +596,7 @@ namespace OpenSim.Services.Connectors | |||
593 | { | 596 | { |
594 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 597 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
595 | uri, | 598 | uri, |
596 | ServerUtils.BuildQueryString(sendData)); | 599 | ServerUtils.BuildQueryString(sendData), m_Auth); |
597 | 600 | ||
598 | //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); | 601 | //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); |
599 | } | 602 | } |
@@ -644,7 +647,7 @@ namespace OpenSim.Services.Connectors | |||
644 | { | 647 | { |
645 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 648 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
646 | uri, | 649 | uri, |
647 | ServerUtils.BuildQueryString(sendData)); | 650 | ServerUtils.BuildQueryString(sendData), m_Auth); |
648 | 651 | ||
649 | //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); | 652 | //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); |
650 | } | 653 | } |
@@ -695,7 +698,7 @@ namespace OpenSim.Services.Connectors | |||
695 | { | 698 | { |
696 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 699 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
697 | uri, | 700 | uri, |
698 | ServerUtils.BuildQueryString(sendData)); | 701 | ServerUtils.BuildQueryString(sendData), m_Auth); |
699 | } | 702 | } |
700 | catch (Exception e) | 703 | catch (Exception e) |
701 | { | 704 | { |
@@ -726,6 +729,45 @@ namespace OpenSim.Services.Connectors | |||
726 | return flags; | 729 | return flags; |
727 | } | 730 | } |
728 | 731 | ||
732 | public Dictionary<string, object> GetExtraFeatures() | ||
733 | { | ||
734 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | ||
735 | Dictionary<string, object> extraFeatures = new Dictionary<string, object>(); | ||
736 | |||
737 | sendData["METHOD"] = "get_grid_extra_features"; | ||
738 | |||
739 | string reply = string.Empty; | ||
740 | string uri = m_ServerURI + "/grid"; | ||
741 | |||
742 | try | ||
743 | { | ||
744 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | ||
745 | uri, | ||
746 | ServerUtils.BuildQueryString(sendData), m_Auth); | ||
747 | } | ||
748 | catch (Exception e) | ||
749 | { | ||
750 | m_log.DebugFormat("[GRID CONNECTOR]: GetExtraFeatures - Exception when contacting grid server at {0}: {1}", uri, e.Message); | ||
751 | return extraFeatures; | ||
752 | } | ||
753 | |||
754 | if (reply != string.Empty) | ||
755 | { | ||
756 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | ||
757 | |||
758 | if ((replyData != null) && replyData.Count > 0) | ||
759 | { | ||
760 | foreach (string key in replyData.Keys) | ||
761 | { | ||
762 | extraFeatures[key] = replyData[key].ToString(); | ||
763 | } | ||
764 | } | ||
765 | } | ||
766 | else | ||
767 | m_log.DebugFormat("[GRID CONNECTOR]: GetExtraServiceURLs received null reply"); | ||
768 | |||
769 | return extraFeatures; | ||
770 | } | ||
729 | #endregion | 771 | #endregion |
730 | 772 | ||
731 | } | 773 | } |
diff --git a/OpenSim/Services/Connectors/GridUser/GridUserServicesConnector.cs b/OpenSim/Services/Connectors/GridUser/GridUserServicesConnector.cs index 1a62d2f..ffdd94a 100644 --- a/OpenSim/Services/Connectors/GridUser/GridUserServicesConnector.cs +++ b/OpenSim/Services/Connectors/GridUser/GridUserServicesConnector.cs | |||
@@ -33,6 +33,7 @@ using System.Reflection; | |||
33 | using Nini.Config; | 33 | using Nini.Config; |
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Communications; | 35 | using OpenSim.Framework.Communications; |
36 | using OpenSim.Framework.ServiceAuth; | ||
36 | using OpenSim.Services.Interfaces; | 37 | using OpenSim.Services.Interfaces; |
37 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | 38 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; |
38 | using OpenSim.Server.Base; | 39 | using OpenSim.Server.Base; |
@@ -40,7 +41,7 @@ using OpenMetaverse; | |||
40 | 41 | ||
41 | namespace OpenSim.Services.Connectors | 42 | namespace OpenSim.Services.Connectors |
42 | { | 43 | { |
43 | public class GridUserServicesConnector : IGridUserService | 44 | public class GridUserServicesConnector : BaseServiceConnector, IGridUserService |
44 | { | 45 | { |
45 | private static readonly ILog m_log = | 46 | private static readonly ILog m_log = |
46 | LogManager.GetLogger( | 47 | LogManager.GetLogger( |
@@ -80,6 +81,7 @@ namespace OpenSim.Services.Connectors | |||
80 | throw new Exception("GridUser connector init error"); | 81 | throw new Exception("GridUser connector init error"); |
81 | } | 82 | } |
82 | m_ServerURI = serviceURI; | 83 | m_ServerURI = serviceURI; |
84 | base.Initialise(source, "GridUserService"); | ||
83 | } | 85 | } |
84 | 86 | ||
85 | 87 | ||
@@ -162,7 +164,8 @@ namespace OpenSim.Services.Connectors | |||
162 | { | 164 | { |
163 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", | 165 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", |
164 | uri, | 166 | uri, |
165 | reqString); | 167 | reqString, |
168 | m_Auth); | ||
166 | if (reply != string.Empty) | 169 | if (reply != string.Empty) |
167 | { | 170 | { |
168 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | 171 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); |
@@ -198,7 +201,8 @@ namespace OpenSim.Services.Connectors | |||
198 | { | 201 | { |
199 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", | 202 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", |
200 | uri, | 203 | uri, |
201 | reqString); | 204 | reqString, |
205 | m_Auth); | ||
202 | if (reply != string.Empty) | 206 | if (reply != string.Empty) |
203 | { | 207 | { |
204 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | 208 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); |
@@ -243,7 +247,8 @@ namespace OpenSim.Services.Connectors | |||
243 | { | 247 | { |
244 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 248 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
245 | uri, | 249 | uri, |
246 | reqString); | 250 | reqString, |
251 | m_Auth); | ||
247 | if (reply == null || (reply != null && reply == string.Empty)) | 252 | if (reply == null || (reply != null && reply == string.Empty)) |
248 | { | 253 | { |
249 | m_log.DebugFormat("[GRID USER CONNECTOR]: GetGridUserInfo received null or empty reply"); | 254 | m_log.DebugFormat("[GRID USER CONNECTOR]: GetGridUserInfo received null or empty reply"); |
diff --git a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs index 803cd1b..2340998 100644 --- a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs | |||
@@ -202,10 +202,16 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
202 | return mapTile; | 202 | return mapTile; |
203 | } | 203 | } |
204 | 204 | ||
205 | public GridRegion GetHyperlinkRegion(GridRegion gatekeeper, UUID regionID) | 205 | public GridRegion GetHyperlinkRegion(GridRegion gatekeeper, UUID regionID, UUID agentID, string agentHomeURI, out string message) |
206 | { | 206 | { |
207 | Hashtable hash = new Hashtable(); | 207 | Hashtable hash = new Hashtable(); |
208 | hash["region_uuid"] = regionID.ToString(); | 208 | hash["region_uuid"] = regionID.ToString(); |
209 | if (agentID != UUID.Zero) | ||
210 | { | ||
211 | hash["agent_id"] = agentID.ToString(); | ||
212 | if (agentHomeURI != null) | ||
213 | hash["agent_home_uri"] = agentHomeURI; | ||
214 | } | ||
209 | 215 | ||
210 | IList paramList = new ArrayList(); | 216 | IList paramList = new ArrayList(); |
211 | paramList.Add(hash); | 217 | paramList.Add(hash); |
@@ -219,12 +225,14 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
219 | } | 225 | } |
220 | catch (Exception e) | 226 | catch (Exception e) |
221 | { | 227 | { |
228 | message = "Error contacting grid."; | ||
222 | m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Exception " + e.Message); | 229 | m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Exception " + e.Message); |
223 | return null; | 230 | return null; |
224 | } | 231 | } |
225 | 232 | ||
226 | if (response.IsFault) | 233 | if (response.IsFault) |
227 | { | 234 | { |
235 | message = "Error contacting grid."; | ||
228 | m_log.ErrorFormat("[GATEKEEPER SERVICE CONNECTOR]: remote call returned an error: {0}", response.FaultString); | 236 | m_log.ErrorFormat("[GATEKEEPER SERVICE CONNECTOR]: remote call returned an error: {0}", response.FaultString); |
229 | return null; | 237 | return null; |
230 | } | 238 | } |
@@ -236,6 +244,14 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
236 | { | 244 | { |
237 | bool success = false; | 245 | bool success = false; |
238 | Boolean.TryParse((string)hash["result"], out success); | 246 | Boolean.TryParse((string)hash["result"], out success); |
247 | |||
248 | if (hash["message"] != null) | ||
249 | message = (string)hash["message"]; | ||
250 | else if (success) | ||
251 | message = null; | ||
252 | else | ||
253 | message = "The teleport destination could not be found."; // probably the dest grid is old and doesn't send 'message', but the most common problem is that the region is unavailable | ||
254 | |||
239 | if (success) | 255 | if (success) |
240 | { | 256 | { |
241 | GridRegion region = new GridRegion(); | 257 | GridRegion region = new GridRegion(); |
@@ -255,6 +271,18 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
255 | region.RegionLocY = n; | 271 | region.RegionLocY = n; |
256 | //m_log.Debug(">> HERE, y: " + region.RegionLocY); | 272 | //m_log.Debug(">> HERE, y: " + region.RegionLocY); |
257 | } | 273 | } |
274 | if (hash["size_x"] != null) | ||
275 | { | ||
276 | Int32.TryParse((string)hash["size_x"], out n); | ||
277 | region.RegionSizeX = n; | ||
278 | //m_log.Debug(">> HERE, x: " + region.RegionLocX); | ||
279 | } | ||
280 | if (hash["size_y"] != null) | ||
281 | { | ||
282 | Int32.TryParse((string)hash["size_y"], out n); | ||
283 | region.RegionSizeY = n; | ||
284 | //m_log.Debug(">> HERE, y: " + region.RegionLocY); | ||
285 | } | ||
258 | if (hash["region_name"] != null) | 286 | if (hash["region_name"] != null) |
259 | { | 287 | { |
260 | region.RegionName = (string)hash["region_name"]; | 288 | region.RegionName = (string)hash["region_name"]; |
@@ -293,6 +321,7 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
293 | } | 321 | } |
294 | catch (Exception e) | 322 | catch (Exception e) |
295 | { | 323 | { |
324 | message = "Error parsing response from grid."; | ||
296 | m_log.Error("[GATEKEEPER SERVICE CONNECTOR]: Got exception while parsing hyperlink response " + e.StackTrace); | 325 | m_log.Error("[GATEKEEPER SERVICE CONNECTOR]: Got exception while parsing hyperlink response " + e.StackTrace); |
297 | return null; | 326 | return null; |
298 | } | 327 | } |
diff --git a/OpenSim/Services/Connectors/Hypergrid/HeloServicesConnector.cs b/OpenSim/Services/Connectors/Hypergrid/HeloServicesConnector.cs index 5004d99..b5e6d69 100644 --- a/OpenSim/Services/Connectors/Hypergrid/HeloServicesConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/HeloServicesConnector.cs | |||
@@ -47,16 +47,22 @@ namespace OpenSim.Services.Connectors | |||
47 | 47 | ||
48 | public HeloServicesConnector(string serverURI) | 48 | public HeloServicesConnector(string serverURI) |
49 | { | 49 | { |
50 | if (!serverURI.EndsWith("=")) | 50 | try |
51 | m_ServerURI = serverURI.TrimEnd('/') + "/helo/"; | ||
52 | else | ||
53 | { | 51 | { |
54 | // Simian sends malformed urls like this: | 52 | Uri uri; |
55 | // http://valley.virtualportland.org/simtest/Grid/?id= | 53 | |
56 | // | 54 | if (!serverURI.EndsWith("=")) |
57 | try | 55 | { |
56 | // Let's check if this is a valid URI, because it may not be | ||
57 | uri = new Uri(serverURI); | ||
58 | m_ServerURI = serverURI.TrimEnd('/') + "/helo/"; | ||
59 | } | ||
60 | else | ||
58 | { | 61 | { |
59 | Uri uri = new Uri(serverURI + "xxx"); | 62 | // Simian sends malformed urls like this: |
63 | // http://valley.virtualportland.org/simtest/Grid/?id= | ||
64 | // | ||
65 | uri = new Uri(serverURI + "xxx"); | ||
60 | if (uri.Query == string.Empty) | 66 | if (uri.Query == string.Empty) |
61 | m_ServerURI = serverURI.TrimEnd('/') + "/helo/"; | 67 | m_ServerURI = serverURI.TrimEnd('/') + "/helo/"; |
62 | else | 68 | else |
@@ -66,21 +72,28 @@ namespace OpenSim.Services.Connectors | |||
66 | m_ServerURI = m_ServerURI.TrimEnd('/') + "/helo/"; | 72 | m_ServerURI = m_ServerURI.TrimEnd('/') + "/helo/"; |
67 | } | 73 | } |
68 | } | 74 | } |
69 | catch (UriFormatException) | 75 | |
70 | { | 76 | } |
71 | m_log.WarnFormat("[HELO SERVICE]: Malformed URL {0}", serverURI); | 77 | catch (UriFormatException) |
72 | } | 78 | { |
79 | m_log.WarnFormat("[HELO SERVICE]: Malformed URL {0}", serverURI); | ||
73 | } | 80 | } |
74 | } | 81 | } |
75 | 82 | ||
76 | public virtual string Helo() | 83 | public virtual string Helo() |
77 | { | 84 | { |
78 | HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(m_ServerURI); | 85 | if (String.IsNullOrEmpty(m_ServerURI)) |
79 | // Eventually we need to switch to HEAD | 86 | { |
80 | /* req.Method = "HEAD"; */ | 87 | m_log.WarnFormat("[HELO SERVICE]: Unable to invoke HELO due to empty URL"); |
88 | return String.Empty; | ||
89 | } | ||
81 | 90 | ||
82 | try | 91 | try |
83 | { | 92 | { |
93 | HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(m_ServerURI); | ||
94 | // Eventually we need to switch to HEAD | ||
95 | /* req.Method = "HEAD"; */ | ||
96 | |||
84 | using (WebResponse response = req.GetResponse()) | 97 | using (WebResponse response = req.GetResponse()) |
85 | { | 98 | { |
86 | if (response.Headers.Get("X-Handlers-Provided") == null) // just in case this ever returns a null | 99 | if (response.Headers.Get("X-Handlers-Provided") == null) // just in case this ever returns a null |
diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs index 32ea4ee..10b8d22 100644 --- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs | |||
@@ -50,6 +50,7 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
50 | LogManager.GetLogger( | 50 | LogManager.GetLogger( |
51 | MethodBase.GetCurrentMethod().DeclaringType); | 51 | MethodBase.GetCurrentMethod().DeclaringType); |
52 | 52 | ||
53 | private string m_ServerURLHost; | ||
53 | private string m_ServerURL; | 54 | private string m_ServerURL; |
54 | private GridRegion m_Gatekeeper; | 55 | private GridRegion m_Gatekeeper; |
55 | 56 | ||
@@ -59,7 +60,7 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
59 | 60 | ||
60 | public UserAgentServiceConnector(string url, bool dnsLookup) | 61 | public UserAgentServiceConnector(string url, bool dnsLookup) |
61 | { | 62 | { |
62 | m_ServerURL = url; | 63 | m_ServerURL = m_ServerURLHost = url; |
63 | 64 | ||
64 | if (dnsLookup) | 65 | if (dnsLookup) |
65 | { | 66 | { |
@@ -75,10 +76,11 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
75 | } | 76 | } |
76 | catch (Exception e) | 77 | catch (Exception e) |
77 | { | 78 | { |
78 | m_log.DebugFormat("[USER AGENT CONNECTOR]: Malformed Uri {0}: {1}", m_ServerURL, e.Message); | 79 | m_log.DebugFormat("[USER AGENT CONNECTOR]: Malformed Uri {0}: {1}", url, e.Message); |
79 | } | 80 | } |
80 | } | 81 | } |
81 | m_log.DebugFormat("[USER AGENT CONNECTOR]: new connector to {0} ({1})", url, m_ServerURL); | 82 | |
83 | //m_log.DebugFormat("[USER AGENT CONNECTOR]: new connector to {0} ({1})", url, m_ServerURL); | ||
82 | } | 84 | } |
83 | 85 | ||
84 | public UserAgentServiceConnector(IConfigSource config) | 86 | public UserAgentServiceConnector(IConfigSource config) |
@@ -98,9 +100,16 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
98 | m_log.Error("[USER AGENT CONNECTOR]: No Server URI named in section UserAgentService"); | 100 | m_log.Error("[USER AGENT CONNECTOR]: No Server URI named in section UserAgentService"); |
99 | throw new Exception("UserAgent connector init error"); | 101 | throw new Exception("UserAgent connector init error"); |
100 | } | 102 | } |
103 | <<<<<<< HEAD | ||
104 | |||
105 | m_ServerURL = m_ServerURLHost = serviceURI; | ||
106 | if (!m_ServerURL.EndsWith("/")) | ||
107 | m_ServerURL += "/"; | ||
108 | ======= | ||
101 | m_ServerURL = serviceURI; | 109 | m_ServerURL = serviceURI; |
110 | >>>>>>> avn/ubitvar | ||
102 | 111 | ||
103 | m_log.DebugFormat("[USER AGENT CONNECTOR]: UserAgentServiceConnector started for {0}", m_ServerURL); | 112 | //m_log.DebugFormat("[USER AGENT CONNECTOR]: new connector to {0}", m_ServerURL); |
104 | } | 113 | } |
105 | 114 | ||
106 | protected override string AgentPath() | 115 | protected override string AgentPath() |
@@ -111,7 +120,7 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
111 | // The Login service calls this interface with fromLogin=true | 120 | // The Login service calls this interface with fromLogin=true |
112 | // Sims call it with fromLogin=false | 121 | // Sims call it with fromLogin=false |
113 | // Either way, this is verified by the handler | 122 | // Either way, this is verified by the handler |
114 | public bool LoginAgentToGrid(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, bool fromLogin, out string reason) | 123 | public bool LoginAgentToGrid(GridRegion source, AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, bool fromLogin, out string reason) |
115 | { | 124 | { |
116 | reason = String.Empty; | 125 | reason = String.Empty; |
117 | 126 | ||
@@ -133,59 +142,62 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
133 | Console.WriteLine(" >>> LoginAgentToGrid <<< " + home.ServerURI); | 142 | Console.WriteLine(" >>> LoginAgentToGrid <<< " + home.ServerURI); |
134 | 143 | ||
135 | uint flags = fromLogin ? (uint)TeleportFlags.ViaLogin : (uint)TeleportFlags.ViaHome; | 144 | uint flags = fromLogin ? (uint)TeleportFlags.ViaLogin : (uint)TeleportFlags.ViaHome; |
136 | return CreateAgent(home, aCircuit, flags, out reason); | 145 | return CreateAgent(source, home, aCircuit, flags, out reason); |
137 | } | 146 | } |
138 | 147 | ||
139 | 148 | ||
140 | // The simulators call this interface | 149 | // The simulators call this interface |
141 | public bool LoginAgentToGrid(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, out string reason) | 150 | public bool LoginAgentToGrid(GridRegion source, AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, out string reason) |
142 | { | 151 | { |
143 | return LoginAgentToGrid(aCircuit, gatekeeper, destination, false, out reason); | 152 | return LoginAgentToGrid(source, aCircuit, gatekeeper, destination, false, out reason); |
144 | } | 153 | } |
145 | 154 | ||
146 | protected override void PackData(OSDMap args, AgentCircuitData aCircuit, GridRegion destination, uint flags) | 155 | protected override void PackData(OSDMap args, GridRegion source, AgentCircuitData aCircuit, GridRegion destination, uint flags) |
147 | { | 156 | { |
148 | base.PackData(args, aCircuit, destination, flags); | 157 | base.PackData(args, source, aCircuit, destination, flags); |
149 | args["gatekeeper_serveruri"] = OSD.FromString(m_Gatekeeper.ServerURI); | 158 | args["gatekeeper_serveruri"] = OSD.FromString(m_Gatekeeper.ServerURI); |
150 | args["gatekeeper_host"] = OSD.FromString(m_Gatekeeper.ExternalHostName); | 159 | args["gatekeeper_host"] = OSD.FromString(m_Gatekeeper.ExternalHostName); |
151 | args["gatekeeper_port"] = OSD.FromString(m_Gatekeeper.HttpPort.ToString()); | 160 | args["gatekeeper_port"] = OSD.FromString(m_Gatekeeper.HttpPort.ToString()); |
152 | args["destination_serveruri"] = OSD.FromString(destination.ServerURI); | 161 | args["destination_serveruri"] = OSD.FromString(destination.ServerURI); |
153 | } | 162 | } |
154 | 163 | ||
155 | protected OSDMap PackCreateAgentArguments(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, IPEndPoint ipaddress) | 164 | public void SetClientToken(UUID sessionID, string token) |
165 | { | ||
166 | // no-op | ||
167 | } | ||
168 | |||
169 | private Hashtable CallServer(string methodName, Hashtable hash) | ||
156 | { | 170 | { |
157 | OSDMap args = null; | 171 | IList paramList = new ArrayList(); |
172 | paramList.Add(hash); | ||
173 | |||
174 | XmlRpcRequest request = new XmlRpcRequest(methodName, paramList); | ||
175 | |||
176 | // Send and get reply | ||
177 | XmlRpcResponse response = null; | ||
158 | try | 178 | try |
159 | { | 179 | { |
160 | args = aCircuit.PackAgentCircuitData(); | 180 | response = request.Send(m_ServerURL, 10000); |
161 | } | 181 | } |
162 | catch (Exception e) | 182 | catch (Exception e) |
163 | { | 183 | { |
164 | m_log.Debug("[USER AGENT CONNECTOR]: PackAgentCircuitData failed with exception: " + e.Message); | 184 | m_log.DebugFormat("[USER AGENT CONNECTOR]: {0} call to {1} failed: {2}", methodName, m_ServerURLHost, e.Message); |
185 | throw; | ||
165 | } | 186 | } |
166 | 187 | ||
167 | // Add the input arguments | 188 | if (response.IsFault) |
168 | args["gatekeeper_serveruri"] = OSD.FromString(gatekeeper.ServerURI); | 189 | { |
169 | args["gatekeeper_host"] = OSD.FromString(gatekeeper.ExternalHostName); | 190 | throw new Exception(string.Format("[USER AGENT CONNECTOR]: {0} call to {1} returned an error: {2}", methodName, m_ServerURLHost, response.FaultString)); |
170 | args["gatekeeper_port"] = OSD.FromString(gatekeeper.HttpPort.ToString()); | 191 | } |
171 | args["destination_x"] = OSD.FromString(destination.RegionLocX.ToString()); | ||
172 | args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString()); | ||
173 | args["destination_name"] = OSD.FromString(destination.RegionName); | ||
174 | args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString()); | ||
175 | args["destination_serveruri"] = OSD.FromString(destination.ServerURI); | ||
176 | 192 | ||
177 | // 10/3/2010 | 193 | hash = (Hashtable)response.Value; |
178 | // I added the client_ip up to the regular AgentCircuitData, so this doesn't need to be here. | ||
179 | // This need cleaning elsewhere... | ||
180 | //if (ipaddress != null) | ||
181 | // args["client_ip"] = OSD.FromString(ipaddress.Address.ToString()); | ||
182 | 194 | ||
183 | return args; | 195 | if (hash == null) |
184 | } | 196 | { |
197 | throw new Exception(string.Format("[USER AGENT CONNECTOR]: {0} call to {1} returned null", methodName, m_ServerURLHost)); | ||
198 | } | ||
185 | 199 | ||
186 | public void SetClientToken(UUID sessionID, string token) | 200 | return hash; |
187 | { | ||
188 | // no-op | ||
189 | } | 201 | } |
190 | 202 | ||
191 | public GridRegion GetHomeRegion(UUID userID, out Vector3 position, out Vector3 lookAt) | 203 | public GridRegion GetHomeRegion(UUID userID, out Vector3 position, out Vector3 lookAt) |
@@ -195,89 +207,70 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
195 | Hashtable hash = new Hashtable(); | 207 | Hashtable hash = new Hashtable(); |
196 | hash["userID"] = userID.ToString(); | 208 | hash["userID"] = userID.ToString(); |
197 | 209 | ||
198 | IList paramList = new ArrayList(); | 210 | hash = CallServer("get_home_region", hash); |
199 | paramList.Add(hash); | ||
200 | 211 | ||
201 | XmlRpcRequest request = new XmlRpcRequest("get_home_region", paramList); | 212 | bool success; |
202 | XmlRpcResponse response = null; | 213 | if (!Boolean.TryParse((string)hash["result"], out success) || !success) |
203 | try | 214 | return null; |
215 | |||
216 | GridRegion region = new GridRegion(); | ||
217 | |||
218 | UUID.TryParse((string)hash["uuid"], out region.RegionID); | ||
219 | //m_log.Debug(">> HERE, uuid: " + region.RegionID); | ||
220 | int n = 0; | ||
221 | if (hash["x"] != null) | ||
204 | { | 222 | { |
205 | response = request.Send(m_ServerURL, 10000); | 223 | Int32.TryParse((string)hash["x"], out n); |
224 | region.RegionLocX = n; | ||
225 | //m_log.Debug(">> HERE, x: " + region.RegionLocX); | ||
206 | } | 226 | } |
207 | catch (Exception) | 227 | if (hash["y"] != null) |
208 | { | 228 | { |
209 | return null; | 229 | Int32.TryParse((string)hash["y"], out n); |
230 | region.RegionLocY = n; | ||
231 | //m_log.Debug(">> HERE, y: " + region.RegionLocY); | ||
210 | } | 232 | } |
211 | 233 | if (hash["size_x"] != null) | |
212 | if (response.IsFault) | ||
213 | { | 234 | { |
214 | return null; | 235 | Int32.TryParse((string)hash["size_x"], out n); |
236 | region.RegionSizeX = n; | ||
237 | //m_log.Debug(">> HERE, x: " + region.RegionLocX); | ||
215 | } | 238 | } |
216 | 239 | if (hash["size_y"] != null) | |
217 | hash = (Hashtable)response.Value; | ||
218 | //foreach (Object o in hash) | ||
219 | // m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value); | ||
220 | try | ||
221 | { | 240 | { |
222 | bool success = false; | 241 | Int32.TryParse((string)hash["size_y"], out n); |
223 | Boolean.TryParse((string)hash["result"], out success); | 242 | region.RegionSizeY = n; |
224 | if (success) | 243 | //m_log.Debug(">> HERE, y: " + region.RegionLocY); |
225 | { | ||
226 | GridRegion region = new GridRegion(); | ||
227 | |||
228 | UUID.TryParse((string)hash["uuid"], out region.RegionID); | ||
229 | //m_log.Debug(">> HERE, uuid: " + region.RegionID); | ||
230 | int n = 0; | ||
231 | if (hash["x"] != null) | ||
232 | { | ||
233 | Int32.TryParse((string)hash["x"], out n); | ||
234 | region.RegionLocX = n; | ||
235 | //m_log.Debug(">> HERE, x: " + region.RegionLocX); | ||
236 | } | ||
237 | if (hash["y"] != null) | ||
238 | { | ||
239 | Int32.TryParse((string)hash["y"], out n); | ||
240 | region.RegionLocY = n; | ||
241 | //m_log.Debug(">> HERE, y: " + region.RegionLocY); | ||
242 | } | ||
243 | if (hash["region_name"] != null) | ||
244 | { | ||
245 | region.RegionName = (string)hash["region_name"]; | ||
246 | //m_log.Debug(">> HERE, name: " + region.RegionName); | ||
247 | } | ||
248 | if (hash["hostname"] != null) | ||
249 | region.ExternalHostName = (string)hash["hostname"]; | ||
250 | if (hash["http_port"] != null) | ||
251 | { | ||
252 | uint p = 0; | ||
253 | UInt32.TryParse((string)hash["http_port"], out p); | ||
254 | region.HttpPort = p; | ||
255 | } | ||
256 | if (hash.ContainsKey("server_uri") && hash["server_uri"] != null) | ||
257 | region.ServerURI = (string)hash["server_uri"]; | ||
258 | |||
259 | if (hash["internal_port"] != null) | ||
260 | { | ||
261 | int p = 0; | ||
262 | Int32.TryParse((string)hash["internal_port"], out p); | ||
263 | region.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), p); | ||
264 | } | ||
265 | if (hash["position"] != null) | ||
266 | Vector3.TryParse((string)hash["position"], out position); | ||
267 | if (hash["lookAt"] != null) | ||
268 | Vector3.TryParse((string)hash["lookAt"], out lookAt); | ||
269 | |||
270 | // Successful return | ||
271 | return region; | ||
272 | } | ||
273 | |||
274 | } | 244 | } |
275 | catch (Exception) | 245 | if (hash["region_name"] != null) |
276 | { | 246 | { |
277 | return null; | 247 | region.RegionName = (string)hash["region_name"]; |
248 | //m_log.Debug(">> HERE, name: " + region.RegionName); | ||
249 | } | ||
250 | if (hash["hostname"] != null) | ||
251 | region.ExternalHostName = (string)hash["hostname"]; | ||
252 | if (hash["http_port"] != null) | ||
253 | { | ||
254 | uint p = 0; | ||
255 | UInt32.TryParse((string)hash["http_port"], out p); | ||
256 | region.HttpPort = p; | ||
278 | } | 257 | } |
258 | if (hash.ContainsKey("server_uri") && hash["server_uri"] != null) | ||
259 | region.ServerURI = (string)hash["server_uri"]; | ||
279 | 260 | ||
280 | return null; | 261 | if (hash["internal_port"] != null) |
262 | { | ||
263 | int p = 0; | ||
264 | Int32.TryParse((string)hash["internal_port"], out p); | ||
265 | region.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), p); | ||
266 | } | ||
267 | if (hash["position"] != null) | ||
268 | Vector3.TryParse((string)hash["position"], out position); | ||
269 | if (hash["lookAt"] != null) | ||
270 | Vector3.TryParse((string)hash["lookAt"], out lookAt); | ||
271 | |||
272 | // Successful return | ||
273 | return region; | ||
281 | } | 274 | } |
282 | 275 | ||
283 | public bool IsAgentComingHome(UUID sessionID, string thisGridExternalName) | 276 | public bool IsAgentComingHome(UUID sessionID, string thisGridExternalName) |
@@ -364,14 +357,14 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
364 | } | 357 | } |
365 | catch | 358 | catch |
366 | { | 359 | { |
367 | m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0} for StatusNotification", m_ServerURL); | 360 | m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0} for StatusNotification", m_ServerURLHost); |
368 | // reason = "Exception: " + e.Message; | 361 | // reason = "Exception: " + e.Message; |
369 | return friendsOnline; | 362 | return friendsOnline; |
370 | } | 363 | } |
371 | 364 | ||
372 | if (response.IsFault) | 365 | if (response.IsFault) |
373 | { | 366 | { |
374 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} for StatusNotification returned an error: {1}", m_ServerURL, response.FaultString); | 367 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} for StatusNotification returned an error: {1}", m_ServerURLHost, response.FaultString); |
375 | // reason = "XMLRPC Fault"; | 368 | // reason = "XMLRPC Fault"; |
376 | return friendsOnline; | 369 | return friendsOnline; |
377 | } | 370 | } |
@@ -383,7 +376,7 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
383 | { | 376 | { |
384 | if (hash == null) | 377 | if (hash == null) |
385 | { | 378 | { |
386 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: GetOnlineFriends Got null response from {0}! THIS IS BAAAAD", m_ServerURL); | 379 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: GetOnlineFriends Got null response from {0}! THIS IS BAAAAD", m_ServerURLHost); |
387 | // reason = "Internal error 1"; | 380 | // reason = "Internal error 1"; |
388 | return friendsOnline; | 381 | return friendsOnline; |
389 | } | 382 | } |
@@ -436,14 +429,14 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
436 | } | 429 | } |
437 | catch | 430 | catch |
438 | { | 431 | { |
439 | m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0} for GetOnlineFriends", m_ServerURL); | 432 | m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0} for GetOnlineFriends", m_ServerURLHost); |
440 | // reason = "Exception: " + e.Message; | 433 | // reason = "Exception: " + e.Message; |
441 | return online; | 434 | return online; |
442 | } | 435 | } |
443 | 436 | ||
444 | if (response.IsFault) | 437 | if (response.IsFault) |
445 | { | 438 | { |
446 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} for GetOnlineFriends returned an error: {1}", m_ServerURL, response.FaultString); | 439 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} for GetOnlineFriends returned an error: {1}", m_ServerURLHost, response.FaultString); |
447 | // reason = "XMLRPC Fault"; | 440 | // reason = "XMLRPC Fault"; |
448 | return online; | 441 | return online; |
449 | } | 442 | } |
@@ -455,7 +448,7 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
455 | { | 448 | { |
456 | if (hash == null) | 449 | if (hash == null) |
457 | { | 450 | { |
458 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: GetOnlineFriends Got null response from {0}! THIS IS BAAAAD", m_ServerURL); | 451 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: GetOnlineFriends Got null response from {0}! THIS IS BAAAAD", m_ServerURLHost); |
459 | // reason = "Internal error 1"; | 452 | // reason = "Internal error 1"; |
460 | return online; | 453 | return online; |
461 | } | 454 | } |
@@ -486,50 +479,16 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
486 | Hashtable hash = new Hashtable(); | 479 | Hashtable hash = new Hashtable(); |
487 | hash["userID"] = userID.ToString(); | 480 | hash["userID"] = userID.ToString(); |
488 | 481 | ||
489 | IList paramList = new ArrayList(); | 482 | hash = CallServer("get_user_info", hash); |
490 | paramList.Add(hash); | ||
491 | |||
492 | XmlRpcRequest request = new XmlRpcRequest("get_user_info", paramList); | ||
493 | 483 | ||
494 | Dictionary<string, object> info = new Dictionary<string, object>(); | 484 | Dictionary<string, object> info = new Dictionary<string, object>(); |
495 | XmlRpcResponse response = null; | ||
496 | try | ||
497 | { | ||
498 | response = request.Send(m_ServerURL, 10000); | ||
499 | } | ||
500 | catch | ||
501 | { | ||
502 | m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0} for GetUserInfo", m_ServerURL); | ||
503 | return info; | ||
504 | } | ||
505 | |||
506 | if (response.IsFault) | ||
507 | { | ||
508 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} for GetServerURLs returned an error: {1}", m_ServerURL, response.FaultString); | ||
509 | return info; | ||
510 | } | ||
511 | 485 | ||
512 | hash = (Hashtable)response.Value; | 486 | foreach (object key in hash.Keys) |
513 | try | ||
514 | { | 487 | { |
515 | if (hash == null) | 488 | if (hash[key] != null) |
516 | { | 489 | { |
517 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: GetUserInfo Got null response from {0}! THIS IS BAAAAD", m_ServerURL); | 490 | info.Add(key.ToString(), hash[key]); |
518 | return info; | ||
519 | } | 491 | } |
520 | |||
521 | // Here is the actual response | ||
522 | foreach (object key in hash.Keys) | ||
523 | { | ||
524 | if (hash[key] != null) | ||
525 | { | ||
526 | info.Add(key.ToString(), hash[key]); | ||
527 | } | ||
528 | } | ||
529 | } | ||
530 | catch | ||
531 | { | ||
532 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got exception on GetOnlineFriends response."); | ||
533 | } | 492 | } |
534 | 493 | ||
535 | return info; | 494 | return info; |
@@ -540,60 +499,16 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
540 | Hashtable hash = new Hashtable(); | 499 | Hashtable hash = new Hashtable(); |
541 | hash["userID"] = userID.ToString(); | 500 | hash["userID"] = userID.ToString(); |
542 | 501 | ||
543 | IList paramList = new ArrayList(); | 502 | hash = CallServer("get_server_urls", hash); |
544 | paramList.Add(hash); | 503 | |
545 | 504 | Dictionary<string, object> serverURLs = new Dictionary<string, object>(); | |
546 | XmlRpcRequest request = new XmlRpcRequest("get_server_urls", paramList); | 505 | foreach (object key in hash.Keys) |
547 | // string reason = string.Empty; | ||
548 | |||
549 | // Send and get reply | ||
550 | Dictionary<string, object> serverURLs = new Dictionary<string,object>(); | ||
551 | XmlRpcResponse response = null; | ||
552 | try | ||
553 | { | ||
554 | response = request.Send(m_ServerURL, 10000); | ||
555 | } | ||
556 | catch | ||
557 | { | ||
558 | m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0} for GetServerURLs for user {1}", m_ServerURL, userID); | ||
559 | // reason = "Exception: " + e.Message; | ||
560 | return serverURLs; | ||
561 | } | ||
562 | |||
563 | if (response.IsFault) | ||
564 | { | ||
565 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} for GetServerURLs returned an error: {1}", m_ServerURL, response.FaultString); | ||
566 | // reason = "XMLRPC Fault"; | ||
567 | return serverURLs; | ||
568 | } | ||
569 | |||
570 | hash = (Hashtable)response.Value; | ||
571 | //foreach (Object o in hash) | ||
572 | // m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value); | ||
573 | try | ||
574 | { | 506 | { |
575 | if (hash == null) | 507 | if (key is string && ((string)key).StartsWith("SRV_") && hash[key] != null) |
576 | { | 508 | { |
577 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: GetServerURLs Got null response from {0}! THIS IS BAAAAD", m_ServerURL); | 509 | string serverType = key.ToString().Substring(4); // remove "SRV_" |
578 | // reason = "Internal error 1"; | 510 | serverURLs.Add(serverType, hash[key].ToString()); |
579 | return serverURLs; | ||
580 | } | 511 | } |
581 | |||
582 | // Here is the actual response | ||
583 | foreach (object key in hash.Keys) | ||
584 | { | ||
585 | if (key is string && ((string)key).StartsWith("SRV_") && hash[key] != null) | ||
586 | { | ||
587 | string serverType = key.ToString().Substring(4); // remove "SRV_" | ||
588 | serverURLs.Add(serverType, hash[key].ToString()); | ||
589 | } | ||
590 | } | ||
591 | |||
592 | } | ||
593 | catch | ||
594 | { | ||
595 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got exception on GetOnlineFriends response."); | ||
596 | // reason = "Exception: " + e.Message; | ||
597 | } | 512 | } |
598 | 513 | ||
599 | return serverURLs; | 514 | return serverURLs; |
@@ -604,55 +519,13 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
604 | Hashtable hash = new Hashtable(); | 519 | Hashtable hash = new Hashtable(); |
605 | hash["userID"] = userID.ToString(); | 520 | hash["userID"] = userID.ToString(); |
606 | 521 | ||
607 | IList paramList = new ArrayList(); | 522 | hash = CallServer("locate_user", hash); |
608 | paramList.Add(hash); | ||
609 | |||
610 | XmlRpcRequest request = new XmlRpcRequest("locate_user", paramList); | ||
611 | // string reason = string.Empty; | ||
612 | 523 | ||
613 | // Send and get reply | ||
614 | string url = string.Empty; | 524 | string url = string.Empty; |
615 | XmlRpcResponse response = null; | ||
616 | try | ||
617 | { | ||
618 | response = request.Send(m_ServerURL, 10000); | ||
619 | } | ||
620 | catch | ||
621 | { | ||
622 | m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0} for LocateUser", m_ServerURL); | ||
623 | // reason = "Exception: " + e.Message; | ||
624 | return url; | ||
625 | } | ||
626 | 525 | ||
627 | if (response.IsFault) | 526 | // Here's the actual response |
628 | { | 527 | if (hash.ContainsKey("URL")) |
629 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} for LocateUser returned an error: {1}", m_ServerURL, response.FaultString); | 528 | url = hash["URL"].ToString(); |
630 | // reason = "XMLRPC Fault"; | ||
631 | return url; | ||
632 | } | ||
633 | |||
634 | hash = (Hashtable)response.Value; | ||
635 | //foreach (Object o in hash) | ||
636 | // m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value); | ||
637 | try | ||
638 | { | ||
639 | if (hash == null) | ||
640 | { | ||
641 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: LocateUser Got null response from {0}! THIS IS BAAAAD", m_ServerURL); | ||
642 | // reason = "Internal error 1"; | ||
643 | return url; | ||
644 | } | ||
645 | |||
646 | // Here's the actual response | ||
647 | if (hash.ContainsKey("URL")) | ||
648 | url = hash["URL"].ToString(); | ||
649 | |||
650 | } | ||
651 | catch | ||
652 | { | ||
653 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got exception on LocateUser response."); | ||
654 | // reason = "Exception: " + e.Message; | ||
655 | } | ||
656 | 529 | ||
657 | return url; | 530 | return url; |
658 | } | 531 | } |
@@ -663,55 +536,13 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
663 | hash["userID"] = userID.ToString(); | 536 | hash["userID"] = userID.ToString(); |
664 | hash["targetUserID"] = targetUserID.ToString(); | 537 | hash["targetUserID"] = targetUserID.ToString(); |
665 | 538 | ||
666 | IList paramList = new ArrayList(); | 539 | hash = CallServer("get_uui", hash); |
667 | paramList.Add(hash); | ||
668 | |||
669 | XmlRpcRequest request = new XmlRpcRequest("get_uui", paramList); | ||
670 | // string reason = string.Empty; | ||
671 | 540 | ||
672 | // Send and get reply | ||
673 | string uui = string.Empty; | 541 | string uui = string.Empty; |
674 | XmlRpcResponse response = null; | ||
675 | try | ||
676 | { | ||
677 | response = request.Send(m_ServerURL, 10000); | ||
678 | } | ||
679 | catch | ||
680 | { | ||
681 | m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0} for GetUUI", m_ServerURL); | ||
682 | // reason = "Exception: " + e.Message; | ||
683 | return uui; | ||
684 | } | ||
685 | 542 | ||
686 | if (response.IsFault) | 543 | // Here's the actual response |
687 | { | 544 | if (hash.ContainsKey("UUI")) |
688 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} for GetUUI returned an error: {1}", m_ServerURL, response.FaultString); | 545 | uui = hash["UUI"].ToString(); |
689 | // reason = "XMLRPC Fault"; | ||
690 | return uui; | ||
691 | } | ||
692 | |||
693 | hash = (Hashtable)response.Value; | ||
694 | //foreach (Object o in hash) | ||
695 | // m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value); | ||
696 | try | ||
697 | { | ||
698 | if (hash == null) | ||
699 | { | ||
700 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: GetUUI Got null response from {0}! THIS IS BAAAAD", m_ServerURL); | ||
701 | // reason = "Internal error 1"; | ||
702 | return uui; | ||
703 | } | ||
704 | |||
705 | // Here's the actual response | ||
706 | if (hash.ContainsKey("UUI")) | ||
707 | uui = hash["UUI"].ToString(); | ||
708 | |||
709 | } | ||
710 | catch | ||
711 | { | ||
712 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got exception on GetUUI response."); | ||
713 | // reason = "Exception: " + e.Message; | ||
714 | } | ||
715 | 546 | ||
716 | return uui; | 547 | return uui; |
717 | } | 548 | } |
@@ -722,54 +553,17 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
722 | hash["first"] = first; | 553 | hash["first"] = first; |
723 | hash["last"] = last; | 554 | hash["last"] = last; |
724 | 555 | ||
725 | IList paramList = new ArrayList(); | 556 | hash = CallServer("get_uuid", hash); |
726 | paramList.Add(hash); | ||
727 | |||
728 | XmlRpcRequest request = new XmlRpcRequest("get_uuid", paramList); | ||
729 | // string reason = string.Empty; | ||
730 | |||
731 | // Send and get reply | ||
732 | UUID uuid = UUID.Zero; | ||
733 | XmlRpcResponse response = null; | ||
734 | try | ||
735 | { | ||
736 | response = request.Send(m_ServerURL, 10000); | ||
737 | } | ||
738 | catch | ||
739 | { | ||
740 | m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0} for GetUUID", m_ServerURL); | ||
741 | // reason = "Exception: " + e.Message; | ||
742 | return uuid; | ||
743 | } | ||
744 | 557 | ||
745 | if (response.IsFault) | 558 | if (!hash.ContainsKey("UUID")) |
746 | { | 559 | { |
747 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} for GetUUID returned an error: {1}", m_ServerURL, response.FaultString); | 560 | throw new Exception(string.Format("[USER AGENT CONNECTOR]: get_uuid call to {0} didn't return a UUID", m_ServerURLHost)); |
748 | // reason = "XMLRPC Fault"; | ||
749 | return uuid; | ||
750 | } | 561 | } |
751 | 562 | ||
752 | hash = (Hashtable)response.Value; | 563 | UUID uuid; |
753 | //foreach (Object o in hash) | 564 | if (!UUID.TryParse(hash["UUID"].ToString(), out uuid)) |
754 | // m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value); | ||
755 | try | ||
756 | { | ||
757 | if (hash == null) | ||
758 | { | ||
759 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: GetUUDI Got null response from {0}! THIS IS BAAAAD", m_ServerURL); | ||
760 | // reason = "Internal error 1"; | ||
761 | return uuid; | ||
762 | } | ||
763 | |||
764 | // Here's the actual response | ||
765 | if (hash.ContainsKey("UUID")) | ||
766 | UUID.TryParse(hash["UUID"].ToString(), out uuid); | ||
767 | |||
768 | } | ||
769 | catch | ||
770 | { | 565 | { |
771 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got exception on UUID response."); | 566 | throw new Exception(string.Format("[USER AGENT CONNECTOR]: get_uuid call to {0} returned an invalid UUID: {1}", m_ServerURLHost, hash["UUID"].ToString())); |
772 | // reason = "Exception: " + e.Message; | ||
773 | } | 567 | } |
774 | 568 | ||
775 | return uuid; | 569 | return uuid; |
@@ -777,7 +571,7 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
777 | 571 | ||
778 | private bool GetBoolResponse(XmlRpcRequest request, out string reason) | 572 | private bool GetBoolResponse(XmlRpcRequest request, out string reason) |
779 | { | 573 | { |
780 | //m_log.Debug("[USER AGENT CONNECTOR]: GetBoolResponse from/to " + m_ServerURL); | 574 | //m_log.Debug("[USER AGENT CONNECTOR]: GetBoolResponse from/to " + m_ServerURLHost); |
781 | XmlRpcResponse response = null; | 575 | XmlRpcResponse response = null; |
782 | try | 576 | try |
783 | { | 577 | { |
@@ -785,14 +579,14 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
785 | } | 579 | } |
786 | catch (Exception e) | 580 | catch (Exception e) |
787 | { | 581 | { |
788 | m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0} for GetBoolResponse", m_ServerURL); | 582 | m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0} for GetBoolResponse", m_ServerURLHost); |
789 | reason = "Exception: " + e.Message; | 583 | reason = "Exception: " + e.Message; |
790 | return false; | 584 | return false; |
791 | } | 585 | } |
792 | 586 | ||
793 | if (response.IsFault) | 587 | if (response.IsFault) |
794 | { | 588 | { |
795 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} for GetBoolResponse returned an error: {1}", m_ServerURL, response.FaultString); | 589 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} for GetBoolResponse returned an error: {1}", m_ServerURLHost, response.FaultString); |
796 | reason = "XMLRPC Fault"; | 590 | reason = "XMLRPC Fault"; |
797 | return false; | 591 | return false; |
798 | } | 592 | } |
@@ -804,7 +598,7 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
804 | { | 598 | { |
805 | if (hash == null) | 599 | if (hash == null) |
806 | { | 600 | { |
807 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got null response from {0}! THIS IS BAAAAD", m_ServerURL); | 601 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got null response from {0}! THIS IS BAAAAD", m_ServerURLHost); |
808 | reason = "Internal error 1"; | 602 | reason = "Internal error 1"; |
809 | return false; | 603 | return false; |
810 | } | 604 | } |
@@ -815,7 +609,7 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
815 | else | 609 | else |
816 | { | 610 | { |
817 | reason = "Internal error 2"; | 611 | reason = "Internal error 2"; |
818 | m_log.WarnFormat("[USER AGENT CONNECTOR]: response from {0} does not have expected key 'result'", m_ServerURL); | 612 | m_log.WarnFormat("[USER AGENT CONNECTOR]: response from {0} does not have expected key 'result'", m_ServerURLHost); |
819 | } | 613 | } |
820 | 614 | ||
821 | return success; | 615 | return success; |
diff --git a/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs b/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs index 36d4ae2..b0615b8 100644 --- a/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs | |||
@@ -34,21 +34,36 @@ using Nini.Config; | |||
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Console; | 35 | using OpenSim.Framework.Console; |
36 | using OpenSim.Framework.Communications; | 36 | using OpenSim.Framework.Communications; |
37 | using OpenSim.Framework.Monitoring; | ||
37 | using OpenSim.Services.Interfaces; | 38 | using OpenSim.Services.Interfaces; |
38 | using OpenSim.Server.Base; | 39 | using OpenSim.Server.Base; |
39 | using OpenMetaverse; | 40 | using OpenMetaverse; |
40 | 41 | ||
41 | namespace OpenSim.Services.Connectors | 42 | namespace OpenSim.Services.Connectors |
42 | { | 43 | { |
43 | public class XInventoryServicesConnector : IInventoryService | 44 | public class XInventoryServicesConnector : BaseServiceConnector, IInventoryService |
44 | { | 45 | { |
45 | private static readonly ILog m_log = | 46 | private static readonly ILog m_log = |
46 | LogManager.GetLogger( | 47 | LogManager.GetLogger( |
47 | MethodBase.GetCurrentMethod().DeclaringType); | 48 | MethodBase.GetCurrentMethod().DeclaringType); |
48 | 49 | ||
50 | /// <summary> | ||
51 | /// Number of requests made to the remote inventory service. | ||
52 | /// </summary> | ||
53 | public int RequestsMade { get; private set; } | ||
54 | |||
49 | private string m_ServerURI = String.Empty; | 55 | private string m_ServerURI = String.Empty; |
50 | 56 | ||
51 | private object m_Lock = new object(); | 57 | /// <summary> |
58 | /// Timeout for remote requests. | ||
59 | /// </summary> | ||
60 | /// <remarks> | ||
61 | /// In this case, -1 is default timeout (100 seconds), not infinite. | ||
62 | /// </remarks> | ||
63 | private int m_requestTimeoutSecs = -1; | ||
64 | |||
65 | private const double CACHE_EXPIRATION_SECONDS = 20.0; | ||
66 | private static ExpiringCache<UUID, InventoryItemBase> m_ItemCache = new ExpiringCache<UUID,InventoryItemBase>(); | ||
52 | 67 | ||
53 | public XInventoryServicesConnector() | 68 | public XInventoryServicesConnector() |
54 | { | 69 | { |
@@ -60,20 +75,21 @@ namespace OpenSim.Services.Connectors | |||
60 | } | 75 | } |
61 | 76 | ||
62 | public XInventoryServicesConnector(IConfigSource source) | 77 | public XInventoryServicesConnector(IConfigSource source) |
78 | : base(source, "InventoryService") | ||
63 | { | 79 | { |
64 | Initialise(source); | 80 | Initialise(source); |
65 | } | 81 | } |
66 | 82 | ||
67 | public virtual void Initialise(IConfigSource source) | 83 | public virtual void Initialise(IConfigSource source) |
68 | { | 84 | { |
69 | IConfig assetConfig = source.Configs["InventoryService"]; | 85 | IConfig config = source.Configs["InventoryService"]; |
70 | if (assetConfig == null) | 86 | if (config == null) |
71 | { | 87 | { |
72 | m_log.Error("[INVENTORY CONNECTOR]: InventoryService missing from OpenSim.ini"); | 88 | m_log.Error("[INVENTORY CONNECTOR]: InventoryService missing from OpenSim.ini"); |
73 | throw new Exception("Inventory connector init error"); | 89 | throw new Exception("Inventory connector init error"); |
74 | } | 90 | } |
75 | 91 | ||
76 | string serviceURI = assetConfig.GetString("InventoryServerURI", | 92 | string serviceURI = config.GetString("InventoryServerURI", |
77 | String.Empty); | 93 | String.Empty); |
78 | 94 | ||
79 | if (serviceURI == String.Empty) | 95 | if (serviceURI == String.Empty) |
@@ -82,6 +98,21 @@ namespace OpenSim.Services.Connectors | |||
82 | throw new Exception("Inventory connector init error"); | 98 | throw new Exception("Inventory connector init error"); |
83 | } | 99 | } |
84 | m_ServerURI = serviceURI; | 100 | m_ServerURI = serviceURI; |
101 | |||
102 | m_requestTimeoutSecs = config.GetInt("RemoteRequestTimeout", m_requestTimeoutSecs); | ||
103 | |||
104 | StatsManager.RegisterStat( | ||
105 | new Stat( | ||
106 | "RequestsMade", | ||
107 | "Requests made", | ||
108 | "Number of requests made to the remove inventory service", | ||
109 | "requests", | ||
110 | "inventory", | ||
111 | serviceURI, | ||
112 | StatType.Pull, | ||
113 | MeasuresOfInterest.AverageChangeOverTime, | ||
114 | s => s.Value = RequestsMade, | ||
115 | StatVerbosity.Debug)); | ||
85 | } | 116 | } |
86 | 117 | ||
87 | private bool CheckReturn(Dictionary<string, object> ret) | 118 | private bool CheckReturn(Dictionary<string, object> ret) |
@@ -158,7 +189,7 @@ namespace OpenSim.Services.Connectors | |||
158 | return BuildFolder((Dictionary<string, object>)ret["folder"]); | 189 | return BuildFolder((Dictionary<string, object>)ret["folder"]); |
159 | } | 190 | } |
160 | 191 | ||
161 | public InventoryFolderBase GetFolderForType(UUID principalID, AssetType type) | 192 | public InventoryFolderBase GetFolderForType(UUID principalID, FolderType type) |
162 | { | 193 | { |
163 | Dictionary<string,object> ret = MakeRequest("GETFOLDERFORTYPE", | 194 | Dictionary<string,object> ret = MakeRequest("GETFOLDERFORTYPE", |
164 | new Dictionary<string,object> { | 195 | new Dictionary<string,object> { |
@@ -177,7 +208,7 @@ namespace OpenSim.Services.Connectors | |||
177 | InventoryCollection inventory = new InventoryCollection(); | 208 | InventoryCollection inventory = new InventoryCollection(); |
178 | inventory.Folders = new List<InventoryFolderBase>(); | 209 | inventory.Folders = new List<InventoryFolderBase>(); |
179 | inventory.Items = new List<InventoryItemBase>(); | 210 | inventory.Items = new List<InventoryItemBase>(); |
180 | inventory.UserID = principalID; | 211 | inventory.OwnerID = principalID; |
181 | 212 | ||
182 | try | 213 | try |
183 | { | 214 | { |
@@ -190,15 +221,17 @@ namespace OpenSim.Services.Connectors | |||
190 | if (!CheckReturn(ret)) | 221 | if (!CheckReturn(ret)) |
191 | return null; | 222 | return null; |
192 | 223 | ||
193 | Dictionary<string,object> folders = | 224 | Dictionary<string,object> folders = ret.ContainsKey("FOLDERS") ? |
194 | (Dictionary<string,object>)ret["FOLDERS"]; | 225 | (Dictionary<string,object>)ret["FOLDERS"] : null; |
195 | Dictionary<string,object> items = | 226 | Dictionary<string,object> items = ret.ContainsKey("ITEMS") ? |
196 | (Dictionary<string,object>)ret["ITEMS"]; | 227 | (Dictionary<string, object>)ret["ITEMS"] : null; |
197 | 228 | ||
198 | foreach (Object o in folders.Values) // getting the values directly, we don't care about the keys folder_i | 229 | if (folders != null) |
199 | inventory.Folders.Add(BuildFolder((Dictionary<string, object>)o)); | 230 | foreach (Object o in folders.Values) // getting the values directly, we don't care about the keys folder_i |
200 | foreach (Object o in items.Values) // getting the values directly, we don't care about the keys item_i | 231 | inventory.Folders.Add(BuildFolder((Dictionary<string, object>)o)); |
201 | inventory.Items.Add(BuildItem((Dictionary<string, object>)o)); | 232 | if (items != null) |
233 | foreach (Object o in items.Values) // getting the values directly, we don't care about the keys item_i | ||
234 | inventory.Items.Add(BuildItem((Dictionary<string, object>)o)); | ||
202 | } | 235 | } |
203 | catch (Exception e) | 236 | catch (Exception e) |
204 | { | 237 | { |
@@ -207,6 +240,87 @@ namespace OpenSim.Services.Connectors | |||
207 | 240 | ||
208 | return inventory; | 241 | return inventory; |
209 | } | 242 | } |
243 | |||
244 | public virtual InventoryCollection[] GetMultipleFoldersContent(UUID principalID, UUID[] folderIDs) | ||
245 | { | ||
246 | InventoryCollection[] inventoryArr = new InventoryCollection[folderIDs.Length]; | ||
247 | // m_log.DebugFormat("[XXX]: In GetMultipleFoldersContent {0}", String.Join(",", folderIDs)); | ||
248 | try | ||
249 | { | ||
250 | Dictionary<string, object> resultSet = MakeRequest("GETMULTIPLEFOLDERSCONTENT", | ||
251 | new Dictionary<string, object> { | ||
252 | { "PRINCIPAL", principalID.ToString() }, | ||
253 | { "FOLDERS", String.Join(",", folderIDs) }, | ||
254 | { "COUNT", folderIDs.Length.ToString() } | ||
255 | }); | ||
256 | |||
257 | if (!CheckReturn(resultSet)) | ||
258 | return null; | ||
259 | |||
260 | int i = 0; | ||
261 | foreach (KeyValuePair<string, object> kvp in resultSet) | ||
262 | { | ||
263 | InventoryCollection inventory = new InventoryCollection(); | ||
264 | if (kvp.Key.StartsWith("F_")) | ||
265 | { | ||
266 | UUID fid = UUID.Zero; | ||
267 | if (UUID.TryParse(kvp.Key.Substring(2), out fid) && fid == folderIDs[i]) | ||
268 | { | ||
269 | inventory.Folders = new List<InventoryFolderBase>(); | ||
270 | inventory.Items = new List<InventoryItemBase>(); | ||
271 | |||
272 | Dictionary<string, object> ret = (Dictionary<string, object>)kvp.Value; | ||
273 | |||
274 | if (ret.ContainsKey("FID")) | ||
275 | { | ||
276 | if (!UUID.TryParse(ret["FID"].ToString(), out inventory.FolderID)) | ||
277 | m_log.WarnFormat("[XINVENTORY SERVICES CONNECTOR]: Could not parse folder id {0}", ret["FID"].ToString()); | ||
278 | } | ||
279 | else | ||
280 | m_log.WarnFormat("[XINVENTORY SERVICES CONNECTOR]: FID key not present in response"); | ||
281 | |||
282 | inventory.Version = -1; | ||
283 | if (ret.ContainsKey("VERSION")) | ||
284 | Int32.TryParse(ret["VERSION"].ToString(), out inventory.Version); | ||
285 | if (ret.ContainsKey("OWNER")) | ||
286 | UUID.TryParse(ret["OWNER"].ToString(), out inventory.OwnerID); | ||
287 | |||
288 | //m_log.DebugFormat("[XXX]: Received {0} ({1}) {2} {3}", inventory.FolderID, fid, inventory.Version, inventory.OwnerID); | ||
289 | |||
290 | Dictionary<string, object> folders = | ||
291 | (Dictionary<string, object>)ret["FOLDERS"]; | ||
292 | Dictionary<string, object> items = | ||
293 | (Dictionary<string, object>)ret["ITEMS"]; | ||
294 | |||
295 | foreach (Object o in folders.Values) // getting the values directly, we don't care about the keys folder_i | ||
296 | { | ||
297 | inventory.Folders.Add(BuildFolder((Dictionary<string, object>)o)); | ||
298 | } | ||
299 | foreach (Object o in items.Values) // getting the values directly, we don't care about the keys item_i | ||
300 | { | ||
301 | inventory.Items.Add(BuildItem((Dictionary<string, object>)o)); | ||
302 | } | ||
303 | |||
304 | inventoryArr[i] = inventory; | ||
305 | } | ||
306 | else | ||
307 | { | ||
308 | m_log.WarnFormat("[XINVENTORY SERVICES CONNECTOR]: Folder id does not match. Expected {0} got {1}", | ||
309 | folderIDs[i], fid); | ||
310 | m_log.WarnFormat("[XINVENTORY SERVICES CONNECTOR]: {0} {1}", String.Join(",", folderIDs), String.Join(",", resultSet.Keys)); | ||
311 | } | ||
312 | |||
313 | i += 1; | ||
314 | } | ||
315 | } | ||
316 | } | ||
317 | catch (Exception e) | ||
318 | { | ||
319 | m_log.WarnFormat("[XINVENTORY SERVICES CONNECTOR]: Exception in GetMultipleFoldersContent: {0}", e.Message); | ||
320 | } | ||
321 | |||
322 | return inventoryArr; | ||
323 | } | ||
210 | 324 | ||
211 | public List<InventoryItemBase> GetFolderItems(UUID principalID, UUID folderID) | 325 | public List<InventoryItemBase> GetFolderItems(UUID principalID, UUID folderID) |
212 | { | 326 | { |
@@ -297,9 +411,13 @@ namespace OpenSim.Services.Connectors | |||
297 | 411 | ||
298 | public bool AddItem(InventoryItemBase item) | 412 | public bool AddItem(InventoryItemBase item) |
299 | { | 413 | { |
414 | if (item.Description == null) | ||
415 | item.Description = String.Empty; | ||
300 | if (item.CreatorData == null) | 416 | if (item.CreatorData == null) |
301 | item.CreatorData = String.Empty; | 417 | item.CreatorData = String.Empty; |
302 | Dictionary<string,object> ret = MakeRequest("ADDITEM", | 418 | if (item.CreatorId == null) |
419 | item.CreatorId = String.Empty; | ||
420 | Dictionary<string, object> ret = MakeRequest("ADDITEM", | ||
303 | new Dictionary<string,object> { | 421 | new Dictionary<string,object> { |
304 | { "AssetID", item.AssetID.ToString() }, | 422 | { "AssetID", item.AssetID.ToString() }, |
305 | { "AssetType", item.AssetType.ToString() }, | 423 | { "AssetType", item.AssetType.ToString() }, |
@@ -398,6 +516,10 @@ namespace OpenSim.Services.Connectors | |||
398 | 516 | ||
399 | public InventoryItemBase GetItem(InventoryItemBase item) | 517 | public InventoryItemBase GetItem(InventoryItemBase item) |
400 | { | 518 | { |
519 | InventoryItemBase retrieved = null; | ||
520 | if (m_ItemCache.TryGetValue(item.ID, out retrieved)) | ||
521 | return retrieved; | ||
522 | |||
401 | try | 523 | try |
402 | { | 524 | { |
403 | Dictionary<string, object> ret = MakeRequest("GETITEM", | 525 | Dictionary<string, object> ret = MakeRequest("GETITEM", |
@@ -408,14 +530,78 @@ namespace OpenSim.Services.Connectors | |||
408 | if (!CheckReturn(ret)) | 530 | if (!CheckReturn(ret)) |
409 | return null; | 531 | return null; |
410 | 532 | ||
411 | return BuildItem((Dictionary<string, object>)ret["item"]); | 533 | retrieved = BuildItem((Dictionary<string, object>)ret["item"]); |
412 | } | 534 | } |
413 | catch (Exception e) | 535 | catch (Exception e) |
414 | { | 536 | { |
415 | m_log.Error("[XINVENTORY SERVICES CONNECTOR]: Exception in GetItem: ", e); | 537 | m_log.Error("[XINVENTORY SERVICES CONNECTOR]: Exception in GetItem: ", e); |
416 | } | 538 | } |
417 | 539 | ||
418 | return null; | 540 | m_ItemCache.AddOrUpdate(item.ID, retrieved, CACHE_EXPIRATION_SECONDS); |
541 | |||
542 | return retrieved; | ||
543 | } | ||
544 | |||
545 | public virtual InventoryItemBase[] GetMultipleItems(UUID principalID, UUID[] itemIDs) | ||
546 | { | ||
547 | //m_log.DebugFormat("[XXX]: In GetMultipleItems {0}", String.Join(",", itemIDs)); | ||
548 | |||
549 | InventoryItemBase[] itemArr = new InventoryItemBase[itemIDs.Length]; | ||
550 | // Try to get them from the cache | ||
551 | List<UUID> pending = new List<UUID>(); | ||
552 | InventoryItemBase item = null; | ||
553 | int i = 0; | ||
554 | foreach (UUID id in itemIDs) | ||
555 | { | ||
556 | if (m_ItemCache.TryGetValue(id, out item)) | ||
557 | itemArr[i++] = item; | ||
558 | else | ||
559 | pending.Add(id); | ||
560 | } | ||
561 | |||
562 | if (pending.Count == 0) // we're done, everything was in the cache | ||
563 | return itemArr; | ||
564 | |||
565 | try | ||
566 | { | ||
567 | Dictionary<string, object> resultSet = MakeRequest("GETMULTIPLEITEMS", | ||
568 | new Dictionary<string, object> { | ||
569 | { "PRINCIPAL", principalID.ToString() }, | ||
570 | { "ITEMS", String.Join(",", pending.ToArray()) }, | ||
571 | { "COUNT", pending.Count.ToString() } | ||
572 | }); | ||
573 | |||
574 | if (!CheckReturn(resultSet)) | ||
575 | { | ||
576 | if (i == 0) | ||
577 | return null; | ||
578 | else | ||
579 | return itemArr; | ||
580 | } | ||
581 | |||
582 | // carry over index i where we left above | ||
583 | foreach (KeyValuePair<string, object> kvp in resultSet) | ||
584 | { | ||
585 | InventoryCollection inventory = new InventoryCollection(); | ||
586 | if (kvp.Key.StartsWith("item_")) | ||
587 | { | ||
588 | if (kvp.Value is Dictionary<string, object>) | ||
589 | { | ||
590 | item = BuildItem((Dictionary<string, object>)kvp.Value); | ||
591 | m_ItemCache.AddOrUpdate(item.ID, item, CACHE_EXPIRATION_SECONDS); | ||
592 | itemArr[i++] = item; | ||
593 | } | ||
594 | else | ||
595 | itemArr[i++] = null; | ||
596 | } | ||
597 | } | ||
598 | } | ||
599 | catch (Exception e) | ||
600 | { | ||
601 | m_log.WarnFormat("[XINVENTORY SERVICES CONNECTOR]: Exception in GetMultipleItems: {0}", e.Message); | ||
602 | } | ||
603 | |||
604 | return itemArr; | ||
419 | } | 605 | } |
420 | 606 | ||
421 | public InventoryFolderBase GetFolder(InventoryFolderBase folder) | 607 | public InventoryFolderBase GetFolder(InventoryFolderBase folder) |
@@ -484,45 +670,6 @@ namespace OpenSim.Services.Connectors | |||
484 | return 0; | 670 | return 0; |
485 | } | 671 | } |
486 | 672 | ||
487 | public InventoryCollection GetUserInventory(UUID principalID) | ||
488 | { | ||
489 | InventoryCollection inventory = new InventoryCollection(); | ||
490 | inventory.Folders = new List<InventoryFolderBase>(); | ||
491 | inventory.Items = new List<InventoryItemBase>(); | ||
492 | inventory.UserID = principalID; | ||
493 | |||
494 | try | ||
495 | { | ||
496 | Dictionary<string, object> ret = MakeRequest("GETUSERINVENTORY", | ||
497 | new Dictionary<string, object> { | ||
498 | { "PRINCIPAL", principalID.ToString() } | ||
499 | }); | ||
500 | |||
501 | if (!CheckReturn(ret)) | ||
502 | return null; | ||
503 | |||
504 | Dictionary<string, object> folders = | ||
505 | (Dictionary<string, object>)ret["FOLDERS"]; | ||
506 | Dictionary<string, object> items = | ||
507 | (Dictionary<string, object>)ret["ITEMS"]; | ||
508 | |||
509 | foreach (Object o in folders.Values) // getting the values directly, we don't care about the keys folder_i | ||
510 | inventory.Folders.Add(BuildFolder((Dictionary<string, object>)o)); | ||
511 | foreach (Object o in items.Values) // getting the values directly, we don't care about the keys item_i | ||
512 | inventory.Items.Add(BuildItem((Dictionary<string, object>)o)); | ||
513 | } | ||
514 | catch (Exception e) | ||
515 | { | ||
516 | m_log.Error("[XINVENTORY SERVICES CONNECTOR]: Exception in GetUserInventory: ", e); | ||
517 | } | ||
518 | |||
519 | return inventory; | ||
520 | } | ||
521 | |||
522 | public void GetUserInventory(UUID principalID, InventoryReceiptCallback callback) | ||
523 | { | ||
524 | } | ||
525 | |||
526 | public bool HasInventoryForUser(UUID principalID) | 673 | public bool HasInventoryForUser(UUID principalID) |
527 | { | 674 | { |
528 | return false; | 675 | return false; |
@@ -533,13 +680,19 @@ namespace OpenSim.Services.Connectors | |||
533 | private Dictionary<string,object> MakeRequest(string method, | 680 | private Dictionary<string,object> MakeRequest(string method, |
534 | Dictionary<string,object> sendData) | 681 | Dictionary<string,object> sendData) |
535 | { | 682 | { |
536 | sendData["METHOD"] = method; | 683 | // Add "METHOD" as the first key in the dictionary. This ensures that it will be |
684 | // visible even when using partial logging ("debug http all 5"). | ||
685 | Dictionary<string, object> temp = sendData; | ||
686 | sendData = new Dictionary<string,object>{ { "METHOD", method } }; | ||
687 | foreach (KeyValuePair<string, object> kvp in temp) | ||
688 | sendData.Add(kvp.Key, kvp.Value); | ||
689 | |||
690 | RequestsMade++; | ||
537 | 691 | ||
538 | string reply = string.Empty; | 692 | string reply |
539 | lock (m_Lock) | 693 | = SynchronousRestFormsRequester.MakeRequest( |
540 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 694 | "POST", m_ServerURI + "/xinventory", |
541 | m_ServerURI + "/xinventory", | 695 | ServerUtils.BuildQueryString(sendData), m_requestTimeoutSecs, m_Auth); |
542 | ServerUtils.BuildQueryString(sendData)); | ||
543 | 696 | ||
544 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse( | 697 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse( |
545 | reply); | 698 | reply); |
@@ -607,4 +760,4 @@ namespace OpenSim.Services.Connectors | |||
607 | return item; | 760 | return item; |
608 | } | 761 | } |
609 | } | 762 | } |
610 | } \ No newline at end of file | 763 | } |
diff --git a/OpenSim/Services/Connectors/Land/LandServicesConnector.cs b/OpenSim/Services/Connectors/Land/LandServicesConnector.cs index 833e22a..3408f7a 100644 --- a/OpenSim/Services/Connectors/Land/LandServicesConnector.cs +++ b/OpenSim/Services/Connectors/Land/LandServicesConnector.cs | |||
@@ -78,7 +78,7 @@ namespace OpenSim.Services.Connectors | |||
78 | try | 78 | try |
79 | { | 79 | { |
80 | uint xpos = 0, ypos = 0; | 80 | uint xpos = 0, ypos = 0; |
81 | Utils.LongToUInts(regionHandle, out xpos, out ypos); | 81 | Util.RegionHandleToWorldLoc(regionHandle, out xpos, out ypos); |
82 | GridRegion info = m_GridService.GetRegionByPosition(scopeID, (int)xpos, (int)ypos); | 82 | GridRegion info = m_GridService.GetRegionByPosition(scopeID, (int)xpos, (int)ypos); |
83 | if (info != null) // just to be sure | 83 | if (info != null) // just to be sure |
84 | { | 84 | { |
diff --git a/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs b/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs index ba4c3c5..a0ac5f9 100644 --- a/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs +++ b/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs | |||
@@ -36,6 +36,7 @@ using Nini.Config; | |||
36 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
37 | using OpenSim.Framework.Console; | 37 | using OpenSim.Framework.Console; |
38 | using OpenSim.Framework.Communications; | 38 | using OpenSim.Framework.Communications; |
39 | using OpenSim.Framework.ServiceAuth; | ||
39 | using OpenSim.Server.Base; | 40 | using OpenSim.Server.Base; |
40 | using OpenSim.Services.Interfaces; | 41 | using OpenSim.Services.Interfaces; |
41 | using OpenMetaverse; | 42 | using OpenMetaverse; |
@@ -43,7 +44,7 @@ using OpenMetaverse.StructuredData; | |||
43 | 44 | ||
44 | namespace OpenSim.Services.Connectors | 45 | namespace OpenSim.Services.Connectors |
45 | { | 46 | { |
46 | public class MapImageServicesConnector : IMapImageService | 47 | public class MapImageServicesConnector : BaseServiceConnector, IMapImageService |
47 | { | 48 | { |
48 | private static readonly ILog m_log = | 49 | private static readonly ILog m_log = |
49 | LogManager.GetLogger( | 50 | LogManager.GetLogger( |
@@ -84,6 +85,68 @@ namespace OpenSim.Services.Connectors | |||
84 | } | 85 | } |
85 | m_ServerURI = serviceURI; | 86 | m_ServerURI = serviceURI; |
86 | m_ServerURI = serviceURI.TrimEnd('/'); | 87 | m_ServerURI = serviceURI.TrimEnd('/'); |
88 | base.Initialise(source, "MapImageService"); | ||
89 | } | ||
90 | |||
91 | public bool RemoveMapTile(int x, int y, out string reason) | ||
92 | { | ||
93 | reason = string.Empty; | ||
94 | int tickstart = Util.EnvironmentTickCount(); | ||
95 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | ||
96 | sendData["X"] = x.ToString(); | ||
97 | sendData["Y"] = y.ToString(); | ||
98 | |||
99 | string reqString = ServerUtils.BuildQueryString(sendData); | ||
100 | string uri = m_ServerURI + "/removemap"; | ||
101 | |||
102 | try | ||
103 | { | ||
104 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", | ||
105 | uri, | ||
106 | reqString, | ||
107 | m_Auth); | ||
108 | if (reply != string.Empty) | ||
109 | { | ||
110 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | ||
111 | |||
112 | if (replyData.ContainsKey("Result") && (replyData["Result"].ToString().ToLower() == "success")) | ||
113 | { | ||
114 | return true; | ||
115 | } | ||
116 | else if (replyData.ContainsKey("Result") && (replyData["Result"].ToString().ToLower() == "failure")) | ||
117 | { | ||
118 | m_log.DebugFormat("[MAP IMAGE CONNECTOR]: Delete failed: {0}", replyData["Message"].ToString()); | ||
119 | reason = replyData["Message"].ToString(); | ||
120 | return false; | ||
121 | } | ||
122 | else if (!replyData.ContainsKey("Result")) | ||
123 | { | ||
124 | m_log.DebugFormat("[MAP IMAGE CONNECTOR]: reply data does not contain result field"); | ||
125 | } | ||
126 | else | ||
127 | { | ||
128 | m_log.DebugFormat("[MAP IMAGE CONNECTOR]: unexpected result {0}", replyData["Result"].ToString()); | ||
129 | reason = "Unexpected result " + replyData["Result"].ToString(); | ||
130 | } | ||
131 | |||
132 | } | ||
133 | else | ||
134 | { | ||
135 | m_log.DebugFormat("[MAP IMAGE CONNECTOR]: Map post received null reply"); | ||
136 | } | ||
137 | } | ||
138 | catch (Exception e) | ||
139 | { | ||
140 | m_log.DebugFormat("[MAP IMAGE CONNECTOR]: Exception when contacting map server at {0}: {1}", uri, e.Message); | ||
141 | } | ||
142 | finally | ||
143 | { | ||
144 | // This just dumps a warning for any operation that takes more than 100 ms | ||
145 | int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); | ||
146 | m_log.DebugFormat("[MAP IMAGE CONNECTOR]: map tile deleted in {0}ms", tickdiff); | ||
147 | } | ||
148 | |||
149 | return false; | ||
87 | } | 150 | } |
88 | 151 | ||
89 | public bool RemoveMapTile(int x, int y, UUID scopeID, out string reason) | 152 | public bool RemoveMapTile(int x, int y, UUID scopeID, out string reason) |
@@ -165,7 +228,8 @@ namespace OpenSim.Services.Connectors | |||
165 | { | 228 | { |
166 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", | 229 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", |
167 | uri, | 230 | uri, |
168 | reqString); | 231 | reqString, |
232 | m_Auth); | ||
169 | if (reply != string.Empty) | 233 | if (reply != string.Empty) |
170 | { | 234 | { |
171 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | 235 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); |
diff --git a/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs b/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs index 245703c..e236ec3 100644 --- a/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs +++ b/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs | |||
@@ -69,7 +69,7 @@ namespace OpenSim.Services.Connectors | |||
69 | public virtual GridRegion HelloNeighbour(ulong regionHandle, RegionInfo thisRegion) | 69 | public virtual GridRegion HelloNeighbour(ulong regionHandle, RegionInfo thisRegion) |
70 | { | 70 | { |
71 | uint x = 0, y = 0; | 71 | uint x = 0, y = 0; |
72 | Utils.LongToUInts(regionHandle, out x, out y); | 72 | Util.RegionHandleToWorldLoc(regionHandle, out x, out y); |
73 | GridRegion regInfo = m_GridService.GetRegionByPosition(thisRegion.ScopeID, (int)x, (int)y); | 73 | GridRegion regInfo = m_GridService.GetRegionByPosition(thisRegion.ScopeID, (int)x, (int)y); |
74 | if ((regInfo != null) && | 74 | if ((regInfo != null) && |
75 | // Don't remote-call this instance; that's a startup hickup | 75 | // Don't remote-call this instance; that's a startup hickup |
@@ -97,9 +97,9 @@ namespace OpenSim.Services.Connectors | |||
97 | } | 97 | } |
98 | catch (Exception e) | 98 | catch (Exception e) |
99 | { | 99 | { |
100 | m_log.WarnFormat( | 100 | m_log.Warn(string.Format( |
101 | "[NEIGHBOUR SERVICES CONNECTOR]: Unable to parse uri {0} to send HelloNeighbour from {1} to {2}. Exception {3}{4}", | 101 | "[NEIGHBOUR SERVICES CONNECTOR]: Unable to parse uri {0} to send HelloNeighbour from {1} to {2}. Exception {3} ", |
102 | uri, thisRegion.RegionName, region.RegionName, e.Message, e.StackTrace); | 102 | uri, thisRegion.RegionName, region.RegionName, e.Message), e); |
103 | 103 | ||
104 | return false; | 104 | return false; |
105 | } | 105 | } |
@@ -116,9 +116,9 @@ namespace OpenSim.Services.Connectors | |||
116 | } | 116 | } |
117 | catch (Exception e) | 117 | catch (Exception e) |
118 | { | 118 | { |
119 | m_log.WarnFormat( | 119 | m_log.Warn(string.Format( |
120 | "[NEIGHBOUR SERVICES CONNECTOR]: PackRegionInfoData failed for HelloNeighbour from {0} to {1}. Exception {2}{3}", | 120 | "[NEIGHBOUR SERVICES CONNECTOR]: PackRegionInfoData failed for HelloNeighbour from {0} to {1}. Exception {2} ", |
121 | thisRegion.RegionName, region.RegionName, e.Message, e.StackTrace); | 121 | thisRegion.RegionName, region.RegionName, e.Message), e); |
122 | 122 | ||
123 | return false; | 123 | return false; |
124 | } | 124 | } |
@@ -136,9 +136,9 @@ namespace OpenSim.Services.Connectors | |||
136 | } | 136 | } |
137 | catch (Exception e) | 137 | catch (Exception e) |
138 | { | 138 | { |
139 | m_log.WarnFormat( | 139 | m_log.Warn(string.Format( |
140 | "[NEIGHBOUR SERVICES CONNECTOR]: Exception thrown on serialization of HelloNeighbour from {0} to {1}. Exception {2}{3}", | 140 | "[NEIGHBOUR SERVICES CONNECTOR]: Exception thrown on serialization of HelloNeighbour from {0} to {1}. Exception {2} ", |
141 | thisRegion.RegionName, region.RegionName, e.Message, e.StackTrace); | 141 | thisRegion.RegionName, region.RegionName, e.Message), e); |
142 | 142 | ||
143 | return false; | 143 | return false; |
144 | } | 144 | } |
@@ -153,16 +153,22 @@ namespace OpenSim.Services.Connectors | |||
153 | } | 153 | } |
154 | catch (Exception e) | 154 | catch (Exception e) |
155 | { | 155 | { |
156 | <<<<<<< HEAD | ||
157 | m_log.Warn(string.Format( | ||
158 | "[NEIGHBOUR SERVICES CONNECTOR]: Unable to send HelloNeighbour from {0} to {1} (uri {2}). Exception {3} ", | ||
159 | thisRegion.RegionName, region.RegionName, uri, e.Message), e); | ||
160 | ======= | ||
156 | // m_log.WarnFormat( | 161 | // m_log.WarnFormat( |
157 | // "[NEIGHBOUR SERVICE CONNCTOR]: Unable to send HelloNeighbour from {0} to {1}. Exception {2}{3}", | 162 | // "[NEIGHBOUR SERVICE CONNCTOR]: Unable to send HelloNeighbour from {0} to {1}. Exception {2}{3}", |
158 | // thisRegion.RegionName, region.RegionName, e.Message, e.StackTrace); | 163 | // thisRegion.RegionName, region.RegionName, e.Message, e.StackTrace); |
164 | >>>>>>> avn/ubitvar | ||
159 | 165 | ||
160 | return false; | 166 | return false; |
161 | } | 167 | } |
162 | finally | 168 | finally |
163 | { | 169 | { |
164 | if (os != null) | 170 | if (os != null) |
165 | os.Close(); | 171 | os.Dispose(); |
166 | } | 172 | } |
167 | 173 | ||
168 | // Let's wait for the response | 174 | // Let's wait for the response |
@@ -192,9 +198,9 @@ namespace OpenSim.Services.Connectors | |||
192 | } | 198 | } |
193 | catch (Exception e) | 199 | catch (Exception e) |
194 | { | 200 | { |
195 | m_log.WarnFormat( | 201 | m_log.Warn(string.Format( |
196 | "[NEIGHBOUR SERVICES CONNECTOR]: Exception on reply of DoHelloNeighbourCall from {0} back to {1}. Exception {2}{3}", | 202 | "[NEIGHBOUR SERVICES CONNECTOR]: Exception on reply of DoHelloNeighbourCall from {0} back to {1}. Exception {2} ", |
197 | region.RegionName, thisRegion.RegionName, e.Message, e.StackTrace); | 203 | region.RegionName, thisRegion.RegionName, e.Message), e); |
198 | 204 | ||
199 | return false; | 205 | return false; |
200 | } | 206 | } |
diff --git a/OpenSim/Services/Connectors/Presence/PresenceServicesConnector.cs b/OpenSim/Services/Connectors/Presence/PresenceServicesConnector.cs index 378aab6..e474d41 100644 --- a/OpenSim/Services/Connectors/Presence/PresenceServicesConnector.cs +++ b/OpenSim/Services/Connectors/Presence/PresenceServicesConnector.cs | |||
@@ -33,6 +33,7 @@ using System.Reflection; | |||
33 | using Nini.Config; | 33 | using Nini.Config; |
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Communications; | 35 | using OpenSim.Framework.Communications; |
36 | using OpenSim.Framework.ServiceAuth; | ||
36 | using OpenSim.Services.Interfaces; | 37 | using OpenSim.Services.Interfaces; |
37 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | 38 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; |
38 | using OpenSim.Server.Base; | 39 | using OpenSim.Server.Base; |
@@ -40,7 +41,7 @@ using OpenMetaverse; | |||
40 | 41 | ||
41 | namespace OpenSim.Services.Connectors | 42 | namespace OpenSim.Services.Connectors |
42 | { | 43 | { |
43 | public class PresenceServicesConnector : IPresenceService | 44 | public class PresenceServicesConnector : BaseServiceConnector, IPresenceService |
44 | { | 45 | { |
45 | private static readonly ILog m_log = | 46 | private static readonly ILog m_log = |
46 | LogManager.GetLogger( | 47 | LogManager.GetLogger( |
@@ -80,6 +81,8 @@ namespace OpenSim.Services.Connectors | |||
80 | throw new Exception("Presence connector init error"); | 81 | throw new Exception("Presence connector init error"); |
81 | } | 82 | } |
82 | m_ServerURI = serviceURI; | 83 | m_ServerURI = serviceURI; |
84 | |||
85 | base.Initialise(source, "PresenceService"); | ||
83 | } | 86 | } |
84 | 87 | ||
85 | 88 | ||
@@ -104,7 +107,8 @@ namespace OpenSim.Services.Connectors | |||
104 | { | 107 | { |
105 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", | 108 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", |
106 | uri, | 109 | uri, |
107 | reqString); | 110 | reqString, |
111 | m_Auth); | ||
108 | if (reply != string.Empty) | 112 | if (reply != string.Empty) |
109 | { | 113 | { |
110 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | 114 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); |
@@ -149,7 +153,8 @@ namespace OpenSim.Services.Connectors | |||
149 | { | 153 | { |
150 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", | 154 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", |
151 | uri, | 155 | uri, |
152 | reqString); | 156 | reqString, |
157 | m_Auth); | ||
153 | if (reply != string.Empty) | 158 | if (reply != string.Empty) |
154 | { | 159 | { |
155 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | 160 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); |
@@ -193,7 +198,8 @@ namespace OpenSim.Services.Connectors | |||
193 | { | 198 | { |
194 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", | 199 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", |
195 | uri, | 200 | uri, |
196 | reqString); | 201 | reqString, |
202 | m_Auth); | ||
197 | if (reply != string.Empty) | 203 | if (reply != string.Empty) |
198 | { | 204 | { |
199 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | 205 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); |
@@ -238,7 +244,8 @@ namespace OpenSim.Services.Connectors | |||
238 | { | 244 | { |
239 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", | 245 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", |
240 | uri, | 246 | uri, |
241 | reqString); | 247 | reqString, |
248 | m_Auth); | ||
242 | if (reply != string.Empty) | 249 | if (reply != string.Empty) |
243 | { | 250 | { |
244 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | 251 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); |
@@ -283,7 +290,8 @@ namespace OpenSim.Services.Connectors | |||
283 | { | 290 | { |
284 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 291 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
285 | uri, | 292 | uri, |
286 | reqString); | 293 | reqString, |
294 | m_Auth); | ||
287 | if (reply == null || (reply != null && reply == string.Empty)) | 295 | if (reply == null || (reply != null && reply == string.Empty)) |
288 | { | 296 | { |
289 | m_log.DebugFormat("[PRESENCE CONNECTOR]: GetAgent received null or empty reply"); | 297 | m_log.DebugFormat("[PRESENCE CONNECTOR]: GetAgent received null or empty reply"); |
@@ -293,6 +301,7 @@ namespace OpenSim.Services.Connectors | |||
293 | catch (Exception e) | 301 | catch (Exception e) |
294 | { | 302 | { |
295 | m_log.DebugFormat("[PRESENCE CONNECTOR]: Exception when contacting presence server at {0}: {1}", uri, e.Message); | 303 | m_log.DebugFormat("[PRESENCE CONNECTOR]: Exception when contacting presence server at {0}: {1}", uri, e.Message); |
304 | return null; | ||
296 | } | 305 | } |
297 | 306 | ||
298 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | 307 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); |
@@ -338,7 +347,8 @@ namespace OpenSim.Services.Connectors | |||
338 | { | 347 | { |
339 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 348 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
340 | uri, | 349 | uri, |
341 | reqString); | 350 | reqString, |
351 | m_Auth); | ||
342 | if (reply == null || (reply != null && reply == string.Empty)) | 352 | if (reply == null || (reply != null && reply == string.Empty)) |
343 | { | 353 | { |
344 | m_log.DebugFormat("[PRESENCE CONNECTOR]: GetAgents received null or empty reply"); | 354 | m_log.DebugFormat("[PRESENCE CONNECTOR]: GetAgents received null or empty reply"); |
diff --git a/OpenSim/Services/Connectors/Properties/AssemblyInfo.cs b/OpenSim/Services/Connectors/Properties/AssemblyInfo.cs index bc89f5d..2af2ec1 100644 --- a/OpenSim/Services/Connectors/Properties/AssemblyInfo.cs +++ b/OpenSim/Services/Connectors/Properties/AssemblyInfo.cs | |||
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices; | |||
29 | // Build Number | 29 | // Build Number |
30 | // Revision | 30 | // Revision |
31 | // | 31 | // |
32 | [assembly: AssemblyVersion("0.8.0.*")] | 32 | [assembly: AssemblyVersion("0.8.2.*")] |
33 | 33 | ||
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs index 95e4bab..cd4781d 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs | |||
@@ -69,7 +69,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
69 | Util.FireAndForget(delegate(object o) | 69 | Util.FireAndForget(delegate(object o) |
70 | { | 70 | { |
71 | m_GridUserService.SetLastPosition(sp.UUID.ToString(), sp.ControllingClient.SessionId, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat); | 71 | m_GridUserService.SetLastPosition(sp.UUID.ToString(), sp.ControllingClient.SessionId, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat); |
72 | }); | 72 | }, null, "SimianActivityDetector.SetLastPositionOnMakeRootAgent"); |
73 | } | 73 | } |
74 | 74 | ||
75 | public void OnNewClient(IClientAPI client) | 75 | public void OnNewClient(IClientAPI client) |
@@ -94,7 +94,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
94 | Util.FireAndForget(delegate(object o) | 94 | Util.FireAndForget(delegate(object o) |
95 | { | 95 | { |
96 | m_GridUserService.SetLastPosition(sp.UUID.ToString(), sp.ControllingClient.SessionId, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat); | 96 | m_GridUserService.SetLastPosition(sp.UUID.ToString(), sp.ControllingClient.SessionId, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat); |
97 | }); | 97 | }, null, "SimianActivityDetector.SetLastPositionOnEnteringNewParcel"); |
98 | } | 98 | } |
99 | } | 99 | } |
100 | } \ No newline at end of file | 100 | } \ No newline at end of file |
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs index 6f8d9ed..9ad4a7a 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs | |||
@@ -225,12 +225,32 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
225 | { | 225 | { |
226 | AssetBase asset = SimianGetOperation(id); | 226 | AssetBase asset = SimianGetOperation(id); |
227 | handler(id, sender, asset); | 227 | handler(id, sender, asset); |
228 | } | 228 | }, null, "SimianAssetServiceConnector.GetFromService" |
229 | ); | 229 | ); |
230 | 230 | ||
231 | return true; | 231 | return true; |
232 | } | 232 | } |
233 | 233 | ||
234 | public bool[] AssetsExist(string[] ids) | ||
235 | { | ||
236 | if (String.IsNullOrEmpty(m_serverUrl)) | ||
237 | { | ||
238 | m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI configured"); | ||
239 | throw new InvalidOperationException(); | ||
240 | } | ||
241 | |||
242 | bool[] exist = new bool[ids.Length]; | ||
243 | |||
244 | for (int i = 0; i < ids.Length; i++) | ||
245 | { | ||
246 | AssetMetadata metadata = GetMetadata(ids[i]); | ||
247 | if (metadata != null) | ||
248 | exist[i] = true; | ||
249 | } | ||
250 | |||
251 | return exist; | ||
252 | } | ||
253 | |||
234 | /// <summary> | 254 | /// <summary> |
235 | /// Creates a new asset | 255 | /// Creates a new asset |
236 | /// </summary> | 256 | /// </summary> |
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGrid.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGrid.cs index 9898da9..a35d749 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianGrid.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianGrid.cs | |||
@@ -39,8 +39,8 @@ using OpenSim.Services.Interfaces; | |||
39 | using OpenMetaverse; | 39 | using OpenMetaverse; |
40 | using OpenMetaverse.StructuredData; | 40 | using OpenMetaverse.StructuredData; |
41 | 41 | ||
42 | [assembly: Addin("SimianGrid", "1.0")] | 42 | [assembly: Addin("SimianGrid", OpenSim.VersionInfo.VersionNumber)] |
43 | [assembly: AddinDependency("OpenSim", "0.5")] | 43 | [assembly: AddinDependency("OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)] |
44 | 44 | ||
45 | namespace OpenSim.Services.Connectors.SimianGrid | 45 | namespace OpenSim.Services.Connectors.SimianGrid |
46 | { | 46 | { |
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridMaptileModule.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridMaptileModule.cs index b999509..8375c95 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianGridMaptileModule.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridMaptileModule.cs | |||
@@ -181,7 +181,6 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
181 | m_log.DebugFormat("[SIMIAN MAPTILE]: upload maptile for {0}",scene.RegionInfo.RegionName); | 181 | m_log.DebugFormat("[SIMIAN MAPTILE]: upload maptile for {0}",scene.RegionInfo.RegionName); |
182 | 182 | ||
183 | // Create a PNG map tile and upload it to the AddMapTile API | 183 | // Create a PNG map tile and upload it to the AddMapTile API |
184 | byte[] pngData = Utils.EmptyBytes; | ||
185 | IMapImageGenerator tileGenerator = scene.RequestModuleInterface<IMapImageGenerator>(); | 184 | IMapImageGenerator tileGenerator = scene.RequestModuleInterface<IMapImageGenerator>(); |
186 | if (tileGenerator == null) | 185 | if (tileGenerator == null) |
187 | { | 186 | { |
@@ -189,93 +188,79 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
189 | return; | 188 | return; |
190 | } | 189 | } |
191 | 190 | ||
192 | using (Image mapTile = tileGenerator.CreateMapTile()) | 191 | using (Bitmap mapTile = tileGenerator.CreateMapTile()) |
193 | { | 192 | { |
194 | using (MemoryStream stream = new MemoryStream()) | 193 | if (mapTile != null) |
194 | { | ||
195 | // If the region/maptile is legacy sized, just upload the one tile like it has always been done | ||
196 | if (mapTile.Width == Constants.RegionSize && mapTile.Height == Constants.RegionSize) | ||
197 | { | ||
198 | ConvertAndUploadMaptile(mapTile, scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY); | ||
199 | } | ||
200 | else | ||
201 | { | ||
202 | // For larger regions (varregion) we must cut the region image into legacy sized | ||
203 | // pieces since that is how the maptile system works. | ||
204 | // Note the assumption that varregions are always a multiple of legacy size. | ||
205 | for (uint xx = 0; xx < mapTile.Width; xx += Constants.RegionSize) | ||
206 | { | ||
207 | for (uint yy = 0; yy < mapTile.Height; yy += Constants.RegionSize) | ||
208 | { | ||
209 | // Images are addressed from the upper left corner so have to do funny | ||
210 | // math to pick out the sub-tile since regions are numbered from | ||
211 | // the lower left. | ||
212 | Rectangle rect = new Rectangle( | ||
213 | (int)xx, | ||
214 | mapTile.Height - (int)yy - (int)Constants.RegionSize, | ||
215 | (int)Constants.RegionSize, (int)Constants.RegionSize); | ||
216 | |||
217 | using (Bitmap subMapTile = mapTile.Clone(rect, mapTile.PixelFormat)) | ||
218 | { | ||
219 | uint locX = scene.RegionInfo.RegionLocX + (xx / Constants.RegionSize); | ||
220 | uint locY = scene.RegionInfo.RegionLocY + (yy / Constants.RegionSize); | ||
221 | |||
222 | ConvertAndUploadMaptile(subMapTile, locX, locY); | ||
223 | } | ||
224 | } | ||
225 | } | ||
226 | } | ||
227 | } | ||
228 | else | ||
195 | { | 229 | { |
196 | mapTile.Save(stream, ImageFormat.Png); | 230 | m_log.WarnFormat("[SIMIAN MAPTILE] Tile image generation failed"); |
197 | pngData = stream.ToArray(); | ||
198 | } | 231 | } |
199 | } | 232 | } |
200 | 233 | ||
234 | } | ||
235 | |||
236 | ///<summary> | ||
237 | /// | ||
238 | ///</summary> | ||
239 | private void ConvertAndUploadMaptile(Image mapTile, uint locX, uint locY) | ||
240 | { | ||
241 | //m_log.DebugFormat("[SIMIAN MAPTILE]: upload maptile for location {0}, {1}", locX, locY); | ||
242 | |||
243 | byte[] pngData = Utils.EmptyBytes; | ||
244 | using (MemoryStream stream = new MemoryStream()) | ||
245 | { | ||
246 | mapTile.Save(stream, ImageFormat.Png); | ||
247 | pngData = stream.ToArray(); | ||
248 | } | ||
249 | |||
201 | NameValueCollection requestArgs = new NameValueCollection | 250 | NameValueCollection requestArgs = new NameValueCollection |
202 | { | 251 | { |
203 | { "RequestMethod", "xAddMapTile" }, | 252 | { "RequestMethod", "xAddMapTile" }, |
204 | { "X", scene.RegionInfo.RegionLocX.ToString() }, | 253 | { "X", locX.ToString() }, |
205 | { "Y", scene.RegionInfo.RegionLocY.ToString() }, | 254 | { "Y", locY.ToString() }, |
206 | { "ContentType", "image/png" }, | 255 | { "ContentType", "image/png" }, |
207 | { "EncodedData", System.Convert.ToBase64String(pngData) } | 256 | { "EncodedData", System.Convert.ToBase64String(pngData) } |
208 | }; | 257 | }; |
209 | 258 | ||
210 | OSDMap response = SimianGrid.PostToService(m_serverUrl,requestArgs); | 259 | OSDMap response = SimianGrid.PostToService(m_serverUrl,requestArgs); |
211 | if (! response["Success"].AsBoolean()) | 260 | if (! response["Success"].AsBoolean()) |
212 | { | 261 | { |
213 | m_log.WarnFormat("[SIMIAN MAPTILE] failed to store map tile; {0}",response["Message"].AsString()); | 262 | m_log.WarnFormat("[SIMIAN MAPTILE] failed to store map tile; {0}",response["Message"].AsString()); |
214 | return; | ||
215 | } | 263 | } |
216 | |||
217 | // List<MultipartForm.Element> postParameters = new List<MultipartForm.Element>() | ||
218 | // { | ||
219 | // new MultipartForm.Parameter("X", scene.RegionInfo.RegionLocX.ToString()), | ||
220 | // new MultipartForm.Parameter("Y", scene.RegionInfo.RegionLocY.ToString()), | ||
221 | // new MultipartForm.File("Tile", "tile.png", "image/png", pngData) | ||
222 | // }; | ||
223 | |||
224 | // string errorMessage = null; | ||
225 | // int tickstart = Util.EnvironmentTickCount(); | ||
226 | |||
227 | // // Make the remote storage request | ||
228 | // try | ||
229 | // { | ||
230 | // HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(m_serverUrl); | ||
231 | // request.Timeout = 20000; | ||
232 | // request.ReadWriteTimeout = 5000; | ||
233 | |||
234 | // using (HttpWebResponse response = MultipartForm.Post(request, postParameters)) | ||
235 | // { | ||
236 | // using (Stream responseStream = response.GetResponseStream()) | ||
237 | // { | ||
238 | // string responseStr = responseStream.GetStreamString(); | ||
239 | // OSD responseOSD = OSDParser.Deserialize(responseStr); | ||
240 | // if (responseOSD.Type == OSDType.Map) | ||
241 | // { | ||
242 | // OSDMap responseMap = (OSDMap)responseOSD; | ||
243 | // if (responseMap["Success"].AsBoolean()) | ||
244 | // return; | ||
245 | |||
246 | // errorMessage = "Upload failed: " + responseMap["Message"].AsString(); | ||
247 | // } | ||
248 | // else | ||
249 | // { | ||
250 | // errorMessage = "Response format was invalid:\n" + responseStr; | ||
251 | // } | ||
252 | // } | ||
253 | // } | ||
254 | // } | ||
255 | // catch (WebException we) | ||
256 | // { | ||
257 | // errorMessage = we.Message; | ||
258 | // if (we.Status == WebExceptionStatus.ProtocolError) | ||
259 | // { | ||
260 | // HttpWebResponse webResponse = (HttpWebResponse)we.Response; | ||
261 | // errorMessage = String.Format("[{0}] {1}", | ||
262 | // webResponse.StatusCode,webResponse.StatusDescription); | ||
263 | // } | ||
264 | // } | ||
265 | // catch (Exception ex) | ||
266 | // { | ||
267 | // errorMessage = ex.Message; | ||
268 | // } | ||
269 | // finally | ||
270 | // { | ||
271 | // // This just dumps a warning for any operation that takes more than 100 ms | ||
272 | // int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); | ||
273 | // m_log.DebugFormat("[SIMIAN MAPTILE]: map tile uploaded in {0}ms",tickdiff); | ||
274 | // } | ||
275 | |||
276 | // m_log.WarnFormat("[SIMIAN MAPTILE]: Failed to store {0} byte tile for {1}: {2}", | ||
277 | // pngData.Length, scene.RegionInfo.RegionName, errorMessage); | ||
278 | |||
279 | } | 264 | } |
280 | } | 265 | } |
281 | } \ No newline at end of file | 266 | } \ No newline at end of file |
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs index 312832f..6043b70 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs | |||
@@ -167,10 +167,10 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
167 | 167 | ||
168 | public List<GridRegion> GetNeighbours(UUID scopeID, UUID regionID) | 168 | public List<GridRegion> GetNeighbours(UUID scopeID, UUID regionID) |
169 | { | 169 | { |
170 | const int NEIGHBOR_RADIUS = 128; | ||
171 | |||
172 | GridRegion region = GetRegionByUUID(scopeID, regionID); | 170 | GridRegion region = GetRegionByUUID(scopeID, regionID); |
173 | 171 | ||
172 | int NEIGHBOR_RADIUS = Math.Max(region.RegionSizeX, region.RegionSizeY) / 2; | ||
173 | |||
174 | if (region != null) | 174 | if (region != null) |
175 | { | 175 | { |
176 | List<GridRegion> regions = GetRegionRange(scopeID, | 176 | List<GridRegion> regions = GetRegionRange(scopeID, |
@@ -413,6 +413,13 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
413 | return -1; | 413 | return -1; |
414 | } | 414 | } |
415 | } | 415 | } |
416 | |||
417 | public Dictionary<string, object> GetExtraFeatures() | ||
418 | { | ||
419 | /// See SimulatorFeaturesModule - Need to get map, search and destination guide | ||
420 | Dictionary<string, object> extraFeatures = new Dictionary<string, object>(); | ||
421 | return extraFeatures; | ||
422 | } | ||
416 | 423 | ||
417 | #endregion IGridService | 424 | #endregion IGridService |
418 | 425 | ||
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs index 97eaabe..e793420 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs | |||
@@ -74,6 +74,9 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
74 | // private object m_gestureSyncRoot = new object(); | 74 | // private object m_gestureSyncRoot = new object(); |
75 | private bool m_Enabled = false; | 75 | private bool m_Enabled = false; |
76 | 76 | ||
77 | private const double CACHE_EXPIRATION_SECONDS = 20.0; | ||
78 | private static ExpiringCache<UUID, InventoryItemBase> m_ItemCache; | ||
79 | |||
77 | #region ISharedRegionModule | 80 | #region ISharedRegionModule |
78 | 81 | ||
79 | public Type ReplaceableInterface { get { return null; } } | 82 | public Type ReplaceableInterface { get { return null; } } |
@@ -99,6 +102,9 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
99 | url = url + '/'; | 102 | url = url + '/'; |
100 | m_serverUrl = url; | 103 | m_serverUrl = url; |
101 | 104 | ||
105 | if (m_ItemCache == null) | ||
106 | m_ItemCache = new ExpiringCache<UUID, InventoryItemBase>(); | ||
107 | |||
102 | } | 108 | } |
103 | 109 | ||
104 | public void Initialise(IConfigSource source) | 110 | public void Initialise(IConfigSource source) |
@@ -132,6 +138,8 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
132 | { | 138 | { |
133 | m_userServerUrl = serviceUrl; | 139 | m_userServerUrl = serviceUrl; |
134 | m_Enabled = true; | 140 | m_Enabled = true; |
141 | if (m_ItemCache == null) | ||
142 | m_ItemCache = new ExpiringCache<UUID, InventoryItemBase>(); | ||
135 | } | 143 | } |
136 | } | 144 | } |
137 | } | 145 | } |
@@ -197,37 +205,6 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
197 | } | 205 | } |
198 | 206 | ||
199 | /// <summary> | 207 | /// <summary> |
200 | /// Synchronous inventory fetch. | ||
201 | /// </summary> | ||
202 | /// <param name="userID"></param> | ||
203 | /// <returns></returns> | ||
204 | [Obsolete] | ||
205 | public InventoryCollection GetUserInventory(UUID userID) | ||
206 | { | ||
207 | m_log.Error("[SIMIAN INVENTORY CONNECTOR]: Obsolete GetUserInventory called for " + userID); | ||
208 | |||
209 | InventoryCollection inventory = new InventoryCollection(); | ||
210 | inventory.UserID = userID; | ||
211 | inventory.Folders = new List<InventoryFolderBase>(); | ||
212 | inventory.Items = new List<InventoryItemBase>(); | ||
213 | |||
214 | return inventory; | ||
215 | } | ||
216 | |||
217 | /// <summary> | ||
218 | /// Request the inventory for a user. This is an asynchronous operation that will call the callback when the | ||
219 | /// inventory has been received | ||
220 | /// </summary> | ||
221 | /// <param name="userID"></param> | ||
222 | /// <param name="callback"></param> | ||
223 | [Obsolete] | ||
224 | public void GetUserInventory(UUID userID, InventoryReceiptCallback callback) | ||
225 | { | ||
226 | m_log.Error("[SIMIAN INVENTORY CONNECTOR]: Obsolete GetUserInventory called for " + userID); | ||
227 | callback(new List<InventoryFolderImpl>(0), new List<InventoryItemBase>(0)); | ||
228 | } | ||
229 | |||
230 | /// <summary> | ||
231 | /// Retrieve the root inventory folder for the given user. | 208 | /// Retrieve the root inventory folder for the given user. |
232 | /// </summary> | 209 | /// </summary> |
233 | /// <param name="userID"></param> | 210 | /// <param name="userID"></param> |
@@ -263,7 +240,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
263 | /// <param name="userID"></param> | 240 | /// <param name="userID"></param> |
264 | /// <param name="type"></param> | 241 | /// <param name="type"></param> |
265 | /// <returns></returns> | 242 | /// <returns></returns> |
266 | public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) | 243 | public InventoryFolderBase GetFolderForType(UUID userID, FolderType type) |
267 | { | 244 | { |
268 | string contentType = SLUtil.SLAssetTypeToContentType((int)type); | 245 | string contentType = SLUtil.SLAssetTypeToContentType((int)type); |
269 | 246 | ||
@@ -302,6 +279,10 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
302 | /// <returns></returns> | 279 | /// <returns></returns> |
303 | public InventoryItemBase GetItem(InventoryItemBase item) | 280 | public InventoryItemBase GetItem(InventoryItemBase item) |
304 | { | 281 | { |
282 | InventoryItemBase retrieved = null; | ||
283 | if (m_ItemCache.TryGetValue(item.ID, out retrieved)) | ||
284 | return retrieved; | ||
285 | |||
305 | NameValueCollection requestArgs = new NameValueCollection | 286 | NameValueCollection requestArgs = new NameValueCollection |
306 | { | 287 | { |
307 | { "RequestMethod", "GetInventoryNode" }, | 288 | { "RequestMethod", "GetInventoryNode" }, |
@@ -323,7 +304,11 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
323 | for (int i = 0; i < items.Count; i++) | 304 | for (int i = 0; i < items.Count; i++) |
324 | { | 305 | { |
325 | if (items[i].ID == item.ID) | 306 | if (items[i].ID == item.ID) |
326 | return items[i]; | 307 | { |
308 | retrieved = items[i]; | ||
309 | m_ItemCache.AddOrUpdate(item.ID, retrieved, CACHE_EXPIRATION_SECONDS); | ||
310 | return retrieved; | ||
311 | } | ||
327 | } | 312 | } |
328 | } | 313 | } |
329 | } | 314 | } |
@@ -332,6 +317,21 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
332 | return null; | 317 | return null; |
333 | } | 318 | } |
334 | 319 | ||
320 | public InventoryItemBase[] GetMultipleItems(UUID principalID, UUID[] itemIDs) | ||
321 | { | ||
322 | InventoryItemBase[] result = new InventoryItemBase[itemIDs.Length]; | ||
323 | int i = 0; | ||
324 | InventoryItemBase item = new InventoryItemBase(); | ||
325 | item.Owner = principalID; | ||
326 | foreach (UUID id in itemIDs) | ||
327 | { | ||
328 | item.ID = id; | ||
329 | result[i++] = GetItem(item); | ||
330 | } | ||
331 | |||
332 | return result; | ||
333 | } | ||
334 | |||
335 | /// <summary> | 335 | /// <summary> |
336 | /// Get a folder, given by its UUID | 336 | /// Get a folder, given by its UUID |
337 | /// </summary> | 337 | /// </summary> |
@@ -371,7 +371,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
371 | public InventoryCollection GetFolderContent(UUID userID, UUID folderID) | 371 | public InventoryCollection GetFolderContent(UUID userID, UUID folderID) |
372 | { | 372 | { |
373 | InventoryCollection inventory = new InventoryCollection(); | 373 | InventoryCollection inventory = new InventoryCollection(); |
374 | inventory.UserID = userID; | 374 | inventory.OwnerID = userID; |
375 | 375 | ||
376 | NameValueCollection requestArgs = new NameValueCollection | 376 | NameValueCollection requestArgs = new NameValueCollection |
377 | { | 377 | { |
@@ -402,6 +402,18 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
402 | return inventory; | 402 | return inventory; |
403 | } | 403 | } |
404 | 404 | ||
405 | public virtual InventoryCollection[] GetMultipleFoldersContent(UUID principalID, UUID[] folderIDs) | ||
406 | { | ||
407 | InventoryCollection[] invColl = new InventoryCollection[folderIDs.Length]; | ||
408 | int i = 0; | ||
409 | foreach (UUID fid in folderIDs) | ||
410 | { | ||
411 | invColl[i++] = GetFolderContent(principalID, fid); | ||
412 | } | ||
413 | |||
414 | return invColl; | ||
415 | } | ||
416 | |||
405 | /// <summary> | 417 | /// <summary> |
406 | /// Gets the items inside a folder | 418 | /// Gets the items inside a folder |
407 | /// </summary> | 419 | /// </summary> |
@@ -411,7 +423,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
411 | public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID) | 423 | public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID) |
412 | { | 424 | { |
413 | InventoryCollection inventory = new InventoryCollection(); | 425 | InventoryCollection inventory = new InventoryCollection(); |
414 | inventory.UserID = userID; | 426 | inventory.OwnerID = userID; |
415 | 427 | ||
416 | NameValueCollection requestArgs = new NameValueCollection | 428 | NameValueCollection requestArgs = new NameValueCollection |
417 | { | 429 | { |
@@ -568,7 +580,9 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
568 | // A folder of UUID.Zero means we need to find the most appropriate home for this item | 580 | // A folder of UUID.Zero means we need to find the most appropriate home for this item |
569 | if (item.Folder == UUID.Zero) | 581 | if (item.Folder == UUID.Zero) |
570 | { | 582 | { |
571 | InventoryFolderBase folder = GetFolderForType(item.Owner, (AssetType)item.AssetType); | 583 | InventoryFolderBase folder = null; |
584 | if (Enum.IsDefined(typeof(FolderType), (sbyte)item.AssetType)) | ||
585 | folder = GetFolderForType(item.Owner, (FolderType)item.AssetType); | ||
572 | if (folder != null && folder.ID != UUID.Zero) | 586 | if (folder != null && folder.ID != UUID.Zero) |
573 | item.Folder = folder.ID; | 587 | item.Folder = folder.ID; |
574 | else | 588 | else |
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs b/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs index 684a0db..8fc766d 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs | |||
@@ -425,7 +425,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
425 | estate.EstateID, admin.Name); | 425 | estate.EstateID, admin.Name); |
426 | 426 | ||
427 | estate.EstateOwner = admin.PrincipalID; | 427 | estate.EstateOwner = admin.PrincipalID; |
428 | estate.Save(); | 428 | scene.EstateDataService.StoreEstateSettings(estate); |
429 | } | 429 | } |
430 | else | 430 | else |
431 | { | 431 | { |
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs index fdc8697..08c5c50 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs | |||
@@ -191,9 +191,15 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
191 | return accounts; | 191 | return accounts; |
192 | } | 192 | } |
193 | 193 | ||
194 | <<<<<<< HEAD | ||
195 | public void InvalidateCache(UUID userID) | ||
196 | { | ||
197 | m_accountCache.Remove(userID); | ||
198 | ======= | ||
194 | public List<UserAccount> GetUserAccountsWhere(UUID scopeID, string query) | 199 | public List<UserAccount> GetUserAccountsWhere(UUID scopeID, string query) |
195 | { | 200 | { |
196 | return null; | 201 | return null; |
202 | >>>>>>> avn/ubitvar | ||
197 | } | 203 | } |
198 | 204 | ||
199 | public bool StoreUserAccount(UserAccount data) | 205 | public bool StoreUserAccount(UserAccount data) |
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index 75c5b35..28b6de7 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs | |||
@@ -79,22 +79,32 @@ namespace OpenSim.Services.Connectors.Simulation | |||
79 | return "agent/"; | 79 | return "agent/"; |
80 | } | 80 | } |
81 | 81 | ||
82 | protected virtual void PackData(OSDMap args, AgentCircuitData aCircuit, GridRegion destination, uint flags) | 82 | protected virtual void PackData(OSDMap args, GridRegion source, AgentCircuitData aCircuit, GridRegion destination, uint flags) |
83 | { | 83 | { |
84 | args["destination_x"] = OSD.FromString(destination.RegionLocX.ToString()); | 84 | if (source != null) |
85 | args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString()); | 85 | { |
86 | args["destination_name"] = OSD.FromString(destination.RegionName); | 86 | args["source_x"] = OSD.FromString(source.RegionLocX.ToString()); |
87 | args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString()); | 87 | args["source_y"] = OSD.FromString(source.RegionLocY.ToString()); |
88 | args["teleport_flags"] = OSD.FromString(flags.ToString()); | 88 | args["source_name"] = OSD.FromString(source.RegionName); |
89 | args["source_uuid"] = OSD.FromString(source.RegionID.ToString()); | ||
90 | if (!String.IsNullOrEmpty(source.RawServerURI)) | ||
91 | args["source_server_uri"] = OSD.FromString(source.RawServerURI); | ||
92 | } | ||
93 | |||
94 | args["destination_x"] = OSD.FromString(destination.RegionLocX.ToString()); | ||
95 | args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString()); | ||
96 | args["destination_name"] = OSD.FromString(destination.RegionName); | ||
97 | args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString()); | ||
98 | args["teleport_flags"] = OSD.FromString(flags.ToString()); | ||
89 | } | 99 | } |
90 | 100 | ||
91 | public bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint flags, out string reason) | 101 | public bool CreateAgent(GridRegion source, GridRegion destination, AgentCircuitData aCircuit, uint flags, out string reason) |
92 | { | 102 | { |
93 | string tmp = String.Empty; | 103 | string tmp = String.Empty; |
94 | return CreateAgent(destination, aCircuit, flags, out tmp, out reason); | 104 | return CreateAgent(source, destination, aCircuit, flags, out tmp, out reason); |
95 | } | 105 | } |
96 | 106 | ||
97 | public bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint flags, out string myipaddress, out string reason) | 107 | public bool CreateAgent(GridRegion source, GridRegion destination, AgentCircuitData aCircuit, uint flags, out string myipaddress, out string reason) |
98 | { | 108 | { |
99 | m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: Creating agent at {0}", destination.ServerURI); | 109 | m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: Creating agent at {0}", destination.ServerURI); |
100 | reason = String.Empty; | 110 | reason = String.Empty; |
@@ -112,7 +122,7 @@ namespace OpenSim.Services.Connectors.Simulation | |||
112 | try | 122 | try |
113 | { | 123 | { |
114 | OSDMap args = aCircuit.PackAgentCircuitData(); | 124 | OSDMap args = aCircuit.PackAgentCircuitData(); |
115 | PackData(args, aCircuit, destination, flags); | 125 | PackData(args, source, aCircuit, destination, flags); |
116 | 126 | ||
117 | OSDMap result = WebUtil.PostToServiceCompressed(uri, args, 30000); | 127 | OSDMap result = WebUtil.PostToServiceCompressed(uri, args, 30000); |
118 | bool success = result["success"].AsBoolean(); | 128 | bool success = result["success"].AsBoolean(); |
@@ -127,7 +137,7 @@ namespace OpenSim.Services.Connectors.Simulation | |||
127 | } | 137 | } |
128 | 138 | ||
129 | // Try the old version, uncompressed | 139 | // Try the old version, uncompressed |
130 | result = WebUtil.PostToService(uri, args, 30000); | 140 | result = WebUtil.PostToService(uri, args, 30000, false); |
131 | 141 | ||
132 | if (result["Success"].AsBoolean()) | 142 | if (result["Success"].AsBoolean()) |
133 | { | 143 | { |
@@ -273,9 +283,13 @@ namespace OpenSim.Services.Connectors.Simulation | |||
273 | } | 283 | } |
274 | 284 | ||
275 | 285 | ||
286 | <<<<<<< HEAD | ||
287 | public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, string myversion, List<UUID> featuresAvailable, out string version, out string reason) | ||
288 | ======= | ||
276 | /// <summary> | 289 | /// <summary> |
277 | /// </summary> | 290 | /// </summary> |
278 | public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, string myversion, out string version, out string reason) | 291 | public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, string myversion, out string version, out string reason) |
292 | >>>>>>> avn/ubitvar | ||
279 | { | 293 | { |
280 | reason = "Failed to contact destination"; | 294 | reason = "Failed to contact destination"; |
281 | version = "Unknown"; | 295 | version = "Unknown"; |
@@ -292,12 +306,22 @@ namespace OpenSim.Services.Connectors.Simulation | |||
292 | request.Add("viaTeleport", OSD.FromBoolean(viaTeleport)); | 306 | request.Add("viaTeleport", OSD.FromBoolean(viaTeleport)); |
293 | request.Add("position", OSD.FromString(position.ToString())); | 307 | request.Add("position", OSD.FromString(position.ToString())); |
294 | request.Add("my_version", OSD.FromString(myversion)); | 308 | request.Add("my_version", OSD.FromString(myversion)); |
309 | <<<<<<< HEAD | ||
310 | |||
311 | OSDArray features = new OSDArray(); | ||
312 | foreach (UUID feature in featuresAvailable) | ||
313 | features.Add(OSD.FromString(feature.ToString())); | ||
314 | |||
315 | request.Add("features", features); | ||
316 | |||
317 | ======= | ||
318 | >>>>>>> avn/ubitvar | ||
295 | if (agentHomeURI != null) | 319 | if (agentHomeURI != null) |
296 | request.Add("agent_home_uri", OSD.FromString(agentHomeURI)); | 320 | request.Add("agent_home_uri", OSD.FromString(agentHomeURI)); |
297 | 321 | ||
298 | try | 322 | try |
299 | { | 323 | { |
300 | OSDMap result = WebUtil.ServiceOSDRequest(uri, request, "QUERYACCESS", 30000, false); | 324 | OSDMap result = WebUtil.ServiceOSDRequest(uri, request, "QUERYACCESS", 30000, false, false); |
301 | bool success = result["success"].AsBoolean(); | 325 | bool success = result["success"].AsBoolean(); |
302 | if (result.ContainsKey("_Result")) | 326 | if (result.ContainsKey("_Result")) |
303 | { | 327 | { |
@@ -342,9 +366,22 @@ namespace OpenSim.Services.Connectors.Simulation | |||
342 | return false; | 366 | return false; |
343 | } | 367 | } |
344 | 368 | ||
369 | <<<<<<< HEAD | ||
370 | |||
371 | featuresAvailable.Clear(); | ||
372 | |||
373 | if (result.ContainsKey("features")) | ||
374 | { | ||
375 | OSDArray array = (OSDArray)result["features"]; | ||
376 | |||
377 | foreach (OSD o in array) | ||
378 | featuresAvailable.Add(new UUID(o.AsString())); | ||
379 | } | ||
380 | ======= | ||
345 | OSDMap resp = (OSDMap)result["_Result"]; | 381 | OSDMap resp = (OSDMap)result["_Result"]; |
346 | success = resp["success"].AsBoolean(); | 382 | success = resp["success"].AsBoolean(); |
347 | reason = resp["reason"].AsString(); | 383 | reason = resp["reason"].AsString(); |
384 | >>>>>>> avn/ubitvar | ||
348 | 385 | ||
349 | return success; | 386 | return success; |
350 | } | 387 | } |
@@ -364,7 +401,7 @@ namespace OpenSim.Services.Connectors.Simulation | |||
364 | 401 | ||
365 | try | 402 | try |
366 | { | 403 | { |
367 | WebUtil.ServiceOSDRequest(uri, null, "DELETE", 10000, false); | 404 | WebUtil.ServiceOSDRequest(uri, null, "DELETE", 10000, false, false); |
368 | } | 405 | } |
369 | catch (Exception e) | 406 | catch (Exception e) |
370 | { | 407 | { |
@@ -383,7 +420,7 @@ namespace OpenSim.Services.Connectors.Simulation | |||
383 | 420 | ||
384 | try | 421 | try |
385 | { | 422 | { |
386 | WebUtil.ServiceOSDRequest(uri, null, "DELETE", 10000, false); | 423 | WebUtil.ServiceOSDRequest(uri, null, "DELETE", 10000, false, false); |
387 | } | 424 | } |
388 | catch (Exception e) | 425 | catch (Exception e) |
389 | { | 426 | { |
@@ -430,8 +467,17 @@ namespace OpenSim.Services.Connectors.Simulation | |||
430 | args["destination_name"] = OSD.FromString(destination.RegionName); | 467 | args["destination_name"] = OSD.FromString(destination.RegionName); |
431 | args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString()); | 468 | args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString()); |
432 | 469 | ||
470 | <<<<<<< HEAD | ||
471 | OSDMap result = WebUtil.PostToService(uri, args, 40000, false); | ||
472 | |||
473 | if (result == null) | ||
474 | return false; | ||
475 | bool success = result["success"].AsBoolean(); | ||
476 | if (!success) | ||
477 | ======= | ||
433 | OSDMap response = WebUtil.PostToService(uri, args, 40000); | 478 | OSDMap response = WebUtil.PostToService(uri, args, 40000); |
434 | if (response["Success"] == "False") | 479 | if (response["Success"] == "False") |
480 | >>>>>>> avn/ubitvar | ||
435 | return false; | 481 | return false; |
436 | } | 482 | } |
437 | catch (Exception e) | 483 | catch (Exception e) |
diff --git a/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs b/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs index 6b2d710..e5fb5a8 100644 --- a/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs +++ b/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs | |||
@@ -33,13 +33,14 @@ using System.Reflection; | |||
33 | using Nini.Config; | 33 | using Nini.Config; |
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Communications; | 35 | using OpenSim.Framework.Communications; |
36 | using OpenSim.Framework.ServiceAuth; | ||
36 | using OpenSim.Server.Base; | 37 | using OpenSim.Server.Base; |
37 | using OpenSim.Services.Interfaces; | 38 | using OpenSim.Services.Interfaces; |
38 | using OpenMetaverse; | 39 | using OpenMetaverse; |
39 | 40 | ||
40 | namespace OpenSim.Services.Connectors | 41 | namespace OpenSim.Services.Connectors |
41 | { | 42 | { |
42 | public class UserAccountServicesConnector : IUserAccountService | 43 | public class UserAccountServicesConnector : BaseServiceConnector, IUserAccountService |
43 | { | 44 | { |
44 | private static readonly ILog m_log = | 45 | private static readonly ILog m_log = |
45 | LogManager.GetLogger( | 46 | LogManager.GetLogger( |
@@ -79,6 +80,8 @@ namespace OpenSim.Services.Connectors | |||
79 | throw new Exception("User account connector init error"); | 80 | throw new Exception("User account connector init error"); |
80 | } | 81 | } |
81 | m_ServerURI = serviceURI; | 82 | m_ServerURI = serviceURI; |
83 | |||
84 | base.Initialise(source, "UserAccountService"); | ||
82 | } | 85 | } |
83 | 86 | ||
84 | public virtual UserAccount GetUserAccount(UUID scopeID, string firstName, string lastName) | 87 | public virtual UserAccount GetUserAccount(UUID scopeID, string firstName, string lastName) |
@@ -144,7 +147,8 @@ namespace OpenSim.Services.Connectors | |||
144 | { | 147 | { |
145 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 148 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
146 | uri, | 149 | uri, |
147 | reqString); | 150 | reqString, |
151 | m_Auth); | ||
148 | if (reply == null || (reply != null && reply == string.Empty)) | 152 | if (reply == null || (reply != null && reply == string.Empty)) |
149 | { | 153 | { |
150 | m_log.DebugFormat("[ACCOUNT CONNECTOR]: GetUserAccounts received null or empty reply"); | 154 | m_log.DebugFormat("[ACCOUNT CONNECTOR]: GetUserAccounts received null or empty reply"); |
@@ -187,9 +191,14 @@ namespace OpenSim.Services.Connectors | |||
187 | return accounts; | 191 | return accounts; |
188 | } | 192 | } |
189 | 193 | ||
194 | <<<<<<< HEAD | ||
195 | public void InvalidateCache(UUID userID) | ||
196 | { | ||
197 | ======= | ||
190 | public List<UserAccount> GetUserAccountsWhere(UUID scopeID, string where) | 198 | public List<UserAccount> GetUserAccountsWhere(UUID scopeID, string where) |
191 | { | 199 | { |
192 | return null; // Not implemented for regions | 200 | return null; // Not implemented for regions |
201 | >>>>>>> avn/ubitvar | ||
193 | } | 202 | } |
194 | 203 | ||
195 | public virtual bool StoreUserAccount(UserAccount data) | 204 | public virtual bool StoreUserAccount(UserAccount data) |
@@ -212,9 +221,39 @@ namespace OpenSim.Services.Connectors | |||
212 | sendData[kvp.Key] = kvp.Value.ToString(); | 221 | sendData[kvp.Key] = kvp.Value.ToString(); |
213 | } | 222 | } |
214 | 223 | ||
215 | return SendAndGetBoolReply(sendData); | 224 | if (SendAndGetReply(sendData) != null) |
225 | return true; | ||
226 | else | ||
227 | return false; | ||
216 | } | 228 | } |
217 | 229 | ||
230 | /// <summary> | ||
231 | /// Create user remotely. Note this this is not part of the IUserAccountsService | ||
232 | /// </summary> | ||
233 | /// <param name="first"></param> | ||
234 | /// <param name="last"></param> | ||
235 | /// <param name="password"></param> | ||
236 | /// <param name="email"></param> | ||
237 | /// <param name="scopeID"></param> | ||
238 | /// <returns></returns> | ||
239 | public virtual UserAccount CreateUser(string first, string last, string password, string email, UUID scopeID) | ||
240 | { | ||
241 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | ||
242 | //sendData["SCOPEID"] = scopeID.ToString(); | ||
243 | sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString(); | ||
244 | sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString(); | ||
245 | sendData["METHOD"] = "createuser"; | ||
246 | |||
247 | sendData["FirstName"] = first; | ||
248 | sendData["LastName"] = last; | ||
249 | sendData["Password"] = password; | ||
250 | if (!string.IsNullOrEmpty(email)) | ||
251 | sendData["Email"] = first; | ||
252 | sendData["ScopeID"] = scopeID.ToString(); | ||
253 | |||
254 | return SendAndGetReply(sendData); | ||
255 | } | ||
256 | |||
218 | private UserAccount SendAndGetReply(Dictionary<string, object> sendData) | 257 | private UserAccount SendAndGetReply(Dictionary<string, object> sendData) |
219 | { | 258 | { |
220 | string reply = string.Empty; | 259 | string reply = string.Empty; |
@@ -225,7 +264,8 @@ namespace OpenSim.Services.Connectors | |||
225 | { | 264 | { |
226 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 265 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
227 | uri, | 266 | uri, |
228 | reqString); | 267 | reqString, |
268 | m_Auth); | ||
229 | if (reply == null || (reply != null && reply == string.Empty)) | 269 | if (reply == null || (reply != null && reply == string.Empty)) |
230 | { | 270 | { |
231 | m_log.DebugFormat("[ACCOUNT CONNECTOR]: GetUserAccount received null or empty reply"); | 271 | m_log.DebugFormat("[ACCOUNT CONNECTOR]: GetUserAccount received null or empty reply"); |
@@ -256,14 +296,16 @@ namespace OpenSim.Services.Connectors | |||
256 | { | 296 | { |
257 | string reqString = ServerUtils.BuildQueryString(sendData); | 297 | string reqString = ServerUtils.BuildQueryString(sendData); |
258 | string uri = m_ServerURI + "/accounts"; | 298 | string uri = m_ServerURI + "/accounts"; |
259 | // m_log.DebugFormat("[ACCOUNTS CONNECTOR]: queryString = {0}", reqString); | 299 | //m_log.DebugFormat("[ACCOUNTS CONNECTOR]: queryString = {0}", reqString); |
260 | try | 300 | try |
261 | { | 301 | { |
262 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", | 302 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", |
263 | uri, | 303 | uri, |
264 | reqString); | 304 | reqString, |
305 | m_Auth); | ||
265 | if (reply != string.Empty) | 306 | if (reply != string.Empty) |
266 | { | 307 | { |
308 | //m_log.DebugFormat("[ACCOUNTS CONNECTOR]: reply = {0}", reply); | ||
267 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | 309 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); |
268 | 310 | ||
269 | if (replyData.ContainsKey("result")) | 311 | if (replyData.ContainsKey("result")) |
diff --git a/OpenSim/Services/Connectors/Simulation/EstateDataService.cs b/OpenSim/Services/EstateService/EstateDataService.cs index cdcdecf..f6a8654 100644 --- a/OpenSim/Services/Connectors/Simulation/EstateDataService.cs +++ b/OpenSim/Services/EstateService/EstateDataService.cs | |||
@@ -29,17 +29,14 @@ using System; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using OpenMetaverse; | 30 | using OpenMetaverse; |
31 | using log4net; | 31 | using log4net; |
32 | using Mono.Addins; | ||
33 | using Nini.Config; | 32 | using Nini.Config; |
34 | using System.Reflection; | 33 | using System.Reflection; |
35 | using OpenSim.Services.Base; | 34 | using OpenSim.Services.Base; |
36 | using OpenSim.Services.Interfaces; | 35 | using OpenSim.Services.Interfaces; |
37 | using OpenSim.Data; | 36 | using OpenSim.Data; |
38 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
39 | using OpenSim.Region.Framework.Interfaces; | ||
40 | using OpenSim.Region.Framework.Scenes; | ||
41 | 38 | ||
42 | namespace OpenSim.Services.Connectors | 39 | namespace OpenSim.Services.EstateService |
43 | { | 40 | { |
44 | public class EstateDataService : ServiceBase, IEstateDataService | 41 | public class EstateDataService : ServiceBase, IEstateDataService |
45 | { | 42 | { |
diff --git a/OpenSim/Services/FSAssetService/FSAssetService.cs b/OpenSim/Services/FSAssetService/FSAssetService.cs new file mode 100644 index 0000000..1bab687 --- /dev/null +++ b/OpenSim/Services/FSAssetService/FSAssetService.cs | |||
@@ -0,0 +1,723 @@ | |||
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.Diagnostics; | ||
30 | using System.Collections.Generic; | ||
31 | using System.IO; | ||
32 | using System.IO.Compression; | ||
33 | using System.Text; | ||
34 | using System.Threading; | ||
35 | using System.Reflection; | ||
36 | using OpenSim.Data; | ||
37 | using OpenSim.Framework; | ||
38 | using OpenSim.Framework.Serialization.External; | ||
39 | using OpenSim.Framework.Console; | ||
40 | using OpenSim.Server.Base; | ||
41 | using OpenSim.Services.Base; | ||
42 | using OpenSim.Services.Interfaces; | ||
43 | using Nini.Config; | ||
44 | using log4net; | ||
45 | using OpenMetaverse; | ||
46 | using System.Security.Cryptography; | ||
47 | |||
48 | namespace OpenSim.Services.FSAssetService | ||
49 | { | ||
50 | public class FSAssetConnector : ServiceBase, IAssetService | ||
51 | { | ||
52 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
53 | |||
54 | static System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); | ||
55 | static SHA256CryptoServiceProvider SHA256 = new SHA256CryptoServiceProvider(); | ||
56 | |||
57 | static byte[] ToCString(string s) | ||
58 | { | ||
59 | byte[] ret = enc.GetBytes(s); | ||
60 | Array.Resize(ref ret, ret.Length + 1); | ||
61 | ret[ret.Length - 1] = 0; | ||
62 | |||
63 | return ret; | ||
64 | } | ||
65 | |||
66 | protected IAssetLoader m_AssetLoader = null; | ||
67 | protected IFSAssetDataPlugin m_DataConnector = null; | ||
68 | protected IAssetService m_FallbackService; | ||
69 | protected Thread m_WriterThread; | ||
70 | protected Thread m_StatsThread; | ||
71 | protected string m_SpoolDirectory; | ||
72 | protected object m_readLock = new object(); | ||
73 | protected object m_statsLock = new object(); | ||
74 | protected int m_readCount = 0; | ||
75 | protected int m_readTicks = 0; | ||
76 | protected int m_missingAssets = 0; | ||
77 | protected int m_missingAssetsFS = 0; | ||
78 | protected string m_FSBase; | ||
79 | |||
80 | private static bool m_Initialized; | ||
81 | private bool m_MainInstance; | ||
82 | |||
83 | public FSAssetConnector(IConfigSource config) | ||
84 | : this(config, "AssetService") | ||
85 | { | ||
86 | } | ||
87 | |||
88 | public FSAssetConnector(IConfigSource config, string configName) : base(config) | ||
89 | { | ||
90 | if (!m_Initialized) | ||
91 | { | ||
92 | m_Initialized = true; | ||
93 | m_MainInstance = true; | ||
94 | |||
95 | MainConsole.Instance.Commands.AddCommand("fs", false, | ||
96 | "show assets", "show assets", "Show asset stats", | ||
97 | HandleShowAssets); | ||
98 | MainConsole.Instance.Commands.AddCommand("fs", false, | ||
99 | "show digest", "show digest <ID>", "Show asset digest", | ||
100 | HandleShowDigest); | ||
101 | MainConsole.Instance.Commands.AddCommand("fs", false, | ||
102 | "delete asset", "delete asset <ID>", | ||
103 | "Delete asset from database", | ||
104 | HandleDeleteAsset); | ||
105 | MainConsole.Instance.Commands.AddCommand("fs", false, | ||
106 | "import", "import <conn> <table> [<start> <count>]", | ||
107 | "Import legacy assets", | ||
108 | HandleImportAssets); | ||
109 | MainConsole.Instance.Commands.AddCommand("fs", false, | ||
110 | "force import", "force import <conn> <table> [<start> <count>]", | ||
111 | "Import legacy assets, overwriting current content", | ||
112 | HandleImportAssets); | ||
113 | } | ||
114 | |||
115 | IConfig assetConfig = config.Configs[configName]; | ||
116 | |||
117 | if (assetConfig == null) | ||
118 | throw new Exception("No AssetService configuration"); | ||
119 | |||
120 | // Get Database Connector from Asset Config (If present) | ||
121 | string dllName = assetConfig.GetString("StorageProvider", string.Empty); | ||
122 | string m_ConnectionString = assetConfig.GetString("ConnectionString", string.Empty); | ||
123 | string m_Realm = assetConfig.GetString("Realm", "fsassets"); | ||
124 | |||
125 | int SkipAccessTimeDays = assetConfig.GetInt("DaysBetweenAccessTimeUpdates", 0); | ||
126 | |||
127 | // If not found above, fallback to Database defaults | ||
128 | IConfig dbConfig = config.Configs["DatabaseService"]; | ||
129 | |||
130 | if (dbConfig != null) | ||
131 | { | ||
132 | if (dllName == String.Empty) | ||
133 | dllName = dbConfig.GetString("StorageProvider", String.Empty); | ||
134 | |||
135 | if (m_ConnectionString == String.Empty) | ||
136 | m_ConnectionString = dbConfig.GetString("ConnectionString", String.Empty); | ||
137 | } | ||
138 | |||
139 | // No databse connection found in either config | ||
140 | if (dllName.Equals(String.Empty)) | ||
141 | throw new Exception("No StorageProvider configured"); | ||
142 | |||
143 | if (m_ConnectionString.Equals(String.Empty)) | ||
144 | throw new Exception("Missing database connection string"); | ||
145 | |||
146 | // Create Storage Provider | ||
147 | m_DataConnector = LoadPlugin<IFSAssetDataPlugin>(dllName); | ||
148 | |||
149 | if (m_DataConnector == null) | ||
150 | throw new Exception(string.Format("Could not find a storage interface in the module {0}", dllName)); | ||
151 | |||
152 | // Initialize DB And perform any migrations required | ||
153 | m_DataConnector.Initialise(m_ConnectionString, m_Realm, SkipAccessTimeDays); | ||
154 | |||
155 | // Setup Fallback Service | ||
156 | string str = assetConfig.GetString("FallbackService", string.Empty); | ||
157 | |||
158 | if (str != string.Empty) | ||
159 | { | ||
160 | object[] args = new object[] { config }; | ||
161 | m_FallbackService = LoadPlugin<IAssetService>(str, args); | ||
162 | if (m_FallbackService != null) | ||
163 | { | ||
164 | m_log.Info("[FSASSETS]: Fallback service loaded"); | ||
165 | } | ||
166 | else | ||
167 | { | ||
168 | m_log.Error("[FSASSETS]: Failed to load fallback service"); | ||
169 | } | ||
170 | } | ||
171 | |||
172 | // Setup directory structure including temp directory | ||
173 | m_SpoolDirectory = assetConfig.GetString("SpoolDirectory", "/tmp"); | ||
174 | |||
175 | string spoolTmp = Path.Combine(m_SpoolDirectory, "spool"); | ||
176 | |||
177 | Directory.CreateDirectory(spoolTmp); | ||
178 | |||
179 | m_FSBase = assetConfig.GetString("BaseDirectory", String.Empty); | ||
180 | if (m_FSBase == String.Empty) | ||
181 | { | ||
182 | m_log.ErrorFormat("[FSASSETS]: BaseDirectory not specified"); | ||
183 | throw new Exception("Configuration error"); | ||
184 | } | ||
185 | |||
186 | if (m_MainInstance) | ||
187 | { | ||
188 | string loader = assetConfig.GetString("DefaultAssetLoader", string.Empty); | ||
189 | if (loader != string.Empty) | ||
190 | { | ||
191 | m_AssetLoader = LoadPlugin<IAssetLoader>(loader); | ||
192 | string loaderArgs = assetConfig.GetString("AssetLoaderArgs", string.Empty); | ||
193 | m_log.InfoFormat("[FSASSETS]: Loading default asset set from {0}", loaderArgs); | ||
194 | m_AssetLoader.ForEachDefaultXmlAsset(loaderArgs, | ||
195 | delegate(AssetBase a) | ||
196 | { | ||
197 | Store(a, false); | ||
198 | }); | ||
199 | } | ||
200 | |||
201 | m_WriterThread = new Thread(Writer); | ||
202 | m_WriterThread.Start(); | ||
203 | m_StatsThread = new Thread(Stats); | ||
204 | m_StatsThread.Start(); | ||
205 | } | ||
206 | |||
207 | m_log.Info("[FSASSETS]: FS asset service enabled"); | ||
208 | } | ||
209 | |||
210 | private void Stats() | ||
211 | { | ||
212 | while (true) | ||
213 | { | ||
214 | Thread.Sleep(60000); | ||
215 | |||
216 | lock (m_statsLock) | ||
217 | { | ||
218 | if (m_readCount > 0) | ||
219 | { | ||
220 | double avg = (double)m_readTicks / (double)m_readCount; | ||
221 | // if (avg > 10000) | ||
222 | // Environment.Exit(0); | ||
223 | m_log.InfoFormat("[FSASSETS]: Read stats: {0} files, {1} ticks, avg {2:F2}, missing {3}, FS {4}", m_readCount, m_readTicks, (double)m_readTicks / (double)m_readCount, m_missingAssets, m_missingAssetsFS); | ||
224 | } | ||
225 | m_readCount = 0; | ||
226 | m_readTicks = 0; | ||
227 | m_missingAssets = 0; | ||
228 | m_missingAssetsFS = 0; | ||
229 | } | ||
230 | } | ||
231 | } | ||
232 | |||
233 | private void Writer() | ||
234 | { | ||
235 | m_log.Info("[FSASSETS]: Writer started"); | ||
236 | |||
237 | while (true) | ||
238 | { | ||
239 | string[] files = Directory.GetFiles(m_SpoolDirectory); | ||
240 | |||
241 | if (files.Length > 0) | ||
242 | { | ||
243 | int tickCount = Environment.TickCount; | ||
244 | for (int i = 0 ; i < files.Length ; i++) | ||
245 | { | ||
246 | string hash = Path.GetFileNameWithoutExtension(files[i]); | ||
247 | string s = HashToFile(hash); | ||
248 | string diskFile = Path.Combine(m_FSBase, s); | ||
249 | |||
250 | Directory.CreateDirectory(Path.GetDirectoryName(diskFile)); | ||
251 | try | ||
252 | { | ||
253 | byte[] data = File.ReadAllBytes(files[i]); | ||
254 | |||
255 | using (GZipStream gz = new GZipStream(new FileStream(diskFile + ".gz", FileMode.Create), CompressionMode.Compress)) | ||
256 | { | ||
257 | gz.Write(data, 0, data.Length); | ||
258 | gz.Close(); | ||
259 | } | ||
260 | File.Delete(files[i]); | ||
261 | |||
262 | //File.Move(files[i], diskFile); | ||
263 | } | ||
264 | catch(System.IO.IOException e) | ||
265 | { | ||
266 | if (e.Message.StartsWith("Win32 IO returned ERROR_ALREADY_EXISTS")) | ||
267 | File.Delete(files[i]); | ||
268 | else | ||
269 | throw; | ||
270 | } | ||
271 | } | ||
272 | int totalTicks = System.Environment.TickCount - tickCount; | ||
273 | if (totalTicks > 0) // Wrap? | ||
274 | { | ||
275 | m_log.InfoFormat("[FSASSETS]: Write cycle complete, {0} files, {1} ticks, avg {2:F2}", files.Length, totalTicks, (double)totalTicks / (double)files.Length); | ||
276 | } | ||
277 | } | ||
278 | |||
279 | Thread.Sleep(1000); | ||
280 | } | ||
281 | } | ||
282 | |||
283 | string GetSHA256Hash(byte[] data) | ||
284 | { | ||
285 | byte[] hash = SHA256.ComputeHash(data); | ||
286 | |||
287 | return BitConverter.ToString(hash).Replace("-", String.Empty); | ||
288 | } | ||
289 | |||
290 | public string HashToPath(string hash) | ||
291 | { | ||
292 | if (hash == null || hash.Length < 10) | ||
293 | return "junkyard"; | ||
294 | |||
295 | return Path.Combine(hash.Substring(0, 3), | ||
296 | Path.Combine(hash.Substring(3, 3))); | ||
297 | /* | ||
298 | * The below is what core would normally use. | ||
299 | * This is modified to work in OSGrid, as seen | ||
300 | * above, because the SRAS data is structured | ||
301 | * that way. | ||
302 | */ | ||
303 | /* | ||
304 | return Path.Combine(hash.Substring(0, 2), | ||
305 | Path.Combine(hash.Substring(2, 2), | ||
306 | Path.Combine(hash.Substring(4, 2), | ||
307 | hash.Substring(6, 4)))); | ||
308 | */ | ||
309 | } | ||
310 | |||
311 | private bool AssetExists(string hash) | ||
312 | { | ||
313 | string s = HashToFile(hash); | ||
314 | string diskFile = Path.Combine(m_FSBase, s); | ||
315 | |||
316 | if (File.Exists(diskFile + ".gz") || File.Exists(diskFile)) | ||
317 | return true; | ||
318 | |||
319 | return false; | ||
320 | } | ||
321 | |||
322 | public virtual bool[] AssetsExist(string[] ids) | ||
323 | { | ||
324 | UUID[] uuid = Array.ConvertAll(ids, id => UUID.Parse(id)); | ||
325 | return m_DataConnector.AssetsExist(uuid); | ||
326 | } | ||
327 | |||
328 | public string HashToFile(string hash) | ||
329 | { | ||
330 | return Path.Combine(HashToPath(hash), hash); | ||
331 | } | ||
332 | |||
333 | public virtual AssetBase Get(string id) | ||
334 | { | ||
335 | string hash; | ||
336 | |||
337 | return Get(id, out hash); | ||
338 | } | ||
339 | |||
340 | private AssetBase Get(string id, out string sha) | ||
341 | { | ||
342 | string hash = string.Empty; | ||
343 | |||
344 | int startTime = System.Environment.TickCount; | ||
345 | AssetMetadata metadata; | ||
346 | |||
347 | lock (m_readLock) | ||
348 | { | ||
349 | metadata = m_DataConnector.Get(id, out hash); | ||
350 | } | ||
351 | |||
352 | sha = hash; | ||
353 | |||
354 | if (metadata == null) | ||
355 | { | ||
356 | AssetBase asset = null; | ||
357 | if (m_FallbackService != null) | ||
358 | { | ||
359 | asset = m_FallbackService.Get(id); | ||
360 | if (asset != null) | ||
361 | { | ||
362 | asset.Metadata.ContentType = | ||
363 | SLUtil.SLAssetTypeToContentType((int)asset.Type); | ||
364 | sha = GetSHA256Hash(asset.Data); | ||
365 | m_log.InfoFormat("[FSASSETS]: Added asset {0} from fallback to local store", id); | ||
366 | Store(asset); | ||
367 | } | ||
368 | } | ||
369 | if (asset == null) | ||
370 | { | ||
371 | // m_log.InfoFormat("[FSASSETS]: Asset {0} not found", id); | ||
372 | m_missingAssets++; | ||
373 | } | ||
374 | return asset; | ||
375 | } | ||
376 | AssetBase newAsset = new AssetBase(); | ||
377 | newAsset.Metadata = metadata; | ||
378 | try | ||
379 | { | ||
380 | newAsset.Data = GetFsData(hash); | ||
381 | if (newAsset.Data.Length == 0) | ||
382 | { | ||
383 | AssetBase asset = null; | ||
384 | if (m_FallbackService != null) | ||
385 | { | ||
386 | asset = m_FallbackService.Get(id); | ||
387 | if (asset != null) | ||
388 | { | ||
389 | asset.Metadata.ContentType = | ||
390 | SLUtil.SLAssetTypeToContentType((int)asset.Type); | ||
391 | sha = GetSHA256Hash(asset.Data); | ||
392 | m_log.InfoFormat("[FSASSETS]: Added asset {0} from fallback to local store", id); | ||
393 | Store(asset); | ||
394 | } | ||
395 | } | ||
396 | if (asset == null) | ||
397 | m_missingAssetsFS++; | ||
398 | // m_log.InfoFormat("[FSASSETS]: Asset {0}, hash {1} not found in FS", id, hash); | ||
399 | else | ||
400 | { | ||
401 | // Deal with bug introduced in Oct. 20 (1eb3e6cc43e2a7b4053bc1185c7c88e22356c5e8) | ||
402 | // Fix bad assets before sending them elsewhere | ||
403 | if (asset.Type == (int)AssetType.Object && asset.Data != null) | ||
404 | { | ||
405 | string xml = ExternalRepresentationUtils.SanitizeXml(Utils.BytesToString(asset.Data)); | ||
406 | asset.Data = Utils.StringToBytes(xml); | ||
407 | } | ||
408 | return asset; | ||
409 | } | ||
410 | } | ||
411 | |||
412 | lock (m_statsLock) | ||
413 | { | ||
414 | m_readTicks += Environment.TickCount - startTime; | ||
415 | m_readCount++; | ||
416 | } | ||
417 | |||
418 | // Deal with bug introduced in Oct. 20 (1eb3e6cc43e2a7b4053bc1185c7c88e22356c5e8) | ||
419 | // Fix bad assets before sending them elsewhere | ||
420 | if (newAsset.Type == (int)AssetType.Object && newAsset.Data != null) | ||
421 | { | ||
422 | string xml = ExternalRepresentationUtils.SanitizeXml(Utils.BytesToString(newAsset.Data)); | ||
423 | newAsset.Data = Utils.StringToBytes(xml); | ||
424 | } | ||
425 | |||
426 | return newAsset; | ||
427 | } | ||
428 | catch (Exception exception) | ||
429 | { | ||
430 | m_log.Error(exception.ToString()); | ||
431 | Thread.Sleep(5000); | ||
432 | Environment.Exit(1); | ||
433 | return null; | ||
434 | } | ||
435 | } | ||
436 | |||
437 | public virtual AssetMetadata GetMetadata(string id) | ||
438 | { | ||
439 | string hash; | ||
440 | return m_DataConnector.Get(id, out hash); | ||
441 | } | ||
442 | |||
443 | public virtual byte[] GetData(string id) | ||
444 | { | ||
445 | string hash; | ||
446 | if (m_DataConnector.Get(id, out hash) == null) | ||
447 | return null; | ||
448 | |||
449 | return GetFsData(hash); | ||
450 | } | ||
451 | |||
452 | public bool Get(string id, Object sender, AssetRetrieved handler) | ||
453 | { | ||
454 | AssetBase asset = Get(id); | ||
455 | |||
456 | handler(id, sender, asset); | ||
457 | |||
458 | return true; | ||
459 | } | ||
460 | |||
461 | public byte[] GetFsData(string hash) | ||
462 | { | ||
463 | string spoolFile = Path.Combine(m_SpoolDirectory, hash + ".asset"); | ||
464 | |||
465 | if (File.Exists(spoolFile)) | ||
466 | { | ||
467 | try | ||
468 | { | ||
469 | byte[] content = File.ReadAllBytes(spoolFile); | ||
470 | |||
471 | return content; | ||
472 | } | ||
473 | catch | ||
474 | { | ||
475 | } | ||
476 | } | ||
477 | |||
478 | string file = HashToFile(hash); | ||
479 | string diskFile = Path.Combine(m_FSBase, file); | ||
480 | |||
481 | if (File.Exists(diskFile + ".gz")) | ||
482 | { | ||
483 | try | ||
484 | { | ||
485 | using (GZipStream gz = new GZipStream(new FileStream(diskFile + ".gz", FileMode.Open, FileAccess.Read), CompressionMode.Decompress)) | ||
486 | { | ||
487 | using (MemoryStream ms = new MemoryStream()) | ||
488 | { | ||
489 | byte[] data = new byte[32768]; | ||
490 | int bytesRead; | ||
491 | |||
492 | do | ||
493 | { | ||
494 | bytesRead = gz.Read(data, 0, 32768); | ||
495 | if (bytesRead > 0) | ||
496 | ms.Write(data, 0, bytesRead); | ||
497 | } while (bytesRead > 0); | ||
498 | |||
499 | return ms.ToArray(); | ||
500 | } | ||
501 | } | ||
502 | } | ||
503 | catch (Exception) | ||
504 | { | ||
505 | return new Byte[0]; | ||
506 | } | ||
507 | } | ||
508 | else if (File.Exists(diskFile)) | ||
509 | { | ||
510 | try | ||
511 | { | ||
512 | byte[] content = File.ReadAllBytes(diskFile); | ||
513 | |||
514 | return content; | ||
515 | } | ||
516 | catch | ||
517 | { | ||
518 | } | ||
519 | } | ||
520 | return new Byte[0]; | ||
521 | |||
522 | } | ||
523 | |||
524 | public virtual string Store(AssetBase asset) | ||
525 | { | ||
526 | return Store(asset, false); | ||
527 | } | ||
528 | |||
529 | private string Store(AssetBase asset, bool force) | ||
530 | { | ||
531 | int tickCount = Environment.TickCount; | ||
532 | string hash = GetSHA256Hash(asset.Data); | ||
533 | |||
534 | if (!AssetExists(hash)) | ||
535 | { | ||
536 | string tempFile = Path.Combine(Path.Combine(m_SpoolDirectory, "spool"), hash + ".asset"); | ||
537 | string finalFile = Path.Combine(m_SpoolDirectory, hash + ".asset"); | ||
538 | |||
539 | if (!File.Exists(finalFile)) | ||
540 | { | ||
541 | // Deal with bug introduced in Oct. 20 (1eb3e6cc43e2a7b4053bc1185c7c88e22356c5e8) | ||
542 | // Fix bad assets before storing on this server | ||
543 | if (asset.Type == (int)AssetType.Object && asset.Data != null) | ||
544 | { | ||
545 | string xml = ExternalRepresentationUtils.SanitizeXml(Utils.BytesToString(asset.Data)); | ||
546 | asset.Data = Utils.StringToBytes(xml); | ||
547 | } | ||
548 | |||
549 | FileStream fs = File.Create(tempFile); | ||
550 | |||
551 | fs.Write(asset.Data, 0, asset.Data.Length); | ||
552 | |||
553 | fs.Close(); | ||
554 | |||
555 | File.Move(tempFile, finalFile); | ||
556 | } | ||
557 | } | ||
558 | |||
559 | if (asset.ID == string.Empty) | ||
560 | { | ||
561 | if (asset.FullID == UUID.Zero) | ||
562 | { | ||
563 | asset.FullID = UUID.Random(); | ||
564 | } | ||
565 | asset.ID = asset.FullID.ToString(); | ||
566 | } | ||
567 | else if (asset.FullID == UUID.Zero) | ||
568 | { | ||
569 | UUID uuid = UUID.Zero; | ||
570 | if (UUID.TryParse(asset.ID, out uuid)) | ||
571 | { | ||
572 | asset.FullID = uuid; | ||
573 | } | ||
574 | else | ||
575 | { | ||
576 | asset.FullID = UUID.Random(); | ||
577 | } | ||
578 | } | ||
579 | |||
580 | if (!m_DataConnector.Store(asset.Metadata, hash)) | ||
581 | { | ||
582 | return UUID.Zero.ToString(); | ||
583 | } | ||
584 | else | ||
585 | { | ||
586 | return asset.ID; | ||
587 | } | ||
588 | } | ||
589 | |||
590 | public bool UpdateContent(string id, byte[] data) | ||
591 | { | ||
592 | return false; | ||
593 | |||
594 | // string oldhash; | ||
595 | // AssetMetadata meta = m_DataConnector.Get(id, out oldhash); | ||
596 | // | ||
597 | // if (meta == null) | ||
598 | // return false; | ||
599 | // | ||
600 | // AssetBase asset = new AssetBase(); | ||
601 | // asset.Metadata = meta; | ||
602 | // asset.Data = data; | ||
603 | // | ||
604 | // Store(asset); | ||
605 | // | ||
606 | // return true; | ||
607 | } | ||
608 | |||
609 | public virtual bool Delete(string id) | ||
610 | { | ||
611 | m_DataConnector.Delete(id); | ||
612 | |||
613 | return true; | ||
614 | } | ||
615 | |||
616 | private void HandleShowAssets(string module, string[] args) | ||
617 | { | ||
618 | int num = m_DataConnector.Count(); | ||
619 | MainConsole.Instance.Output(string.Format("Total asset count: {0}", num)); | ||
620 | } | ||
621 | |||
622 | private void HandleShowDigest(string module, string[] args) | ||
623 | { | ||
624 | if (args.Length < 3) | ||
625 | { | ||
626 | MainConsole.Instance.Output("Syntax: show digest <ID>"); | ||
627 | return; | ||
628 | } | ||
629 | |||
630 | string hash; | ||
631 | AssetBase asset = Get(args[2], out hash); | ||
632 | |||
633 | if (asset == null || asset.Data.Length == 0) | ||
634 | { | ||
635 | MainConsole.Instance.Output("Asset not found"); | ||
636 | return; | ||
637 | } | ||
638 | |||
639 | int i; | ||
640 | |||
641 | MainConsole.Instance.Output(String.Format("Name: {0}", asset.Name)); | ||
642 | MainConsole.Instance.Output(String.Format("Description: {0}", asset.Description)); | ||
643 | MainConsole.Instance.Output(String.Format("Type: {0}", asset.Type)); | ||
644 | MainConsole.Instance.Output(String.Format("Content-type: {0}", asset.Metadata.ContentType)); | ||
645 | MainConsole.Instance.Output(String.Format("Flags: {0}", asset.Metadata.Flags.ToString())); | ||
646 | MainConsole.Instance.Output(String.Format("FS file: {0}", HashToFile(hash))); | ||
647 | |||
648 | for (i = 0 ; i < 5 ; i++) | ||
649 | { | ||
650 | int off = i * 16; | ||
651 | if (asset.Data.Length <= off) | ||
652 | break; | ||
653 | int len = 16; | ||
654 | if (asset.Data.Length < off + len) | ||
655 | len = asset.Data.Length - off; | ||
656 | |||
657 | byte[] line = new byte[len]; | ||
658 | Array.Copy(asset.Data, off, line, 0, len); | ||
659 | |||
660 | string text = BitConverter.ToString(line); | ||
661 | MainConsole.Instance.Output(String.Format("{0:x4}: {1}", off, text)); | ||
662 | } | ||
663 | } | ||
664 | |||
665 | private void HandleDeleteAsset(string module, string[] args) | ||
666 | { | ||
667 | if (args.Length < 3) | ||
668 | { | ||
669 | MainConsole.Instance.Output("Syntax: delete asset <ID>"); | ||
670 | return; | ||
671 | } | ||
672 | |||
673 | AssetBase asset = Get(args[2]); | ||
674 | |||
675 | if (asset == null || asset.Data.Length == 0) | ||
676 | { | ||
677 | MainConsole.Instance.Output("Asset not found"); | ||
678 | return; | ||
679 | } | ||
680 | |||
681 | m_DataConnector.Delete(args[2]); | ||
682 | |||
683 | MainConsole.Instance.Output("Asset deleted"); | ||
684 | } | ||
685 | |||
686 | private void HandleImportAssets(string module, string[] args) | ||
687 | { | ||
688 | bool force = false; | ||
689 | if (args[0] == "force") | ||
690 | { | ||
691 | force = true; | ||
692 | List<string> list = new List<string>(args); | ||
693 | list.RemoveAt(0); | ||
694 | args = list.ToArray(); | ||
695 | } | ||
696 | if (args.Length < 3) | ||
697 | { | ||
698 | MainConsole.Instance.Output("Syntax: import <conn> <table> [<start> <count>]"); | ||
699 | } | ||
700 | else | ||
701 | { | ||
702 | string conn = args[1]; | ||
703 | string table = args[2]; | ||
704 | int start = 0; | ||
705 | int count = -1; | ||
706 | if (args.Length > 3) | ||
707 | { | ||
708 | start = Convert.ToInt32(args[3]); | ||
709 | } | ||
710 | if (args.Length > 4) | ||
711 | { | ||
712 | count = Convert.ToInt32(args[4]); | ||
713 | } | ||
714 | m_DataConnector.Import(conn, table, start, count, force, new FSStoreDelegate(Store)); | ||
715 | } | ||
716 | } | ||
717 | |||
718 | public AssetBase GetCached(string id) | ||
719 | { | ||
720 | return Get(id); | ||
721 | } | ||
722 | } | ||
723 | } | ||
diff --git a/OpenSim/Services/FreeswitchService/Properties/AssemblyInfo.cs b/OpenSim/Services/FreeswitchService/Properties/AssemblyInfo.cs index 6bc543a..ca16f08 100644 --- a/OpenSim/Services/FreeswitchService/Properties/AssemblyInfo.cs +++ b/OpenSim/Services/FreeswitchService/Properties/AssemblyInfo.cs | |||
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices; | |||
29 | // Build Number | 29 | // Build Number |
30 | // Revision | 30 | // Revision |
31 | // | 31 | // |
32 | [assembly: AssemblyVersion("0.8.0.*")] | 32 | [assembly: AssemblyVersion("0.8.2.*")] |
33 | 33 | ||
diff --git a/OpenSim/Services/Friends/Properties/AssemblyInfo.cs b/OpenSim/Services/Friends/Properties/AssemblyInfo.cs index f9473e2..f258f94 100644 --- a/OpenSim/Services/Friends/Properties/AssemblyInfo.cs +++ b/OpenSim/Services/Friends/Properties/AssemblyInfo.cs | |||
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices; | |||
29 | // Build Number | 29 | // Build Number |
30 | // Revision | 30 | // Revision |
31 | // | 31 | // |
32 | [assembly: AssemblyVersion("0.8.0.*")] | 32 | [assembly: AssemblyVersion("0.8.2.*")] |
33 | 33 | ||
diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 6f610f8..8293c18 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs | |||
@@ -46,6 +46,7 @@ namespace OpenSim.Services.GridService | |||
46 | private static readonly ILog m_log = | 46 | private static readonly ILog m_log = |
47 | LogManager.GetLogger( | 47 | LogManager.GetLogger( |
48 | MethodBase.GetCurrentMethod().DeclaringType); | 48 | MethodBase.GetCurrentMethod().DeclaringType); |
49 | private string LogHeader = "[GRID SERVICE]"; | ||
49 | 50 | ||
50 | private bool m_DeleteOnUnregister = true; | 51 | private bool m_DeleteOnUnregister = true; |
51 | private static GridService m_RootInstance = null; | 52 | private static GridService m_RootInstance = null; |
@@ -56,7 +57,13 @@ namespace OpenSim.Services.GridService | |||
56 | protected bool m_AllowDuplicateNames = false; | 57 | protected bool m_AllowDuplicateNames = false; |
57 | protected bool m_AllowHypergridMapSearch = false; | 58 | protected bool m_AllowHypergridMapSearch = false; |
58 | 59 | ||
60 | <<<<<<< HEAD | ||
61 | protected bool m_SuppressVarregionOverlapCheckOnRegistration = false; | ||
62 | |||
63 | private static Dictionary<string,object> m_ExtraFeatures = new Dictionary<string, object>(); | ||
64 | ======= | ||
59 | private static Dictionary<string, object> m_ExtraFeatures = new Dictionary<string, object>(); | 65 | private static Dictionary<string, object> m_ExtraFeatures = new Dictionary<string, object>(); |
66 | >>>>>>> avn/ubitvar | ||
60 | 67 | ||
61 | public GridService(IConfigSource config) | 68 | public GridService(IConfigSource config) |
62 | : base(config) | 69 | : base(config) |
@@ -65,6 +72,9 @@ namespace OpenSim.Services.GridService | |||
65 | 72 | ||
66 | m_config = config; | 73 | m_config = config; |
67 | IConfig gridConfig = config.Configs["GridService"]; | 74 | IConfig gridConfig = config.Configs["GridService"]; |
75 | |||
76 | bool suppressConsoleCommands = false; | ||
77 | |||
68 | if (gridConfig != null) | 78 | if (gridConfig != null) |
69 | { | 79 | { |
70 | m_DeleteOnUnregister = gridConfig.GetBoolean("DeleteOnUnregister", true); | 80 | m_DeleteOnUnregister = gridConfig.GetBoolean("DeleteOnUnregister", true); |
@@ -78,13 +88,19 @@ namespace OpenSim.Services.GridService | |||
78 | } | 88 | } |
79 | m_AllowDuplicateNames = gridConfig.GetBoolean("AllowDuplicateNames", m_AllowDuplicateNames); | 89 | m_AllowDuplicateNames = gridConfig.GetBoolean("AllowDuplicateNames", m_AllowDuplicateNames); |
80 | m_AllowHypergridMapSearch = gridConfig.GetBoolean("AllowHypergridMapSearch", m_AllowHypergridMapSearch); | 90 | m_AllowHypergridMapSearch = gridConfig.GetBoolean("AllowHypergridMapSearch", m_AllowHypergridMapSearch); |
91 | |||
92 | m_SuppressVarregionOverlapCheckOnRegistration = gridConfig.GetBoolean("SuppressVarregionOverlapCheckOnRegistration", m_SuppressVarregionOverlapCheckOnRegistration); | ||
93 | |||
94 | // This service is also used locally by a simulator running in grid mode. This switches prevents | ||
95 | // inappropriate console commands from being registered | ||
96 | suppressConsoleCommands = gridConfig.GetBoolean("SuppressConsoleCommands", suppressConsoleCommands); | ||
81 | } | 97 | } |
82 | 98 | ||
83 | if (m_RootInstance == null) | 99 | if (m_RootInstance == null) |
84 | { | 100 | { |
85 | m_RootInstance = this; | 101 | m_RootInstance = this; |
86 | 102 | ||
87 | if (MainConsole.Instance != null) | 103 | if (!suppressConsoleCommands && MainConsole.Instance != null) |
88 | { | 104 | { |
89 | MainConsole.Instance.Commands.AddCommand("Regions", true, | 105 | MainConsole.Instance.Commands.AddCommand("Regions", true, |
90 | "deregister region id", | 106 | "deregister region id", |
@@ -93,17 +109,12 @@ namespace OpenSim.Services.GridService | |||
93 | String.Empty, | 109 | String.Empty, |
94 | HandleDeregisterRegion); | 110 | HandleDeregisterRegion); |
95 | 111 | ||
96 | // A messy way of stopping this command being added if we are in standalone (since the simulator | 112 | MainConsole.Instance.Commands.AddCommand("Regions", true, |
97 | // has an identically named command | 113 | "show regions", |
98 | // | 114 | "show regions", |
99 | // XXX: We're relying on the OpenSimulator version being registered first, which is not well defined. | 115 | "Show details on all regions", |
100 | if (MainConsole.Instance.Commands.Resolve(new string[] { "show", "regions" }).Length == 0) | 116 | String.Empty, |
101 | MainConsole.Instance.Commands.AddCommand("Regions", true, | 117 | HandleShowRegions); |
102 | "show regions", | ||
103 | "show regions", | ||
104 | "Show details on all regions", | ||
105 | String.Empty, | ||
106 | HandleShowRegions); | ||
107 | 118 | ||
108 | MainConsole.Instance.Commands.AddCommand("Regions", true, | 119 | MainConsole.Instance.Commands.AddCommand("Regions", true, |
109 | "show region name", | 120 | "show region name", |
@@ -119,13 +130,24 @@ namespace OpenSim.Services.GridService | |||
119 | "For example, show region at 1000 1000", | 130 | "For example, show region at 1000 1000", |
120 | HandleShowRegionAt); | 131 | HandleShowRegionAt); |
121 | 132 | ||
122 | MainConsole.Instance.Commands.AddCommand("Regions", true, | 133 | MainConsole.Instance.Commands.AddCommand("General", true, |
123 | "set region flags", | 134 | "show grid size", |
124 | "set region flags <Region name> <flags>", | 135 | "show grid size", |
125 | "Set database flags for region", | 136 | "Show the current grid size (excluding hyperlink references)", |
126 | String.Empty, | 137 | String.Empty, |
127 | HandleSetFlags); | 138 | HandleShowGridSize); |
139 | |||
140 | MainConsole.Instance.Commands.AddCommand("Regions", true, | ||
141 | "set region flags", | ||
142 | "set region flags <Region name> <flags>", | ||
143 | "Set database flags for region", | ||
144 | String.Empty, | ||
145 | HandleSetFlags); | ||
128 | } | 146 | } |
147 | |||
148 | if (!suppressConsoleCommands) | ||
149 | SetExtraServiceURLs(config); | ||
150 | |||
129 | m_HypergridLinker = new HypergridLinker(m_config, this, m_Database); | 151 | m_HypergridLinker = new HypergridLinker(m_config, this, m_Database); |
130 | } | 152 | } |
131 | } | 153 | } |
@@ -137,9 +159,15 @@ namespace OpenSim.Services.GridService | |||
137 | 159 | ||
138 | if (loginConfig == null || gridConfig == null) | 160 | if (loginConfig == null || gridConfig == null) |
139 | return; | 161 | return; |
162 | <<<<<<< HEAD | ||
163 | |||
164 | string configVal; | ||
165 | |||
166 | ======= | ||
140 | 167 | ||
141 | string configVal; | 168 | string configVal; |
142 | 169 | ||
170 | >>>>>>> avn/ubitvar | ||
143 | configVal = loginConfig.GetString("SearchURL", string.Empty); | 171 | configVal = loginConfig.GetString("SearchURL", string.Empty); |
144 | if (!string.IsNullOrEmpty(configVal)) | 172 | if (!string.IsNullOrEmpty(configVal)) |
145 | m_ExtraFeatures["search-server-url"] = configVal; | 173 | m_ExtraFeatures["search-server-url"] = configVal; |
@@ -183,14 +211,26 @@ namespace OpenSim.Services.GridService | |||
183 | if (regionInfos.RegionID == UUID.Zero) | 211 | if (regionInfos.RegionID == UUID.Zero) |
184 | return "Invalid RegionID - cannot be zero UUID"; | 212 | return "Invalid RegionID - cannot be zero UUID"; |
185 | 213 | ||
214 | <<<<<<< HEAD | ||
215 | String reason = "Region overlaps another region"; | ||
216 | RegionData region = FindAnyConflictingRegion(regionInfos, scopeID, out reason); | ||
217 | // If there is a conflicting region, if it has the same ID and same coordinates | ||
218 | // then it is a region re-registering (permissions and ownership checked later). | ||
219 | if ((region != null) | ||
220 | && ( (region.coordX != regionInfos.RegionCoordX) | ||
221 | || (region.coordY != regionInfos.RegionCoordY) | ||
222 | || (region.RegionID != regionInfos.RegionID) ) | ||
223 | ) | ||
224 | ======= | ||
186 | // we should not need to check for overlaps | 225 | // we should not need to check for overlaps |
187 | 226 | ||
188 | RegionData region = m_Database.Get(regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID); | 227 | RegionData region = m_Database.Get(regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID); |
189 | if ((region != null) && (region.RegionID != regionInfos.RegionID)) | 228 | if ((region != null) && (region.RegionID != regionInfos.RegionID)) |
229 | >>>>>>> avn/ubitvar | ||
190 | { | 230 | { |
191 | m_log.WarnFormat("[GRID SERVICE]: Region {0} tried to register in coordinates {1}, {2} which are already in use in scope {3}.", | 231 | // If not same ID and same coordinates, this new region has conflicts and can't be registered. |
192 | regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID); | 232 | m_log.WarnFormat("{0} Register region conflict in scope {1}. {2}", LogHeader, scopeID, reason); |
193 | return "Region overlaps another region"; | 233 | return reason; |
194 | } | 234 | } |
195 | 235 | ||
196 | if (region != null) | 236 | if (region != null) |
@@ -313,13 +353,121 @@ namespace OpenSim.Services.GridService | |||
313 | m_log.DebugFormat("[GRID SERVICE]: Database exception: {0}", e); | 353 | m_log.DebugFormat("[GRID SERVICE]: Database exception: {0}", e); |
314 | } | 354 | } |
315 | 355 | ||
316 | m_log.DebugFormat("[GRID SERVICE]: Region {0} ({1}) registered successfully at {2}-{3} with flags {4}", | 356 | m_log.DebugFormat |
317 | regionInfos.RegionName, regionInfos.RegionID, regionInfos.RegionCoordX, regionInfos.RegionCoordY, | 357 | ("[GRID SERVICE]: Region {0} ({1}, {2}x{3}) registered at {4},{5} with flags {6}", |
358 | regionInfos.RegionName, regionInfos.RegionID, regionInfos.RegionSizeX, regionInfos.RegionSizeY, | ||
359 | regionInfos.RegionCoordX, regionInfos.RegionCoordY, | ||
318 | (OpenSim.Framework.RegionFlags)flags); | 360 | (OpenSim.Framework.RegionFlags)flags); |
319 | 361 | ||
320 | return String.Empty; | 362 | return String.Empty; |
321 | } | 363 | } |
322 | 364 | ||
365 | /// <summary> | ||
366 | /// Search the region map for regions conflicting with this region. | ||
367 | /// The region to be added is passed and we look for any existing regions that are | ||
368 | /// in the requested location, that are large varregions that overlap this region, or | ||
369 | /// are previously defined regions that would lie under this new region. | ||
370 | /// </summary> | ||
371 | /// <param name="regionInfos">Information on region requested to be added to the world map</param> | ||
372 | /// <param name="scopeID">Grid id for region</param> | ||
373 | /// <param name="reason">The reason the returned region conflicts with passed region</param> | ||
374 | /// <returns></returns> | ||
375 | private RegionData FindAnyConflictingRegion(GridRegion regionInfos, UUID scopeID, out string reason) | ||
376 | { | ||
377 | reason = "Reregistration"; | ||
378 | // First see if there is an existing region right where this region is trying to go | ||
379 | // (We keep this result so it can be returned if suppressing errors) | ||
380 | RegionData noErrorRegion = m_Database.Get(regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID); | ||
381 | RegionData region = noErrorRegion; | ||
382 | if (region != null | ||
383 | && region.RegionID == regionInfos.RegionID | ||
384 | && region.sizeX == regionInfos.RegionSizeX | ||
385 | && region.sizeY == regionInfos.RegionSizeY) | ||
386 | { | ||
387 | // If this seems to be exactly the same region, return this as it could be | ||
388 | // a re-registration (permissions checked by calling routine). | ||
389 | m_log.DebugFormat("{0} FindAnyConflictingRegion: re-register of {1}", | ||
390 | LogHeader, RegionString(regionInfos)); | ||
391 | return region; | ||
392 | } | ||
393 | |||
394 | // No region exactly there or we're resizing an existing region. | ||
395 | // Fetch regions that could be varregions overlapping requested location. | ||
396 | int xmin = regionInfos.RegionLocX - (int)Constants.MaximumRegionSize + 10; | ||
397 | int xmax = regionInfos.RegionLocX; | ||
398 | int ymin = regionInfos.RegionLocY - (int)Constants.MaximumRegionSize + 10; | ||
399 | int ymax = regionInfos.RegionLocY; | ||
400 | List<RegionData> rdatas = m_Database.Get(xmin, ymin, xmax, ymax, scopeID); | ||
401 | foreach (RegionData rdata in rdatas) | ||
402 | { | ||
403 | // m_log.DebugFormat("{0} FindAnyConflictingRegion: find existing. Checking {1}", LogHeader, RegionString(rdata) ); | ||
404 | if ( (rdata.posX + rdata.sizeX > regionInfos.RegionLocX) | ||
405 | && (rdata.posY + rdata.sizeY > regionInfos.RegionLocY) ) | ||
406 | { | ||
407 | region = rdata; | ||
408 | m_log.WarnFormat("{0} FindAnyConflictingRegion: conflict of {1} by existing varregion {2}", | ||
409 | LogHeader, RegionString(regionInfos), RegionString(region)); | ||
410 | reason = String.Format("Region location is overlapped by existing varregion {0}", | ||
411 | RegionString(region)); | ||
412 | |||
413 | if (m_SuppressVarregionOverlapCheckOnRegistration) | ||
414 | region = noErrorRegion; | ||
415 | return region; | ||
416 | } | ||
417 | } | ||
418 | |||
419 | // There isn't a region that overlaps this potential region. | ||
420 | // See if this potential region overlaps an existing region. | ||
421 | // First, a shortcut of not looking for overlap if new region is legacy region sized | ||
422 | // and connot overlap anything. | ||
423 | if (regionInfos.RegionSizeX != Constants.RegionSize | ||
424 | || regionInfos.RegionSizeY != Constants.RegionSize) | ||
425 | { | ||
426 | // trim range looked for so we don't pick up neighbor regions just off the edges | ||
427 | xmin = regionInfos.RegionLocX; | ||
428 | xmax = regionInfos.RegionLocX + regionInfos.RegionSizeX - 10; | ||
429 | ymin = regionInfos.RegionLocY; | ||
430 | ymax = regionInfos.RegionLocY + regionInfos.RegionSizeY - 10; | ||
431 | rdatas = m_Database.Get(xmin, ymin, xmax, ymax, scopeID); | ||
432 | |||
433 | // If the region is being resized, the found region could be ourself. | ||
434 | foreach (RegionData rdata in rdatas) | ||
435 | { | ||
436 | // m_log.DebugFormat("{0} FindAnyConflictingRegion: see if overlap. Checking {1}", LogHeader, RegionString(rdata) ); | ||
437 | if (region == null || region.RegionID != regionInfos.RegionID) | ||
438 | { | ||
439 | region = rdata; | ||
440 | m_log.WarnFormat("{0} FindAnyConflictingRegion: conflict of varregion {1} overlaps existing region {2}", | ||
441 | LogHeader, RegionString(regionInfos), RegionString(region)); | ||
442 | reason = String.Format("Region {0} would overlap existing region {1}", | ||
443 | RegionString(regionInfos), RegionString(region)); | ||
444 | |||
445 | if (m_SuppressVarregionOverlapCheckOnRegistration) | ||
446 | region = noErrorRegion; | ||
447 | return region; | ||
448 | } | ||
449 | } | ||
450 | } | ||
451 | |||
452 | // If we get here, region is either null (nothing found here) or | ||
453 | // is the non-conflicting region found at the location being requested. | ||
454 | return region; | ||
455 | } | ||
456 | |||
457 | // String describing name and region location of passed region | ||
458 | private String RegionString(RegionData reg) | ||
459 | { | ||
460 | return String.Format("{0}/{1} at <{2},{3}>", | ||
461 | reg.RegionName, reg.RegionID, reg.coordX, reg.coordY); | ||
462 | } | ||
463 | |||
464 | // String describing name and region location of passed region | ||
465 | private String RegionString(GridRegion reg) | ||
466 | { | ||
467 | return String.Format("{0}/{1} at <{2},{3}>", | ||
468 | reg.RegionName, reg.RegionID, reg.RegionCoordX, reg.RegionCoordY); | ||
469 | } | ||
470 | |||
323 | public bool DeregisterRegion(UUID regionID) | 471 | public bool DeregisterRegion(UUID regionID) |
324 | { | 472 | { |
325 | RegionData region = m_Database.Get(regionID, UUID.Zero); | 473 | RegionData region = m_Database.Get(regionID, UUID.Zero); |
@@ -360,7 +508,11 @@ namespace OpenSim.Services.GridService | |||
360 | if (region != null) | 508 | if (region != null) |
361 | { | 509 | { |
362 | // Not really? Maybe? | 510 | // Not really? Maybe? |
511 | <<<<<<< HEAD | ||
512 | // The adjacent regions are presumed to be the same size as the current region | ||
513 | ======= | ||
363 | /* this fails wiht var regions. My_sql db should now handle var regions | 514 | /* this fails wiht var regions. My_sql db should now handle var regions |
515 | >>>>>>> avn/ubitvar | ||
364 | List<RegionData> rdatas = m_Database.Get( | 516 | List<RegionData> rdatas = m_Database.Get( |
365 | region.posX - region.sizeX - 1, region.posY - region.sizeY - 1, | 517 | region.posX - region.sizeX - 1, region.posY - region.sizeY - 1, |
366 | region.posX + region.sizeX + 1, region.posY + region.sizeY + 1, scopeID); | 518 | region.posX + region.sizeX + 1, region.posY + region.sizeY + 1, scopeID); |
@@ -380,7 +532,11 @@ namespace OpenSim.Services.GridService | |||
380 | } | 532 | } |
381 | } | 533 | } |
382 | 534 | ||
383 | // m_log.DebugFormat("[GRID SERVICE]: region {0} has {1} neighbours", region.RegionName, rinfos.Count); | 535 | // string rNames = ""; |
536 | // foreach (GridRegion gr in rinfos) | ||
537 | // rNames += gr.RegionName + ","; | ||
538 | // m_log.DebugFormat("{0} region {1} has {2} neighbours ({3})", | ||
539 | // LogHeader, region.RegionName, rinfos.Count, rNames); | ||
384 | } | 540 | } |
385 | else | 541 | else |
386 | { | 542 | { |
@@ -409,13 +565,24 @@ namespace OpenSim.Services.GridService | |||
409 | 565 | ||
410 | public GridRegion GetRegionByPosition(UUID scopeID, int x, int y) | 566 | public GridRegion GetRegionByPosition(UUID scopeID, int x, int y) |
411 | { | 567 | { |
412 | int snapX = (int)(x / Constants.RegionSize) * (int)Constants.RegionSize; | 568 | uint regionX = Util.WorldToRegionLoc((uint)x); |
413 | int snapY = (int)(y / Constants.RegionSize) * (int)Constants.RegionSize; | 569 | uint regionY = Util.WorldToRegionLoc((uint)y); |
570 | int snapX = (int)Util.RegionToWorldLoc(regionX); | ||
571 | int snapY = (int)Util.RegionToWorldLoc(regionY); | ||
572 | |||
414 | RegionData rdata = m_Database.Get(snapX, snapY, scopeID); | 573 | RegionData rdata = m_Database.Get(snapX, snapY, scopeID); |
415 | if (rdata != null) | 574 | if (rdata != null) |
575 | { | ||
576 | m_log.DebugFormat("{0} GetRegionByPosition. Found region {1} in database. Pos=<{2},{3}>", | ||
577 | LogHeader, rdata.RegionName, regionX, regionY); | ||
416 | return RegionData2RegionInfo(rdata); | 578 | return RegionData2RegionInfo(rdata); |
417 | 579 | } | |
418 | return null; | 580 | else |
581 | { | ||
582 | m_log.DebugFormat("{0} GetRegionByPosition. Did not find region in database. Pos=<{1},{2}>", | ||
583 | LogHeader, regionX, regionY); | ||
584 | return null; | ||
585 | } | ||
419 | } | 586 | } |
420 | 587 | ||
421 | public GridRegion GetRegionByName(UUID scopeID, string name) | 588 | public GridRegion GetRegionByName(UUID scopeID, string name) |
@@ -668,6 +835,27 @@ namespace OpenSim.Services.GridService | |||
668 | OutputRegionsToConsoleSummary(regions); | 835 | OutputRegionsToConsoleSummary(regions); |
669 | } | 836 | } |
670 | 837 | ||
838 | private void HandleShowGridSize(string module, string[] cmd) | ||
839 | { | ||
840 | List<RegionData> regions = m_Database.Get(int.MinValue, int.MinValue, int.MaxValue, int.MaxValue, UUID.Zero); | ||
841 | |||
842 | double size = 0; | ||
843 | |||
844 | foreach (RegionData region in regions) | ||
845 | { | ||
846 | int flags = Convert.ToInt32(region.Data["flags"]); | ||
847 | |||
848 | if ((flags & (int)Framework.RegionFlags.Hyperlink) == 0) | ||
849 | size += region.sizeX * region.sizeY; | ||
850 | } | ||
851 | |||
852 | MainConsole.Instance.Output("This is a very rough approximation."); | ||
853 | MainConsole.Instance.Output("Although it will not count regions that are actually links to others over the Hypergrid, "); | ||
854 | MainConsole.Instance.Output("it will count regions that are inactive but were not deregistered from the grid service"); | ||
855 | MainConsole.Instance.Output("(e.g. simulator crashed rather than shutting down cleanly).\n"); | ||
856 | |||
857 | MainConsole.Instance.OutputFormat("Grid size: {0} km squared.", size / 1000000); | ||
858 | } | ||
671 | 859 | ||
672 | private void HandleShowRegion(string module, string[] cmd) | 860 | private void HandleShowRegion(string module, string[] cmd) |
673 | { | 861 | { |
@@ -697,20 +885,24 @@ namespace OpenSim.Services.GridService | |||
697 | return; | 885 | return; |
698 | } | 886 | } |
699 | 887 | ||
700 | int x, y; | 888 | uint x, y; |
701 | if (!int.TryParse(cmd[3], out x)) | 889 | if (!uint.TryParse(cmd[3], out x)) |
702 | { | 890 | { |
703 | MainConsole.Instance.Output("x-coord must be an integer"); | 891 | MainConsole.Instance.Output("x-coord must be an integer"); |
704 | return; | 892 | return; |
705 | } | 893 | } |
706 | 894 | ||
707 | if (!int.TryParse(cmd[4], out y)) | 895 | if (!uint.TryParse(cmd[4], out y)) |
708 | { | 896 | { |
709 | MainConsole.Instance.Output("y-coord must be an integer"); | 897 | MainConsole.Instance.Output("y-coord must be an integer"); |
710 | return; | 898 | return; |
711 | } | 899 | } |
712 | 900 | ||
901 | <<<<<<< HEAD | ||
902 | RegionData region = m_Database.Get((int)Util.RegionToWorldLoc(x), (int)Util.RegionToWorldLoc(y), UUID.Zero); | ||
903 | ======= | ||
713 | RegionData region = m_Database.Get((int)Util.RegionToWorldLoc((uint)x), (int)Util.RegionToWorldLoc((uint)y), UUID.Zero); | 904 | RegionData region = m_Database.Get((int)Util.RegionToWorldLoc((uint)x), (int)Util.RegionToWorldLoc((uint)y), UUID.Zero); |
905 | >>>>>>> avn/ubitvar | ||
714 | if (region == null) | 906 | if (region == null) |
715 | { | 907 | { |
716 | MainConsole.Instance.OutputFormat("No region found at {0},{1}", x, y); | 908 | MainConsole.Instance.OutputFormat("No region found at {0},{1}", x, y); |
@@ -727,7 +919,11 @@ namespace OpenSim.Services.GridService | |||
727 | ConsoleDisplayList dispList = new ConsoleDisplayList(); | 919 | ConsoleDisplayList dispList = new ConsoleDisplayList(); |
728 | dispList.AddRow("Region Name", r.RegionName); | 920 | dispList.AddRow("Region Name", r.RegionName); |
729 | dispList.AddRow("Region ID", r.RegionID); | 921 | dispList.AddRow("Region ID", r.RegionID); |
922 | <<<<<<< HEAD | ||
923 | dispList.AddRow("Position", string.Format("{0},{1}", r.coordX, r.coordY)); | ||
924 | ======= | ||
730 | dispList.AddRow("Location", string.Format("{0},{1}", r.coordX, r.coordY)); | 925 | dispList.AddRow("Location", string.Format("{0},{1}", r.coordX, r.coordY)); |
926 | >>>>>>> avn/ubitvar | ||
731 | dispList.AddRow("Size", string.Format("{0}x{1}", r.sizeX, r.sizeY)); | 927 | dispList.AddRow("Size", string.Format("{0}x{1}", r.sizeX, r.sizeY)); |
732 | dispList.AddRow("URI", r.Data["serverURI"]); | 928 | dispList.AddRow("URI", r.Data["serverURI"]); |
733 | dispList.AddRow("Owner ID", r.Data["owner_uuid"]); | 929 | dispList.AddRow("Owner ID", r.Data["owner_uuid"]); |
@@ -745,10 +941,10 @@ namespace OpenSim.Services.GridService | |||
745 | private void OutputRegionsToConsoleSummary(List<RegionData> regions) | 941 | private void OutputRegionsToConsoleSummary(List<RegionData> regions) |
746 | { | 942 | { |
747 | ConsoleDisplayTable dispTable = new ConsoleDisplayTable(); | 943 | ConsoleDisplayTable dispTable = new ConsoleDisplayTable(); |
748 | dispTable.AddColumn("Name", 16); | 944 | dispTable.AddColumn("Name", 44); |
749 | dispTable.AddColumn("ID", 36); | 945 | dispTable.AddColumn("ID", 36); |
750 | dispTable.AddColumn("Position", 11); | 946 | dispTable.AddColumn("Position", 11); |
751 | dispTable.AddColumn("Owner ID", 36); | 947 | dispTable.AddColumn("Size", 11); |
752 | dispTable.AddColumn("Flags", 60); | 948 | dispTable.AddColumn("Flags", 60); |
753 | 949 | ||
754 | foreach (RegionData r in regions) | 950 | foreach (RegionData r in regions) |
@@ -758,7 +954,7 @@ namespace OpenSim.Services.GridService | |||
758 | r.RegionName, | 954 | r.RegionName, |
759 | r.RegionID.ToString(), | 955 | r.RegionID.ToString(), |
760 | string.Format("{0},{1}", r.coordX, r.coordY), | 956 | string.Format("{0},{1}", r.coordX, r.coordY), |
761 | r.Data["owner_uuid"].ToString(), | 957 | string.Format("{0}x{1}", r.sizeX, r.sizeY), |
762 | flags.ToString()); | 958 | flags.ToString()); |
763 | } | 959 | } |
764 | 960 | ||
diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 0448b54..b4577b0 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs | |||
@@ -47,7 +47,7 @@ using OpenMetaverse; | |||
47 | 47 | ||
48 | namespace OpenSim.Services.GridService | 48 | namespace OpenSim.Services.GridService |
49 | { | 49 | { |
50 | public class HypergridLinker | 50 | public class HypergridLinker : IHypergridLinker |
51 | { | 51 | { |
52 | private static readonly ILog m_log = | 52 | private static readonly ILog m_log = |
53 | LogManager.GetLogger( | 53 | LogManager.GetLogger( |
@@ -68,10 +68,6 @@ namespace OpenSim.Services.GridService | |||
68 | protected string m_ThisGatekeeper = string.Empty; | 68 | protected string m_ThisGatekeeper = string.Empty; |
69 | protected Uri m_ThisGatekeeperURI = null; | 69 | protected Uri m_ThisGatekeeperURI = null; |
70 | 70 | ||
71 | // Hyperlink regions are hyperlinks on the map | ||
72 | public readonly Dictionary<UUID, GridRegion> m_HyperlinkRegions = new Dictionary<UUID, GridRegion>(); | ||
73 | protected Dictionary<UUID, ulong> m_HyperlinkHandles = new Dictionary<UUID, ulong>(); | ||
74 | |||
75 | protected GridRegion m_DefaultRegion; | 71 | protected GridRegion m_DefaultRegion; |
76 | protected GridRegion DefaultRegion | 72 | protected GridRegion DefaultRegion |
77 | { | 73 | { |
@@ -160,18 +156,18 @@ namespace OpenSim.Services.GridService | |||
160 | 156 | ||
161 | if (MainConsole.Instance != null) | 157 | if (MainConsole.Instance != null) |
162 | { | 158 | { |
163 | MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", | 159 | MainConsole.Instance.Commands.AddCommand("Hypergrid", false, "link-region", |
164 | "link-region <Xloc> <Yloc> <ServerURI> [<RemoteRegionName>]", | 160 | "link-region <Xloc> <Yloc> <ServerURI> [<RemoteRegionName>]", |
165 | "Link a HyperGrid Region. Examples for <ServerURI>: http://grid.net:8002/ or http://example.org/path/foo.php", RunCommand); | 161 | "Link a HyperGrid Region. Examples for <ServerURI>: http://grid.net:8002/ or http://example.org/path/foo.php", RunCommand); |
166 | MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", | 162 | MainConsole.Instance.Commands.AddCommand("Hypergrid", false, "link-region", |
167 | "link-region <Xloc> <Yloc> <RegionIP> <RegionPort> [<RemoteRegionName>]", | 163 | "link-region <Xloc> <Yloc> <RegionIP> <RegionPort> [<RemoteRegionName>]", |
168 | "Link a hypergrid region (deprecated)", RunCommand); | 164 | "Link a hypergrid region (deprecated)", RunCommand); |
169 | MainConsole.Instance.Commands.AddCommand("hypergrid", false, "unlink-region", | 165 | MainConsole.Instance.Commands.AddCommand("Hypergrid", false, "unlink-region", |
170 | "unlink-region <local name>", | 166 | "unlink-region <local name>", |
171 | "Unlink a hypergrid region", RunCommand); | 167 | "Unlink a hypergrid region", RunCommand); |
172 | MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-mapping", "link-mapping [<x> <y>]", | 168 | MainConsole.Instance.Commands.AddCommand("Hypergrid", false, "link-mapping", "link-mapping [<x> <y>]", |
173 | "Set local coordinate to map HG regions to", RunCommand); | 169 | "Set local coordinate to map HG regions to", RunCommand); |
174 | MainConsole.Instance.Commands.AddCommand("hypergrid", false, "show hyperlinks", "show hyperlinks", | 170 | MainConsole.Instance.Commands.AddCommand("Hypergrid", false, "show hyperlinks", "show hyperlinks", |
175 | "List the HG regions", HandleShow); | 171 | "List the HG regions", HandleShow); |
176 | } | 172 | } |
177 | } | 173 | } |
@@ -190,7 +186,7 @@ namespace OpenSim.Services.GridService | |||
190 | private static Random random = new Random(); | 186 | private static Random random = new Random(); |
191 | 187 | ||
192 | // From the command line link-region (obsolete) and the map | 188 | // From the command line link-region (obsolete) and the map |
193 | public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, out string reason) | 189 | private GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, out string reason) |
194 | { | 190 | { |
195 | return TryLinkRegionToCoords(scopeID, mapName, xloc, yloc, UUID.Zero, out reason); | 191 | return TryLinkRegionToCoords(scopeID, mapName, xloc, yloc, UUID.Zero, out reason); |
196 | } | 192 | } |
@@ -200,24 +196,36 @@ namespace OpenSim.Services.GridService | |||
200 | reason = string.Empty; | 196 | reason = string.Empty; |
201 | GridRegion regInfo = null; | 197 | GridRegion regInfo = null; |
202 | 198 | ||
199 | mapName = mapName.Trim(); | ||
200 | |||
203 | if (!mapName.StartsWith("http")) | 201 | if (!mapName.StartsWith("http")) |
204 | { | 202 | { |
205 | string host = "127.0.0.1"; | 203 | // Formats: grid.example.com:8002:region name |
206 | string portstr; | 204 | // grid.example.com:region name |
205 | // grid.example.com:8002 | ||
206 | // grid.example.com | ||
207 | |||
208 | string host; | ||
209 | uint port = 80; | ||
207 | string regionName = ""; | 210 | string regionName = ""; |
208 | uint port = 0; | 211 | |
209 | string[] parts = mapName.Split(new char[] { ':' }); | 212 | string[] parts = mapName.Split(new char[] { ':' }); |
210 | if (parts.Length >= 1) | 213 | |
214 | if (parts.Length == 0) | ||
211 | { | 215 | { |
212 | host = parts[0]; | 216 | reason = "Wrong format for link-region"; |
217 | return null; | ||
213 | } | 218 | } |
219 | |||
220 | host = parts[0]; | ||
221 | |||
214 | if (parts.Length >= 2) | 222 | if (parts.Length >= 2) |
215 | { | 223 | { |
216 | portstr = parts[1]; | 224 | // If it's a number then assume it's a port. Otherwise, it's a region name. |
217 | //m_log.Debug("-- port = " + portstr); | 225 | if (!UInt32.TryParse(parts[1], out port)) |
218 | if (!UInt32.TryParse(portstr, out port)) | ||
219 | regionName = parts[1]; | 226 | regionName = parts[1]; |
220 | } | 227 | } |
228 | |||
221 | // always take the last one | 229 | // always take the last one |
222 | if (parts.Length >= 3) | 230 | if (parts.Length >= 3) |
223 | { | 231 | { |
@@ -234,14 +242,30 @@ namespace OpenSim.Services.GridService | |||
234 | } | 242 | } |
235 | else | 243 | else |
236 | { | 244 | { |
237 | string[] parts = mapName.Split(new char[] {' '}); | 245 | // Formats: http://grid.example.com region name |
238 | string regionName = String.Empty; | 246 | // http://grid.example.com "region name" |
239 | if (parts.Length > 1) | 247 | // http://grid.example.com |
248 | |||
249 | string serverURI; | ||
250 | string regionName = ""; | ||
251 | |||
252 | string[] parts = mapName.Split(new char[] { ' ' }); | ||
253 | |||
254 | if (parts.Length == 0) | ||
240 | { | 255 | { |
241 | regionName = mapName.Substring(parts[0].Length + 1); | 256 | reason = "Wrong format for link-region"; |
242 | regionName = regionName.Trim(new char[] {'"'}); | 257 | return null; |
243 | } | 258 | } |
244 | if (TryCreateLink(scopeID, xloc, yloc, regionName, 0, null, parts[0], ownerID, out regInfo, out reason)) | 259 | |
260 | serverURI = parts[0]; | ||
261 | |||
262 | if (parts.Length >= 2) | ||
263 | { | ||
264 | regionName = mapName.Substring(serverURI.Length); | ||
265 | regionName = regionName.Trim(new char[] { '"', ' ' }); | ||
266 | } | ||
267 | |||
268 | if (TryCreateLink(scopeID, xloc, yloc, regionName, 0, null, serverURI, ownerID, out regInfo, out reason)) | ||
245 | { | 269 | { |
246 | regInfo.RegionName = mapName; | 270 | regInfo.RegionName = mapName; |
247 | return regInfo; | 271 | return regInfo; |
@@ -250,15 +274,23 @@ namespace OpenSim.Services.GridService | |||
250 | 274 | ||
251 | return null; | 275 | return null; |
252 | } | 276 | } |
253 | 277 | ||
254 | public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string remoteRegionName, uint externalPort, string externalHostName, UUID ownerID, out GridRegion regInfo, out string reason) | 278 | private bool TryCreateLink(UUID scopeID, int xloc, int yloc, string remoteRegionName, uint externalPort, string externalHostName, UUID ownerID, out GridRegion regInfo, out string reason) |
255 | { | 279 | { |
256 | return TryCreateLink(scopeID, xloc, yloc, remoteRegionName, externalPort, externalHostName, null, ownerID, out regInfo, out reason); | 280 | return TryCreateLink(scopeID, xloc, yloc, remoteRegionName, externalPort, externalHostName, null, ownerID, out regInfo, out reason); |
257 | } | 281 | } |
258 | 282 | ||
259 | public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string remoteRegionName, uint externalPort, string externalHostName, string serverURI, UUID ownerID, out GridRegion regInfo, out string reason) | 283 | private bool TryCreateLink(UUID scopeID, int xloc, int yloc, string remoteRegionName, uint externalPort, string externalHostName, string serverURI, UUID ownerID, out GridRegion regInfo, out string reason) |
284 | { | ||
285 | lock (this) | ||
286 | { | ||
287 | return TryCreateLinkImpl(scopeID, xloc, yloc, remoteRegionName, externalPort, externalHostName, serverURI, ownerID, out regInfo, out reason); | ||
288 | } | ||
289 | } | ||
290 | |||
291 | private bool TryCreateLinkImpl(UUID scopeID, int xloc, int yloc, string remoteRegionName, uint externalPort, string externalHostName, string serverURI, UUID ownerID, out GridRegion regInfo, out string reason) | ||
260 | { | 292 | { |
261 | m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0} {1}, in {2}-{3}", | 293 | m_log.InfoFormat("[HYPERGRID LINKER]: Link to {0} {1}, in <{2},{3}>", |
262 | ((serverURI == null) ? (externalHostName + ":" + externalPort) : serverURI), | 294 | ((serverURI == null) ? (externalHostName + ":" + externalPort) : serverURI), |
263 | remoteRegionName, Util.WorldToRegionLoc((uint)xloc), Util.WorldToRegionLoc((uint)yloc)); | 295 | remoteRegionName, Util.WorldToRegionLoc((uint)xloc), Util.WorldToRegionLoc((uint)yloc)); |
264 | 296 | ||
@@ -266,15 +298,15 @@ namespace OpenSim.Services.GridService | |||
266 | Uri uri = null; | 298 | Uri uri = null; |
267 | 299 | ||
268 | regInfo = new GridRegion(); | 300 | regInfo = new GridRegion(); |
269 | if ( externalPort > 0) | 301 | if (externalPort > 0) |
270 | regInfo.HttpPort = externalPort; | 302 | regInfo.HttpPort = externalPort; |
271 | else | 303 | else |
272 | regInfo.HttpPort = 0; | 304 | regInfo.HttpPort = 80; |
273 | if ( externalHostName != null) | 305 | if (externalHostName != null) |
274 | regInfo.ExternalHostName = externalHostName; | 306 | regInfo.ExternalHostName = externalHostName; |
275 | else | 307 | else |
276 | regInfo.ExternalHostName = "0.0.0.0"; | 308 | regInfo.ExternalHostName = "0.0.0.0"; |
277 | if ( serverURI != null) | 309 | if (serverURI != null) |
278 | { | 310 | { |
279 | regInfo.ServerURI = serverURI; | 311 | regInfo.ServerURI = serverURI; |
280 | try | 312 | try |
@@ -286,7 +318,7 @@ namespace OpenSim.Services.GridService | |||
286 | catch {} | 318 | catch {} |
287 | } | 319 | } |
288 | 320 | ||
289 | if ( remoteRegionName != string.Empty ) | 321 | if (remoteRegionName != string.Empty) |
290 | regInfo.RegionName = remoteRegionName; | 322 | regInfo.RegionName = remoteRegionName; |
291 | 323 | ||
292 | regInfo.RegionLocX = xloc; | 324 | regInfo.RegionLocX = xloc; |
@@ -299,6 +331,7 @@ namespace OpenSim.Services.GridService | |||
299 | { | 331 | { |
300 | if (regInfo.ExternalHostName == m_ThisGatekeeperURI.Host && regInfo.HttpPort == m_ThisGatekeeperURI.Port) | 332 | if (regInfo.ExternalHostName == m_ThisGatekeeperURI.Host && regInfo.HttpPort == m_ThisGatekeeperURI.Port) |
301 | { | 333 | { |
334 | m_log.InfoFormat("[HYPERGRID LINKER]: Cannot hyperlink to regions on the same grid"); | ||
302 | reason = "Cannot hyperlink to regions on the same grid"; | 335 | reason = "Cannot hyperlink to regions on the same grid"; |
303 | return false; | 336 | return false; |
304 | } | 337 | } |
@@ -310,7 +343,11 @@ namespace OpenSim.Services.GridService | |||
310 | GridRegion region = m_GridService.GetRegionByPosition(regInfo.ScopeID, regInfo.RegionLocX, regInfo.RegionLocY); | 343 | GridRegion region = m_GridService.GetRegionByPosition(regInfo.ScopeID, regInfo.RegionLocX, regInfo.RegionLocY); |
311 | if (region != null) | 344 | if (region != null) |
312 | { | 345 | { |
346 | <<<<<<< HEAD | ||
347 | m_log.WarnFormat("[HYPERGRID LINKER]: Coordinates <{0},{1}> are already occupied by region {2} with uuid {3}", | ||
348 | ======= | ||
313 | m_log.WarnFormat("[HYPERGRID LINKER]: Coordinates {0}-{1} are already occupied by region {2} with uuid {3}", | 349 | m_log.WarnFormat("[HYPERGRID LINKER]: Coordinates {0}-{1} are already occupied by region {2} with uuid {3}", |
350 | >>>>>>> avn/ubitvar | ||
314 | Util.WorldToRegionLoc((uint)regInfo.RegionLocX), Util.WorldToRegionLoc((uint)regInfo.RegionLocY), | 351 | Util.WorldToRegionLoc((uint)regInfo.RegionLocX), Util.WorldToRegionLoc((uint)regInfo.RegionLocY), |
315 | region.RegionName, region.RegionID); | 352 | region.RegionName, region.RegionID); |
316 | reason = "Coordinates are already in use"; | 353 | reason = "Coordinates are already in use"; |
@@ -346,8 +383,13 @@ namespace OpenSim.Services.GridService | |||
346 | region = m_GridService.GetRegionByUUID(scopeID, regionID); | 383 | region = m_GridService.GetRegionByUUID(scopeID, regionID); |
347 | if (region != null) | 384 | if (region != null) |
348 | { | 385 | { |
386 | <<<<<<< HEAD | ||
387 | m_log.DebugFormat("[HYPERGRID LINKER]: Region already exists in coordinates <{0},{1}>", | ||
388 | Util.WorldToRegionLoc((uint)region.RegionLocX), Util.WorldToRegionLoc((uint)region.RegionLocY)); | ||
389 | ======= | ||
349 | m_log.DebugFormat("[HYPERGRID LINKER]: Region already exists in coordinates {0} {1}", | 390 | m_log.DebugFormat("[HYPERGRID LINKER]: Region already exists in coordinates {0} {1}", |
350 | Util.WorldToRegionLoc((uint)regInfo.RegionLocX), Util.WorldToRegionLoc((uint)regInfo.RegionLocY)); | 391 | Util.WorldToRegionLoc((uint)regInfo.RegionLocX), Util.WorldToRegionLoc((uint)regInfo.RegionLocY)); |
392 | >>>>>>> avn/ubitvar | ||
351 | regInfo = region; | 393 | regInfo = region; |
352 | return true; | 394 | return true; |
353 | } | 395 | } |
@@ -381,7 +423,8 @@ namespace OpenSim.Services.GridService | |||
381 | regInfo.RegionSecret = handle.ToString(); | 423 | regInfo.RegionSecret = handle.ToString(); |
382 | 424 | ||
383 | AddHyperlinkRegion(regInfo, handle); | 425 | AddHyperlinkRegion(regInfo, handle); |
384 | m_log.InfoFormat("[HYPERGRID LINKER]: Successfully linked to region {0} with image {1}", regInfo.RegionName, regInfo.TerrainImage); | 426 | m_log.InfoFormat("[HYPERGRID LINKER]: Successfully linked to region {0} at <{1},{2}> with image {3}", |
427 | regInfo.RegionName, Util.WorldToRegionLoc((uint)regInfo.RegionLocX), Util.WorldToRegionLoc((uint)regInfo.RegionLocY), regInfo.TerrainImage); | ||
385 | return true; | 428 | return true; |
386 | } | 429 | } |
387 | 430 | ||
@@ -502,10 +545,21 @@ namespace OpenSim.Services.GridService | |||
502 | MainConsole.Instance.Output(new string('-', 72)); | 545 | MainConsole.Instance.Output(new string('-', 72)); |
503 | foreach (RegionData r in regions) | 546 | foreach (RegionData r in regions) |
504 | { | 547 | { |
548 | <<<<<<< HEAD | ||
549 | MainConsole.Instance.Output( | ||
550 | String.Format("{0}\n{2,-32} {1}\n", | ||
551 | r.RegionName, r.RegionID, | ||
552 | String.Format("{0},{1} ({2},{3})", r.posX, r.posY, | ||
553 | Util.WorldToRegionLoc((uint)r.posX), Util.WorldToRegionLoc((uint)r.posY) | ||
554 | ) | ||
555 | ) | ||
556 | ); | ||
557 | ======= | ||
505 | MainConsole.Instance.Output(String.Format("{0}\n{2,-32} {1}\n", | 558 | MainConsole.Instance.Output(String.Format("{0}\n{2,-32} {1}\n", |
506 | r.RegionName, r.RegionID, | 559 | r.RegionName, r.RegionID, |
507 | String.Format("{0},{1} ({2},{3})", r.posX, r.posY, | 560 | String.Format("{0},{1} ({2},{3})", r.posX, r.posY, |
508 | Util.WorldToRegionLoc((uint)r.posX), Util.WorldToRegionLoc((uint)r.posY))) ); | 561 | Util.WorldToRegionLoc((uint)r.posX), Util.WorldToRegionLoc((uint)r.posY))) ); |
562 | >>>>>>> avn/ubitvar | ||
509 | } | 563 | } |
510 | return; | 564 | return; |
511 | } | 565 | } |
@@ -607,8 +661,13 @@ namespace OpenSim.Services.GridService | |||
607 | string externalHostName; | 661 | string externalHostName; |
608 | try | 662 | try |
609 | { | 663 | { |
664 | <<<<<<< HEAD | ||
665 | xloc = Convert.ToUInt32(cmdparams[0]); | ||
666 | yloc = Convert.ToUInt32(cmdparams[1]); | ||
667 | ======= | ||
610 | xloc = (uint)Convert.ToInt32(cmdparams[0]); | 668 | xloc = (uint)Convert.ToInt32(cmdparams[0]); |
611 | yloc = (uint)Convert.ToInt32(cmdparams[1]); | 669 | yloc = (uint)Convert.ToInt32(cmdparams[1]); |
670 | >>>>>>> avn/ubitvar | ||
612 | externalPort = Convert.ToUInt32(cmdparams[3]); | 671 | externalPort = Convert.ToUInt32(cmdparams[3]); |
613 | externalHostName = cmdparams[2]; | 672 | externalHostName = cmdparams[2]; |
614 | //internalPort = Convert.ToUInt32(cmdparams[4]); | 673 | //internalPort = Convert.ToUInt32(cmdparams[4]); |
@@ -711,8 +770,13 @@ namespace OpenSim.Services.GridService | |||
711 | string externalHostName; | 770 | string externalHostName; |
712 | uint realXLoc, realYLoc; | 771 | uint realXLoc, realYLoc; |
713 | 772 | ||
773 | <<<<<<< HEAD | ||
774 | xloc = Convert.ToUInt32(config.GetString("xloc", "0")); | ||
775 | yloc = Convert.ToUInt32(config.GetString("yloc", "0")); | ||
776 | ======= | ||
714 | xloc = (uint)Convert.ToInt32(config.GetString("xloc", "0")); | 777 | xloc = (uint)Convert.ToInt32(config.GetString("xloc", "0")); |
715 | yloc = (uint)Convert.ToInt32(config.GetString("yloc", "0")); | 778 | yloc = (uint)Convert.ToInt32(config.GetString("yloc", "0")); |
779 | >>>>>>> avn/ubitvar | ||
716 | externalPort = Convert.ToUInt32(config.GetString("externalPort", "0")); | 780 | externalPort = Convert.ToUInt32(config.GetString("externalPort", "0")); |
717 | externalHostName = config.GetString("externalHostName", ""); | 781 | externalHostName = config.GetString("externalHostName", ""); |
718 | realXLoc = Convert.ToUInt32(config.GetString("real-xloc", "0")); | 782 | realXLoc = Convert.ToUInt32(config.GetString("real-xloc", "0")); |
@@ -720,8 +784,13 @@ namespace OpenSim.Services.GridService | |||
720 | 784 | ||
721 | if (m_enableAutoMapping) | 785 | if (m_enableAutoMapping) |
722 | { | 786 | { |
787 | <<<<<<< HEAD | ||
788 | xloc = (xloc % 100) + m_autoMappingX; | ||
789 | yloc = (yloc % 100) + m_autoMappingY; | ||
790 | ======= | ||
723 | xloc = (uint)((xloc % 100) + m_autoMappingX); | 791 | xloc = (uint)((xloc % 100) + m_autoMappingX); |
724 | yloc = (uint)((yloc % 100) + m_autoMappingY); | 792 | yloc = (uint)((yloc % 100) + m_autoMappingY); |
793 | >>>>>>> avn/ubitvar | ||
725 | } | 794 | } |
726 | 795 | ||
727 | if (((realXLoc == 0) && (realYLoc == 0)) || | 796 | if (((realXLoc == 0) && (realYLoc == 0)) || |
diff --git a/OpenSim/Services/GridService/Properties/AssemblyInfo.cs b/OpenSim/Services/GridService/Properties/AssemblyInfo.cs index bd84123..ebe3c44 100644 --- a/OpenSim/Services/GridService/Properties/AssemblyInfo.cs +++ b/OpenSim/Services/GridService/Properties/AssemblyInfo.cs | |||
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices; | |||
29 | // Build Number | 29 | // Build Number |
30 | // Revision | 30 | // Revision |
31 | // | 31 | // |
32 | [assembly: AssemblyVersion("0.8.0.*")] | 32 | [assembly: AssemblyVersion("0.8.2.*")] |
33 | 33 | ||
diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs index f6136b5..44b26d5 100644 --- a/OpenSim/Services/HypergridService/GatekeeperService.cs +++ b/OpenSim/Services/HypergridService/GatekeeperService.cs | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
@@ -204,29 +204,63 @@ namespace OpenSim.Services.HypergridService | |||
204 | return true; | 204 | return true; |
205 | } | 205 | } |
206 | 206 | ||
207 | public GridRegion GetHyperlinkRegion(UUID regionID) | 207 | public GridRegion GetHyperlinkRegion(UUID regionID, UUID agentID, string agentHomeURI, out string message) |
208 | { | 208 | { |
209 | m_log.DebugFormat("[GATEKEEPER SERVICE]: Request to get hyperlink region {0}", regionID); | 209 | message = null; |
210 | 210 | ||
211 | if (!m_AllowTeleportsToAnyRegion) | 211 | if (!m_AllowTeleportsToAnyRegion) |
212 | { | ||
212 | // Don't even check the given regionID | 213 | // Don't even check the given regionID |
214 | m_log.DebugFormat( | ||
215 | "[GATEKEEPER SERVICE]: Returning gateway region {0} {1} @ {2} to user {3}{4} as teleporting to arbitrary regions is not allowed.", | ||
216 | m_DefaultGatewayRegion.RegionName, | ||
217 | m_DefaultGatewayRegion.RegionID, | ||
218 | m_DefaultGatewayRegion.ServerURI, | ||
219 | agentID, | ||
220 | agentHomeURI == null ? "" : " @ " + agentHomeURI); | ||
221 | |||
222 | message = "Teleporting to the default region."; | ||
213 | return m_DefaultGatewayRegion; | 223 | return m_DefaultGatewayRegion; |
224 | } | ||
214 | 225 | ||
215 | GridRegion region = m_GridService.GetRegionByUUID(m_ScopeID, regionID); | 226 | GridRegion region = m_GridService.GetRegionByUUID(m_ScopeID, regionID); |
227 | |||
228 | if (region == null) | ||
229 | { | ||
230 | m_log.DebugFormat( | ||
231 | "[GATEKEEPER SERVICE]: Could not find region with ID {0} as requested by user {1}{2}. Returning null.", | ||
232 | regionID, agentID, (agentHomeURI == null) ? "" : " @ " + agentHomeURI); | ||
233 | |||
234 | message = "The teleport destination could not be found."; | ||
235 | return null; | ||
236 | } | ||
237 | |||
238 | m_log.DebugFormat( | ||
239 | "[GATEKEEPER SERVICE]: Returning region {0} {1} @ {2} to user {3}{4}.", | ||
240 | region.RegionName, | ||
241 | region.RegionID, | ||
242 | region.ServerURI, | ||
243 | agentID, | ||
244 | agentHomeURI == null ? "" : " @ " + agentHomeURI); | ||
245 | |||
216 | return region; | 246 | return region; |
217 | } | 247 | } |
218 | 248 | ||
219 | #region Login Agent | 249 | #region Login Agent |
220 | public bool LoginAgent(AgentCircuitData aCircuit, GridRegion destination, out string reason) | 250 | public bool LoginAgent(GridRegion source, AgentCircuitData aCircuit, GridRegion destination, out string reason) |
221 | { | 251 | { |
222 | reason = string.Empty; | 252 | reason = string.Empty; |
223 | 253 | ||
224 | string authURL = string.Empty; | 254 | string authURL = string.Empty; |
225 | if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) | 255 | if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) |
226 | authURL = aCircuit.ServiceURLs["HomeURI"].ToString(); | 256 | authURL = aCircuit.ServiceURLs["HomeURI"].ToString(); |
227 | m_log.InfoFormat("[GATEKEEPER SERVICE]: Login request for {0} {1} @ {2} ({3}) at {4} using viewer {5}, channel {6}, IP {7}, Mac {8}, Id0 {9} Teleport Flags {10}", | 257 | |
228 | aCircuit.firstname, aCircuit.lastname, authURL, aCircuit.AgentID, destination.RegionName, | 258 | m_log.InfoFormat("[GATEKEEPER SERVICE]: Login request for {0} {1} @ {2} ({3}) at {4} using viewer {5}, channel {6}, IP {7}, Mac {8}, Id0 {9}, Teleport Flags: {10}. From region {11}", |
229 | aCircuit.Viewer, aCircuit.Channel, aCircuit.IPAddress, aCircuit.Mac, aCircuit.Id0, aCircuit.teleportFlags.ToString()); | 259 | aCircuit.firstname, aCircuit.lastname, authURL, aCircuit.AgentID, destination.RegionID, |
260 | aCircuit.Viewer, aCircuit.Channel, aCircuit.IPAddress, aCircuit.Mac, aCircuit.Id0, (TeleportFlags)aCircuit.teleportFlags, | ||
261 | (source == null) ? "Unknown" : string.Format("{0} ({1}){2}", source.RegionName, source.RegionID, (source.RawServerURI == null) ? "" : " @ " + source.ServerURI)); | ||
262 | |||
263 | string curViewer = Util.GetViewerName(aCircuit); | ||
230 | 264 | ||
231 | // | 265 | // |
232 | // Check client | 266 | // Check client |
@@ -234,11 +268,11 @@ namespace OpenSim.Services.HypergridService | |||
234 | if (m_AllowedClients != string.Empty) | 268 | if (m_AllowedClients != string.Empty) |
235 | { | 269 | { |
236 | Regex arx = new Regex(m_AllowedClients); | 270 | Regex arx = new Regex(m_AllowedClients); |
237 | Match am = arx.Match(aCircuit.Viewer); | 271 | Match am = arx.Match(curViewer); |
238 | 272 | ||
239 | if (!am.Success) | 273 | if (!am.Success) |
240 | { | 274 | { |
241 | m_log.InfoFormat("[GATEKEEPER SERVICE]: Login failed, reason: client {0} is not allowed", aCircuit.Viewer); | 275 | m_log.InfoFormat("[GATEKEEPER SERVICE]: Login failed, reason: client {0} is not allowed", curViewer); |
242 | return false; | 276 | return false; |
243 | } | 277 | } |
244 | } | 278 | } |
@@ -246,11 +280,11 @@ namespace OpenSim.Services.HypergridService | |||
246 | if (m_DeniedClients != string.Empty) | 280 | if (m_DeniedClients != string.Empty) |
247 | { | 281 | { |
248 | Regex drx = new Regex(m_DeniedClients); | 282 | Regex drx = new Regex(m_DeniedClients); |
249 | Match dm = drx.Match(aCircuit.Viewer); | 283 | Match dm = drx.Match(curViewer); |
250 | 284 | ||
251 | if (dm.Success) | 285 | if (dm.Success) |
252 | { | 286 | { |
253 | m_log.InfoFormat("[GATEKEEPER SERVICE]: Login failed, reason: client {0} is denied", aCircuit.Viewer); | 287 | m_log.InfoFormat("[GATEKEEPER SERVICE]: Login failed, reason: client {0} is denied", curViewer); |
254 | return false; | 288 | return false; |
255 | } | 289 | } |
256 | } | 290 | } |
@@ -396,7 +430,7 @@ namespace OpenSim.Services.HypergridService | |||
396 | try | 430 | try |
397 | { | 431 | { |
398 | Uri uri = new Uri(aCircuit.ServiceURLs["HomeURI"].ToString()); | 432 | Uri uri = new Uri(aCircuit.ServiceURLs["HomeURI"].ToString()); |
399 | aCircuit.lastname = "@" + uri.Host; // + ":" + uri.Port; | 433 | aCircuit.lastname = "@" + uri.Authority; |
400 | } | 434 | } |
401 | catch | 435 | catch |
402 | { | 436 | { |
@@ -413,9 +447,16 @@ namespace OpenSim.Services.HypergridService | |||
413 | // Preserve our TeleportFlags we have gathered so-far | 447 | // Preserve our TeleportFlags we have gathered so-far |
414 | loginFlag |= (Constants.TeleportFlags) aCircuit.teleportFlags; | 448 | loginFlag |= (Constants.TeleportFlags) aCircuit.teleportFlags; |
415 | 449 | ||
416 | m_log.DebugFormat("[GATEKEEPER SERVICE]: Launching {0} {1}", aCircuit.Name, loginFlag); | 450 | m_log.DebugFormat("[GATEKEEPER SERVICE]: Launching {0}, Teleport Flags: {1}", aCircuit.Name, loginFlag); |
451 | |||
452 | string version; | ||
453 | |||
454 | if (!m_SimulationService.QueryAccess( | ||
455 | destination, aCircuit.AgentID, aCircuit.ServiceURLs["HomeURI"].ToString(), | ||
456 | true, aCircuit.startpos, "SIMULATION/0.3", new List<UUID>(), out version, out reason)) | ||
457 | return false; | ||
417 | 458 | ||
418 | return m_SimulationService.CreateAgent(destination, aCircuit, (uint)loginFlag, out reason); | 459 | return m_SimulationService.CreateAgent(source, destination, aCircuit, (uint)loginFlag, out reason); |
419 | } | 460 | } |
420 | 461 | ||
421 | protected bool Authenticate(AgentCircuitData aCircuit) | 462 | protected bool Authenticate(AgentCircuitData aCircuit) |
diff --git a/OpenSim/Services/HypergridService/HGAssetService.cs b/OpenSim/Services/HypergridService/HGAssetService.cs index 84dec8d..b83fb1e 100644 --- a/OpenSim/Services/HypergridService/HGAssetService.cs +++ b/OpenSim/Services/HypergridService/HGAssetService.cs | |||
@@ -76,10 +76,10 @@ namespace OpenSim.Services.HypergridService | |||
76 | if (m_UserAccountService == null) | 76 | if (m_UserAccountService == null) |
77 | throw new Exception(String.Format("Unable to create UserAccountService from {0}", userAccountsDll)); | 77 | throw new Exception(String.Format("Unable to create UserAccountService from {0}", userAccountsDll)); |
78 | 78 | ||
79 | // legacy configuration [obsolete] | 79 | m_HomeURL = Util.GetConfigVarFromSections<string>(config, "HomeURI", |
80 | m_HomeURL = assetConfig.GetString("ProfileServerURI", string.Empty); | 80 | new string[] { "Startup", "Hypergrid", configName }, string.Empty); |
81 | // Preferred | 81 | if (m_HomeURL == string.Empty) |
82 | m_HomeURL = assetConfig.GetString("HomeURI", m_HomeURL); | 82 | throw new Exception("[HGAssetService] No HomeURI specified"); |
83 | 83 | ||
84 | m_Cache = UserAccountCache.CreateUserAccountCache(m_UserAccountService); | 84 | m_Cache = UserAccountCache.CreateUserAccountCache(m_UserAccountService); |
85 | 85 | ||
@@ -100,7 +100,7 @@ namespace OpenSim.Services.HypergridService | |||
100 | return null; | 100 | return null; |
101 | 101 | ||
102 | if (asset.Metadata.Type == (sbyte)AssetType.Object) | 102 | if (asset.Metadata.Type == (sbyte)AssetType.Object) |
103 | asset.Data = AdjustIdentifiers(asset.Data); ; | 103 | asset.Data = AdjustIdentifiers(asset.Data); |
104 | 104 | ||
105 | AdjustIdentifiers(asset.Metadata); | 105 | AdjustIdentifiers(asset.Metadata); |
106 | 106 | ||
@@ -129,6 +129,14 @@ namespace OpenSim.Services.HypergridService | |||
129 | if (!m_AssetPerms.AllowedExport(asset.Type)) | 129 | if (!m_AssetPerms.AllowedExport(asset.Type)) |
130 | return null; | 130 | return null; |
131 | 131 | ||
132 | // Deal with bug introduced in Oct. 20 (1eb3e6cc43e2a7b4053bc1185c7c88e22356c5e8) | ||
133 | // Fix bad assets before sending them elsewhere | ||
134 | if (asset.Type == (int)AssetType.Object && asset.Data != null) | ||
135 | { | ||
136 | string xml = ExternalRepresentationUtils.SanitizeXml(Utils.BytesToString(asset.Data)); | ||
137 | asset.Data = Utils.StringToBytes(xml); | ||
138 | } | ||
139 | |||
132 | return asset.Data; | 140 | return asset.Data; |
133 | } | 141 | } |
134 | 142 | ||
@@ -139,6 +147,14 @@ namespace OpenSim.Services.HypergridService | |||
139 | if (!m_AssetPerms.AllowedImport(asset.Type)) | 147 | if (!m_AssetPerms.AllowedImport(asset.Type)) |
140 | return string.Empty; | 148 | return string.Empty; |
141 | 149 | ||
150 | // Deal with bug introduced in Oct. 20 (1eb3e6cc43e2a7b4053bc1185c7c88e22356c5e8) | ||
151 | // Fix bad assets before storing on this server | ||
152 | if (asset.Type == (int)AssetType.Object && asset.Data != null) | ||
153 | { | ||
154 | string xml = ExternalRepresentationUtils.SanitizeXml(Utils.BytesToString(asset.Data)); | ||
155 | asset.Data = Utils.StringToBytes(xml); | ||
156 | } | ||
157 | |||
142 | return base.Store(asset); | 158 | return base.Store(asset); |
143 | } | 159 | } |
144 | 160 | ||
@@ -160,10 +176,16 @@ namespace OpenSim.Services.HypergridService | |||
160 | meta.CreatorID = meta.CreatorID + ";" + m_HomeURL + "/" + creator.FirstName + " " + creator.LastName; | 176 | meta.CreatorID = meta.CreatorID + ";" + m_HomeURL + "/" + creator.FirstName + " " + creator.LastName; |
161 | } | 177 | } |
162 | 178 | ||
179 | // Only for Object | ||
163 | protected byte[] AdjustIdentifiers(byte[] data) | 180 | protected byte[] AdjustIdentifiers(byte[] data) |
164 | { | 181 | { |
165 | string xml = Utils.BytesToString(data); | 182 | string xml = Utils.BytesToString(data); |
166 | return Utils.StringToBytes(ExternalRepresentationUtils.RewriteSOP(xml, m_HomeURL, m_Cache, UUID.Zero)); | 183 | |
184 | // Deal with bug introduced in Oct. 20 (1eb3e6cc43e2a7b4053bc1185c7c88e22356c5e8) | ||
185 | // Fix bad assets before sending them elsewhere | ||
186 | xml = ExternalRepresentationUtils.SanitizeXml(xml); | ||
187 | |||
188 | return Utils.StringToBytes(ExternalRepresentationUtils.RewriteSOP(xml, "HGAssetService", m_HomeURL, m_Cache, UUID.Zero)); | ||
167 | } | 189 | } |
168 | 190 | ||
169 | } | 191 | } |
diff --git a/OpenSim/Services/HypergridService/HGFSAssetService.cs b/OpenSim/Services/HypergridService/HGFSAssetService.cs new file mode 100644 index 0000000..54e8ccb --- /dev/null +++ b/OpenSim/Services/HypergridService/HGFSAssetService.cs | |||
@@ -0,0 +1,189 @@ | |||
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 | using System; | ||
28 | using System.Reflection; | ||
29 | |||
30 | using Nini.Config; | ||
31 | using log4net; | ||
32 | using OpenMetaverse; | ||
33 | |||
34 | using OpenSim.Framework; | ||
35 | using OpenSim.Framework.Serialization.External; | ||
36 | using OpenSim.Server.Base; | ||
37 | using OpenSim.Services.Interfaces; | ||
38 | using OpenSim.Services.FSAssetService; | ||
39 | |||
40 | namespace OpenSim.Services.HypergridService | ||
41 | { | ||
42 | /// <summary> | ||
43 | /// Hypergrid asset service. It serves the IAssetService interface, | ||
44 | /// but implements it in ways that are appropriate for inter-grid | ||
45 | /// asset exchanges. This version is for FSAssets. | ||
46 | /// </summary> | ||
47 | public class HGFSAssetService : FSAssetConnector, IAssetService | ||
48 | { | ||
49 | private static readonly ILog m_log = | ||
50 | LogManager.GetLogger( | ||
51 | MethodBase.GetCurrentMethod().DeclaringType); | ||
52 | |||
53 | private string m_HomeURL; | ||
54 | private IUserAccountService m_UserAccountService; | ||
55 | |||
56 | private UserAccountCache m_Cache; | ||
57 | |||
58 | private AssetPermissions m_AssetPerms; | ||
59 | |||
60 | public HGFSAssetService(IConfigSource config, string configName) : base(config, "AssetService") | ||
61 | { | ||
62 | m_log.Debug("[HGAsset Service]: Starting in FSAsset mode"); | ||
63 | IConfig assetConfig = config.Configs[configName]; | ||
64 | if (assetConfig == null) | ||
65 | throw new Exception("No HGAssetService configuration"); | ||
66 | |||
67 | string userAccountsDll = assetConfig.GetString("UserAccountsService", string.Empty); | ||
68 | if (userAccountsDll == string.Empty) | ||
69 | throw new Exception("Please specify UserAccountsService in HGAssetService configuration"); | ||
70 | |||
71 | Object[] args = new Object[] { config }; | ||
72 | m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(userAccountsDll, args); | ||
73 | if (m_UserAccountService == null) | ||
74 | throw new Exception(String.Format("Unable to create UserAccountService from {0}", userAccountsDll)); | ||
75 | |||
76 | m_HomeURL = Util.GetConfigVarFromSections<string>(config, "HomeURI", | ||
77 | new string[] { "Startup", "Hypergrid", configName }, string.Empty); | ||
78 | if (m_HomeURL == string.Empty) | ||
79 | throw new Exception("[HGAssetService] No HomeURI specified"); | ||
80 | |||
81 | m_Cache = UserAccountCache.CreateUserAccountCache(m_UserAccountService); | ||
82 | |||
83 | // Permissions | ||
84 | m_AssetPerms = new AssetPermissions(assetConfig); | ||
85 | } | ||
86 | |||
87 | #region IAssetService overrides | ||
88 | public override AssetBase Get(string id) | ||
89 | { | ||
90 | AssetBase asset = base.Get(id); | ||
91 | |||
92 | if (asset == null) | ||
93 | return null; | ||
94 | |||
95 | if (!m_AssetPerms.AllowedExport(asset.Type)) | ||
96 | return null; | ||
97 | |||
98 | if (asset.Metadata.Type == (sbyte)AssetType.Object) | ||
99 | asset.Data = AdjustIdentifiers(asset.Data); | ||
100 | |||
101 | AdjustIdentifiers(asset.Metadata); | ||
102 | |||
103 | return asset; | ||
104 | } | ||
105 | |||
106 | public override AssetMetadata GetMetadata(string id) | ||
107 | { | ||
108 | AssetMetadata meta = base.GetMetadata(id); | ||
109 | |||
110 | if (meta == null) | ||
111 | return null; | ||
112 | |||
113 | AdjustIdentifiers(meta); | ||
114 | |||
115 | return meta; | ||
116 | } | ||
117 | |||
118 | public override byte[] GetData(string id) | ||
119 | { | ||
120 | AssetBase asset = Get(id); | ||
121 | |||
122 | if (asset == null) | ||
123 | return null; | ||
124 | |||
125 | if (!m_AssetPerms.AllowedExport(asset.Type)) | ||
126 | return null; | ||
127 | |||
128 | // Deal with bug introduced in Oct. 20 (1eb3e6cc43e2a7b4053bc1185c7c88e22356c5e8) | ||
129 | // Fix bad assets before sending them elsewhere | ||
130 | if (asset.Type == (int)AssetType.Object && asset.Data != null) | ||
131 | { | ||
132 | string xml = ExternalRepresentationUtils.SanitizeXml(Utils.BytesToString(asset.Data)); | ||
133 | asset.Data = Utils.StringToBytes(xml); | ||
134 | } | ||
135 | |||
136 | return asset.Data; | ||
137 | } | ||
138 | |||
139 | //public virtual bool Get(string id, Object sender, AssetRetrieved handler) | ||
140 | |||
141 | public override string Store(AssetBase asset) | ||
142 | { | ||
143 | if (!m_AssetPerms.AllowedImport(asset.Type)) | ||
144 | return string.Empty; | ||
145 | |||
146 | // Deal with bug introduced in Oct. 20 (1eb3e6cc43e2a7b4053bc1185c7c88e22356c5e8) | ||
147 | // Fix bad assets before storing on this server | ||
148 | if (asset.Type == (int)AssetType.Object && asset.Data != null) | ||
149 | { | ||
150 | string xml = ExternalRepresentationUtils.SanitizeXml(Utils.BytesToString(asset.Data)); | ||
151 | asset.Data = Utils.StringToBytes(xml); | ||
152 | } | ||
153 | |||
154 | return base.Store(asset); | ||
155 | } | ||
156 | |||
157 | public override bool Delete(string id) | ||
158 | { | ||
159 | // NOGO | ||
160 | return false; | ||
161 | } | ||
162 | |||
163 | #endregion | ||
164 | |||
165 | protected void AdjustIdentifiers(AssetMetadata meta) | ||
166 | { | ||
167 | if (meta == null || m_Cache == null) | ||
168 | return; | ||
169 | |||
170 | UserAccount creator = m_Cache.GetUser(meta.CreatorID); | ||
171 | if (creator != null) | ||
172 | meta.CreatorID = meta.CreatorID + ";" + m_HomeURL + "/" + creator.FirstName + " " + creator.LastName; | ||
173 | } | ||
174 | |||
175 | // Only for Object | ||
176 | protected byte[] AdjustIdentifiers(byte[] data) | ||
177 | { | ||
178 | string xml = Utils.BytesToString(data); | ||
179 | |||
180 | // Deal with bug introduced in Oct. 20 (1eb3e6cc43e2a7b4053bc1185c7c88e22356c5e8) | ||
181 | // Fix bad assets before sending them elsewhere | ||
182 | xml = ExternalRepresentationUtils.SanitizeXml(xml); | ||
183 | |||
184 | return Utils.StringToBytes(ExternalRepresentationUtils.RewriteSOP(xml, "HGAssetService", m_HomeURL, m_Cache, UUID.Zero)); | ||
185 | } | ||
186 | |||
187 | } | ||
188 | |||
189 | } | ||
diff --git a/OpenSim/Services/HypergridService/HGFriendsService.cs b/OpenSim/Services/HypergridService/HGFriendsService.cs index a8bcfb2..6e35a88 100644 --- a/OpenSim/Services/HypergridService/HGFriendsService.cs +++ b/OpenSim/Services/HypergridService/HGFriendsService.cs | |||
@@ -198,7 +198,8 @@ namespace OpenSim.Services.HypergridService | |||
198 | // So let's send back the call, but start a thread to continue | 198 | // So let's send back the call, but start a thread to continue |
199 | // with the verification and the actual action. | 199 | // with the verification and the actual action. |
200 | 200 | ||
201 | Util.FireAndForget(delegate { ProcessFriendshipOffered(fromID, fromName, toID, message); }); | 201 | Util.FireAndForget( |
202 | o => ProcessFriendshipOffered(fromID, fromName, toID, message), null, "HGFriendsService.ProcessFriendshipOffered"); | ||
202 | 203 | ||
203 | return true; | 204 | return true; |
204 | } | 205 | } |
diff --git a/OpenSim/Services/HypergridService/HGInstantMessageService.cs b/OpenSim/Services/HypergridService/HGInstantMessageService.cs index e8d7cca..32ca09a 100644 --- a/OpenSim/Services/HypergridService/HGInstantMessageService.cs +++ b/OpenSim/Services/HypergridService/HGInstantMessageService.cs | |||
@@ -101,7 +101,14 @@ namespace OpenSim.Services.HypergridService | |||
101 | Object[] args = new Object[] { config }; | 101 | Object[] args = new Object[] { config }; |
102 | m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args); | 102 | m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args); |
103 | m_PresenceService = ServerUtils.LoadPlugin<IPresenceService>(presenceService, args); | 103 | m_PresenceService = ServerUtils.LoadPlugin<IPresenceService>(presenceService, args); |
104 | m_UserAgentService = ServerUtils.LoadPlugin<IUserAgentService>(userAgentService, args); | 104 | try |
105 | { | ||
106 | m_UserAgentService = ServerUtils.LoadPlugin<IUserAgentService>(userAgentService, args); | ||
107 | } | ||
108 | catch | ||
109 | { | ||
110 | m_log.WarnFormat("[HG IM SERVICE]: Unable to create User Agent Service. Missing config var in [HGInstantMessageService]?"); | ||
111 | } | ||
105 | 112 | ||
106 | m_RegionCache = new ExpiringCache<UUID, GridRegion>(); | 113 | m_RegionCache = new ExpiringCache<UUID, GridRegion>(); |
107 | 114 | ||
@@ -215,7 +222,15 @@ namespace OpenSim.Services.HypergridService | |||
215 | { | 222 | { |
216 | // Let's check with the UAS if the user is elsewhere | 223 | // Let's check with the UAS if the user is elsewhere |
217 | m_log.DebugFormat("[HG IM SERVICE]: User is not present. Checking location with User Agent service"); | 224 | m_log.DebugFormat("[HG IM SERVICE]: User is not present. Checking location with User Agent service"); |
218 | url = m_UserAgentService.LocateUser(toAgentID); | 225 | try |
226 | { | ||
227 | url = m_UserAgentService.LocateUser(toAgentID); | ||
228 | } | ||
229 | catch (Exception e) | ||
230 | { | ||
231 | m_log.Warn("[HG IM SERVICE]: LocateUser call failed ", e); | ||
232 | url = string.Empty; | ||
233 | } | ||
219 | } | 234 | } |
220 | 235 | ||
221 | // check if we've tried this before.. | 236 | // check if we've tried this before.. |
diff --git a/OpenSim/Services/HypergridService/HGInventoryService.cs b/OpenSim/Services/HypergridService/HGInventoryService.cs index 3233caf..9158b41 100644 --- a/OpenSim/Services/HypergridService/HGInventoryService.cs +++ b/OpenSim/Services/HypergridService/HGInventoryService.cs | |||
@@ -103,12 +103,6 @@ namespace OpenSim.Services.HypergridService | |||
103 | return new List<InventoryFolderBase>(); | 103 | return new List<InventoryFolderBase>(); |
104 | } | 104 | } |
105 | 105 | ||
106 | public override InventoryCollection GetUserInventory(UUID userID) | ||
107 | { | ||
108 | // NOGO for this inventory service | ||
109 | return null; | ||
110 | } | ||
111 | |||
112 | public override InventoryFolderBase GetRootFolder(UUID principalID) | 106 | public override InventoryFolderBase GetRootFolder(UUID principalID) |
113 | { | 107 | { |
114 | //m_log.DebugFormat("[HG INVENTORY SERVICE]: GetRootFolder for {0}", principalID); | 108 | //m_log.DebugFormat("[HG INVENTORY SERVICE]: GetRootFolder for {0}", principalID); |
@@ -121,7 +115,7 @@ namespace OpenSim.Services.HypergridService | |||
121 | return ConvertToOpenSim(folders[0]); | 115 | return ConvertToOpenSim(folders[0]); |
122 | 116 | ||
123 | // make one | 117 | // make one |
124 | XInventoryFolder suitcase = CreateFolder(principalID, UUID.Zero, (int)AssetType.Folder, "My Suitcase"); | 118 | XInventoryFolder suitcase = CreateFolder(principalID, UUID.Zero, (int)FolderType.Suitcase, "My Suitcase"); |
125 | return ConvertToOpenSim(suitcase); | 119 | return ConvertToOpenSim(suitcase); |
126 | } | 120 | } |
127 | 121 | ||
@@ -147,7 +141,7 @@ namespace OpenSim.Services.HypergridService | |||
147 | //} | 141 | //} |
148 | 142 | ||
149 | 143 | ||
150 | public override InventoryFolderBase GetFolderForType(UUID principalID, AssetType type) | 144 | public override InventoryFolderBase GetFolderForType(UUID principalID, FolderType type) |
151 | { | 145 | { |
152 | //m_log.DebugFormat("[HG INVENTORY SERVICE]: GetFolderForType for {0} {0}", principalID, type); | 146 | //m_log.DebugFormat("[HG INVENTORY SERVICE]: GetFolderForType for {0} {0}", principalID, type); |
153 | return GetRootFolder(principalID); | 147 | return GetRootFolder(principalID); |
@@ -159,7 +153,14 @@ namespace OpenSim.Services.HypergridService | |||
159 | //public InventoryCollection GetFolderContent(UUID principalID, UUID folderID) | 153 | //public InventoryCollection GetFolderContent(UUID principalID, UUID folderID) |
160 | //{ | 154 | //{ |
161 | //} | 155 | //} |
162 | 156 | ||
157 | // NOGO | ||
158 | // | ||
159 | public override InventoryCollection[] GetMultipleFoldersContent(UUID principalID, UUID[] folderID) | ||
160 | { | ||
161 | return new InventoryCollection[0]; | ||
162 | } | ||
163 | |||
163 | //public List<InventoryItemBase> GetFolderItems(UUID principalID, UUID folderID) | 164 | //public List<InventoryItemBase> GetFolderItems(UUID principalID, UUID folderID) |
164 | //{ | 165 | //{ |
165 | //} | 166 | //} |
diff --git a/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs index 835cde3..40eb6d4 100644 --- a/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs +++ b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs | |||
@@ -122,7 +122,7 @@ namespace OpenSim.Services.HypergridService | |||
122 | } | 122 | } |
123 | 123 | ||
124 | List<XInventoryFolder> tree = GetFolderTree(principalID, suitcase.folderID); | 124 | List<XInventoryFolder> tree = GetFolderTree(principalID, suitcase.folderID); |
125 | if (tree == null || (tree != null && tree.Count == 0)) | 125 | if (tree.Count == 0) |
126 | return null; | 126 | return null; |
127 | 127 | ||
128 | List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); | 128 | List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); |
@@ -137,59 +137,6 @@ namespace OpenSim.Services.HypergridService | |||
137 | return folders; | 137 | return folders; |
138 | } | 138 | } |
139 | 139 | ||
140 | public override InventoryCollection GetUserInventory(UUID userID) | ||
141 | { | ||
142 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Get Suitcase inventory for user {0}", userID); | ||
143 | |||
144 | InventoryCollection userInventory = new InventoryCollection(); | ||
145 | userInventory.UserID = userID; | ||
146 | userInventory.Folders = new List<InventoryFolderBase>(); | ||
147 | userInventory.Items = new List<InventoryItemBase>(); | ||
148 | |||
149 | XInventoryFolder suitcase = GetSuitcaseXFolder(userID); | ||
150 | |||
151 | if (suitcase == null) | ||
152 | { | ||
153 | m_log.WarnFormat("[HG SUITCASE INVENTORY SERVICE]: Found no suitcase folder for user {0} when looking for user inventory", userID); | ||
154 | return null; | ||
155 | } | ||
156 | |||
157 | List<XInventoryFolder> tree = GetFolderTree(userID, suitcase.folderID); | ||
158 | if (tree == null || (tree != null && tree.Count == 0)) | ||
159 | { | ||
160 | SetAsNormalFolder(suitcase); | ||
161 | userInventory.Folders.Add(ConvertToOpenSim(suitcase)); | ||
162 | return userInventory; | ||
163 | } | ||
164 | |||
165 | List<InventoryItemBase> items; | ||
166 | foreach (XInventoryFolder f in tree) | ||
167 | { | ||
168 | // Add the items of this subfolder | ||
169 | items = GetFolderItems(userID, f.folderID); | ||
170 | if (items != null && items.Count > 0) | ||
171 | { | ||
172 | userInventory.Items.AddRange(items); | ||
173 | } | ||
174 | |||
175 | // Add the folder itself | ||
176 | userInventory.Folders.Add(ConvertToOpenSim(f)); | ||
177 | } | ||
178 | |||
179 | items = GetFolderItems(userID, suitcase.folderID); | ||
180 | if (items != null && items.Count > 0) | ||
181 | { | ||
182 | userInventory.Items.AddRange(items); | ||
183 | } | ||
184 | |||
185 | SetAsNormalFolder(suitcase); | ||
186 | userInventory.Folders.Add(ConvertToOpenSim(suitcase)); | ||
187 | |||
188 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: GetUserInventory for user {0} returning {1} folders and {2} items", | ||
189 | userID, userInventory.Folders.Count, userInventory.Items.Count); | ||
190 | return userInventory; | ||
191 | } | ||
192 | |||
193 | public override InventoryFolderBase GetRootFolder(UUID principalID) | 140 | public override InventoryFolderBase GetRootFolder(UUID principalID) |
194 | { | 141 | { |
195 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: GetRootFolder for {0}", principalID); | 142 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: GetRootFolder for {0}", principalID); |
@@ -209,27 +156,21 @@ namespace OpenSim.Services.HypergridService | |||
209 | if (suitcase == null) | 156 | if (suitcase == null) |
210 | { | 157 | { |
211 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: User {0} does not have a Suitcase folder. Creating it...", principalID); | 158 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: User {0} does not have a Suitcase folder. Creating it...", principalID); |
212 | // make one, and let's add it to the user's inventory as a direct child of the root folder | 159 | // Create the My Suitcase folder under the user's root folder. |
213 | // In the DB we tag it as type 100, but we use -1 (Unknown) outside | 160 | // In the DB we tag it as type 100, but we use type 8 (Folder) outside, as this affects the sort order. |
214 | suitcase = CreateFolder(principalID, root.folderID, 100, "My Suitcase"); | 161 | suitcase = CreateFolder(principalID, root.folderID, (int)FolderType.Suitcase, InventoryFolderBase.SUITCASE_FOLDER_NAME); |
215 | if (suitcase == null) | 162 | if (suitcase == null) |
216 | { | 163 | { |
217 | m_log.ErrorFormat("[HG SUITCASE INVENTORY SERVICE]: Unable to create suitcase folder"); | 164 | m_log.ErrorFormat("[HG SUITCASE INVENTORY SERVICE]: Unable to create suitcase folder"); |
165 | return null; | ||
218 | } | 166 | } |
219 | else | ||
220 | { | ||
221 | m_Database.StoreFolder(suitcase); | ||
222 | |||
223 | // Create System folders | ||
224 | CreateSystemFolders(principalID, suitcase.folderID); | ||
225 | 167 | ||
226 | SetAsNormalFolder(suitcase); | 168 | CreateSystemFolders(principalID, suitcase.folderID); |
227 | |||
228 | return ConvertToOpenSim(suitcase); | ||
229 | } | ||
230 | } | 169 | } |
231 | 170 | ||
232 | return null; | 171 | SetAsNormalFolder(suitcase); |
172 | |||
173 | return ConvertToOpenSim(suitcase); | ||
233 | } | 174 | } |
234 | 175 | ||
235 | protected void CreateSystemFolders(UUID principalID, UUID rootID) | 176 | protected void CreateSystemFolders(UUID principalID, UUID rootID) |
@@ -237,42 +178,41 @@ namespace OpenSim.Services.HypergridService | |||
237 | m_log.Debug("[HG SUITCASE INVENTORY SERVICE]: Creating System folders under Suitcase..."); | 178 | m_log.Debug("[HG SUITCASE INVENTORY SERVICE]: Creating System folders under Suitcase..."); |
238 | XInventoryFolder[] sysFolders = GetSystemFolders(principalID, rootID); | 179 | XInventoryFolder[] sysFolders = GetSystemFolders(principalID, rootID); |
239 | 180 | ||
240 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.Animation) return true; return false; })) | 181 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.Animation) return true; return false; })) |
241 | CreateFolder(principalID, rootID, (int)AssetType.Animation, "Animations"); | 182 | CreateFolder(principalID, rootID, (int)FolderType.Animation, "Animations"); |
242 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.Bodypart) return true; return false; })) | 183 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.BodyPart) return true; return false; })) |
243 | CreateFolder(principalID, rootID, (int)AssetType.Bodypart, "Body Parts"); | 184 | CreateFolder(principalID, rootID, (int)FolderType.BodyPart, "Body Parts"); |
244 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.CallingCard) return true; return false; })) | 185 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.CallingCard) return true; return false; })) |
245 | CreateFolder(principalID, rootID, (int)AssetType.CallingCard, "Calling Cards"); | 186 | CreateFolder(principalID, rootID, (int)FolderType.CallingCard, "Calling Cards"); |
246 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.Clothing) return true; return false; })) | 187 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.Clothing) return true; return false; })) |
247 | CreateFolder(principalID, rootID, (int)AssetType.Clothing, "Clothing"); | 188 | CreateFolder(principalID, rootID, (int)FolderType.Clothing, "Clothing"); |
248 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.Gesture) return true; return false; })) | 189 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.CurrentOutfit) return true; return false; })) |
249 | CreateFolder(principalID, rootID, (int)AssetType.Gesture, "Gestures"); | 190 | CreateFolder(principalID, rootID, (int)FolderType.CurrentOutfit, "Current Outfit"); |
250 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.Landmark) return true; return false; })) | 191 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.Favorites) return true; return false; })) |
251 | CreateFolder(principalID, rootID, (int)AssetType.Landmark, "Landmarks"); | 192 | CreateFolder(principalID, rootID, (int)FolderType.Favorites, "Favorites"); |
252 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.LostAndFoundFolder) return true; return false; })) | 193 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.Gesture) return true; return false; })) |
253 | CreateFolder(principalID, rootID, (int)AssetType.LostAndFoundFolder, "Lost And Found"); | 194 | CreateFolder(principalID, rootID, (int)FolderType.Gesture, "Gestures"); |
254 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.Notecard) return true; return false; })) | 195 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.Landmark) return true; return false; })) |
255 | CreateFolder(principalID, rootID, (int)AssetType.Notecard, "Notecards"); | 196 | CreateFolder(principalID, rootID, (int)FolderType.Landmark, "Landmarks"); |
256 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.Object) return true; return false; })) | 197 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.LostAndFound) return true; return false; })) |
257 | CreateFolder(principalID, rootID, (int)AssetType.Object, "Objects"); | 198 | CreateFolder(principalID, rootID, (int)FolderType.LostAndFound, "Lost And Found"); |
258 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.SnapshotFolder) return true; return false; })) | 199 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.Notecard) return true; return false; })) |
259 | CreateFolder(principalID, rootID, (int)AssetType.SnapshotFolder, "Photo Album"); | 200 | CreateFolder(principalID, rootID, (int)FolderType.Notecard, "Notecards"); |
260 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.LSLText) return true; return false; })) | 201 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.Object) return true; return false; })) |
261 | CreateFolder(principalID, rootID, (int)AssetType.LSLText, "Scripts"); | 202 | CreateFolder(principalID, rootID, (int)FolderType.Object, "Objects"); |
262 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.Sound) return true; return false; })) | 203 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.Snapshot) return true; return false; })) |
263 | CreateFolder(principalID, rootID, (int)AssetType.Sound, "Sounds"); | 204 | CreateFolder(principalID, rootID, (int)FolderType.Snapshot, "Photo Album"); |
264 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.Texture) return true; return false; })) | 205 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.LSLText) return true; return false; })) |
265 | CreateFolder(principalID, rootID, (int)AssetType.Texture, "Textures"); | 206 | CreateFolder(principalID, rootID, (int)FolderType.LSLText, "Scripts"); |
266 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.TrashFolder) return true; return false; })) | 207 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.Sound) return true; return false; })) |
267 | CreateFolder(principalID, rootID, (int)AssetType.TrashFolder, "Trash"); | 208 | CreateFolder(principalID, rootID, (int)FolderType.Sound, "Sounds"); |
268 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.FavoriteFolder) return true; return false; })) | 209 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.Texture) return true; return false; })) |
269 | CreateFolder(principalID, rootID, (int)AssetType.FavoriteFolder, "Favorites"); | 210 | CreateFolder(principalID, rootID, (int)FolderType.Texture, "Textures"); |
270 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.CurrentOutfitFolder) return true; return false; })) | 211 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.Trash) return true; return false; })) |
271 | CreateFolder(principalID, rootID, (int)AssetType.CurrentOutfitFolder, "Current Outfit"); | 212 | CreateFolder(principalID, rootID, (int)FolderType.Trash, "Trash"); |
272 | |||
273 | } | 213 | } |
274 | 214 | ||
275 | public override InventoryFolderBase GetFolderForType(UUID principalID, AssetType type) | 215 | public override InventoryFolderBase GetFolderForType(UUID principalID, FolderType type) |
276 | { | 216 | { |
277 | //m_log.DebugFormat("[HG INVENTORY SERVICE]: GetFolderForType for {0} {0}", principalID, type); | 217 | //m_log.DebugFormat("[HG INVENTORY SERVICE]: GetFolderForType for {0} {0}", principalID, type); |
278 | XInventoryFolder suitcase = GetSuitcaseXFolder(principalID); | 218 | XInventoryFolder suitcase = GetSuitcaseXFolder(principalID); |
@@ -305,7 +245,10 @@ namespace OpenSim.Services.HypergridService | |||
305 | InventoryCollection coll = null; | 245 | InventoryCollection coll = null; |
306 | 246 | ||
307 | if (!IsWithinSuitcaseTree(principalID, folderID)) | 247 | if (!IsWithinSuitcaseTree(principalID, folderID)) |
248 | { | ||
249 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: GetFolderContent: folder {0} (user {1}) is not within Suitcase tree", folderID, principalID); | ||
308 | return new InventoryCollection(); | 250 | return new InventoryCollection(); |
251 | } | ||
309 | 252 | ||
310 | coll = base.GetFolderContent(principalID, folderID); | 253 | coll = base.GetFolderContent(principalID, folderID); |
311 | 254 | ||
@@ -322,7 +265,10 @@ namespace OpenSim.Services.HypergridService | |||
322 | // Let's do a bit of sanity checking, more than the base service does | 265 | // Let's do a bit of sanity checking, more than the base service does |
323 | // make sure the given folder exists under the suitcase tree of this user | 266 | // make sure the given folder exists under the suitcase tree of this user |
324 | if (!IsWithinSuitcaseTree(principalID, folderID)) | 267 | if (!IsWithinSuitcaseTree(principalID, folderID)) |
268 | { | ||
269 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: GetFolderItems: folder {0} (user {1}) is not within Suitcase tree", folderID, principalID); | ||
325 | return new List<InventoryItemBase>(); | 270 | return new List<InventoryItemBase>(); |
271 | } | ||
326 | 272 | ||
327 | return base.GetFolderItems(principalID, folderID); | 273 | return base.GetFolderItems(principalID, folderID); |
328 | } | 274 | } |
@@ -334,7 +280,10 @@ namespace OpenSim.Services.HypergridService | |||
334 | // make sure the given folder's parent folder exists under the suitcase tree of this user | 280 | // make sure the given folder's parent folder exists under the suitcase tree of this user |
335 | 281 | ||
336 | if (!IsWithinSuitcaseTree(folder.Owner, folder.ParentID)) | 282 | if (!IsWithinSuitcaseTree(folder.Owner, folder.ParentID)) |
283 | { | ||
284 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: AddFolder: folder {0} (user {1}) is not within Suitcase tree", folder.ParentID, folder.Owner); | ||
337 | return false; | 285 | return false; |
286 | } | ||
338 | 287 | ||
339 | // OK, it's legit | 288 | // OK, it's legit |
340 | if (base.AddFolder(folder)) | 289 | if (base.AddFolder(folder)) |
@@ -354,7 +303,7 @@ namespace OpenSim.Services.HypergridService | |||
354 | //m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Update folder {0}, version {1}", folder.ID, folder.Version); | 303 | //m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Update folder {0}, version {1}", folder.ID, folder.Version); |
355 | if (!IsWithinSuitcaseTree(folder.Owner, folder.ID)) | 304 | if (!IsWithinSuitcaseTree(folder.Owner, folder.ID)) |
356 | { | 305 | { |
357 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: folder {0} not within Suitcase tree", folder.Name); | 306 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: UpdateFolder: folder {0}/{1} (user {2}) is not within Suitcase tree", folder.Name, folder.ID, folder.Owner); |
358 | return false; | 307 | return false; |
359 | } | 308 | } |
360 | 309 | ||
@@ -364,9 +313,17 @@ namespace OpenSim.Services.HypergridService | |||
364 | 313 | ||
365 | public override bool MoveFolder(InventoryFolderBase folder) | 314 | public override bool MoveFolder(InventoryFolderBase folder) |
366 | { | 315 | { |
367 | if (!IsWithinSuitcaseTree(folder.Owner, folder.ID) || | 316 | if (!IsWithinSuitcaseTree(folder.Owner, folder.ID)) |
368 | !IsWithinSuitcaseTree(folder.Owner, folder.ParentID)) | 317 | { |
318 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: MoveFolder: folder {0} (user {1}) is not within Suitcase tree", folder.ID, folder.Owner); | ||
369 | return false; | 319 | return false; |
320 | } | ||
321 | |||
322 | if (!IsWithinSuitcaseTree(folder.Owner, folder.ParentID)) | ||
323 | { | ||
324 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: MoveFolder: folder {0} (user {1}) is not within Suitcase tree", folder.ParentID, folder.Owner); | ||
325 | return false; | ||
326 | } | ||
370 | 327 | ||
371 | return base.MoveFolder(folder); | 328 | return base.MoveFolder(folder); |
372 | } | 329 | } |
@@ -388,7 +345,10 @@ namespace OpenSim.Services.HypergridService | |||
388 | // Let's do a bit of sanity checking, more than the base service does | 345 | // Let's do a bit of sanity checking, more than the base service does |
389 | // make sure the given folder's parent folder exists under the suitcase tree of this user | 346 | // make sure the given folder's parent folder exists under the suitcase tree of this user |
390 | if (!IsWithinSuitcaseTree(item.Owner, item.Folder)) | 347 | if (!IsWithinSuitcaseTree(item.Owner, item.Folder)) |
348 | { | ||
349 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: AddItem: folder {0} (user {1}) is not within Suitcase tree", item.Folder, item.Owner); | ||
391 | return false; | 350 | return false; |
351 | } | ||
392 | 352 | ||
393 | // OK, it's legit | 353 | // OK, it's legit |
394 | return base.AddItem(item); | 354 | return base.AddItem(item); |
@@ -398,7 +358,10 @@ namespace OpenSim.Services.HypergridService | |||
398 | public override bool UpdateItem(InventoryItemBase item) | 358 | public override bool UpdateItem(InventoryItemBase item) |
399 | { | 359 | { |
400 | if (!IsWithinSuitcaseTree(item.Owner, item.Folder)) | 360 | if (!IsWithinSuitcaseTree(item.Owner, item.Folder)) |
361 | { | ||
362 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: UpdateItem: folder {0} (user {1}) is not within Suitcase tree", item.Folder, item.Owner); | ||
401 | return false; | 363 | return false; |
364 | } | ||
402 | 365 | ||
403 | return base.UpdateItem(item); | 366 | return base.UpdateItem(item); |
404 | } | 367 | } |
@@ -407,11 +370,28 @@ namespace OpenSim.Services.HypergridService | |||
407 | { | 370 | { |
408 | // Principal is b0rked. *sigh* | 371 | // Principal is b0rked. *sigh* |
409 | 372 | ||
410 | if (!IsWithinSuitcaseTree(items[0].Owner, items[0].Folder)) | 373 | // Check the items' destination folders |
411 | return false; | 374 | foreach (InventoryItemBase item in items) |
375 | { | ||
376 | if (!IsWithinSuitcaseTree(item.Owner, item.Folder)) | ||
377 | { | ||
378 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: MoveItems: folder {0} (user {1}) is not within Suitcase tree", item.Folder, item.Owner); | ||
379 | return false; | ||
380 | } | ||
381 | } | ||
412 | 382 | ||
413 | return base.MoveItems(principalID, items); | 383 | // Check the items' current folders |
384 | foreach (InventoryItemBase item in items) | ||
385 | { | ||
386 | InventoryItemBase originalItem = base.GetItem(item); | ||
387 | if (!IsWithinSuitcaseTree(originalItem.Owner, originalItem.Folder)) | ||
388 | { | ||
389 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: MoveItems: folder {0} (user {1}) is not within Suitcase tree", item.Folder, item.Owner); | ||
390 | return false; | ||
391 | } | ||
392 | } | ||
414 | 393 | ||
394 | return base.MoveItems(principalID, items); | ||
415 | } | 395 | } |
416 | 396 | ||
417 | public override bool DeleteItems(UUID principalID, List<UUID> itemIDs) | 397 | public override bool DeleteItems(UUID principalID, List<UUID> itemIDs) |
@@ -431,8 +411,8 @@ namespace OpenSim.Services.HypergridService | |||
431 | 411 | ||
432 | if (!IsWithinSuitcaseTree(it.Owner, it.Folder) && !IsPartOfAppearance(it.Owner, it.ID)) | 412 | if (!IsWithinSuitcaseTree(it.Owner, it.Folder) && !IsPartOfAppearance(it.Owner, it.ID)) |
433 | { | 413 | { |
434 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Item {0} (folder {1}) is not within Suitcase", | 414 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: GetItem: item {0}/{1} (folder {2}) (user {3}) is not within Suitcase tree or Appearance", |
435 | it.Name, it.Folder); | 415 | it.Name, it.ID, it.Folder, it.Owner); |
436 | return null; | 416 | return null; |
437 | } | 417 | } |
438 | 418 | ||
@@ -453,7 +433,11 @@ namespace OpenSim.Services.HypergridService | |||
453 | if (f != null) | 433 | if (f != null) |
454 | { | 434 | { |
455 | if (!IsWithinSuitcaseTree(f.Owner, f.ID)) | 435 | if (!IsWithinSuitcaseTree(f.Owner, f.ID)) |
436 | { | ||
437 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: GetFolder: folder {0}/{1} (user {2}) is not within Suitcase tree", | ||
438 | f.Name, f.ID, f.Owner); | ||
456 | return null; | 439 | return null; |
440 | } | ||
457 | } | 441 | } |
458 | 442 | ||
459 | return f; | 443 | return f; |
@@ -484,7 +468,7 @@ namespace OpenSim.Services.HypergridService | |||
484 | { | 468 | { |
485 | XInventoryFolder[] folders = m_Database.GetFolders( | 469 | XInventoryFolder[] folders = m_Database.GetFolders( |
486 | new string[] { "agentID", "folderName", "type" }, | 470 | new string[] { "agentID", "folderName", "type" }, |
487 | new string[] { principalID.ToString(), "My Inventory", ((int)AssetType.RootFolder).ToString() }); | 471 | new string[] { principalID.ToString(), InventoryFolderBase.ROOT_FOLDER_NAME, ((int)FolderType.Root).ToString() }); |
488 | 472 | ||
489 | if (folders != null && folders.Length > 0) | 473 | if (folders != null && folders.Length > 0) |
490 | return folders[0]; | 474 | return folders[0]; |
@@ -492,7 +476,7 @@ namespace OpenSim.Services.HypergridService | |||
492 | // OK, so the RootFolder type didn't work. Let's look for any type with parent UUID.Zero. | 476 | // OK, so the RootFolder type didn't work. Let's look for any type with parent UUID.Zero. |
493 | folders = m_Database.GetFolders( | 477 | folders = m_Database.GetFolders( |
494 | new string[] { "agentID", "folderName", "parentFolderID" }, | 478 | new string[] { "agentID", "folderName", "parentFolderID" }, |
495 | new string[] { principalID.ToString(), "My Inventory", UUID.Zero.ToString() }); | 479 | new string[] { principalID.ToString(), InventoryFolderBase.ROOT_FOLDER_NAME, UUID.Zero.ToString() }); |
496 | 480 | ||
497 | if (folders != null && folders.Length > 0) | 481 | if (folders != null && folders.Length > 0) |
498 | return folders[0]; | 482 | return folders[0]; |
@@ -508,7 +492,7 @@ namespace OpenSim.Services.HypergridService | |||
508 | 492 | ||
509 | XInventoryFolder[] folders = m_Database.GetFolders( | 493 | XInventoryFolder[] folders = m_Database.GetFolders( |
510 | new string[] { "agentID", "type", "parentFolderID" }, | 494 | new string[] { "agentID", "type", "parentFolderID" }, |
511 | new string[] { userID.ToString(), ((int)AssetType.CurrentOutfitFolder).ToString(), root.folderID.ToString() }); | 495 | new string[] { userID.ToString(), ((int)FolderType.CurrentOutfit).ToString(), root.folderID.ToString() }); |
512 | 496 | ||
513 | if (folders.Length == 0) | 497 | if (folders.Length == 0) |
514 | return null; | 498 | return null; |
@@ -521,7 +505,7 @@ namespace OpenSim.Services.HypergridService | |||
521 | // Warp! Root folder for travelers | 505 | // Warp! Root folder for travelers |
522 | XInventoryFolder[] folders = m_Database.GetFolders( | 506 | XInventoryFolder[] folders = m_Database.GetFolders( |
523 | new string[] { "agentID", "type" }, | 507 | new string[] { "agentID", "type" }, |
524 | new string[] { principalID.ToString(), "100" }); // This is a special folder type... | 508 | new string[] { principalID.ToString(), ((int)FolderType.Suitcase).ToString() }); |
525 | 509 | ||
526 | if (folders != null && folders.Length > 0) | 510 | if (folders != null && folders.Length > 0) |
527 | return folders[0]; | 511 | return folders[0]; |
@@ -529,13 +513,13 @@ namespace OpenSim.Services.HypergridService | |||
529 | // check to see if we have the old Suitcase folder | 513 | // check to see if we have the old Suitcase folder |
530 | folders = m_Database.GetFolders( | 514 | folders = m_Database.GetFolders( |
531 | new string[] { "agentID", "folderName", "parentFolderID" }, | 515 | new string[] { "agentID", "folderName", "parentFolderID" }, |
532 | new string[] { principalID.ToString(), "My Suitcase", UUID.Zero.ToString() }); | 516 | new string[] { principalID.ToString(), InventoryFolderBase.SUITCASE_FOLDER_NAME, UUID.Zero.ToString() }); |
533 | if (folders != null && folders.Length > 0) | 517 | if (folders != null && folders.Length > 0) |
534 | { | 518 | { |
535 | // Move it to under the root folder | 519 | // Move it to under the root folder |
536 | XInventoryFolder root = GetRootXFolder(principalID); | 520 | XInventoryFolder root = GetRootXFolder(principalID); |
537 | folders[0].parentFolderID = root.folderID; | 521 | folders[0].parentFolderID = root.folderID; |
538 | folders[0].type = 100; | 522 | folders[0].type = (int)FolderType.Suitcase; |
539 | m_Database.StoreFolder(folders[0]); | 523 | m_Database.StoreFolder(folders[0]); |
540 | return folders[0]; | 524 | return folders[0]; |
541 | } | 525 | } |
@@ -545,18 +529,18 @@ namespace OpenSim.Services.HypergridService | |||
545 | 529 | ||
546 | private void SetAsNormalFolder(XInventoryFolder suitcase) | 530 | private void SetAsNormalFolder(XInventoryFolder suitcase) |
547 | { | 531 | { |
548 | suitcase.type = (short)AssetType.Folder; | 532 | //suitcase.type = InventoryItemBase.SUITCASE_FOLDER_FAKE_TYPE; |
549 | } | 533 | } |
550 | 534 | ||
551 | private List<XInventoryFolder> GetFolderTree(UUID principalID, UUID folder) | 535 | private List<XInventoryFolder> GetFolderTree(UUID principalID, UUID folder) |
552 | { | 536 | { |
553 | List<XInventoryFolder> t = null; | 537 | List<XInventoryFolder> t; |
554 | if (m_SuitcaseTrees.TryGetValue(principalID, out t)) | 538 | if (m_SuitcaseTrees.TryGetValue(principalID, out t)) |
555 | return t; | 539 | return t; |
556 | 540 | ||
557 | // Get the tree of the suitcase folder | 541 | // Get the tree of the suitcase folder |
558 | t = GetFolderTreeRecursive(folder); | 542 | t = GetFolderTreeRecursive(folder); |
559 | m_SuitcaseTrees.AddOrUpdate(principalID, t, 5*60); // 5minutes | 543 | m_SuitcaseTrees.AddOrUpdate(principalID, t, 5*60); // 5 minutes |
560 | return t; | 544 | return t; |
561 | } | 545 | } |
562 | 546 | ||
@@ -567,8 +551,10 @@ namespace OpenSim.Services.HypergridService | |||
567 | new string[] { "parentFolderID" }, | 551 | new string[] { "parentFolderID" }, |
568 | new string[] { root.ToString() }); | 552 | new string[] { root.ToString() }); |
569 | 553 | ||
570 | if (folders == null || (folders != null && folders.Length == 0)) | 554 | if (folders == null || folders.Length == 0) |
555 | { | ||
571 | return tree; // empty tree | 556 | return tree; // empty tree |
557 | } | ||
572 | else | 558 | else |
573 | { | 559 | { |
574 | foreach (XInventoryFolder f in folders) | 560 | foreach (XInventoryFolder f in folders) |
@@ -601,17 +587,18 @@ namespace OpenSim.Services.HypergridService | |||
601 | List<XInventoryFolder> tree = new List<XInventoryFolder>(); | 587 | List<XInventoryFolder> tree = new List<XInventoryFolder>(); |
602 | tree.Add(suitcase); // Warp! the tree is the real root folder plus the children of the suitcase folder | 588 | tree.Add(suitcase); // Warp! the tree is the real root folder plus the children of the suitcase folder |
603 | tree.AddRange(GetFolderTree(principalID, suitcase.folderID)); | 589 | tree.AddRange(GetFolderTree(principalID, suitcase.folderID)); |
590 | |||
604 | // Also add the Current Outfit folder to the list of available folders | 591 | // Also add the Current Outfit folder to the list of available folders |
605 | tree.Add(GetCurrentOutfitXFolder(principalID)); | 592 | XInventoryFolder folder = GetCurrentOutfitXFolder(principalID); |
593 | if (folder != null) | ||
594 | tree.Add(folder); | ||
606 | 595 | ||
607 | XInventoryFolder f = tree.Find(delegate(XInventoryFolder fl) | 596 | XInventoryFolder f = tree.Find(delegate(XInventoryFolder fl) |
608 | { | 597 | { |
609 | if (fl.folderID == folderID) return true; | 598 | return (fl.folderID == folderID); |
610 | else return false; | ||
611 | }); | 599 | }); |
612 | 600 | ||
613 | if (f == null) return false; | 601 | return (f != null); |
614 | else return true; | ||
615 | } | 602 | } |
616 | #endregion | 603 | #endregion |
617 | 604 | ||
diff --git a/OpenSim/Services/HypergridService/Properties/AssemblyInfo.cs b/OpenSim/Services/HypergridService/Properties/AssemblyInfo.cs index 0fb60f6..a565729 100644 --- a/OpenSim/Services/HypergridService/Properties/AssemblyInfo.cs +++ b/OpenSim/Services/HypergridService/Properties/AssemblyInfo.cs | |||
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices; | |||
29 | // Build Number | 29 | // Build Number |
30 | // Revision | 30 | // Revision |
31 | // | 31 | // |
32 | [assembly: AssemblyVersion("0.8.0.*")] | 32 | [assembly: AssemblyVersion("0.8.2.*")] |
33 | 33 | ||
diff --git a/OpenSim/Services/HypergridService/UserAccountCache.cs b/OpenSim/Services/HypergridService/UserAccountCache.cs index e0a3e61..6c3c655 100644 --- a/OpenSim/Services/HypergridService/UserAccountCache.cs +++ b/OpenSim/Services/HypergridService/UserAccountCache.cs | |||
@@ -1,4 +1,4 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Reflection; | 3 | using System.Reflection; |
4 | 4 | ||
@@ -100,6 +100,11 @@ namespace OpenSim.Services.HypergridService | |||
100 | return null; | 100 | return null; |
101 | } | 101 | } |
102 | 102 | ||
103 | public void InvalidateCache(UUID userID) | ||
104 | { | ||
105 | m_UUIDCache.Remove(userID); | ||
106 | } | ||
107 | |||
103 | public bool StoreUserAccount(UserAccount data) | 108 | public bool StoreUserAccount(UserAccount data) |
104 | { | 109 | { |
105 | return false; | 110 | return false; |
diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs index b414aca..c65122a 100644 --- a/OpenSim/Services/HypergridService/UserAgentService.cs +++ b/OpenSim/Services/HypergridService/UserAgentService.cs | |||
@@ -75,6 +75,7 @@ namespace OpenSim.Services.HypergridService | |||
75 | protected static string m_GridName; | 75 | protected static string m_GridName; |
76 | 76 | ||
77 | protected static int m_LevelOutsideContacts; | 77 | protected static int m_LevelOutsideContacts; |
78 | protected static bool m_ShowDetails; | ||
78 | 79 | ||
79 | protected static bool m_BypassClientVerification; | 80 | protected static bool m_BypassClientVerification; |
80 | 81 | ||
@@ -128,6 +129,7 @@ namespace OpenSim.Services.HypergridService | |||
128 | m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(userAccountService, args); | 129 | m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(userAccountService, args); |
129 | 130 | ||
130 | m_LevelOutsideContacts = serverConfig.GetInt("LevelOutsideContacts", 0); | 131 | m_LevelOutsideContacts = serverConfig.GetInt("LevelOutsideContacts", 0); |
132 | m_ShowDetails = serverConfig.GetBoolean("ShowUserDetailsInHGProfile", true); | ||
131 | 133 | ||
132 | LoadTripPermissionsFromConfig(serverConfig, "ForeignTripsAllowed"); | 134 | LoadTripPermissionsFromConfig(serverConfig, "ForeignTripsAllowed"); |
133 | LoadDomainExceptionsFromConfig(serverConfig, "AllowExcept", m_TripsAllowedExceptions); | 135 | LoadDomainExceptionsFromConfig(serverConfig, "AllowExcept", m_TripsAllowedExceptions); |
@@ -215,7 +217,7 @@ namespace OpenSim.Services.HypergridService | |||
215 | return home; | 217 | return home; |
216 | } | 218 | } |
217 | 219 | ||
218 | public bool LoginAgentToGrid(AgentCircuitData agentCircuit, GridRegion gatekeeper, GridRegion finalDestination, bool fromLogin, out string reason) | 220 | public bool LoginAgentToGrid(GridRegion source, AgentCircuitData agentCircuit, GridRegion gatekeeper, GridRegion finalDestination, bool fromLogin, out string reason) |
219 | { | 221 | { |
220 | m_log.DebugFormat("[USER AGENT SERVICE]: Request to login user {0} {1} (@{2}) to grid {3}", | 222 | m_log.DebugFormat("[USER AGENT SERVICE]: Request to login user {0} {1} (@{2}) to grid {3}", |
221 | agentCircuit.firstname, agentCircuit.lastname, (fromLogin ? agentCircuit.IPAddress : "stored IP"), gatekeeper.ServerURI); | 223 | agentCircuit.firstname, agentCircuit.lastname, (fromLogin ? agentCircuit.IPAddress : "stored IP"), gatekeeper.ServerURI); |
@@ -274,13 +276,12 @@ namespace OpenSim.Services.HypergridService | |||
274 | m_log.DebugFormat("[USER AGENT SERVICE]: this grid: {0}, desired grid: {1}, desired region: {2}", m_GridName, gridName, region.RegionID); | 276 | m_log.DebugFormat("[USER AGENT SERVICE]: this grid: {0}, desired grid: {1}, desired region: {2}", m_GridName, gridName, region.RegionID); |
275 | 277 | ||
276 | if (m_GridName == gridName) | 278 | if (m_GridName == gridName) |
277 | success = m_GatekeeperService.LoginAgent(agentCircuit, finalDestination, out reason); | 279 | { |
280 | success = m_GatekeeperService.LoginAgent(source, agentCircuit, finalDestination, out reason); | ||
281 | } | ||
278 | else | 282 | else |
279 | { | 283 | { |
280 | success = m_GatekeeperConnector.CreateAgent(region, agentCircuit, (uint)Constants.TeleportFlags.ViaLogin, out myExternalIP, out reason); | 284 | success = m_GatekeeperConnector.CreateAgent(source, region, agentCircuit, (uint)Constants.TeleportFlags.ViaLogin, out myExternalIP, out reason); |
281 | if (success) | ||
282 | // Report them as nowhere | ||
283 | m_PresenceService.ReportAgent(agentCircuit.SessionID, UUID.Zero); | ||
284 | } | 285 | } |
285 | 286 | ||
286 | if (!success) | 287 | if (!success) |
@@ -307,10 +308,10 @@ namespace OpenSim.Services.HypergridService | |||
307 | return true; | 308 | return true; |
308 | } | 309 | } |
309 | 310 | ||
310 | public bool LoginAgentToGrid(AgentCircuitData agentCircuit, GridRegion gatekeeper, GridRegion finalDestination, out string reason) | 311 | public bool LoginAgentToGrid(GridRegion source, AgentCircuitData agentCircuit, GridRegion gatekeeper, GridRegion finalDestination, out string reason) |
311 | { | 312 | { |
312 | reason = string.Empty; | 313 | reason = string.Empty; |
313 | return LoginAgentToGrid(agentCircuit, gatekeeper, finalDestination, false, out reason); | 314 | return LoginAgentToGrid(source, agentCircuit, gatekeeper, finalDestination, false, out reason); |
314 | } | 315 | } |
315 | 316 | ||
316 | TravelingAgentInfo CreateTravelInfo(AgentCircuitData agentCircuit, GridRegion region, bool fromLogin, out TravelingAgentInfo existing) | 317 | TravelingAgentInfo CreateTravelInfo(AgentCircuitData agentCircuit, GridRegion region, bool fromLogin, out TravelingAgentInfo existing) |
@@ -572,10 +573,22 @@ namespace OpenSim.Services.HypergridService | |||
572 | 573 | ||
573 | if (account != null) | 574 | if (account != null) |
574 | { | 575 | { |
575 | info.Add("user_flags", (object)account.UserFlags); | 576 | info.Add("user_firstname", account.FirstName); |
576 | info.Add("user_created", (object)account.Created); | 577 | info.Add("user_lastname", account.LastName); |
577 | info.Add("user_title", (object)account.UserTitle); | ||
578 | info.Add("result", "success"); | 578 | info.Add("result", "success"); |
579 | |||
580 | if (m_ShowDetails) | ||
581 | { | ||
582 | info.Add("user_flags", account.UserFlags); | ||
583 | info.Add("user_created", account.Created); | ||
584 | info.Add("user_title", account.UserTitle); | ||
585 | } | ||
586 | else | ||
587 | { | ||
588 | info.Add("user_flags", 0); | ||
589 | info.Add("user_created", 0); | ||
590 | info.Add("user_title", string.Empty); | ||
591 | } | ||
579 | } | 592 | } |
580 | 593 | ||
581 | return info; | 594 | return info; |
diff --git a/OpenSim/Services/Interfaces/IAgentPreferencesService.cs b/OpenSim/Services/Interfaces/IAgentPreferencesService.cs new file mode 100644 index 0000000..3b4fda2 --- /dev/null +++ b/OpenSim/Services/Interfaces/IAgentPreferencesService.cs | |||
@@ -0,0 +1,115 @@ | |||
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 OpenMetaverse; | ||
31 | |||
32 | namespace OpenSim.Services.Interfaces | ||
33 | { | ||
34 | public class AgentPrefs | ||
35 | { | ||
36 | public AgentPrefs(UUID principalID) | ||
37 | { | ||
38 | PrincipalID = principalID; | ||
39 | } | ||
40 | |||
41 | public AgentPrefs(Dictionary<string, string> kvp) | ||
42 | { | ||
43 | if (kvp.ContainsKey("PrincipalID")) | ||
44 | UUID.TryParse(kvp["PrincipalID"], out PrincipalID); | ||
45 | if (kvp.ContainsKey("AccessPrefs")) | ||
46 | AccessPrefs = kvp["AccessPrefs"]; | ||
47 | if (kvp.ContainsKey("HoverHeight")) | ||
48 | HoverHeight = double.Parse(kvp["HoverHeight"]); | ||
49 | if (kvp.ContainsKey("Language")) | ||
50 | Language = kvp["Language"]; | ||
51 | if (kvp.ContainsKey("LanguageIsPublic")) | ||
52 | LanguageIsPublic = bool.Parse(kvp["LanguageIsPublic"]); | ||
53 | if (kvp.ContainsKey("PermEveryone")) | ||
54 | PermEveryone = int.Parse(kvp["PermEveryone"]); | ||
55 | if (kvp.ContainsKey("PermGroup")) | ||
56 | PermGroup = int.Parse(kvp["PermGroup"]); | ||
57 | if (kvp.ContainsKey("PermNextOwner")) | ||
58 | PermNextOwner = int.Parse(kvp["PermNextOwner"]); | ||
59 | } | ||
60 | |||
61 | public AgentPrefs(Dictionary<string, object> kvp) | ||
62 | { | ||
63 | if (kvp.ContainsKey("PrincipalID")) | ||
64 | UUID.TryParse(kvp["PrincipalID"].ToString(), out PrincipalID); | ||
65 | if (kvp.ContainsKey("AccessPrefs")) | ||
66 | AccessPrefs = kvp["AccessPrefs"].ToString(); | ||
67 | if (kvp.ContainsKey("HoverHeight")) | ||
68 | HoverHeight = double.Parse(kvp["HoverHeight"].ToString()); | ||
69 | if (kvp.ContainsKey("Language")) | ||
70 | Language = kvp["Language"].ToString(); | ||
71 | if (kvp.ContainsKey("LanguageIsPublic")) | ||
72 | LanguageIsPublic = bool.Parse(kvp["LanguageIsPublic"].ToString()); | ||
73 | if (kvp.ContainsKey("PermEveryone")) | ||
74 | PermEveryone = int.Parse(kvp["PermEveryone"].ToString()); | ||
75 | if (kvp.ContainsKey("PermGroup")) | ||
76 | PermGroup = int.Parse(kvp["PermGroup"].ToString()); | ||
77 | if (kvp.ContainsKey("PermNextOwner")) | ||
78 | PermNextOwner = int.Parse(kvp["PermNextOwner"].ToString()); | ||
79 | } | ||
80 | |||
81 | public Dictionary<string, object> ToKeyValuePairs() | ||
82 | { | ||
83 | Dictionary<string, object> result = new Dictionary<string, object>(); | ||
84 | result["PrincipalID"] = PrincipalID.ToString(); | ||
85 | result["AccessPrefs"] = AccessPrefs.ToString(); | ||
86 | result["HoverHeight"] = HoverHeight.ToString(); | ||
87 | result["Language"] = Language.ToString(); | ||
88 | result["LanguageIsPublic"] = LanguageIsPublic.ToString(); | ||
89 | result["PermEveryone"] = PermEveryone.ToString(); | ||
90 | result["PermGroup"] = PermGroup.ToString(); | ||
91 | result["PermNextOwner"] = PermNextOwner.ToString(); | ||
92 | return result; | ||
93 | } | ||
94 | |||
95 | public UUID PrincipalID = UUID.Zero; | ||
96 | public string AccessPrefs = "M"; | ||
97 | //public int GodLevel; // *TODO: Implement GodLevel (Unused by the viewer, afaict - 6/11/2015) | ||
98 | public double HoverHeight = 0.0; | ||
99 | public string Language = "en-us"; | ||
100 | public bool LanguageIsPublic = true; | ||
101 | // DefaultObjectPermMasks | ||
102 | public int PermEveryone = 0; | ||
103 | public int PermGroup = 0; | ||
104 | public int PermNextOwner = 532480; | ||
105 | } | ||
106 | |||
107 | public interface IAgentPreferencesService | ||
108 | { | ||
109 | AgentPrefs GetAgentPreferences(UUID principalID); | ||
110 | bool StoreAgentPreferences(AgentPrefs data); | ||
111 | |||
112 | string GetLang(UUID principalID); | ||
113 | } | ||
114 | } | ||
115 | |||
diff --git a/OpenSim/Services/Interfaces/IAssetService.cs b/OpenSim/Services/Interfaces/IAssetService.cs index 3c469c6..28c3315 100644 --- a/OpenSim/Services/Interfaces/IAssetService.cs +++ b/OpenSim/Services/Interfaces/IAssetService.cs | |||
@@ -75,6 +75,13 @@ namespace OpenSim.Services.Interfaces | |||
75 | /// </param> | 75 | /// </param> |
76 | /// <returns>True if the id was parseable, false otherwise</returns> | 76 | /// <returns>True if the id was parseable, false otherwise</returns> |
77 | bool Get(string id, Object sender, AssetRetrieved handler); | 77 | bool Get(string id, Object sender, AssetRetrieved handler); |
78 | |||
79 | /// <summary> | ||
80 | /// Check if assets exist in the database. | ||
81 | /// </summary> | ||
82 | /// <param name="ids">The assets' IDs</param> | ||
83 | /// <returns>For each asset: true if it exists, false otherwise</returns> | ||
84 | bool[] AssetsExist(string[] ids); | ||
78 | 85 | ||
79 | /// <summary> | 86 | /// <summary> |
80 | /// Creates a new asset | 87 | /// Creates a new asset |
@@ -83,7 +90,7 @@ namespace OpenSim.Services.Interfaces | |||
83 | /// Returns a random ID if none is passed via the asset argument. | 90 | /// Returns a random ID if none is passed via the asset argument. |
84 | /// </remarks> | 91 | /// </remarks> |
85 | /// <param name="asset"></param> | 92 | /// <param name="asset"></param> |
86 | /// <returns></returns> | 93 | /// <returns>The Asset ID, or string.Empty if an error occurred</returns> |
87 | string Store(AssetBase asset); | 94 | string Store(AssetBase asset); |
88 | 95 | ||
89 | /// <summary> | 96 | /// <summary> |
diff --git a/OpenSim/Services/Interfaces/IBakedTextureService.cs b/OpenSim/Services/Interfaces/IBakedTextureService.cs index 8206ecd..ab88695 100644 --- a/OpenSim/Services/Interfaces/IBakedTextureService.cs +++ b/OpenSim/Services/Interfaces/IBakedTextureService.cs | |||
@@ -1,9 +1,39 @@ | |||
1 | <<<<<<< HEAD | ||
2 | /* | ||
3 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
4 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
5 | * | ||
6 | * Redistribution and use in source and binary forms, with or without | ||
7 | * modification, are permitted provided that the following conditions are met: | ||
8 | * * Redistributions of source code must retain the above copyright | ||
9 | * notice, this list of conditions and the following disclaimer. | ||
10 | * * Redistributions in binary form must reproduce the above copyright | ||
11 | * notice, this list of conditions and the following disclaimer in the | ||
12 | * documentation and/or other materials provided with the distribution. | ||
13 | * * Neither the name of the OpenSimulator Project nor the | ||
14 | * names of its contributors may be used to endorse or promote products | ||
15 | * derived from this software without specific prior written permission. | ||
16 | * | ||
17 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
18 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
19 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
20 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
21 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
22 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
23 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
24 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
26 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
27 | */ | ||
28 | |||
29 | ======= | ||
1 | //////////////////////////////////////////////////////////////// | 30 | //////////////////////////////////////////////////////////////// |
2 | // | 31 | // |
3 | // (c) 2009, 2010 Careminster Limited and Melanie Thielker | 32 | // (c) 2009, 2010 Careminster Limited and Melanie Thielker |
4 | // | 33 | // |
5 | // All rights reserved | 34 | // All rights reserved |
6 | // | 35 | // |
36 | >>>>>>> avn/ubitvar | ||
7 | using System; | 37 | using System; |
8 | using Nini.Config; | 38 | using Nini.Config; |
9 | 39 | ||
diff --git a/OpenSim/Services/Interfaces/IEstateDataService.cs b/OpenSim/Services/Interfaces/IEstateDataService.cs new file mode 100644 index 0000000..719563d --- /dev/null +++ b/OpenSim/Services/Interfaces/IEstateDataService.cs | |||
@@ -0,0 +1,115 @@ | |||
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 OpenSim.Framework; | ||
31 | using OpenMetaverse; | ||
32 | |||
33 | namespace OpenSim.Services.Interfaces | ||
34 | { | ||
35 | public interface IEstateDataService | ||
36 | { | ||
37 | /// <summary> | ||
38 | /// Load estate settings for a region. | ||
39 | /// </summary> | ||
40 | /// <param name="regionID"></param> | ||
41 | /// <param name="create">If true, then an estate is created if one is not found.</param> | ||
42 | /// <returns></returns> | ||
43 | EstateSettings LoadEstateSettings(UUID regionID, bool create); | ||
44 | |||
45 | /// <summary> | ||
46 | /// Load estate settings for an estate ID. | ||
47 | /// </summary> | ||
48 | /// <param name="estateID"></param> | ||
49 | /// <returns></returns> | ||
50 | EstateSettings LoadEstateSettings(int estateID); | ||
51 | |||
52 | /// <summary> | ||
53 | /// Create a new estate. | ||
54 | /// </summary> | ||
55 | /// <returns> | ||
56 | /// A <see cref="EstateSettings"/> | ||
57 | /// </returns> | ||
58 | EstateSettings CreateNewEstate(); | ||
59 | |||
60 | /// <summary> | ||
61 | /// Load/Get all estate settings. | ||
62 | /// </summary> | ||
63 | /// <returns>An empty list if no estates were found.</returns> | ||
64 | List<EstateSettings> LoadEstateSettingsAll(); | ||
65 | |||
66 | /// <summary> | ||
67 | /// Store estate settings. | ||
68 | /// </summary> | ||
69 | /// <remarks> | ||
70 | /// This is also called by EstateSettings.Save()</remarks> | ||
71 | /// <param name="es"></param> | ||
72 | void StoreEstateSettings(EstateSettings es); | ||
73 | |||
74 | /// <summary> | ||
75 | /// Get estate IDs. | ||
76 | /// </summary> | ||
77 | /// <param name="search">Name of estate to search for. This is the exact name, no parttern matching is done.</param> | ||
78 | /// <returns></returns> | ||
79 | List<int> GetEstates(string search); | ||
80 | |||
81 | /// <summary> | ||
82 | /// Get the IDs of all estates owned by the given user. | ||
83 | /// </summary> | ||
84 | /// <returns>An empty list if no estates were found.</returns> | ||
85 | List<int> GetEstatesByOwner(UUID ownerID); | ||
86 | |||
87 | /// <summary> | ||
88 | /// Get the IDs of all estates. | ||
89 | /// </summary> | ||
90 | /// <returns>An empty list if no estates were found.</returns> | ||
91 | List<int> GetEstatesAll(); | ||
92 | |||
93 | /// <summary> | ||
94 | /// Link a region to an estate. | ||
95 | /// </summary> | ||
96 | /// <param name="regionID"></param> | ||
97 | /// <param name="estateID"></param> | ||
98 | /// <returns>true if the link succeeded, false otherwise</returns> | ||
99 | bool LinkRegion(UUID regionID, int estateID); | ||
100 | |||
101 | /// <summary> | ||
102 | /// Get the UUIDs of all the regions in an estate. | ||
103 | /// </summary> | ||
104 | /// <param name="estateID"></param> | ||
105 | /// <returns></returns> | ||
106 | List<UUID> GetRegions(int estateID); | ||
107 | |||
108 | /// <summary> | ||
109 | /// Delete an estate | ||
110 | /// </summary> | ||
111 | /// <param name="estateID"></param> | ||
112 | /// <returns>true if the delete succeeded, false otherwise</returns> | ||
113 | bool DeleteEstate(int estateID); | ||
114 | } | ||
115 | } \ No newline at end of file | ||
diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs index 1119e48..7e5597b 100644 --- a/OpenSim/Services/Interfaces/IGridService.cs +++ b/OpenSim/Services/Interfaces/IGridService.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections; | ||
29 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
30 | using System.Net; | 31 | using System.Net; |
31 | using System.Net.Sockets; | 32 | using System.Net.Sockets; |
@@ -119,22 +120,28 @@ namespace OpenSim.Services.Interfaces | |||
119 | /// <param name='scopeID'></param> | 120 | /// <param name='scopeID'></param> |
120 | /// <param name='regionID'></param> | 121 | /// <param name='regionID'></param> |
121 | int GetRegionFlags(UUID scopeID, UUID regionID); | 122 | int GetRegionFlags(UUID scopeID, UUID regionID); |
123 | |||
124 | Dictionary<string,object> GetExtraFeatures(); | ||
125 | } | ||
126 | |||
127 | public interface IHypergridLinker | ||
128 | { | ||
129 | GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, UUID ownerID, out string reason); | ||
130 | bool TryUnlinkRegion(string mapName); | ||
122 | } | 131 | } |
123 | 132 | ||
124 | public class GridRegion | 133 | public class GridRegion |
125 | { | 134 | { |
126 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 135 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
136 | |||
137 | #pragma warning disable 414 | ||
127 | private static readonly string LogHeader = "[GRID REGION]"; | 138 | private static readonly string LogHeader = "[GRID REGION]"; |
139 | #pragma warning restore 414 | ||
128 | 140 | ||
129 | /// <summary> | 141 | /// <summary> |
130 | /// The port by which http communication occurs with the region | 142 | /// The port by which http communication occurs with the region |
131 | /// </summary> | 143 | /// </summary> |
132 | public uint HttpPort | 144 | public uint HttpPort { get; set; } |
133 | { | ||
134 | get { return m_httpPort; } | ||
135 | set { m_httpPort = value; } | ||
136 | } | ||
137 | protected uint m_httpPort; | ||
138 | 145 | ||
139 | /// <summary> | 146 | /// <summary> |
140 | /// A well-formed URI for the host region server (namely "http://" + ExternalHostName) | 147 | /// A well-formed URI for the host region server (namely "http://" + ExternalHostName) |
@@ -142,16 +149,19 @@ namespace OpenSim.Services.Interfaces | |||
142 | public string ServerURI | 149 | public string ServerURI |
143 | { | 150 | { |
144 | get { | 151 | get { |
145 | if ( m_serverURI != string.Empty ) { | 152 | if (!String.IsNullOrEmpty(m_serverURI)) { |
146 | return m_serverURI; | 153 | return m_serverURI; |
147 | } else { | 154 | } else { |
148 | if (m_httpPort == 0) | 155 | if (HttpPort == 0) |
149 | return "http://" + m_externalHostName + "/"; | 156 | return "http://" + m_externalHostName + "/"; |
150 | else | 157 | else |
151 | return "http://" + m_externalHostName + ":" + m_httpPort + "/"; | 158 | return "http://" + m_externalHostName + ":" + HttpPort + "/"; |
152 | } | 159 | } |
153 | } | 160 | } |
154 | set { | 161 | set { |
162 | <<<<<<< HEAD | ||
163 | if (value.EndsWith("/")) { | ||
164 | ======= | ||
155 | if ( value == null) | 165 | if ( value == null) |
156 | { | 166 | { |
157 | m_serverURI = String.Empty; | 167 | m_serverURI = String.Empty; |
@@ -159,6 +169,7 @@ namespace OpenSim.Services.Interfaces | |||
159 | } | 169 | } |
160 | 170 | ||
161 | if ( value.EndsWith("/") ) { | 171 | if ( value.EndsWith("/") ) { |
172 | >>>>>>> avn/ubitvar | ||
162 | m_serverURI = value; | 173 | m_serverURI = value; |
163 | } else { | 174 | } else { |
164 | m_serverURI = value + '/'; | 175 | m_serverURI = value + '/'; |
@@ -167,6 +178,16 @@ namespace OpenSim.Services.Interfaces | |||
167 | } | 178 | } |
168 | protected string m_serverURI; | 179 | protected string m_serverURI; |
169 | 180 | ||
181 | /// <summary> | ||
182 | /// Provides direct access to the 'm_serverURI' field, without returning a generated URL if m_serverURI is missing. | ||
183 | /// </summary> | ||
184 | public string RawServerURI | ||
185 | { | ||
186 | get { return m_serverURI; } | ||
187 | set { m_serverURI = value; } | ||
188 | } | ||
189 | |||
190 | |||
170 | public string RegionName | 191 | public string RegionName |
171 | { | 192 | { |
172 | get { return m_regionName; } | 193 | get { return m_regionName; } |
@@ -174,6 +195,17 @@ namespace OpenSim.Services.Interfaces | |||
174 | } | 195 | } |
175 | protected string m_regionName = String.Empty; | 196 | protected string m_regionName = String.Empty; |
176 | 197 | ||
198 | /// <summary> | ||
199 | /// Region flags. | ||
200 | /// </summary> | ||
201 | /// <remarks> | ||
202 | /// If not set (chiefly if a robust service is running code pre OpenSim 0.8.1) then this will be null and | ||
203 | /// should be ignored. If you require flags information please use the separate IGridService.GetRegionFlags() call | ||
204 | /// XXX: This field is currently ignored when used in RegisterRegion, but could potentially be | ||
205 | /// used to set flags at this point. | ||
206 | /// </remarks> | ||
207 | public OpenSim.Framework.RegionFlags? RegionFlags { get; set; } | ||
208 | |||
177 | protected string m_externalHostName; | 209 | protected string m_externalHostName; |
178 | 210 | ||
179 | protected IPEndPoint m_internalEndPoint; | 211 | protected IPEndPoint m_internalEndPoint; |
@@ -280,7 +312,7 @@ namespace OpenSim.Services.Interfaces | |||
280 | RegionSizeY = (int)ConvertFrom.RegionSizeY; | 312 | RegionSizeY = (int)ConvertFrom.RegionSizeY; |
281 | m_internalEndPoint = ConvertFrom.InternalEndPoint; | 313 | m_internalEndPoint = ConvertFrom.InternalEndPoint; |
282 | m_externalHostName = ConvertFrom.ExternalHostName; | 314 | m_externalHostName = ConvertFrom.ExternalHostName; |
283 | m_httpPort = ConvertFrom.HttpPort; | 315 | HttpPort = ConvertFrom.HttpPort; |
284 | RegionID = ConvertFrom.RegionID; | 316 | RegionID = ConvertFrom.RegionID; |
285 | ServerURI = ConvertFrom.ServerURI; | 317 | ServerURI = ConvertFrom.ServerURI; |
286 | TerrainImage = ConvertFrom.RegionSettings.TerrainImageID; | 318 | TerrainImage = ConvertFrom.RegionSettings.TerrainImageID; |
@@ -294,13 +326,14 @@ namespace OpenSim.Services.Interfaces | |||
294 | public GridRegion(GridRegion ConvertFrom) | 326 | public GridRegion(GridRegion ConvertFrom) |
295 | { | 327 | { |
296 | m_regionName = ConvertFrom.RegionName; | 328 | m_regionName = ConvertFrom.RegionName; |
329 | RegionFlags = ConvertFrom.RegionFlags; | ||
297 | m_regionLocX = ConvertFrom.RegionLocX; | 330 | m_regionLocX = ConvertFrom.RegionLocX; |
298 | m_regionLocY = ConvertFrom.RegionLocY; | 331 | m_regionLocY = ConvertFrom.RegionLocY; |
299 | RegionSizeX = ConvertFrom.RegionSizeX; | 332 | RegionSizeX = ConvertFrom.RegionSizeX; |
300 | RegionSizeY = ConvertFrom.RegionSizeY; | 333 | RegionSizeY = ConvertFrom.RegionSizeY; |
301 | m_internalEndPoint = ConvertFrom.InternalEndPoint; | 334 | m_internalEndPoint = ConvertFrom.InternalEndPoint; |
302 | m_externalHostName = ConvertFrom.ExternalHostName; | 335 | m_externalHostName = ConvertFrom.ExternalHostName; |
303 | m_httpPort = ConvertFrom.HttpPort; | 336 | HttpPort = ConvertFrom.HttpPort; |
304 | RegionID = ConvertFrom.RegionID; | 337 | RegionID = ConvertFrom.RegionID; |
305 | ServerURI = ConvertFrom.ServerURI; | 338 | ServerURI = ConvertFrom.ServerURI; |
306 | TerrainImage = ConvertFrom.TerrainImage; | 339 | TerrainImage = ConvertFrom.TerrainImage; |
@@ -310,8 +343,112 @@ namespace OpenSim.Services.Interfaces | |||
310 | RegionSecret = ConvertFrom.RegionSecret; | 343 | RegionSecret = ConvertFrom.RegionSecret; |
311 | EstateOwner = ConvertFrom.EstateOwner; | 344 | EstateOwner = ConvertFrom.EstateOwner; |
312 | } | 345 | } |
346 | |||
347 | public GridRegion(Dictionary<string, object> kvp) | ||
348 | { | ||
349 | if (kvp.ContainsKey("uuid")) | ||
350 | RegionID = new UUID((string)kvp["uuid"]); | ||
351 | |||
352 | if (kvp.ContainsKey("locX")) | ||
353 | RegionLocX = Convert.ToInt32((string)kvp["locX"]); | ||
354 | |||
355 | if (kvp.ContainsKey("locY")) | ||
356 | RegionLocY = Convert.ToInt32((string)kvp["locY"]); | ||
357 | |||
358 | if (kvp.ContainsKey("sizeX")) | ||
359 | RegionSizeX = Convert.ToInt32((string)kvp["sizeX"]); | ||
360 | else | ||
361 | RegionSizeX = (int)Constants.RegionSize; | ||
362 | |||
363 | if (kvp.ContainsKey("sizeY")) | ||
364 | RegionSizeY = Convert.ToInt32((string)kvp["sizeY"]); | ||
365 | else | ||
366 | RegionSizeX = (int)Constants.RegionSize; | ||
367 | |||
368 | if (kvp.ContainsKey("regionName")) | ||
369 | RegionName = (string)kvp["regionName"]; | ||
370 | |||
371 | if (kvp.ContainsKey("flags") && kvp["flags"] != null) | ||
372 | RegionFlags = (OpenSim.Framework.RegionFlags?)Convert.ToInt32((string)kvp["flags"]); | ||
373 | |||
374 | if (kvp.ContainsKey("serverIP")) | ||
375 | { | ||
376 | //int port = 0; | ||
377 | //Int32.TryParse((string)kvp["serverPort"], out port); | ||
378 | //IPEndPoint ep = new IPEndPoint(IPAddress.Parse((string)kvp["serverIP"]), port); | ||
379 | ExternalHostName = (string)kvp["serverIP"]; | ||
380 | } | ||
381 | else | ||
382 | ExternalHostName = "127.0.0.1"; | ||
383 | |||
384 | if (kvp.ContainsKey("serverPort")) | ||
385 | { | ||
386 | Int32 port = 0; | ||
387 | Int32.TryParse((string)kvp["serverPort"], out port); | ||
388 | InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), port); | ||
389 | } | ||
390 | |||
391 | if (kvp.ContainsKey("serverHttpPort")) | ||
392 | { | ||
393 | UInt32 port = 0; | ||
394 | UInt32.TryParse((string)kvp["serverHttpPort"], out port); | ||
395 | HttpPort = port; | ||
396 | } | ||
397 | |||
398 | if (kvp.ContainsKey("serverURI")) | ||
399 | ServerURI = (string)kvp["serverURI"]; | ||
400 | |||
401 | if (kvp.ContainsKey("regionMapTexture")) | ||
402 | UUID.TryParse((string)kvp["regionMapTexture"], out TerrainImage); | ||
403 | |||
404 | if (kvp.ContainsKey("parcelMapTexture")) | ||
405 | UUID.TryParse((string)kvp["parcelMapTexture"], out ParcelImage); | ||
406 | |||
407 | if (kvp.ContainsKey("access")) | ||
408 | Access = Byte.Parse((string)kvp["access"]); | ||
409 | |||
410 | if (kvp.ContainsKey("regionSecret")) | ||
411 | RegionSecret =(string)kvp["regionSecret"]; | ||
412 | |||
413 | if (kvp.ContainsKey("owner_uuid")) | ||
414 | EstateOwner = new UUID(kvp["owner_uuid"].ToString()); | ||
415 | |||
416 | if (kvp.ContainsKey("Token")) | ||
417 | Token = kvp["Token"].ToString(); | ||
418 | |||
419 | // m_log.DebugFormat("{0} New GridRegion. id={1}, loc=<{2},{3}>, size=<{4},{5}>", | ||
420 | // LogHeader, RegionID, RegionLocX, RegionLocY, RegionSizeX, RegionSizeY); | ||
421 | } | ||
422 | |||
423 | public Dictionary<string, object> ToKeyValuePairs() | ||
424 | { | ||
425 | Dictionary<string, object> kvp = new Dictionary<string, object>(); | ||
426 | kvp["uuid"] = RegionID.ToString(); | ||
427 | kvp["locX"] = RegionLocX.ToString(); | ||
428 | kvp["locY"] = RegionLocY.ToString(); | ||
429 | kvp["sizeX"] = RegionSizeX.ToString(); | ||
430 | kvp["sizeY"] = RegionSizeY.ToString(); | ||
431 | kvp["regionName"] = RegionName; | ||
432 | |||
433 | if (RegionFlags != null) | ||
434 | kvp["flags"] = ((int)RegionFlags).ToString(); | ||
435 | |||
436 | kvp["serverIP"] = ExternalHostName; //ExternalEndPoint.Address.ToString(); | ||
437 | kvp["serverHttpPort"] = HttpPort.ToString(); | ||
438 | kvp["serverURI"] = ServerURI; | ||
439 | kvp["serverPort"] = InternalEndPoint.Port.ToString(); | ||
440 | kvp["regionMapTexture"] = TerrainImage.ToString(); | ||
441 | kvp["parcelMapTexture"] = ParcelImage.ToString(); | ||
442 | kvp["access"] = Access.ToString(); | ||
443 | kvp["regionSecret"] = RegionSecret; | ||
444 | kvp["owner_uuid"] = EstateOwner.ToString(); | ||
445 | kvp["Token"] = Token.ToString(); | ||
446 | // Maturity doesn't seem to exist in the DB | ||
447 | |||
448 | return kvp; | ||
449 | } | ||
313 | 450 | ||
314 | # region Definition of equality | 451 | #region Definition of equality |
315 | 452 | ||
316 | /// <summary> | 453 | /// <summary> |
317 | /// Define equality as two regions having the same, non-zero UUID. | 454 | /// Define equality as two regions having the same, non-zero UUID. |
@@ -402,6 +539,8 @@ namespace OpenSim.Services.Interfaces | |||
402 | { | 539 | { |
403 | get { return Util.UIntsToLong((uint)RegionLocX, (uint)RegionLocY); } | 540 | get { return Util.UIntsToLong((uint)RegionLocX, (uint)RegionLocY); } |
404 | } | 541 | } |
542 | <<<<<<< HEAD | ||
543 | ======= | ||
405 | 544 | ||
406 | public Dictionary<string, object> ToKeyValuePairs() | 545 | public Dictionary<string, object> ToKeyValuePairs() |
407 | { | 546 | { |
@@ -504,5 +643,6 @@ namespace OpenSim.Services.Interfaces | |||
504 | // m_log.DebugFormat("{0} New GridRegion. id={1}, loc=<{2},{3}>, size=<{4},{5}>", | 643 | // m_log.DebugFormat("{0} New GridRegion. id={1}, loc=<{2},{3}>, size=<{4},{5}>", |
505 | // LogHeader, RegionID, RegionLocX, RegionLocY, RegionSizeX, RegionSizeY); | 644 | // LogHeader, RegionID, RegionLocX, RegionLocY, RegionSizeX, RegionSizeY); |
506 | } | 645 | } |
646 | >>>>>>> avn/ubitvar | ||
507 | } | 647 | } |
508 | } | 648 | } |
diff --git a/OpenSim/Services/Interfaces/IHypergridServices.cs b/OpenSim/Services/Interfaces/IHypergridServices.cs index 05e175a..5e012fb 100644 --- a/OpenSim/Services/Interfaces/IHypergridServices.cs +++ b/OpenSim/Services/Interfaces/IHypergridServices.cs | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
@@ -37,25 +37,71 @@ namespace OpenSim.Services.Interfaces | |||
37 | public interface IGatekeeperService | 37 | public interface IGatekeeperService |
38 | { | 38 | { |
39 | bool LinkRegion(string regionDescriptor, out UUID regionID, out ulong regionHandle, out string externalName, out string imageURL, out string reason); | 39 | bool LinkRegion(string regionDescriptor, out UUID regionID, out ulong regionHandle, out string externalName, out string imageURL, out string reason); |
40 | GridRegion GetHyperlinkRegion(UUID regionID); | 40 | |
41 | /// <summary> | ||
42 | /// Returns the region a Hypergrid visitor should enter. | ||
43 | /// </summary> | ||
44 | /// <remarks> | ||
45 | /// Usually the returned region will be the requested region. But the grid can choose to | ||
46 | /// redirect the user to another region: e.g., a default gateway region. | ||
47 | /// </remarks> | ||
48 | /// <param name="regionID">The region the visitor *wants* to enter</param> | ||
49 | /// <param name="agentID">The visitor's User ID. Will be missing (UUID.Zero) in older OpenSims.</param> | ||
50 | /// <param name="agentHomeURI">The visitor's Home URI. Will be missing (null) in older OpenSims.</param> | ||
51 | /// <param name="message">[out] A message to show to the user (optional, may be null)</param> | ||
52 | /// <returns>The region the visitor should enter, or null if no region can be found / is allowed</returns> | ||
53 | GridRegion GetHyperlinkRegion(UUID regionID, UUID agentID, string agentHomeURI, out string message); | ||
41 | 54 | ||
42 | bool LoginAgent(AgentCircuitData aCircuit, GridRegion destination, out string reason); | 55 | bool LoginAgent(GridRegion source, AgentCircuitData aCircuit, GridRegion destination, out string reason); |
43 | 56 | ||
44 | } | 57 | } |
45 | 58 | ||
46 | public interface IUserAgentService | 59 | public interface IUserAgentService |
47 | { | 60 | { |
48 | bool LoginAgentToGrid(AgentCircuitData agent, GridRegion gatekeeper, GridRegion finalDestination, bool fromLogin, out string reason); | 61 | bool LoginAgentToGrid(GridRegion source, AgentCircuitData agent, GridRegion gatekeeper, GridRegion finalDestination, bool fromLogin, out string reason); |
62 | |||
49 | void LogoutAgent(UUID userID, UUID sessionID); | 63 | void LogoutAgent(UUID userID, UUID sessionID); |
64 | |||
65 | /// <summary> | ||
66 | /// Returns the home region of a remote user. | ||
67 | /// </summary> | ||
68 | /// <returns>On success: the user's home region. If the user doesn't exist: null.</returns> | ||
69 | /// <remarks>Throws an exception if an error occurs (e.g., can't contact the server).</remarks> | ||
50 | GridRegion GetHomeRegion(UUID userID, out Vector3 position, out Vector3 lookAt); | 70 | GridRegion GetHomeRegion(UUID userID, out Vector3 position, out Vector3 lookAt); |
71 | |||
72 | /// <summary> | ||
73 | /// Returns the Server URLs of a remote user. | ||
74 | /// </summary> | ||
75 | /// <returns>On success: the user's Server URLs. If the user doesn't exist: an empty dictionary.</returns> | ||
76 | /// <remarks>Throws an exception if an error occurs (e.g., can't contact the server).</remarks> | ||
51 | Dictionary<string, object> GetServerURLs(UUID userID); | 77 | Dictionary<string, object> GetServerURLs(UUID userID); |
52 | Dictionary<string,object> GetUserInfo(UUID userID); | ||
53 | 78 | ||
79 | /// <summary> | ||
80 | /// Returns the UserInfo of a remote user. | ||
81 | /// </summary> | ||
82 | /// <returns>On success: the user's UserInfo. If the user doesn't exist: an empty dictionary.</returns> | ||
83 | /// <remarks>Throws an exception if an error occurs (e.g., can't contact the server).</remarks> | ||
84 | Dictionary<string, object> GetUserInfo(UUID userID); | ||
85 | |||
86 | /// <summary> | ||
87 | /// Returns the current location of a remote user. | ||
88 | /// </summary> | ||
89 | /// <returns>On success: the user's Server URLs. If the user doesn't exist: "".</returns> | ||
90 | /// <remarks>Throws an exception if an error occurs (e.g., can't contact the server).</remarks> | ||
54 | string LocateUser(UUID userID); | 91 | string LocateUser(UUID userID); |
55 | // Tries to get the universal user identifier for the targetUserId | 92 | |
56 | // on behalf of the userID | 93 | /// <summary> |
94 | /// Returns the Universal User Identifier for 'targetUserID' on behalf of 'userID'. | ||
95 | /// </summary> | ||
96 | /// <returns>On success: the user's UUI. If the user doesn't exist: "".</returns> | ||
97 | /// <remarks>Throws an exception if an error occurs (e.g., can't contact the server).</remarks> | ||
57 | string GetUUI(UUID userID, UUID targetUserID); | 98 | string GetUUI(UUID userID, UUID targetUserID); |
58 | 99 | ||
100 | /// <summary> | ||
101 | /// Returns the remote user that has the given name. | ||
102 | /// </summary> | ||
103 | /// <returns>On success: the user's UUID. If the user doesn't exist: UUID.Zero.</returns> | ||
104 | /// <remarks>Throws an exception if an error occurs (e.g., can't contact the server).</remarks> | ||
59 | UUID GetUUID(String first, String last); | 105 | UUID GetUUID(String first, String last); |
60 | 106 | ||
61 | // Returns the local friends online | 107 | // Returns the local friends online |
diff --git a/OpenSim/Services/Interfaces/IInventoryService.cs b/OpenSim/Services/Interfaces/IInventoryService.cs index a8bfe47..4289bba 100644 --- a/OpenSim/Services/Interfaces/IInventoryService.cs +++ b/OpenSim/Services/Interfaces/IInventoryService.cs | |||
@@ -55,23 +55,6 @@ namespace OpenSim.Services.Interfaces | |||
55 | List<InventoryFolderBase> GetInventorySkeleton(UUID userId); | 55 | List<InventoryFolderBase> GetInventorySkeleton(UUID userId); |
56 | 56 | ||
57 | /// <summary> | 57 | /// <summary> |
58 | /// Synchronous inventory fetch. | ||
59 | /// </summary> | ||
60 | /// <param name="userID"></param> | ||
61 | /// <returns></returns> | ||
62 | [Obsolete] | ||
63 | InventoryCollection GetUserInventory(UUID userID); | ||
64 | |||
65 | /// <summary> | ||
66 | /// Request the inventory for a user. This is an asynchronous operation that will call the callback when the | ||
67 | /// inventory has been received | ||
68 | /// </summary> | ||
69 | /// <param name="userID"></param> | ||
70 | /// <param name="callback"></param> | ||
71 | [Obsolete] | ||
72 | void GetUserInventory(UUID userID, InventoryReceiptCallback callback); | ||
73 | |||
74 | /// <summary> | ||
75 | /// Retrieve the root inventory folder for the given user. | 58 | /// Retrieve the root inventory folder for the given user. |
76 | /// </summary> | 59 | /// </summary> |
77 | /// <param name="userID"></param> | 60 | /// <param name="userID"></param> |
@@ -84,15 +67,23 @@ namespace OpenSim.Services.Interfaces | |||
84 | /// <param name="userID"></param> | 67 | /// <param name="userID"></param> |
85 | /// <param name="type"></param> | 68 | /// <param name="type"></param> |
86 | /// <returns></returns> | 69 | /// <returns></returns> |
87 | InventoryFolderBase GetFolderForType(UUID userID, AssetType type); | 70 | InventoryFolderBase GetFolderForType(UUID userID, FolderType type); |
88 | 71 | ||
89 | /// <summary> | 72 | /// <summary> |
90 | /// Gets everything (folders and items) inside a folder | 73 | /// Gets everything (folders and items) inside a folder |
91 | /// </summary> | 74 | /// </summary> |
92 | /// <param name="userId"></param> | 75 | /// <param name="userId"></param> |
93 | /// <param name="folderID"></param> | 76 | /// <param name="folderID"></param> |
94 | /// <returns></returns> | 77 | /// <returns>Inventory content. null if the request failed.</returns> |
95 | InventoryCollection GetFolderContent(UUID userID, UUID folderID); | 78 | InventoryCollection GetFolderContent(UUID userID, UUID folderID); |
79 | |||
80 | /// <summary> | ||
81 | /// Gets everything (folders and items) inside a folder | ||
82 | /// </summary> | ||
83 | /// <param name="userId"></param> | ||
84 | /// <param name="folderIDs"></param> | ||
85 | /// <returns>Inventory content.</returns> | ||
86 | InventoryCollection[] GetMultipleFoldersContent(UUID userID, UUID[] folderIDs); | ||
96 | 87 | ||
97 | /// <summary> | 88 | /// <summary> |
98 | /// Gets the items inside a folder | 89 | /// Gets the items inside a folder |
@@ -173,6 +164,13 @@ namespace OpenSim.Services.Interfaces | |||
173 | InventoryItemBase GetItem(InventoryItemBase item); | 164 | InventoryItemBase GetItem(InventoryItemBase item); |
174 | 165 | ||
175 | /// <summary> | 166 | /// <summary> |
167 | /// Get multiple items, given by their UUIDs | ||
168 | /// </summary> | ||
169 | /// <param name="item"></param> | ||
170 | /// <returns>null if no item was found, otherwise the found item</returns> | ||
171 | InventoryItemBase[] GetMultipleItems(UUID userID, UUID[] ids); | ||
172 | |||
173 | /// <summary> | ||
176 | /// Get a folder, given by its UUID | 174 | /// Get a folder, given by its UUID |
177 | /// </summary> | 175 | /// </summary> |
178 | /// <param name="folder"></param> | 176 | /// <param name="folder"></param> |
diff --git a/OpenSim/Services/Interfaces/IMapImageService.cs b/OpenSim/Services/Interfaces/IMapImageService.cs index b8d45dd..0d1458e 100644 --- a/OpenSim/Services/Interfaces/IMapImageService.cs +++ b/OpenSim/Services/Interfaces/IMapImageService.cs | |||
@@ -34,8 +34,14 @@ namespace OpenSim.Services.Interfaces | |||
34 | public interface IMapImageService | 34 | public interface IMapImageService |
35 | { | 35 | { |
36 | //List<MapBlockData> GetMapBlocks(UUID scopeID, int minX, int minY, int maxX, int maxY); | 36 | //List<MapBlockData> GetMapBlocks(UUID scopeID, int minX, int minY, int maxX, int maxY); |
37 | <<<<<<< HEAD | ||
38 | bool AddMapTile(int x, int y, byte[] imageData, out string reason); | ||
39 | bool RemoveMapTile(int x, int y, out string reason); | ||
40 | byte[] GetMapTile(string fileName, out string format); | ||
41 | ======= | ||
37 | bool AddMapTile(int x, int y, byte[] imageData, UUID scopeID, out string reason); | 42 | bool AddMapTile(int x, int y, byte[] imageData, UUID scopeID, out string reason); |
38 | bool RemoveMapTile(int x, int y, UUID scopeID, out string reason); | 43 | bool RemoveMapTile(int x, int y, UUID scopeID, out string reason); |
39 | byte[] GetMapTile(string fileName, UUID scopeID, out string format); | 44 | byte[] GetMapTile(string fileName, UUID scopeID, out string format); |
45 | >>>>>>> avn/ubitvar | ||
40 | } | 46 | } |
41 | } | 47 | } |
diff --git a/OpenSim/Services/Interfaces/ISimulationService.cs b/OpenSim/Services/Interfaces/ISimulationService.cs index b629177..ee1e294 100644 --- a/OpenSim/Services/Interfaces/ISimulationService.cs +++ b/OpenSim/Services/Interfaces/ISimulationService.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | ||
29 | using OpenSim.Framework; | 30 | using OpenSim.Framework; |
30 | using OpenMetaverse; | 31 | using OpenMetaverse; |
31 | 32 | ||
@@ -53,11 +54,13 @@ namespace OpenSim.Services.Interfaces | |||
53 | /// <summary> | 54 | /// <summary> |
54 | /// Ask the simulator hosting the destination to create an agent on that region. | 55 | /// Ask the simulator hosting the destination to create an agent on that region. |
55 | /// </summary> | 56 | /// </summary> |
57 | /// <param name="source">The region that the user is coming from. Will be null if the user | ||
58 | /// logged-in directly, or arrived from a simulator that doesn't send this parameter.</param> | ||
56 | /// <param name="destination"></param> | 59 | /// <param name="destination"></param> |
57 | /// <param name="aCircuit"></param> | 60 | /// <param name="aCircuit"></param> |
58 | /// <param name="flags"></param> | 61 | /// <param name="flags"></param> |
59 | /// <param name="reason">Reason message in the event of a failure.</param> | 62 | /// <param name="reason">Reason message in the event of a failure.</param> |
60 | bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint flags, out string reason); | 63 | bool CreateAgent(GridRegion source, GridRegion destination, AgentCircuitData aCircuit, uint flags, out string reason); |
61 | 64 | ||
62 | /// <summary> | 65 | /// <summary> |
63 | /// Full child agent update. | 66 | /// Full child agent update. |
@@ -83,11 +86,21 @@ namespace OpenSim.Services.Interfaces | |||
83 | /// <param name="agentHomeURI">The visitor's Home URI. Will be missing (null) in older OpenSims.</param> | 86 | /// <param name="agentHomeURI">The visitor's Home URI. Will be missing (null) in older OpenSims.</param> |
84 | /// <param name="viaTeleport">True: via teleport; False: via cross (walking)</param> | 87 | /// <param name="viaTeleport">True: via teleport; False: via cross (walking)</param> |
85 | /// <param name="position">Position in the region</param> | 88 | /// <param name="position">Position in the region</param> |
89 | <<<<<<< HEAD | ||
90 | /// <param name="sversion"> | ||
91 | /// Version that the requesting simulator is runing. If null then no version check is carried out. | ||
92 | /// </param> | ||
93 | /// <param name="version">Version that the target simulator is running</param> | ||
94 | /// <param name="reason">[out] Optional error message</param> | ||
95 | /// <returns>True: ok; False: not allowed</returns> | ||
96 | bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, string sversion, List<UUID> features, out string version, out string reason); | ||
97 | ======= | ||
86 | /// <param name="sversion">version that the requesting simulator is runing</param> | 98 | /// <param name="sversion">version that the requesting simulator is runing</param> |
87 | /// <param name="version">version that the target simulator is running</param> | 99 | /// <param name="version">version that the target simulator is running</param> |
88 | /// <param name="reason">[out] Optional error message</param> | 100 | /// <param name="reason">[out] Optional error message</param> |
89 | /// <returns>True: ok; False: not allowed</returns> | 101 | /// <returns>True: ok; False: not allowed</returns> |
90 | bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, string sversion, out string version, out string reason); | 102 | bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, string sversion, out string version, out string reason); |
103 | >>>>>>> avn/ubitvar | ||
91 | 104 | ||
92 | /// <summary> | 105 | /// <summary> |
93 | /// Message from receiving region to departing region, telling it got contacted by the client. | 106 | /// Message from receiving region to departing region, telling it got contacted by the client. |
diff --git a/OpenSim/Services/Interfaces/IUserAccountService.cs b/OpenSim/Services/Interfaces/IUserAccountService.cs index 6d5d2a0..1814699 100644 --- a/OpenSim/Services/Interfaces/IUserAccountService.cs +++ b/OpenSim/Services/Interfaces/IUserAccountService.cs | |||
@@ -194,5 +194,7 @@ namespace OpenSim.Services.Interfaces | |||
194 | /// <param name="data"></param> | 194 | /// <param name="data"></param> |
195 | /// <returns></returns> | 195 | /// <returns></returns> |
196 | bool StoreUserAccount(UserAccount data); | 196 | bool StoreUserAccount(UserAccount data); |
197 | |||
198 | void InvalidateCache(UUID userID); | ||
197 | } | 199 | } |
198 | } | 200 | } |
diff --git a/OpenSim/Services/Interfaces/IUserManagement.cs b/OpenSim/Services/Interfaces/IUserManagement.cs new file mode 100644 index 0000000..9e560d5 --- /dev/null +++ b/OpenSim/Services/Interfaces/IUserManagement.cs | |||
@@ -0,0 +1,97 @@ | |||
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 | |||
31 | using OpenMetaverse; | ||
32 | |||
33 | namespace OpenSim.Services.Interfaces | ||
34 | { | ||
35 | /// <summary> | ||
36 | /// This maintains the relationship between a UUID and a user name. | ||
37 | /// </summary> | ||
38 | public interface IUserManagement | ||
39 | { | ||
40 | string GetUserName(UUID uuid); | ||
41 | string GetUserHomeURL(UUID uuid); | ||
42 | string GetUserUUI(UUID uuid); | ||
43 | bool GetUserUUI(UUID userID, out string uui); | ||
44 | string GetUserServerURL(UUID uuid, string serverType); | ||
45 | |||
46 | /// <summary> | ||
47 | /// Get user ID by the given name. | ||
48 | /// </summary> | ||
49 | /// <param name="name"></param> | ||
50 | /// <returns>UUID.Zero if no user with that name is found or if the name is "Unknown User"</returns> | ||
51 | UUID GetUserIdByName(string name); | ||
52 | |||
53 | /// <summary> | ||
54 | /// Get user ID by the given name. | ||
55 | /// </summary> | ||
56 | /// <param name="firstName"></param> | ||
57 | /// <param name="lastName"></param> | ||
58 | /// <returns>UUID.Zero if no user with that name is found or if the name is "Unknown User"</returns> | ||
59 | UUID GetUserIdByName(string firstName, string lastName); | ||
60 | |||
61 | /// <summary> | ||
62 | /// Add a user. | ||
63 | /// </summary> | ||
64 | /// <remarks> | ||
65 | /// If an account is found for the UUID, then the names in this will be used rather than any information | ||
66 | /// extracted from creatorData. | ||
67 | /// </remarks> | ||
68 | /// <param name="uuid"></param> | ||
69 | /// <param name="creatorData">The creator data for this user.</param> | ||
70 | void AddUser(UUID uuid, string creatorData); | ||
71 | |||
72 | /// <summary> | ||
73 | /// Add a user. | ||
74 | /// </summary> | ||
75 | /// <remarks> | ||
76 | /// The UUID is related to the name without any other checks being performed, such as user account presence. | ||
77 | /// </remarks> | ||
78 | /// <param name="uuid"></param> | ||
79 | /// <param name="firstName"></param> | ||
80 | /// <param name="lastName"></param> | ||
81 | void AddUser(UUID uuid, string firstName, string lastName); | ||
82 | |||
83 | /// <summary> | ||
84 | /// Add a user. | ||
85 | /// </summary> | ||
86 | /// <remarks> | ||
87 | /// The arguments apart from uuid are formed into a creatorData string and processing proceeds as for the | ||
88 | /// AddUser(UUID uuid, string creatorData) method. | ||
89 | /// </remarks> | ||
90 | /// <param name="uuid"></param> | ||
91 | /// <param name="firstName"></param> | ||
92 | /// <param name="profileURL"></param> | ||
93 | void AddUser(UUID uuid, string firstName, string lastName, string homeURL); | ||
94 | |||
95 | bool IsLocalGridUser(UUID uuid); | ||
96 | } | ||
97 | } | ||
diff --git a/OpenSim/Services/Interfaces/OpenProfileClient.cs b/OpenSim/Services/Interfaces/OpenProfileClient.cs new file mode 100644 index 0000000..bda8151 --- /dev/null +++ b/OpenSim/Services/Interfaces/OpenProfileClient.cs | |||
@@ -0,0 +1,134 @@ | |||
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; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Net; | ||
32 | using System.Net.Sockets; | ||
33 | using System.Reflection; | ||
34 | using System.Text; | ||
35 | using System.Xml; | ||
36 | using log4net; | ||
37 | using OpenMetaverse; | ||
38 | using OpenSim.Framework; | ||
39 | |||
40 | namespace OpenSim.Services.UserProfilesService | ||
41 | { | ||
42 | /// <summary> | ||
43 | /// A client for accessing a profile server using the OpenProfile protocol. | ||
44 | /// </summary> | ||
45 | /// <remarks> | ||
46 | /// This class was adapted from the full OpenProfile class. Since it's only a client, and not a server, | ||
47 | /// it's much simpler. | ||
48 | /// </remarks> | ||
49 | public class OpenProfileClient | ||
50 | { | ||
51 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
52 | |||
53 | private string m_serverURI; | ||
54 | |||
55 | /// <summary> | ||
56 | /// Creates a client for accessing a foreign grid's profile server using the OpenProfile protocol. | ||
57 | /// </summary> | ||
58 | /// <param name="serverURI">The grid's profile server URL</param> | ||
59 | public OpenProfileClient(string serverURI) | ||
60 | { | ||
61 | m_serverURI = serverURI; | ||
62 | } | ||
63 | |||
64 | /// <summary> | ||
65 | /// Gets an avatar's profile using the OpenProfile protocol. | ||
66 | /// </summary> | ||
67 | /// <param name="props">On success, this will contain the avatar's profile</param> | ||
68 | /// <returns>Success/failure</returns> | ||
69 | /// <remarks> | ||
70 | /// There are two profile modules currently in use in OpenSim: the older one is OpenProfile, and the newer | ||
71 | /// one is UserProfileModule (this file). This method attempts to read an avatar's profile from a foreign | ||
72 | /// grid using the OpenProfile protocol. | ||
73 | /// </remarks> | ||
74 | public bool RequestAvatarPropertiesUsingOpenProfile(ref UserProfileProperties props) | ||
75 | { | ||
76 | Hashtable ReqHash = new Hashtable(); | ||
77 | ReqHash["avatar_id"] = props.UserId.ToString(); | ||
78 | |||
79 | Hashtable profileData = XMLRPCRequester.SendRequest(ReqHash, "avatar_properties_request", m_serverURI); | ||
80 | |||
81 | if (profileData == null) | ||
82 | return false; | ||
83 | if (!profileData.ContainsKey("data")) | ||
84 | return false; | ||
85 | |||
86 | ArrayList dataArray = (ArrayList)profileData["data"]; | ||
87 | |||
88 | if (dataArray == null || dataArray[0] == null) | ||
89 | return false; | ||
90 | profileData = (Hashtable)dataArray[0]; | ||
91 | |||
92 | props.WebUrl = string.Empty; | ||
93 | props.AboutText = String.Empty; | ||
94 | props.FirstLifeText = String.Empty; | ||
95 | props.ImageId = UUID.Zero; | ||
96 | props.FirstLifeImageId = UUID.Zero; | ||
97 | props.PartnerId = UUID.Zero; | ||
98 | |||
99 | if (profileData["ProfileUrl"] != null) | ||
100 | props.WebUrl = profileData["ProfileUrl"].ToString(); | ||
101 | if (profileData["AboutText"] != null) | ||
102 | props.AboutText = profileData["AboutText"].ToString(); | ||
103 | if (profileData["FirstLifeAboutText"] != null) | ||
104 | props.FirstLifeText = profileData["FirstLifeAboutText"].ToString(); | ||
105 | if (profileData["Image"] != null) | ||
106 | props.ImageId = new UUID(profileData["Image"].ToString()); | ||
107 | if (profileData["FirstLifeImage"] != null) | ||
108 | props.FirstLifeImageId = new UUID(profileData["FirstLifeImage"].ToString()); | ||
109 | if (profileData["Partner"] != null) | ||
110 | props.PartnerId = new UUID(profileData["Partner"].ToString()); | ||
111 | |||
112 | props.WantToMask = 0; | ||
113 | props.WantToText = String.Empty; | ||
114 | props.SkillsMask = 0; | ||
115 | props.SkillsText = String.Empty; | ||
116 | props.Language = String.Empty; | ||
117 | |||
118 | if (profileData["wantmask"] != null) | ||
119 | props.WantToMask = Convert.ToInt32(profileData["wantmask"].ToString()); | ||
120 | if (profileData["wanttext"] != null) | ||
121 | props.WantToText = profileData["wanttext"].ToString(); | ||
122 | |||
123 | if (profileData["skillsmask"] != null) | ||
124 | props.SkillsMask = Convert.ToInt32(profileData["skillsmask"].ToString()); | ||
125 | if (profileData["skillstext"] != null) | ||
126 | props.SkillsText = profileData["skillstext"].ToString(); | ||
127 | |||
128 | if (profileData["languages"] != null) | ||
129 | props.Language = profileData["languages"].ToString(); | ||
130 | |||
131 | return true; | ||
132 | } | ||
133 | } | ||
134 | } \ No newline at end of file | ||
diff --git a/OpenSim/Services/Interfaces/Properties/AssemblyInfo.cs b/OpenSim/Services/Interfaces/Properties/AssemblyInfo.cs index f7c8cc1..a2f6c4f 100644 --- a/OpenSim/Services/Interfaces/Properties/AssemblyInfo.cs +++ b/OpenSim/Services/Interfaces/Properties/AssemblyInfo.cs | |||
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices; | |||
29 | // Build Number | 29 | // Build Number |
30 | // Revision | 30 | // Revision |
31 | // | 31 | // |
32 | [assembly: AssemblyVersion("0.8.0.*")] | 32 | [assembly: AssemblyVersion("0.8.2.*")] |
33 | 33 | ||
diff --git a/OpenSim/Services/InventoryService/Properties/AssemblyInfo.cs b/OpenSim/Services/InventoryService/Properties/AssemblyInfo.cs index fd8707b..6a1187c 100644 --- a/OpenSim/Services/InventoryService/Properties/AssemblyInfo.cs +++ b/OpenSim/Services/InventoryService/Properties/AssemblyInfo.cs | |||
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices; | |||
29 | // Build Number | 29 | // Build Number |
30 | // Revision | 30 | // Revision |
31 | // | 31 | // |
32 | [assembly: AssemblyVersion("0.8.0.*")] | 32 | [assembly: AssemblyVersion("0.8.2.*")] |
33 | 33 | ||
diff --git a/OpenSim/Services/InventoryService/XInventoryService.cs b/OpenSim/Services/InventoryService/XInventoryService.cs index 7bad4b0..b75193f 100644 --- a/OpenSim/Services/InventoryService/XInventoryService.cs +++ b/OpenSim/Services/InventoryService/XInventoryService.cs | |||
@@ -111,40 +111,48 @@ namespace OpenSim.Services.InventoryService | |||
111 | 111 | ||
112 | if (rootFolder == null) | 112 | if (rootFolder == null) |
113 | { | 113 | { |
114 | rootFolder = ConvertToOpenSim(CreateFolder(principalID, UUID.Zero, (int)AssetType.RootFolder, "My Inventory")); | 114 | rootFolder = ConvertToOpenSim(CreateFolder(principalID, UUID.Zero, (int)FolderType.Root, InventoryFolderBase.ROOT_FOLDER_NAME)); |
115 | result = true; | 115 | result = true; |
116 | } | 116 | } |
117 | 117 | ||
118 | XInventoryFolder[] sysFolders = GetSystemFolders(principalID, rootFolder.ID); | 118 | XInventoryFolder[] sysFolders = GetSystemFolders(principalID, rootFolder.ID); |
119 | 119 | ||
120 | if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.Animation) return true; return false; })) | 120 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.Animation) return true; return false; })) |
121 | CreateFolder(principalID, rootFolder.ID, (int)AssetType.Animation, "Animations"); | 121 | CreateFolder(principalID, rootFolder.ID, (int)FolderType.Animation, "Animations"); |
122 | if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.Bodypart) return true; return false; })) | 122 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.BodyPart) return true; return false; })) |
123 | CreateFolder(principalID, rootFolder.ID, (int)AssetType.Bodypart, "Body Parts"); | 123 | CreateFolder(principalID, rootFolder.ID, (int)FolderType.BodyPart, "Body Parts"); |
124 | if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.CallingCard) return true; return false; })) | 124 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.CallingCard) return true; return false; })) |
125 | CreateFolder(principalID, rootFolder.ID, (int)AssetType.CallingCard, "Calling Cards"); | 125 | { |
126 | if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.Clothing) return true; return false; })) | 126 | XInventoryFolder folder = CreateFolder(principalID, rootFolder.ID, (int)FolderType.CallingCard, "Calling Cards"); |
127 | CreateFolder(principalID, rootFolder.ID, (int)AssetType.Clothing, "Clothing"); | 127 | folder = CreateFolder(principalID, folder.folderID, (int)FolderType.CallingCard, "Friends"); |
128 | if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.Gesture) return true; return false; })) | 128 | CreateFolder(principalID, folder.folderID, (int)FolderType.CallingCard, "All"); |
129 | CreateFolder(principalID, rootFolder.ID, (int)AssetType.Gesture, "Gestures"); | 129 | } |
130 | if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.Landmark) return true; return false; })) | 130 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.Clothing) return true; return false; })) |
131 | CreateFolder(principalID, rootFolder.ID, (int)AssetType.Landmark, "Landmarks"); | 131 | CreateFolder(principalID, rootFolder.ID, (int)FolderType.Clothing, "Clothing"); |
132 | if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.LostAndFoundFolder) return true; return false; })) | 132 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.CurrentOutfit) return true; return false; })) |
133 | CreateFolder(principalID, rootFolder.ID, (int)AssetType.LostAndFoundFolder, "Lost And Found"); | 133 | CreateFolder(principalID, rootFolder.ID, (int)FolderType.CurrentOutfit, "Current Outfit"); |
134 | if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.Notecard) return true; return false; })) | 134 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.Favorites) return true; return false; })) |
135 | CreateFolder(principalID, rootFolder.ID, (int)AssetType.Notecard, "Notecards"); | 135 | CreateFolder(principalID, rootFolder.ID, (int)FolderType.Favorites, "Favorites"); |
136 | if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.Object) return true; return false; })) | 136 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.Gesture) return true; return false; })) |
137 | CreateFolder(principalID, rootFolder.ID, (int)AssetType.Object, "Objects"); | 137 | CreateFolder(principalID, rootFolder.ID, (int)FolderType.Gesture, "Gestures"); |
138 | if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.SnapshotFolder) return true; return false; })) | 138 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.Landmark) return true; return false; })) |
139 | CreateFolder(principalID, rootFolder.ID, (int)AssetType.SnapshotFolder, "Photo Album"); | 139 | CreateFolder(principalID, rootFolder.ID, (int)FolderType.Landmark, "Landmarks"); |
140 | if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.LSLText) return true; return false; })) | 140 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.LostAndFound) return true; return false; })) |
141 | CreateFolder(principalID, rootFolder.ID, (int)AssetType.LSLText, "Scripts"); | 141 | CreateFolder(principalID, rootFolder.ID, (int)FolderType.LostAndFound, "Lost And Found"); |
142 | if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.Sound) return true; return false; })) | 142 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.Notecard) return true; return false; })) |
143 | CreateFolder(principalID, rootFolder.ID, (int)AssetType.Sound, "Sounds"); | 143 | CreateFolder(principalID, rootFolder.ID, (int)FolderType.Notecard, "Notecards"); |
144 | if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.Texture) return true; return false; })) | 144 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.Object) return true; return false; })) |
145 | CreateFolder(principalID, rootFolder.ID, (int)AssetType.Texture, "Textures"); | 145 | CreateFolder(principalID, rootFolder.ID, (int)FolderType.Object, "Objects"); |
146 | if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.TrashFolder) return true; return false; })) | 146 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.Snapshot) return true; return false; })) |
147 | CreateFolder(principalID, rootFolder.ID, (int)AssetType.TrashFolder, "Trash"); | 147 | CreateFolder(principalID, rootFolder.ID, (int)FolderType.Snapshot, "Photo Album"); |
148 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.LSLText) return true; return false; })) | ||
149 | CreateFolder(principalID, rootFolder.ID, (int)FolderType.LSLText, "Scripts"); | ||
150 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.Sound) return true; return false; })) | ||
151 | CreateFolder(principalID, rootFolder.ID, (int)FolderType.Sound, "Sounds"); | ||
152 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.Texture) return true; return false; })) | ||
153 | CreateFolder(principalID, rootFolder.ID, (int)FolderType.Texture, "Textures"); | ||
154 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.Trash) return true; return false; })) | ||
155 | CreateFolder(principalID, rootFolder.ID, (int)FolderType.Trash, "Trash"); | ||
148 | 156 | ||
149 | return result; | 157 | return result; |
150 | } | 158 | } |
@@ -220,7 +228,7 @@ namespace OpenSim.Services.InventoryService | |||
220 | XInventoryFolder root = null; | 228 | XInventoryFolder root = null; |
221 | foreach (XInventoryFolder folder in folders) | 229 | foreach (XInventoryFolder folder in folders) |
222 | { | 230 | { |
223 | if (folder.folderName == "My Inventory") | 231 | if (folder.folderName == InventoryFolderBase.ROOT_FOLDER_NAME) |
224 | { | 232 | { |
225 | root = folder; | 233 | root = folder; |
226 | break; | 234 | break; |
@@ -233,7 +241,7 @@ namespace OpenSim.Services.InventoryService | |||
233 | return ConvertToOpenSim(root); | 241 | return ConvertToOpenSim(root); |
234 | } | 242 | } |
235 | 243 | ||
236 | public virtual InventoryFolderBase GetFolderForType(UUID principalID, AssetType type) | 244 | public virtual InventoryFolderBase GetFolderForType(UUID principalID, FolderType type) |
237 | { | 245 | { |
238 | // m_log.DebugFormat("[XINVENTORY SERVICE]: Getting folder type {0} for user {1}", type, principalID); | 246 | // m_log.DebugFormat("[XINVENTORY SERVICE]: Getting folder type {0} for user {1}", type, principalID); |
239 | 247 | ||
@@ -251,11 +259,11 @@ namespace OpenSim.Services.InventoryService | |||
251 | return GetSystemFolderForType(rootFolder, type); | 259 | return GetSystemFolderForType(rootFolder, type); |
252 | } | 260 | } |
253 | 261 | ||
254 | private InventoryFolderBase GetSystemFolderForType(InventoryFolderBase rootFolder, AssetType type) | 262 | private InventoryFolderBase GetSystemFolderForType(InventoryFolderBase rootFolder, FolderType type) |
255 | { | 263 | { |
256 | // m_log.DebugFormat("[XINVENTORY SERVICE]: Getting folder type {0} for user {1}", type, principalID); | 264 | //m_log.DebugFormat("[XINVENTORY SERVICE]: Getting folder type {0}", type); |
257 | 265 | ||
258 | if (type == AssetType.RootFolder) | 266 | if (type == FolderType.Root) |
259 | return rootFolder; | 267 | return rootFolder; |
260 | 268 | ||
261 | XInventoryFolder[] folders = m_Database.GetFolders( | 269 | XInventoryFolder[] folders = m_Database.GetFolders( |
@@ -264,13 +272,13 @@ namespace OpenSim.Services.InventoryService | |||
264 | 272 | ||
265 | if (folders.Length == 0) | 273 | if (folders.Length == 0) |
266 | { | 274 | { |
267 | // m_log.WarnFormat("[XINVENTORY SERVICE]: Found no folder for type {0} for user {1}", type, principalID); | 275 | //m_log.WarnFormat("[XINVENTORY SERVICE]: Found no folder for type {0} ", type); |
268 | return null; | 276 | return null; |
269 | } | 277 | } |
270 | 278 | ||
271 | // m_log.DebugFormat( | 279 | //m_log.DebugFormat( |
272 | // "[XINVENTORY SERVICE]: Found folder {0} {1} for type {2} for user {3}", | 280 | // "[XINVENTORY SERVICE]: Found folder {0} {1} for type {2}", |
273 | // folders[0].folderName, folders[0].folderID, type, principalID); | 281 | // folders[0].folderName, folders[0].folderID, type); |
274 | 282 | ||
275 | return ConvertToOpenSim(folders[0]); | 283 | return ConvertToOpenSim(folders[0]); |
276 | } | 284 | } |
@@ -283,7 +291,7 @@ namespace OpenSim.Services.InventoryService | |||
283 | // | 291 | // |
284 | //m_log.DebugFormat("[XINVENTORY SERVICE]: Fetch contents for folder {0}", folderID.ToString()); | 292 | //m_log.DebugFormat("[XINVENTORY SERVICE]: Fetch contents for folder {0}", folderID.ToString()); |
285 | InventoryCollection inventory = new InventoryCollection(); | 293 | InventoryCollection inventory = new InventoryCollection(); |
286 | inventory.UserID = principalID; | 294 | inventory.OwnerID = principalID; |
287 | inventory.Folders = new List<InventoryFolderBase>(); | 295 | inventory.Folders = new List<InventoryFolderBase>(); |
288 | inventory.Items = new List<InventoryItemBase>(); | 296 | inventory.Items = new List<InventoryItemBase>(); |
289 | 297 | ||
@@ -307,8 +315,27 @@ namespace OpenSim.Services.InventoryService | |||
307 | inventory.Items.Add(ConvertToOpenSim(i)); | 315 | inventory.Items.Add(ConvertToOpenSim(i)); |
308 | } | 316 | } |
309 | 317 | ||
318 | InventoryFolderBase f = new InventoryFolderBase(folderID, principalID); | ||
319 | f = GetFolder(f); | ||
320 | if (f != null) | ||
321 | { | ||
322 | inventory.Version = f.Version; | ||
323 | inventory.OwnerID = f.Owner; | ||
324 | } | ||
325 | inventory.FolderID = folderID; | ||
326 | |||
310 | return inventory; | 327 | return inventory; |
311 | } | 328 | } |
329 | |||
330 | public virtual InventoryCollection[] GetMultipleFoldersContent(UUID principalID, UUID[] folderIDs) | ||
331 | { | ||
332 | InventoryCollection[] multiple = new InventoryCollection[folderIDs.Length]; | ||
333 | int i = 0; | ||
334 | foreach (UUID fid in folderIDs) | ||
335 | multiple[i++] = GetFolderContent(principalID, fid); | ||
336 | |||
337 | return multiple; | ||
338 | } | ||
312 | 339 | ||
313 | public virtual List<InventoryItemBase> GetFolderItems(UUID principalID, UUID folderID) | 340 | public virtual List<InventoryItemBase> GetFolderItems(UUID principalID, UUID folderID) |
314 | { | 341 | { |
@@ -336,7 +363,7 @@ namespace OpenSim.Services.InventoryService | |||
336 | if (check != null) | 363 | if (check != null) |
337 | return false; | 364 | return false; |
338 | 365 | ||
339 | if (folder.Type != (short)AssetType.Folder && folder.Type != (short)AssetType.Unknown) | 366 | if (folder.Type != (short)FolderType.None) |
340 | { | 367 | { |
341 | InventoryFolderBase rootFolder = GetRootFolder(folder.Owner); | 368 | InventoryFolderBase rootFolder = GetRootFolder(folder.Owner); |
342 | 369 | ||
@@ -353,7 +380,7 @@ namespace OpenSim.Services.InventoryService | |||
353 | if (folder.ParentID == rootFolder.ID) | 380 | if (folder.ParentID == rootFolder.ID) |
354 | { | 381 | { |
355 | InventoryFolderBase existingSystemFolder | 382 | InventoryFolderBase existingSystemFolder |
356 | = GetSystemFolderForType(rootFolder, (AssetType)folder.Type); | 383 | = GetSystemFolderForType(rootFolder, (FolderType)folder.Type); |
357 | 384 | ||
358 | if (existingSystemFolder != null) | 385 | if (existingSystemFolder != null) |
359 | { | 386 | { |
@@ -380,8 +407,8 @@ namespace OpenSim.Services.InventoryService | |||
380 | if (check == null) | 407 | if (check == null) |
381 | return AddFolder(folder); | 408 | return AddFolder(folder); |
382 | 409 | ||
383 | if ((check.Type != (short)AssetType.Unknown || xFolder.type != (short)AssetType.Unknown) | 410 | if ((check.Type != (short)FolderType.None || xFolder.type != (short)FolderType.None) |
384 | && (check.Type != (short)AssetType.OutfitFolder || xFolder.type != (short)AssetType.OutfitFolder)) | 411 | && (check.Type != (short)FolderType.Outfit || xFolder.type != (short)FolderType.Outfit)) |
385 | { | 412 | { |
386 | if (xFolder.version < check.Version) | 413 | if (xFolder.version < check.Version) |
387 | { | 414 | { |
@@ -583,6 +610,21 @@ namespace OpenSim.Services.InventoryService | |||
583 | return ConvertToOpenSim(items[0]); | 610 | return ConvertToOpenSim(items[0]); |
584 | } | 611 | } |
585 | 612 | ||
613 | public virtual InventoryItemBase[] GetMultipleItems(UUID userID, UUID[] ids) | ||
614 | { | ||
615 | InventoryItemBase[] items = new InventoryItemBase[ids.Length]; | ||
616 | int i = 0; | ||
617 | InventoryItemBase item = new InventoryItemBase(); | ||
618 | item.Owner = userID; | ||
619 | foreach (UUID id in ids) | ||
620 | { | ||
621 | item.ID = id; | ||
622 | items[i++] = GetItem(item); | ||
623 | } | ||
624 | |||
625 | return items; | ||
626 | } | ||
627 | |||
586 | public virtual InventoryFolderBase GetFolder(InventoryFolderBase folder) | 628 | public virtual InventoryFolderBase GetFolder(InventoryFolderBase folder) |
587 | { | 629 | { |
588 | XInventoryFolder[] folders = m_Database.GetFolders( | 630 | XInventoryFolder[] folders = m_Database.GetFolders( |
@@ -615,34 +657,6 @@ namespace OpenSim.Services.InventoryService | |||
615 | return m_Database.GetAssetPermissions(principalID, assetID); | 657 | return m_Database.GetAssetPermissions(principalID, assetID); |
616 | } | 658 | } |
617 | 659 | ||
618 | public virtual InventoryCollection GetUserInventory(UUID userID) | ||
619 | { | ||
620 | InventoryCollection userInventory = new InventoryCollection(); | ||
621 | userInventory.UserID = userID; | ||
622 | userInventory.Folders = new List<InventoryFolderBase>(); | ||
623 | userInventory.Items = new List<InventoryItemBase>(); | ||
624 | |||
625 | List<InventoryFolderBase> skel = GetInventorySkeleton(userID); | ||
626 | if (skel != null) | ||
627 | { | ||
628 | foreach (InventoryFolderBase f in skel) | ||
629 | { | ||
630 | InventoryCollection c = GetFolderContent(userID, f.ID); | ||
631 | if (c != null && c.Items != null && c.Items.Count > 0) | ||
632 | userInventory.Items.AddRange(c.Items); | ||
633 | if (c != null && c.Folders != null && c.Folders.Count > 0) | ||
634 | userInventory.Folders.AddRange(c.Folders); | ||
635 | } | ||
636 | } | ||
637 | m_log.DebugFormat("[XINVENTORY SERVICE]: GetUserInventory for user {0} returning {1} folders and {2} items", | ||
638 | userID, userInventory.Folders.Count, userInventory.Items.Count); | ||
639 | return userInventory; | ||
640 | } | ||
641 | |||
642 | public void GetUserInventory(UUID userID, InventoryReceiptCallback callback) | ||
643 | { | ||
644 | } | ||
645 | |||
646 | // Unused. | 660 | // Unused. |
647 | // | 661 | // |
648 | public bool HasInventoryForUser(UUID userID) | 662 | public bool HasInventoryForUser(UUID userID) |
@@ -658,9 +672,9 @@ namespace OpenSim.Services.InventoryService | |||
658 | 672 | ||
659 | newFolder.ParentID = folder.parentFolderID; | 673 | newFolder.ParentID = folder.parentFolderID; |
660 | newFolder.Type = (short)folder.type; | 674 | newFolder.Type = (short)folder.type; |
661 | // Viewer can't understand anything that's not in it's LLFolderType enum | 675 | //// Viewer can't understand anything that's not in it's LLFolderType enum |
662 | if (newFolder.Type == 100) | 676 | //if (newFolder.Type == InventoryItemBase.SUITCASE_FOLDER_TYPE) |
663 | newFolder.Type = -1; | 677 | // newFolder.Type = InventoryItemBase.SUITCASE_FOLDER_FAKE_TYPE; |
664 | newFolder.Version = (ushort)folder.version; | 678 | newFolder.Version = (ushort)folder.version; |
665 | newFolder.Name = folder.folderName; | 679 | newFolder.Name = folder.folderName; |
666 | newFolder.Owner = folder.agentID; | 680 | newFolder.Owner = folder.agentID; |
@@ -751,7 +765,7 @@ namespace OpenSim.Services.InventoryService | |||
751 | if (folder.Length < 1) | 765 | if (folder.Length < 1) |
752 | return false; | 766 | return false; |
753 | 767 | ||
754 | if (folder[0].type == (int)AssetType.TrashFolder) | 768 | if (folder[0].type == (int)FolderType.Trash) |
755 | return true; | 769 | return true; |
756 | 770 | ||
757 | UUID parentFolder = folder[0].parentFolderID; | 771 | UUID parentFolder = folder[0].parentFolderID; |
@@ -762,9 +776,9 @@ namespace OpenSim.Services.InventoryService | |||
762 | if (parent.Length < 1) | 776 | if (parent.Length < 1) |
763 | return false; | 777 | return false; |
764 | 778 | ||
765 | if (parent[0].type == (int)AssetType.TrashFolder) | 779 | if (parent[0].type == (int)FolderType.Trash) |
766 | return true; | 780 | return true; |
767 | if (parent[0].type == (int)AssetType.RootFolder) | 781 | if (parent[0].type == (int)FolderType.Root) |
768 | return false; | 782 | return false; |
769 | 783 | ||
770 | parentFolder = parent[0].parentFolderID; | 784 | parentFolder = parent[0].parentFolderID; |
diff --git a/OpenSim/Services/LLLoginService/LLLoginResponse.cs b/OpenSim/Services/LLLoginService/LLLoginResponse.cs index da351b9..92d93ee 100644 --- a/OpenSim/Services/LLLoginService/LLLoginResponse.cs +++ b/OpenSim/Services/LLLoginService/LLLoginResponse.cs | |||
@@ -197,6 +197,7 @@ namespace OpenSim.Services.LLLoginService | |||
197 | 197 | ||
198 | private string currency; | 198 | private string currency; |
199 | private string classifiedFee; | 199 | private string classifiedFee; |
200 | private int maxAgentGroups; | ||
200 | 201 | ||
201 | static LLLoginResponse() | 202 | static LLLoginResponse() |
202 | { | 203 | { |
@@ -233,8 +234,13 @@ namespace OpenSim.Services.LLLoginService | |||
233 | public LLLoginResponse(UserAccount account, AgentCircuitData aCircuit, GridUserInfo pinfo, | 234 | public LLLoginResponse(UserAccount account, AgentCircuitData aCircuit, GridUserInfo pinfo, |
234 | GridRegion destination, List<InventoryFolderBase> invSkel, FriendInfo[] friendsList, ILibraryService libService, | 235 | GridRegion destination, List<InventoryFolderBase> invSkel, FriendInfo[] friendsList, ILibraryService libService, |
235 | string where, string startlocation, Vector3 position, Vector3 lookAt, List<InventoryItemBase> gestures, string message, | 236 | string where, string startlocation, Vector3 position, Vector3 lookAt, List<InventoryItemBase> gestures, string message, |
237 | <<<<<<< HEAD | ||
238 | GridRegion home, IPEndPoint clientIP, string mapTileURL, string searchURL, string currency, | ||
239 | string DSTZone, string destinationsURL, string avatarsURL, string classifiedFee, int maxAgentGroups) | ||
240 | ======= | ||
236 | GridRegion home, IPEndPoint clientIP, string mapTileURL, string profileURL, string openIDURL, string searchURL, string currency, | 241 | GridRegion home, IPEndPoint clientIP, string mapTileURL, string profileURL, string openIDURL, string searchURL, string currency, |
237 | string DSTZone, string destinationsURL, string avatarsURL, UUID realID, string classifiedFee) | 242 | string DSTZone, string destinationsURL, string avatarsURL, UUID realID, string classifiedFee) |
243 | >>>>>>> avn/ubitvar | ||
238 | : this() | 244 | : this() |
239 | { | 245 | { |
240 | FillOutInventoryData(invSkel, libService); | 246 | FillOutInventoryData(invSkel, libService); |
@@ -260,12 +266,13 @@ namespace OpenSim.Services.LLLoginService | |||
260 | SearchURL = searchURL; | 266 | SearchURL = searchURL; |
261 | Currency = currency; | 267 | Currency = currency; |
262 | ClassifiedFee = classifiedFee; | 268 | ClassifiedFee = classifiedFee; |
269 | MaxAgentGroups = maxAgentGroups; | ||
263 | 270 | ||
264 | FillOutHomeData(pinfo, home); | 271 | FillOutHomeData(pinfo, home); |
265 | LookAt = String.Format("[r{0},r{1},r{2}]", lookAt.X, lookAt.Y, lookAt.Z); | 272 | LookAt = String.Format("[r{0},r{1},r{2}]", lookAt.X, lookAt.Y, lookAt.Z); |
266 | 273 | ||
267 | FillOutRegionData(destination); | 274 | FillOutRegionData(destination); |
268 | // m_log.DebugFormat("[LOGIN RESPONSE] LLLoginResponse create. sizeX=<{0},{1}>", RegionSizeX, RegionSizeY); | 275 | m_log.DebugFormat("[LOGIN RESPONSE] LLLoginResponse create. sizeX={0}, sizeY={1}", RegionSizeX, RegionSizeY); |
269 | 276 | ||
270 | FillOutSeedCap(aCircuit, destination, clientIP); | 277 | FillOutSeedCap(aCircuit, destination, clientIP); |
271 | 278 | ||
@@ -492,6 +499,7 @@ namespace OpenSim.Services.LLLoginService | |||
492 | 499 | ||
493 | currency = String.Empty; | 500 | currency = String.Empty; |
494 | ClassifiedFee = "0"; | 501 | ClassifiedFee = "0"; |
502 | MaxAgentGroups = 42; | ||
495 | } | 503 | } |
496 | 504 | ||
497 | 505 | ||
@@ -552,12 +560,13 @@ namespace OpenSim.Services.LLLoginService | |||
552 | responseData["seed_capability"] = seedCapability; | 560 | responseData["seed_capability"] = seedCapability; |
553 | responseData["home"] = home; | 561 | responseData["home"] = home; |
554 | responseData["look_at"] = lookAt; | 562 | responseData["look_at"] = lookAt; |
563 | responseData["max-agent-groups"] = MaxAgentGroups; | ||
555 | responseData["message"] = welcomeMessage; | 564 | responseData["message"] = welcomeMessage; |
556 | responseData["region_x"] = (Int32)(RegionX); | 565 | responseData["region_x"] = (Int32)(RegionX); |
557 | responseData["region_y"] = (Int32)(RegionY); | 566 | responseData["region_y"] = (Int32)(RegionY); |
558 | responseData["region_size_x"] = (Int32)RegionSizeX; | 567 | responseData["region_size_x"] = (Int32)RegionSizeX; |
559 | responseData["region_size_y"] = (Int32)RegionSizeY; | 568 | responseData["region_size_y"] = (Int32)RegionSizeY; |
560 | // m_log.DebugFormat("[LOGIN RESPONSE] returning sizeX=<{0},{1}>", RegionSizeX, RegionSizeY); | 569 | m_log.DebugFormat("[LOGIN RESPONSE] returning sizeX={0}, sizeY={1}", RegionSizeX, RegionSizeY); |
561 | 570 | ||
562 | if (searchURL != String.Empty) | 571 | if (searchURL != String.Empty) |
563 | responseData["search"] = searchURL; | 572 | responseData["search"] = searchURL; |
@@ -680,6 +689,7 @@ namespace OpenSim.Services.LLLoginService | |||
680 | map["seed_capability"] = OSD.FromString(seedCapability); | 689 | map["seed_capability"] = OSD.FromString(seedCapability); |
681 | map["home"] = OSD.FromString(home); | 690 | map["home"] = OSD.FromString(home); |
682 | map["look_at"] = OSD.FromString(lookAt); | 691 | map["look_at"] = OSD.FromString(lookAt); |
692 | map["max-agent-groups"] = OSD.FromInteger(MaxAgentGroups); | ||
683 | map["message"] = OSD.FromString(welcomeMessage); | 693 | map["message"] = OSD.FromString(welcomeMessage); |
684 | map["region_x"] = OSD.FromInteger(RegionX); | 694 | map["region_x"] = OSD.FromInteger(RegionX); |
685 | map["region_y"] = OSD.FromInteger(RegionY); | 695 | map["region_y"] = OSD.FromInteger(RegionY); |
@@ -794,7 +804,7 @@ namespace OpenSim.Services.LLLoginService | |||
794 | Hashtable TempHash; | 804 | Hashtable TempHash; |
795 | foreach (InventoryFolderBase InvFolder in folders) | 805 | foreach (InventoryFolderBase InvFolder in folders) |
796 | { | 806 | { |
797 | if (InvFolder.ParentID == UUID.Zero && InvFolder.Name == "My Inventory") | 807 | if (InvFolder.ParentID == UUID.Zero && InvFolder.Name == InventoryFolderBase.ROOT_FOLDER_NAME) |
798 | { | 808 | { |
799 | rootID = InvFolder.ID; | 809 | rootID = InvFolder.ID; |
800 | } | 810 | } |
@@ -1119,6 +1129,12 @@ namespace OpenSim.Services.LLLoginService | |||
1119 | set { classifiedFee = value; } | 1129 | set { classifiedFee = value; } |
1120 | } | 1130 | } |
1121 | 1131 | ||
1132 | public int MaxAgentGroups | ||
1133 | { | ||
1134 | get { return maxAgentGroups; } | ||
1135 | set { maxAgentGroups = value; } | ||
1136 | } | ||
1137 | |||
1122 | public string DestinationsURL | 1138 | public string DestinationsURL |
1123 | { | 1139 | { |
1124 | get; set; | 1140 | get; set; |
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index b009e64..ba69e95 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs | |||
@@ -58,6 +58,7 @@ namespace OpenSim.Services.LLLoginService | |||
58 | protected IGridUserService m_GridUserService; | 58 | protected IGridUserService m_GridUserService; |
59 | protected IAuthenticationService m_AuthenticationService; | 59 | protected IAuthenticationService m_AuthenticationService; |
60 | protected IInventoryService m_InventoryService; | 60 | protected IInventoryService m_InventoryService; |
61 | protected IInventoryService m_HGInventoryService; | ||
61 | protected IGridService m_GridService; | 62 | protected IGridService m_GridService; |
62 | protected IPresenceService m_PresenceService; | 63 | protected IPresenceService m_PresenceService; |
63 | protected ISimulationService m_LocalSimulationService; | 64 | protected ISimulationService m_LocalSimulationService; |
@@ -76,17 +77,15 @@ namespace OpenSim.Services.LLLoginService | |||
76 | protected string m_GatekeeperURL; | 77 | protected string m_GatekeeperURL; |
77 | protected bool m_AllowRemoteSetLoginLevel; | 78 | protected bool m_AllowRemoteSetLoginLevel; |
78 | protected string m_MapTileURL; | 79 | protected string m_MapTileURL; |
79 | protected string m_ProfileURL; | ||
80 | protected string m_OpenIDURL; | ||
81 | protected string m_SearchURL; | 80 | protected string m_SearchURL; |
82 | protected string m_Currency; | 81 | protected string m_Currency; |
83 | protected string m_ClassifiedFee; | 82 | protected string m_ClassifiedFee; |
83 | protected int m_MaxAgentGroups; | ||
84 | protected string m_DestinationGuide; | 84 | protected string m_DestinationGuide; |
85 | protected string m_AvatarPicker; | 85 | protected string m_AvatarPicker; |
86 | |||
87 | protected string m_AllowedClients; | 86 | protected string m_AllowedClients; |
88 | protected string m_DeniedClients; | 87 | protected string m_DeniedClients; |
89 | 88 | protected string m_MessageUrl; | |
90 | protected string m_DSTZone; | 89 | protected string m_DSTZone; |
91 | 90 | ||
92 | IConfig m_LoginServerConfig; | 91 | IConfig m_LoginServerConfig; |
@@ -118,8 +117,6 @@ namespace OpenSim.Services.LLLoginService | |||
118 | m_GatekeeperURL = Util.GetConfigVarFromSections<string>(config, "GatekeeperURI", | 117 | m_GatekeeperURL = Util.GetConfigVarFromSections<string>(config, "GatekeeperURI", |
119 | new string[] { "Startup", "Hypergrid", "LoginService" }, String.Empty); | 118 | new string[] { "Startup", "Hypergrid", "LoginService" }, String.Empty); |
120 | m_MapTileURL = m_LoginServerConfig.GetString("MapTileURL", string.Empty); | 119 | m_MapTileURL = m_LoginServerConfig.GetString("MapTileURL", string.Empty); |
121 | m_ProfileURL = m_LoginServerConfig.GetString("ProfileServerURL", string.Empty); | ||
122 | m_OpenIDURL = m_LoginServerConfig.GetString("OpenIDServerURL", String.Empty); | ||
123 | m_SearchURL = m_LoginServerConfig.GetString("SearchURL", string.Empty); | 120 | m_SearchURL = m_LoginServerConfig.GetString("SearchURL", string.Empty); |
124 | m_Currency = m_LoginServerConfig.GetString("Currency", string.Empty); | 121 | m_Currency = m_LoginServerConfig.GetString("Currency", string.Empty); |
125 | m_ClassifiedFee = m_LoginServerConfig.GetString("ClassifiedFee", string.Empty); | 122 | m_ClassifiedFee = m_LoginServerConfig.GetString("ClassifiedFee", string.Empty); |
@@ -128,9 +125,14 @@ namespace OpenSim.Services.LLLoginService | |||
128 | 125 | ||
129 | m_AllowedClients = m_LoginServerConfig.GetString("AllowedClients", string.Empty); | 126 | m_AllowedClients = m_LoginServerConfig.GetString("AllowedClients", string.Empty); |
130 | m_DeniedClients = m_LoginServerConfig.GetString("DeniedClients", string.Empty); | 127 | m_DeniedClients = m_LoginServerConfig.GetString("DeniedClients", string.Empty); |
131 | 128 | m_MessageUrl = m_LoginServerConfig.GetString("MessageUrl", string.Empty); | |
132 | m_DSTZone = m_LoginServerConfig.GetString("DSTZone", "America/Los_Angeles;Pacific Standard Time"); | 129 | m_DSTZone = m_LoginServerConfig.GetString("DSTZone", "America/Los_Angeles;Pacific Standard Time"); |
133 | 130 | ||
131 | IConfig groupConfig = config.Configs["Groups"]; | ||
132 | if (groupConfig != null) | ||
133 | m_MaxAgentGroups = groupConfig.GetInt("MaxAgentGroups", 42); | ||
134 | |||
135 | |||
134 | // Clean up some of these vars | 136 | // Clean up some of these vars |
135 | if (m_MapTileURL != String.Empty) | 137 | if (m_MapTileURL != String.Empty) |
136 | { | 138 | { |
@@ -166,6 +168,15 @@ namespace OpenSim.Services.LLLoginService | |||
166 | if (agentService != string.Empty) | 168 | if (agentService != string.Empty) |
167 | m_UserAgentService = ServerUtils.LoadPlugin<IUserAgentService>(agentService, args); | 169 | m_UserAgentService = ServerUtils.LoadPlugin<IUserAgentService>(agentService, args); |
168 | 170 | ||
171 | // Get the Hypergrid inventory service (exists only if Hypergrid is enabled) | ||
172 | string hgInvServicePlugin = m_LoginServerConfig.GetString("HGInventoryServicePlugin", String.Empty); | ||
173 | if (hgInvServicePlugin != string.Empty) | ||
174 | { | ||
175 | string hgInvServiceArg = m_LoginServerConfig.GetString("HGInventoryServiceConstructorArg", String.Empty); | ||
176 | Object[] args2 = new Object[] { config, hgInvServiceArg }; | ||
177 | m_HGInventoryService = ServerUtils.LoadPlugin<IInventoryService>(hgInvServicePlugin, args2); | ||
178 | } | ||
179 | |||
169 | // | 180 | // |
170 | // deal with the services given as argument | 181 | // deal with the services given as argument |
171 | // | 182 | // |
@@ -251,8 +262,12 @@ namespace OpenSim.Services.LLLoginService | |||
251 | { | 262 | { |
252 | bool success = false; | 263 | bool success = false; |
253 | UUID session = UUID.Random(); | 264 | UUID session = UUID.Random(); |
265 | <<<<<<< HEAD | ||
266 | string processedMessage; | ||
267 | ======= | ||
254 | if (clientVersion.Contains("Radegast")) | 268 | if (clientVersion.Contains("Radegast")) |
255 | LibOMVclient = false; | 269 | LibOMVclient = false; |
270 | >>>>>>> avn/ubitvar | ||
256 | 271 | ||
257 | 272 | ||
258 | m_log.InfoFormat("[LLOGIN SERVICE]: Login request for {0} {1} at {2} using viewer {3}, channel {4}, IP {5}, Mac {6}, Id0 {7}, Possible LibOMVGridProxy: {8} ", | 273 | m_log.InfoFormat("[LLOGIN SERVICE]: Login request for {0} {1} at {2} using viewer {3}, channel {4}, IP {5}, Mac {6}, Id0 {7}, Possible LibOMVGridProxy: {8} ", |
@@ -361,6 +376,13 @@ namespace OpenSim.Services.LLLoginService | |||
361 | return LLFailedLoginResponse.InventoryProblem; | 376 | return LLFailedLoginResponse.InventoryProblem; |
362 | } | 377 | } |
363 | 378 | ||
379 | if (m_HGInventoryService != null) | ||
380 | { | ||
381 | // Give the Suitcase service a chance to create the suitcase folder. | ||
382 | // (If we're not using the Suitcase inventory service then this won't do anything.) | ||
383 | m_HGInventoryService.GetRootFolder(account.PrincipalID); | ||
384 | } | ||
385 | |||
364 | List<InventoryFolderBase> inventorySkel = m_InventoryService.GetInventorySkeleton(account.PrincipalID); | 386 | List<InventoryFolderBase> inventorySkel = m_InventoryService.GetInventorySkeleton(account.PrincipalID); |
365 | if (m_RequireInventory && ((inventorySkel == null) || (inventorySkel != null && inventorySkel.Count == 0))) | 387 | if (m_RequireInventory && ((inventorySkel == null) || (inventorySkel != null && inventorySkel.Count == 0))) |
366 | { | 388 | { |
@@ -395,11 +417,30 @@ namespace OpenSim.Services.LLLoginService | |||
395 | // | 417 | // |
396 | GridRegion home = null; | 418 | GridRegion home = null; |
397 | GridUserInfo guinfo = m_GridUserService.LoggedIn(account.PrincipalID.ToString()); | 419 | GridUserInfo guinfo = m_GridUserService.LoggedIn(account.PrincipalID.ToString()); |
398 | if (guinfo != null && (guinfo.HomeRegionID != UUID.Zero) && m_GridService != null) | 420 | |
421 | // We are only going to complain about no home if the user actually tries to login there, to avoid | ||
422 | // spamming the console. | ||
423 | if (guinfo != null) | ||
399 | { | 424 | { |
400 | home = m_GridService.GetRegionByUUID(scopeID, guinfo.HomeRegionID); | 425 | if (guinfo.HomeRegionID == UUID.Zero && startLocation == "home") |
426 | { | ||
427 | m_log.WarnFormat( | ||
428 | "[LLOGIN SERVICE]: User {0} tried to login to a 'home' start location but they have none set", | ||
429 | account.Name); | ||
430 | } | ||
431 | else if (m_GridService != null) | ||
432 | { | ||
433 | home = m_GridService.GetRegionByUUID(scopeID, guinfo.HomeRegionID); | ||
434 | |||
435 | if (home == null && startLocation == "home") | ||
436 | { | ||
437 | m_log.WarnFormat( | ||
438 | "[LLOGIN SERVICE]: User {0} tried to login to a 'home' start location with ID {1} but this was not found.", | ||
439 | account.Name, guinfo.HomeRegionID); | ||
440 | } | ||
441 | } | ||
401 | } | 442 | } |
402 | if (guinfo == null) | 443 | else |
403 | { | 444 | { |
404 | // something went wrong, make something up, so that we don't have to test this anywhere else | 445 | // something went wrong, make something up, so that we don't have to test this anywhere else |
405 | m_log.DebugFormat("{0} Failed to fetch GridUserInfo. Creating empty GridUserInfo as home", LogHeader); | 446 | m_log.DebugFormat("{0} Failed to fetch GridUserInfo. Creating empty GridUserInfo as home", LogHeader); |
@@ -469,17 +510,36 @@ namespace OpenSim.Services.LLLoginService | |||
469 | // | 510 | // |
470 | // Finally, fill out the response and return it | 511 | // Finally, fill out the response and return it |
471 | // | 512 | // |
513 | if (m_MessageUrl != String.Empty) | ||
514 | { | ||
515 | WebClient client = new WebClient(); | ||
516 | processedMessage = client.DownloadString(m_MessageUrl); | ||
517 | } | ||
518 | else | ||
519 | { | ||
520 | processedMessage = m_WelcomeMessage; | ||
521 | } | ||
522 | processedMessage = processedMessage.Replace("\\n", "\n").Replace("<USERNAME>", firstName + " " + lastName); | ||
523 | |||
472 | LLLoginResponse response | 524 | LLLoginResponse response |
525 | <<<<<<< HEAD | ||
526 | = new LLLoginResponse( | ||
527 | account, aCircuit, guinfo, destination, inventorySkel, friendsList, m_LibraryService, | ||
528 | where, startLocation, position, lookAt, gestures, processedMessage, home, clientIP, | ||
529 | m_MapTileURL, m_SearchURL, m_Currency, m_DSTZone, | ||
530 | m_DestinationGuide, m_AvatarPicker, m_ClassifiedFee, m_MaxAgentGroups); | ||
531 | ======= | ||
473 | = new LLLoginResponse( | 532 | = new LLLoginResponse( |
474 | account, aCircuit, guinfo, destination, inventorySkel, friendsList, m_LibraryService, | 533 | account, aCircuit, guinfo, destination, inventorySkel, friendsList, m_LibraryService, |
475 | where, startLocation, position, lookAt, gestures, m_WelcomeMessage, home, clientIP, | 534 | where, startLocation, position, lookAt, gestures, m_WelcomeMessage, home, clientIP, |
476 | m_MapTileURL, m_ProfileURL, m_OpenIDURL, m_SearchURL, m_Currency, m_DSTZone, | 535 | m_MapTileURL, m_ProfileURL, m_OpenIDURL, m_SearchURL, m_Currency, m_DSTZone, |
477 | m_DestinationGuide, m_AvatarPicker, realID, m_ClassifiedFee); | 536 | m_DestinationGuide, m_AvatarPicker, realID, m_ClassifiedFee); |
537 | >>>>>>> avn/ubitvar | ||
478 | 538 | ||
479 | m_log.DebugFormat("[LLOGIN SERVICE]: All clear. Sending login response to {0} {1}", firstName, lastName); | 539 | m_log.DebugFormat("[LLOGIN SERVICE]: All clear. Sending login response to {0} {1}", firstName, lastName); |
480 | 540 | ||
481 | return response; | 541 | return response; |
482 | } | 542 | } |
483 | catch (Exception e) | 543 | catch (Exception e) |
484 | { | 544 | { |
485 | m_log.WarnFormat("[LLOGIN SERVICE]: Exception processing login for {0} {1}: {2} {3}", firstName, lastName, e.ToString(), e.StackTrace); | 545 | m_log.WarnFormat("[LLOGIN SERVICE]: Exception processing login for {0} {1}: {2} {3}", firstName, lastName, e.ToString(), e.StackTrace); |
@@ -520,10 +580,6 @@ namespace OpenSim.Services.LLLoginService | |||
520 | 580 | ||
521 | if (home == null) | 581 | if (home == null) |
522 | { | 582 | { |
523 | m_log.WarnFormat( | ||
524 | "[LLOGIN SERVICE]: User {0} {1} tried to login to a 'home' start location but they have none set", | ||
525 | account.FirstName, account.LastName); | ||
526 | |||
527 | tryDefaults = true; | 583 | tryDefaults = true; |
528 | } | 584 | } |
529 | else | 585 | else |
@@ -598,7 +654,7 @@ namespace OpenSim.Services.LLLoginService | |||
598 | // e.g. New Moon&135&46 New Moon@osgrid.org:8002&153&34 | 654 | // e.g. New Moon&135&46 New Moon@osgrid.org:8002&153&34 |
599 | where = "url"; | 655 | where = "url"; |
600 | GridRegion region = null; | 656 | GridRegion region = null; |
601 | Regex reURI = new Regex(@"^uri:(?<region>[^&]+)&(?<x>\d+)&(?<y>\d+)&(?<z>\d+)$"); | 657 | Regex reURI = new Regex(@"^uri:(?<region>[^&]+)&(?<x>\d+[.]?\d*)&(?<y>\d+[.]?\d*)&(?<z>\d+[.]?\d*)$"); |
602 | Match uriMatch = reURI.Match(startLocation); | 658 | Match uriMatch = reURI.Match(startLocation); |
603 | if (uriMatch == null) | 659 | if (uriMatch == null) |
604 | { | 660 | { |
@@ -667,8 +723,7 @@ namespace OpenSim.Services.LLLoginService | |||
667 | if (parts.Length > 1) | 723 | if (parts.Length > 1) |
668 | UInt32.TryParse(parts[1], out port); | 724 | UInt32.TryParse(parts[1], out port); |
669 | 725 | ||
670 | // GridRegion region = FindForeignRegion(domainName, port, regionName, out gatekeeper); | 726 | region = FindForeignRegion(domainName, port, regionName, account, out gatekeeper); |
671 | region = FindForeignRegion(domainName, port, regionName, out gatekeeper); | ||
672 | return region; | 727 | return region; |
673 | } | 728 | } |
674 | } | 729 | } |
@@ -717,7 +772,7 @@ namespace OpenSim.Services.LLLoginService | |||
717 | return null; | 772 | return null; |
718 | } | 773 | } |
719 | 774 | ||
720 | private GridRegion FindForeignRegion(string domainName, uint port, string regionName, out GridRegion gatekeeper) | 775 | private GridRegion FindForeignRegion(string domainName, uint port, string regionName, UserAccount account, out GridRegion gatekeeper) |
721 | { | 776 | { |
722 | m_log.Debug("[LLLOGIN SERVICE]: attempting to findforeignregion " + domainName + ":" + port.ToString() + ":" + regionName); | 777 | m_log.Debug("[LLLOGIN SERVICE]: attempting to findforeignregion " + domainName + ":" + port.ToString() + ":" + regionName); |
723 | gatekeeper = new GridRegion(); | 778 | gatekeeper = new GridRegion(); |
@@ -729,9 +784,14 @@ namespace OpenSim.Services.LLLoginService | |||
729 | UUID regionID; | 784 | UUID regionID; |
730 | ulong handle; | 785 | ulong handle; |
731 | string imageURL = string.Empty, reason = string.Empty; | 786 | string imageURL = string.Empty, reason = string.Empty; |
787 | string message; | ||
732 | if (m_GatekeeperConnector.LinkRegion(gatekeeper, out regionID, out handle, out domainName, out imageURL, out reason)) | 788 | if (m_GatekeeperConnector.LinkRegion(gatekeeper, out regionID, out handle, out domainName, out imageURL, out reason)) |
733 | { | 789 | { |
734 | GridRegion destination = m_GatekeeperConnector.GetHyperlinkRegion(gatekeeper, regionID); | 790 | string homeURI = null; |
791 | if (account.ServiceURLs != null && account.ServiceURLs.ContainsKey("HomeURI")) | ||
792 | homeURI = (string)account.ServiceURLs["HomeURI"]; | ||
793 | |||
794 | GridRegion destination = m_GatekeeperConnector.GetHyperlinkRegion(gatekeeper, regionID, account.PrincipalID, homeURI, out message); | ||
735 | return destination; | 795 | return destination; |
736 | } | 796 | } |
737 | 797 | ||
@@ -924,6 +984,13 @@ namespace OpenSim.Services.LLLoginService | |||
924 | m_log.DebugFormat("[LLLOGIN SERVICE]: found new key {0} {1}", keyName, aCircuit.ServiceURLs[keyName]); | 984 | m_log.DebugFormat("[LLLOGIN SERVICE]: found new key {0} {1}", keyName, aCircuit.ServiceURLs[keyName]); |
925 | } | 985 | } |
926 | 986 | ||
987 | if (!account.ServiceURLs.ContainsKey("GatekeeperURI") && !string.IsNullOrEmpty(m_GatekeeperURL)) | ||
988 | { | ||
989 | m_log.DebugFormat("[LLLOGIN SERVICE]: adding gatekeeper uri {0}", m_GatekeeperURL); | ||
990 | account.ServiceURLs["GatekeeperURI"] = m_GatekeeperURL; | ||
991 | newUrls = true; | ||
992 | } | ||
993 | |||
927 | // The grid operator decided to override the defaults in the | 994 | // The grid operator decided to override the defaults in the |
928 | // [LoginService] configuration. Let's store the correct ones. | 995 | // [LoginService] configuration. Let's store the correct ones. |
929 | if (newUrls) | 996 | if (newUrls) |
@@ -934,13 +1001,21 @@ namespace OpenSim.Services.LLLoginService | |||
934 | 1001 | ||
935 | private bool LaunchAgentDirectly(ISimulationService simConnector, GridRegion region, AgentCircuitData aCircuit, TeleportFlags flags, out string reason) | 1002 | private bool LaunchAgentDirectly(ISimulationService simConnector, GridRegion region, AgentCircuitData aCircuit, TeleportFlags flags, out string reason) |
936 | { | 1003 | { |
937 | return simConnector.CreateAgent(region, aCircuit, (uint)flags, out reason); | 1004 | string version; |
1005 | |||
1006 | if ( | ||
1007 | !simConnector.QueryAccess( | ||
1008 | region, aCircuit.AgentID, null, true, aCircuit.startpos, "SIMULATION/0.3", new List<UUID>(), out version, out reason)) | ||
1009 | return false; | ||
1010 | |||
1011 | return simConnector.CreateAgent(null, region, aCircuit, (uint)flags, out reason); | ||
938 | } | 1012 | } |
939 | 1013 | ||
940 | private bool LaunchAgentIndirectly(GridRegion gatekeeper, GridRegion destination, AgentCircuitData aCircuit, IPEndPoint clientIP, out string reason) | 1014 | private bool LaunchAgentIndirectly(GridRegion gatekeeper, GridRegion destination, AgentCircuitData aCircuit, IPEndPoint clientIP, out string reason) |
941 | { | 1015 | { |
942 | m_log.Debug("[LLOGIN SERVICE] Launching agent at " + destination.RegionName); | 1016 | m_log.Debug("[LLOGIN SERVICE]: Launching agent at " + destination.RegionName); |
943 | if (m_UserAgentService.LoginAgentToGrid(aCircuit, gatekeeper, destination, true, out reason)) | 1017 | |
1018 | if (m_UserAgentService.LoginAgentToGrid(null, aCircuit, gatekeeper, destination, true, out reason)) | ||
944 | return true; | 1019 | return true; |
945 | return false; | 1020 | return false; |
946 | } | 1021 | } |
diff --git a/OpenSim/Services/LLLoginService/Properties/AssemblyInfo.cs b/OpenSim/Services/LLLoginService/Properties/AssemblyInfo.cs index c373351..4dc492a 100644 --- a/OpenSim/Services/LLLoginService/Properties/AssemblyInfo.cs +++ b/OpenSim/Services/LLLoginService/Properties/AssemblyInfo.cs | |||
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices; | |||
29 | // Build Number | 29 | // Build Number |
30 | // Revision | 30 | // Revision |
31 | // | 31 | // |
32 | [assembly: AssemblyVersion("0.8.0.*")] | 32 | [assembly: AssemblyVersion("0.8.2.*")] |
33 | 33 | ||
diff --git a/OpenSim/Services/MapImageService/MapImageService.cs b/OpenSim/Services/MapImageService/MapImageService.cs index 2db1d14..fcace3a 100644 --- a/OpenSim/Services/MapImageService/MapImageService.cs +++ b/OpenSim/Services/MapImageService/MapImageService.cs | |||
@@ -54,6 +54,9 @@ namespace OpenSim.Services.MapImageService | |||
54 | private static readonly ILog m_log = | 54 | private static readonly ILog m_log = |
55 | LogManager.GetLogger( | 55 | LogManager.GetLogger( |
56 | MethodBase.GetCurrentMethod().DeclaringType); | 56 | MethodBase.GetCurrentMethod().DeclaringType); |
57 | #pragma warning disable 414 | ||
58 | private string LogHeader = "[MAP IMAGE SERVICE]"; | ||
59 | #pragma warning restore 414 | ||
57 | 60 | ||
58 | private const int ZOOM_LEVELS = 8; | 61 | private const int ZOOM_LEVELS = 8; |
59 | private const int IMAGE_WIDTH = 256; | 62 | private const int IMAGE_WIDTH = 256; |
@@ -128,6 +131,16 @@ namespace OpenSim.Services.MapImageService | |||
128 | return false; | 131 | return false; |
129 | } | 132 | } |
130 | } | 133 | } |
134 | <<<<<<< HEAD | ||
135 | |||
136 | return UpdateMultiResolutionFilesAsync(x, y, out reason); | ||
137 | } | ||
138 | |||
139 | public bool RemoveMapTile(int x, int y, out string reason) | ||
140 | { | ||
141 | reason = String.Empty; | ||
142 | string fileName = GetFileName(1, x, y); | ||
143 | ======= | ||
131 | 144 | ||
132 | return UpdateMultiResolutionFiles(x, y, scopeID, out reason); | 145 | return UpdateMultiResolutionFiles(x, y, scopeID, out reason); |
133 | } | 146 | } |
@@ -136,24 +149,40 @@ namespace OpenSim.Services.MapImageService | |||
136 | { | 149 | { |
137 | reason = String.Empty; | 150 | reason = String.Empty; |
138 | string fileName = GetFileName(1, x, y, scopeID); | 151 | string fileName = GetFileName(1, x, y, scopeID); |
152 | >>>>>>> avn/ubitvar | ||
139 | 153 | ||
140 | lock (m_Sync) | 154 | lock (m_Sync) |
141 | { | 155 | { |
142 | try | 156 | try |
157 | <<<<<<< HEAD | ||
143 | { | 158 | { |
144 | File.Delete(fileName); | 159 | File.Delete(fileName); |
145 | } | 160 | } |
146 | catch (Exception e) | 161 | catch (Exception e) |
147 | { | 162 | { |
163 | ======= | ||
164 | { | ||
165 | File.Delete(fileName); | ||
166 | } | ||
167 | catch (Exception e) | ||
168 | { | ||
169 | >>>>>>> avn/ubitvar | ||
148 | m_log.WarnFormat("[MAP IMAGE SERVICE]: Unable to save delete file {0}: {1}", fileName, e); | 170 | m_log.WarnFormat("[MAP IMAGE SERVICE]: Unable to save delete file {0}: {1}", fileName, e); |
149 | reason = e.Message; | 171 | reason = e.Message; |
150 | return false; | 172 | return false; |
151 | } | 173 | } |
152 | } | 174 | } |
175 | <<<<<<< HEAD | ||
176 | |||
177 | return UpdateMultiResolutionFilesAsync(x, y, out reason); | ||
178 | } | ||
179 | |||
180 | ======= | ||
153 | 181 | ||
154 | return UpdateMultiResolutionFiles(x, y, scopeID, out reason); | 182 | return UpdateMultiResolutionFiles(x, y, scopeID, out reason); |
155 | } | 183 | } |
156 | 184 | ||
185 | >>>>>>> avn/ubitvar | ||
157 | // When large varregions start up, they can send piles of new map tiles. This causes | 186 | // When large varregions start up, they can send piles of new map tiles. This causes |
158 | // this multi-resolution routine to be called a zillion times an causes much CPU | 187 | // this multi-resolution routine to be called a zillion times an causes much CPU |
159 | // time to be spent creating multi-resolution tiles that will be replaced when | 188 | // time to be spent creating multi-resolution tiles that will be replaced when |
@@ -162,6 +191,25 @@ namespace OpenSim.Services.MapImageService | |||
162 | { | 191 | { |
163 | public int xx; | 192 | public int xx; |
164 | public int yy; | 193 | public int yy; |
194 | <<<<<<< HEAD | ||
195 | public mapToMultiRez(int pX, int pY) | ||
196 | { | ||
197 | xx = pX; | ||
198 | yy = pY; | ||
199 | } | ||
200 | }; | ||
201 | private Queue<mapToMultiRez> multiRezToBuild = new Queue<mapToMultiRez>(); | ||
202 | private bool UpdateMultiResolutionFilesAsync(int x, int y, out string reason) | ||
203 | { | ||
204 | reason = String.Empty; | ||
205 | lock (multiRezToBuild) | ||
206 | { | ||
207 | // m_log.DebugFormat("{0} UpdateMultiResolutionFilesAsync: scheduling update for <{1},{2}>", LogHeader, x, y); | ||
208 | multiRezToBuild.Enqueue(new mapToMultiRez(x, y)); | ||
209 | if (multiRezToBuild.Count == 1) | ||
210 | Util.FireAndForget( | ||
211 | DoUpdateMultiResolutionFilesAsync, null, "MapImageService.DoUpdateMultiResolutionFilesAsync"); | ||
212 | ======= | ||
165 | public UUID scopeID; | 213 | public UUID scopeID; |
166 | public mapToMultiRez(int pX, int pY, UUID pscopeID) | 214 | public mapToMultiRez(int pX, int pY, UUID pscopeID) |
167 | { | 215 | { |
@@ -183,6 +231,7 @@ namespace OpenSim.Services.MapImageService | |||
183 | if (multiRezToBuild.Count == 1) | 231 | if (multiRezToBuild.Count == 1) |
184 | Util.FireAndForget( | 232 | Util.FireAndForget( |
185 | DoUpdateMultiResolutionFilesAsync); | 233 | DoUpdateMultiResolutionFilesAsync); |
234 | >>>>>>> avn/ubitvar | ||
186 | } | 235 | } |
187 | 236 | ||
188 | return true; | 237 | return true; |
@@ -190,8 +239,15 @@ namespace OpenSim.Services.MapImageService | |||
190 | 239 | ||
191 | private void DoUpdateMultiResolutionFilesAsync(object o) | 240 | private void DoUpdateMultiResolutionFilesAsync(object o) |
192 | { | 241 | { |
242 | <<<<<<< HEAD | ||
243 | // This sleep causes the FireAndForget thread to be different than the invocation thread. | ||
244 | // It also allows other tiles to be uploaded so the multi-rez images are more likely | ||
245 | // to be correct. | ||
246 | Thread.Sleep(1 * 1000); | ||
247 | ======= | ||
193 | // let acumulate large region tiles | 248 | // let acumulate large region tiles |
194 | Thread.Sleep(60 * 1000); // large regions take time to upload tiles | 249 | Thread.Sleep(60 * 1000); // large regions take time to upload tiles |
250 | >>>>>>> avn/ubitvar | ||
195 | 251 | ||
196 | while (multiRezToBuild.Count > 0) | 252 | while (multiRezToBuild.Count > 0) |
197 | { | 253 | { |
@@ -205,22 +261,35 @@ namespace OpenSim.Services.MapImageService | |||
205 | { | 261 | { |
206 | int x = toMultiRez.xx; | 262 | int x = toMultiRez.xx; |
207 | int y = toMultiRez.yy; | 263 | int y = toMultiRez.yy; |
264 | <<<<<<< HEAD | ||
265 | // m_log.DebugFormat("{0} DoUpdateMultiResolutionFilesAsync: doing build for <{1},{2}>", LogHeader, x, y); | ||
266 | |||
267 | ======= | ||
208 | UUID scopeID = toMultiRez.scopeID; | 268 | UUID scopeID = toMultiRez.scopeID; |
209 | // m_log.DebugFormat("{0} DoUpdateMultiResolutionFilesAsync: doing build for <{1},{2}>", LogHeader, x, y); | 269 | // m_log.DebugFormat("{0} DoUpdateMultiResolutionFilesAsync: doing build for <{1},{2}>", LogHeader, x, y); |
210 | 270 | ||
211 | int width = 1; | 271 | int width = 1; |
272 | >>>>>>> avn/ubitvar | ||
212 | // Stitch seven more aggregate tiles together | 273 | // Stitch seven more aggregate tiles together |
213 | for (uint zoomLevel = 2; zoomLevel <= ZOOM_LEVELS; zoomLevel++) | 274 | for (uint zoomLevel = 2; zoomLevel <= ZOOM_LEVELS; zoomLevel++) |
214 | { | 275 | { |
215 | // Calculate the width (in full resolution tiles) and bottom-left | 276 | // Calculate the width (in full resolution tiles) and bottom-left |
216 | // corner of the current zoom level | 277 | // corner of the current zoom level |
278 | <<<<<<< HEAD | ||
279 | int width = (int)Math.Pow(2, (double)(zoomLevel - 1)); | ||
280 | ======= | ||
217 | width *= 2; | 281 | width *= 2; |
282 | >>>>>>> avn/ubitvar | ||
218 | int x1 = x - (x % width); | 283 | int x1 = x - (x % width); |
219 | int y1 = y - (y % width); | 284 | int y1 = y - (y % width); |
220 | 285 | ||
221 | lock (m_Sync) // must lock the reading and writing of the maptile files | 286 | lock (m_Sync) // must lock the reading and writing of the maptile files |
222 | { | 287 | { |
288 | <<<<<<< HEAD | ||
289 | if (!CreateTile(zoomLevel, x1, y1)) | ||
290 | ======= | ||
223 | if (!CreateTile(zoomLevel, x1, y1, scopeID)) | 291 | if (!CreateTile(zoomLevel, x1, y1, scopeID)) |
292 | >>>>>>> avn/ubitvar | ||
224 | { | 293 | { |
225 | m_log.WarnFormat("[MAP IMAGE SERVICE]: Unable to create tile for {0},{1} at zoom level {1}", x, y, zoomLevel); | 294 | m_log.WarnFormat("[MAP IMAGE SERVICE]: Unable to create tile for {0},{1} at zoom level {1}", x, y, zoomLevel); |
226 | return; | 295 | return; |
@@ -229,6 +298,10 @@ namespace OpenSim.Services.MapImageService | |||
229 | } | 298 | } |
230 | } | 299 | } |
231 | } | 300 | } |
301 | <<<<<<< HEAD | ||
302 | |||
303 | ======= | ||
304 | >>>>>>> avn/ubitvar | ||
232 | return; | 305 | return; |
233 | } | 306 | } |
234 | 307 | ||
diff --git a/OpenSim/Services/MapImageService/Properties/AssemblyInfo.cs b/OpenSim/Services/MapImageService/Properties/AssemblyInfo.cs index edadb26..e5f1bf9 100644 --- a/OpenSim/Services/MapImageService/Properties/AssemblyInfo.cs +++ b/OpenSim/Services/MapImageService/Properties/AssemblyInfo.cs | |||
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices; | |||
29 | // Build Number | 29 | // Build Number |
30 | // Revision | 30 | // Revision |
31 | // | 31 | // |
32 | [assembly: AssemblyVersion("0.8.0.*")] | 32 | [assembly: AssemblyVersion("0.8.2.*")] |
33 | 33 | ||
diff --git a/OpenSim/Services/PresenceService/PresenceService.cs b/OpenSim/Services/PresenceService/PresenceService.cs index ed2703e..0fe0200 100644 --- a/OpenSim/Services/PresenceService/PresenceService.cs +++ b/OpenSim/Services/PresenceService/PresenceService.cs | |||
@@ -41,9 +41,7 @@ namespace OpenSim.Services.PresenceService | |||
41 | { | 41 | { |
42 | public class PresenceService : PresenceServiceBase, IPresenceService | 42 | public class PresenceService : PresenceServiceBase, IPresenceService |
43 | { | 43 | { |
44 | private static readonly ILog m_log = | 44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
45 | LogManager.GetLogger( | ||
46 | MethodBase.GetCurrentMethod().DeclaringType); | ||
47 | 45 | ||
48 | protected bool m_allowDuplicatePresences = false; | 46 | protected bool m_allowDuplicatePresences = false; |
49 | 47 | ||
@@ -55,19 +53,15 @@ namespace OpenSim.Services.PresenceService | |||
55 | IConfig presenceConfig = config.Configs["PresenceService"]; | 53 | IConfig presenceConfig = config.Configs["PresenceService"]; |
56 | if (presenceConfig != null) | 54 | if (presenceConfig != null) |
57 | { | 55 | { |
58 | m_allowDuplicatePresences = | 56 | m_allowDuplicatePresences = presenceConfig.GetBoolean("AllowDuplicatePresences", m_allowDuplicatePresences); |
59 | presenceConfig.GetBoolean("AllowDuplicatePresences", | ||
60 | m_allowDuplicatePresences); | ||
61 | } | 57 | } |
62 | } | 58 | } |
63 | 59 | ||
64 | public bool LoginAgent(string userID, UUID sessionID, | 60 | public bool LoginAgent(string userID, UUID sessionID, UUID secureSessionID) |
65 | UUID secureSessionID) | ||
66 | { | 61 | { |
67 | //PresenceData[] d = m_Database.Get("UserID", userID); | 62 | PresenceData prevUser = GetUser(userID); |
68 | //m_Database.Get("UserID", userID); | ||
69 | 63 | ||
70 | if (!m_allowDuplicatePresences) | 64 | if (!m_allowDuplicatePresences && (prevUser != null)) |
71 | m_Database.Delete("UserID", userID.ToString()); | 65 | m_Database.Delete("UserID", userID.ToString()); |
72 | 66 | ||
73 | PresenceData data = new PresenceData(); | 67 | PresenceData data = new PresenceData(); |
@@ -80,19 +74,41 @@ namespace OpenSim.Services.PresenceService | |||
80 | 74 | ||
81 | m_Database.Store(data); | 75 | m_Database.Store(data); |
82 | 76 | ||
83 | m_log.DebugFormat("[PRESENCE SERVICE]: LoginAgent {0} with session {1} and ssession {2}", | 77 | string prevUserStr = ""; |
84 | userID, sessionID, secureSessionID); | 78 | if (prevUser != null) |
79 | prevUserStr = string.Format(". This user was already logged-in: session {0}, region {1}", prevUser.SessionID, prevUser.RegionID); | ||
80 | |||
81 | m_log.DebugFormat("[PRESENCE SERVICE]: LoginAgent: session {0}, user {1}, region {2}, secure session {3}{4}", | ||
82 | data.SessionID, data.UserID, data.RegionID, secureSessionID, prevUserStr); | ||
83 | |||
85 | return true; | 84 | return true; |
86 | } | 85 | } |
87 | 86 | ||
88 | public bool LogoutAgent(UUID sessionID) | 87 | public bool LogoutAgent(UUID sessionID) |
89 | { | 88 | { |
90 | m_log.DebugFormat("[PRESENCE SERVICE]: Session {0} logout", sessionID); | 89 | PresenceInfo presence = GetAgent(sessionID); |
90 | |||
91 | m_log.DebugFormat("[PRESENCE SERVICE]: LogoutAgent: session {0}, user {1}, region {2}", | ||
92 | sessionID, | ||
93 | (presence == null) ? null : presence.UserID, | ||
94 | (presence == null) ? null : presence.RegionID.ToString()); | ||
95 | |||
91 | return m_Database.Delete("SessionID", sessionID.ToString()); | 96 | return m_Database.Delete("SessionID", sessionID.ToString()); |
92 | } | 97 | } |
93 | 98 | ||
94 | public bool LogoutRegionAgents(UUID regionID) | 99 | public bool LogoutRegionAgents(UUID regionID) |
95 | { | 100 | { |
101 | PresenceData[] prevSessions = GetRegionAgents(regionID); | ||
102 | |||
103 | if ((prevSessions == null) || (prevSessions.Length == 0)) | ||
104 | return true; | ||
105 | |||
106 | m_log.DebugFormat("[PRESENCE SERVICE]: Logout users in region {0}: {1}", regionID, | ||
107 | string.Join(", ", Array.ConvertAll(prevSessions, session => session.UserID))); | ||
108 | |||
109 | // There's a small chance that LogoutRegionAgents() will logout different users than the | ||
110 | // list that was logged above, but it's unlikely and not worth dealing with. | ||
111 | |||
96 | m_Database.LogoutRegionAgents(regionID); | 112 | m_Database.LogoutRegionAgents(regionID); |
97 | 113 | ||
98 | return true; | 114 | return true; |
@@ -101,20 +117,26 @@ namespace OpenSim.Services.PresenceService | |||
101 | 117 | ||
102 | public bool ReportAgent(UUID sessionID, UUID regionID) | 118 | public bool ReportAgent(UUID sessionID, UUID regionID) |
103 | { | 119 | { |
104 | // m_log.DebugFormat("[PRESENCE SERVICE]: ReportAgent with session {0} in region {1}", sessionID, regionID); | ||
105 | try | 120 | try |
106 | { | 121 | { |
107 | PresenceData pdata = m_Database.Get(sessionID); | 122 | PresenceData presence = m_Database.Get(sessionID); |
108 | if (pdata == null) | 123 | |
109 | return false; | 124 | bool success; |
110 | if (pdata.Data == null) | 125 | if (presence == null) |
111 | return false; | 126 | success = false; |
127 | else | ||
128 | success = m_Database.ReportAgent(sessionID, regionID); | ||
112 | 129 | ||
113 | return m_Database.ReportAgent(sessionID, regionID); | 130 | m_log.DebugFormat("[PRESENCE SERVICE]: ReportAgent{0}: session {1}, user {2}, region {3}. Previously: {4}", |
131 | success ? "" : " failed", | ||
132 | sessionID, (presence == null) ? null : presence.UserID, regionID, | ||
133 | (presence == null) ? "not logged-in" : "region " + presence.RegionID); | ||
134 | |||
135 | return success; | ||
114 | } | 136 | } |
115 | catch (Exception e) | 137 | catch (Exception e) |
116 | { | 138 | { |
117 | m_log.DebugFormat("[PRESENCE SERVICE]: ReportAgent threw exception {0}", e.StackTrace); | 139 | m_log.Debug(string.Format("[PRESENCE SERVICE]: ReportAgent for session {0} threw exception ", sessionID), e); |
118 | return false; | 140 | return false; |
119 | } | 141 | } |
120 | } | 142 | } |
@@ -139,8 +161,7 @@ namespace OpenSim.Services.PresenceService | |||
139 | 161 | ||
140 | foreach (string userIDStr in userIDs) | 162 | foreach (string userIDStr in userIDs) |
141 | { | 163 | { |
142 | PresenceData[] data = m_Database.Get("UserID", | 164 | PresenceData[] data = m_Database.Get("UserID", userIDStr); |
143 | userIDStr); | ||
144 | 165 | ||
145 | foreach (PresenceData d in data) | 166 | foreach (PresenceData d in data) |
146 | { | 167 | { |
@@ -158,5 +179,23 @@ namespace OpenSim.Services.PresenceService | |||
158 | 179 | ||
159 | return info.ToArray(); | 180 | return info.ToArray(); |
160 | } | 181 | } |
182 | |||
183 | /// <summary> | ||
184 | /// Return the user's Presence. This only really works well if !AllowDuplicatePresences, but that's the default. | ||
185 | /// </summary> | ||
186 | private PresenceData GetUser(string userID) | ||
187 | { | ||
188 | PresenceData[] data = m_Database.Get("UserID", userID); | ||
189 | if (data.Length > 0) | ||
190 | return data[0]; | ||
191 | else | ||
192 | return null; | ||
193 | } | ||
194 | |||
195 | private PresenceData[] GetRegionAgents(UUID regionID) | ||
196 | { | ||
197 | return m_Database.Get("RegionID", regionID.ToString()); | ||
198 | } | ||
199 | |||
161 | } | 200 | } |
162 | } \ No newline at end of file | 201 | } \ No newline at end of file |
diff --git a/OpenSim/Services/PresenceService/Properties/AssemblyInfo.cs b/OpenSim/Services/PresenceService/Properties/AssemblyInfo.cs index 3bfd1fc..9ef0ff3 100644 --- a/OpenSim/Services/PresenceService/Properties/AssemblyInfo.cs +++ b/OpenSim/Services/PresenceService/Properties/AssemblyInfo.cs | |||
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices; | |||
29 | // Build Number | 29 | // Build Number |
30 | // Revision | 30 | // Revision |
31 | // | 31 | // |
32 | [assembly: AssemblyVersion("0.8.0.*")] | 32 | [assembly: AssemblyVersion("0.8.2.*")] |
33 | 33 | ||
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationDataService.cs b/OpenSim/Services/SimulationService/SimulationDataService.cs index 4759838..7a544fa 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationDataService.cs +++ b/OpenSim/Services/SimulationService/SimulationDataService.cs | |||
@@ -29,7 +29,6 @@ using System; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using OpenMetaverse; | 30 | using OpenMetaverse; |
31 | using log4net; | 31 | using log4net; |
32 | using Mono.Addins; | ||
33 | using Nini.Config; | 32 | using Nini.Config; |
34 | using System.Reflection; | 33 | using System.Reflection; |
35 | using OpenSim.Services.Base; | 34 | using OpenSim.Services.Base; |
@@ -39,7 +38,7 @@ using OpenSim.Framework; | |||
39 | using OpenSim.Region.Framework.Interfaces; | 38 | using OpenSim.Region.Framework.Interfaces; |
40 | using OpenSim.Region.Framework.Scenes; | 39 | using OpenSim.Region.Framework.Scenes; |
41 | 40 | ||
42 | namespace OpenSim.Services.Connectors | 41 | namespace OpenSim.Services.SimulationService |
43 | { | 42 | { |
44 | public class SimulationDataService : ServiceBase, ISimulationDataService | 43 | public class SimulationDataService : ServiceBase, ISimulationDataService |
45 | { | 44 | { |
diff --git a/OpenSim/Services/UserAccountService/AgentPreferencesService.cs b/OpenSim/Services/UserAccountService/AgentPreferencesService.cs new file mode 100644 index 0000000..1808ee5 --- /dev/null +++ b/OpenSim/Services/UserAccountService/AgentPreferencesService.cs | |||
@@ -0,0 +1,82 @@ | |||
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.Reflection; | ||
31 | using log4net; | ||
32 | using Nini.Config; | ||
33 | using OpenMetaverse; | ||
34 | using OpenSim.Data; | ||
35 | using OpenSim.Framework; | ||
36 | using OpenSim.Services.Interfaces; | ||
37 | |||
38 | namespace OpenSim.Services.UserAccountService | ||
39 | { | ||
40 | public class AgentPreferencesService : AgentPreferencesServiceBase, IAgentPreferencesService | ||
41 | { | ||
42 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
43 | |||
44 | public AgentPreferencesService(IConfigSource config) : base(config) | ||
45 | { | ||
46 | m_log.Debug("[AGENT PREFERENCES SERVICE]: Starting agent preferences service"); | ||
47 | } | ||
48 | |||
49 | public AgentPrefs GetAgentPreferences(UUID principalID) | ||
50 | { | ||
51 | AgentPreferencesData d = m_Database.GetPrefs(principalID); | ||
52 | AgentPrefs prefs = (d == null) ? new AgentPrefs(principalID) : new AgentPrefs(d.Data); | ||
53 | return prefs; | ||
54 | } | ||
55 | |||
56 | public bool StoreAgentPreferences(AgentPrefs data) | ||
57 | { | ||
58 | AgentPreferencesData d = new AgentPreferencesData(); | ||
59 | d.Data = new Dictionary<string, string>(); | ||
60 | d.Data["PrincipalID"] = data.PrincipalID.ToString(); | ||
61 | d.Data["AccessPrefs"] = data.AccessPrefs; | ||
62 | d.Data["HoverHeight"] = data.HoverHeight.ToString(); | ||
63 | d.Data["Language"] = data.Language; | ||
64 | d.Data["LanguageIsPublic"] = (data.LanguageIsPublic ? "1" : "0"); | ||
65 | d.Data["PermEveryone"] = data.PermEveryone.ToString(); | ||
66 | d.Data["PermGroup"] = data.PermGroup.ToString(); | ||
67 | d.Data["PermNextOwner"] = data.PermNextOwner.ToString(); | ||
68 | return m_Database.Store(d); | ||
69 | } | ||
70 | |||
71 | public string GetLang(UUID principalID) | ||
72 | { | ||
73 | AgentPrefs data = GetAgentPreferences(principalID); | ||
74 | if (data != null) | ||
75 | { | ||
76 | if (data.LanguageIsPublic) | ||
77 | return data.Language; | ||
78 | } | ||
79 | return "en-us"; | ||
80 | } | ||
81 | } | ||
82 | } | ||
diff --git a/OpenSim/Services/UserAccountService/AgentPreferencesServiceBase.cs b/OpenSim/Services/UserAccountService/AgentPreferencesServiceBase.cs new file mode 100644 index 0000000..5974349 --- /dev/null +++ b/OpenSim/Services/UserAccountService/AgentPreferencesServiceBase.cs | |||
@@ -0,0 +1,73 @@ | |||
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.Data; | ||
32 | using OpenSim.Services.Interfaces; | ||
33 | using OpenSim.Services.Base; | ||
34 | |||
35 | namespace OpenSim.Services.UserAccountService | ||
36 | { | ||
37 | public class AgentPreferencesServiceBase: ServiceBase | ||
38 | { | ||
39 | protected IAgentPreferencesData m_Database = null; | ||
40 | |||
41 | public AgentPreferencesServiceBase(IConfigSource config) : base(config) | ||
42 | { | ||
43 | string dllName = String.Empty; | ||
44 | string connString = String.Empty; | ||
45 | string realm = "AgentPrefs"; | ||
46 | |||
47 | IConfig dbConfig = config.Configs["DatabaseService"]; | ||
48 | if (dbConfig != null) | ||
49 | { | ||
50 | dllName = dbConfig.GetString("StorageProvider", String.Empty); | ||
51 | connString = dbConfig.GetString("ConnectionString", String.Empty); | ||
52 | } | ||
53 | |||
54 | IConfig userConfig = config.Configs["AgentPreferencesService"]; | ||
55 | if (userConfig == null) | ||
56 | throw new Exception("No AgentPreferencesService configuration"); | ||
57 | |||
58 | dllName = userConfig.GetString("StorageProvider", dllName); | ||
59 | |||
60 | if (dllName == String.Empty) | ||
61 | throw new Exception("No StorageProvider configured"); | ||
62 | |||
63 | connString = userConfig.GetString("ConnectionString", connString); | ||
64 | |||
65 | realm = userConfig.GetString("Realm", realm); | ||
66 | |||
67 | m_Database = LoadPlugin<IAgentPreferencesData>(dllName, new Object[] {connString, realm}); | ||
68 | |||
69 | if (m_Database == null) | ||
70 | throw new Exception("Could not find a storage interface in the given module"); | ||
71 | } | ||
72 | } | ||
73 | } | ||
diff --git a/OpenSim/Services/UserAccountService/GridUserService.cs b/OpenSim/Services/UserAccountService/GridUserService.cs index bef1691..e4bcf15 100644 --- a/OpenSim/Services/UserAccountService/GridUserService.cs +++ b/OpenSim/Services/UserAccountService/GridUserService.cs | |||
@@ -43,19 +43,58 @@ namespace OpenSim.Services.UserAccountService | |||
43 | public class GridUserService : GridUserServiceBase, IGridUserService | 43 | public class GridUserService : GridUserServiceBase, IGridUserService |
44 | { | 44 | { |
45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
46 | private static bool m_Initialized; | ||
46 | 47 | ||
47 | public GridUserService(IConfigSource config) : base(config) | 48 | public GridUserService(IConfigSource config) : base(config) |
48 | { | 49 | { |
49 | m_log.Debug("[GRID USER SERVICE]: Starting user grid service"); | 50 | m_log.Debug("[GRID USER SERVICE]: Starting user grid service"); |
50 | 51 | ||
51 | MainConsole.Instance.Commands.AddCommand( | 52 | if (!m_Initialized) |
52 | "Users", false, | 53 | { |
53 | "show grid users online", | 54 | m_Initialized = true; |
54 | "show grid users online", | 55 | |
55 | "Show number of grid users registered as online.", | 56 | MainConsole.Instance.Commands.AddCommand( |
56 | "This number may not be accurate as a region may crash or not be cleanly shutdown and leave grid users shown as online\n." | 57 | "Users", false, |
57 | + "For this reason, users online for more than 5 days are not currently counted", | 58 | "show grid user", |
58 | HandleShowGridUsersOnline); | 59 | "show grid user <ID>", |
60 | "Show grid user entry or entries that match or start with the given ID. This will normally be a UUID.", | ||
61 | "This is for debug purposes to see what data is found for a particular user id.", | ||
62 | HandleShowGridUser); | ||
63 | |||
64 | MainConsole.Instance.Commands.AddCommand( | ||
65 | "Users", false, | ||
66 | "show grid users online", | ||
67 | "show grid users online", | ||
68 | "Show number of grid users registered as online.", | ||
69 | "This number may not be accurate as a region may crash or not be cleanly shutdown and leave grid users shown as online\n." | ||
70 | + "For this reason, users online for more than 5 days are not currently counted", | ||
71 | HandleShowGridUsersOnline); | ||
72 | } | ||
73 | } | ||
74 | |||
75 | protected void HandleShowGridUser(string module, string[] cmdparams) | ||
76 | { | ||
77 | if (cmdparams.Length != 4) | ||
78 | { | ||
79 | MainConsole.Instance.Output("Usage: show grid user <UUID>"); | ||
80 | return; | ||
81 | } | ||
82 | |||
83 | GridUserData[] data = m_Database.GetAll(cmdparams[3]); | ||
84 | |||
85 | foreach (GridUserData gu in data) | ||
86 | { | ||
87 | ConsoleDisplayList cdl = new ConsoleDisplayList(); | ||
88 | |||
89 | cdl.AddRow("User ID", gu.UserID); | ||
90 | |||
91 | foreach (KeyValuePair<string,string> kvp in gu.Data) | ||
92 | cdl.AddRow(kvp.Key, kvp.Value); | ||
93 | |||
94 | MainConsole.Instance.Output(cdl.ToString()); | ||
95 | } | ||
96 | |||
97 | MainConsole.Instance.OutputFormat("Entries: {0}", data.Length); | ||
59 | } | 98 | } |
60 | 99 | ||
61 | protected void HandleShowGridUsersOnline(string module, string[] cmdparams) | 100 | protected void HandleShowGridUsersOnline(string module, string[] cmdparams) |
@@ -87,11 +126,13 @@ namespace OpenSim.Services.UserAccountService | |||
87 | MainConsole.Instance.OutputFormat("Users online: {0}", onlineRecentlyCount); | 126 | MainConsole.Instance.OutputFormat("Users online: {0}", onlineRecentlyCount); |
88 | } | 127 | } |
89 | 128 | ||
90 | public virtual GridUserInfo GetGridUserInfo(string userID) | 129 | private GridUserData GetGridUserData(string userID) |
91 | { | 130 | { |
92 | GridUserData d = null; | 131 | GridUserData d = null; |
93 | if (userID.Length > 36) // it's a UUI | 132 | if (userID.Length > 36) // it's a UUI |
133 | { | ||
94 | d = m_Database.Get(userID); | 134 | d = m_Database.Get(userID); |
135 | } | ||
95 | else // it's a UUID | 136 | else // it's a UUID |
96 | { | 137 | { |
97 | GridUserData[] ds = m_Database.GetAll(userID); | 138 | GridUserData[] ds = m_Database.GetAll(userID); |
@@ -107,6 +148,13 @@ namespace OpenSim.Services.UserAccountService | |||
107 | } | 148 | } |
108 | } | 149 | } |
109 | 150 | ||
151 | return d; | ||
152 | } | ||
153 | |||
154 | public virtual GridUserInfo GetGridUserInfo(string userID) | ||
155 | { | ||
156 | GridUserData d = GetGridUserData(userID); | ||
157 | |||
110 | if (d == null) | 158 | if (d == null) |
111 | return null; | 159 | return null; |
112 | 160 | ||
@@ -140,7 +188,8 @@ namespace OpenSim.Services.UserAccountService | |||
140 | public GridUserInfo LoggedIn(string userID) | 188 | public GridUserInfo LoggedIn(string userID) |
141 | { | 189 | { |
142 | m_log.DebugFormat("[GRID USER SERVICE]: User {0} is online", userID); | 190 | m_log.DebugFormat("[GRID USER SERVICE]: User {0} is online", userID); |
143 | GridUserData d = m_Database.Get(userID); | 191 | |
192 | GridUserData d = GetGridUserData(userID); | ||
144 | 193 | ||
145 | if (d == null) | 194 | if (d == null) |
146 | { | 195 | { |
@@ -159,7 +208,8 @@ namespace OpenSim.Services.UserAccountService | |||
159 | public bool LoggedOut(string userID, UUID sessionID, UUID regionID, Vector3 lastPosition, Vector3 lastLookAt) | 208 | public bool LoggedOut(string userID, UUID sessionID, UUID regionID, Vector3 lastPosition, Vector3 lastLookAt) |
160 | { | 209 | { |
161 | m_log.DebugFormat("[GRID USER SERVICE]: User {0} is offline", userID); | 210 | m_log.DebugFormat("[GRID USER SERVICE]: User {0} is offline", userID); |
162 | GridUserData d = m_Database.Get(userID); | 211 | |
212 | GridUserData d = GetGridUserData(userID); | ||
163 | 213 | ||
164 | if (d == null) | 214 | if (d == null) |
165 | { | 215 | { |
@@ -178,7 +228,8 @@ namespace OpenSim.Services.UserAccountService | |||
178 | 228 | ||
179 | public bool SetHome(string userID, UUID homeID, Vector3 homePosition, Vector3 homeLookAt) | 229 | public bool SetHome(string userID, UUID homeID, Vector3 homePosition, Vector3 homeLookAt) |
180 | { | 230 | { |
181 | GridUserData d = m_Database.Get(userID); | 231 | GridUserData d = GetGridUserData(userID); |
232 | |||
182 | if (d == null) | 233 | if (d == null) |
183 | { | 234 | { |
184 | d = new GridUserData(); | 235 | d = new GridUserData(); |
@@ -196,7 +247,8 @@ namespace OpenSim.Services.UserAccountService | |||
196 | { | 247 | { |
197 | // m_log.DebugFormat("[GRID USER SERVICE]: SetLastPosition for {0}", userID); | 248 | // m_log.DebugFormat("[GRID USER SERVICE]: SetLastPosition for {0}", userID); |
198 | 249 | ||
199 | GridUserData d = m_Database.Get(userID); | 250 | GridUserData d = GetGridUserData(userID); |
251 | |||
200 | if (d == null) | 252 | if (d == null) |
201 | { | 253 | { |
202 | d = new GridUserData(); | 254 | d = new GridUserData(); |
@@ -210,4 +262,4 @@ namespace OpenSim.Services.UserAccountService | |||
210 | return m_Database.Store(d); | 262 | return m_Database.Store(d); |
211 | } | 263 | } |
212 | } | 264 | } |
213 | } | 265 | } \ No newline at end of file |
diff --git a/OpenSim/Services/UserAccountService/GridUserServiceBase.cs b/OpenSim/Services/UserAccountService/GridUserServiceBase.cs index 990cb63..8c5f5df 100644 --- a/OpenSim/Services/UserAccountService/GridUserServiceBase.cs +++ b/OpenSim/Services/UserAccountService/GridUserServiceBase.cs | |||
@@ -60,12 +60,12 @@ namespace OpenSim.Services.UserAccountService | |||
60 | // | 60 | // |
61 | // [GridUsetService] section overrides [DatabaseService], if it exists | 61 | // [GridUsetService] section overrides [DatabaseService], if it exists |
62 | // | 62 | // |
63 | IConfig presenceConfig = config.Configs["GridUserService"]; | 63 | IConfig usersConfig = config.Configs["GridUserService"]; |
64 | if (presenceConfig != null) | 64 | if (usersConfig != null) |
65 | { | 65 | { |
66 | dllName = presenceConfig.GetString("StorageProvider", dllName); | 66 | dllName = usersConfig.GetString("StorageProvider", dllName); |
67 | connString = presenceConfig.GetString("ConnectionString", connString); | 67 | connString = usersConfig.GetString("ConnectionString", connString); |
68 | realm = presenceConfig.GetString("Realm", realm); | 68 | realm = usersConfig.GetString("Realm", realm); |
69 | } | 69 | } |
70 | 70 | ||
71 | // | 71 | // |
diff --git a/OpenSim/Services/UserAccountService/Properties/AssemblyInfo.cs b/OpenSim/Services/UserAccountService/Properties/AssemblyInfo.cs index 16ae6bd..33933a0 100644 --- a/OpenSim/Services/UserAccountService/Properties/AssemblyInfo.cs +++ b/OpenSim/Services/UserAccountService/Properties/AssemblyInfo.cs | |||
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices; | |||
29 | // Build Number | 29 | // Build Number |
30 | // Revision | 30 | // Revision |
31 | // | 31 | // |
32 | [assembly: AssemblyVersion("0.8.0.*")] | 32 | [assembly: AssemblyVersion("0.8.2.*")] |
33 | 33 | ||
diff --git a/OpenSim/Services/UserAccountService/UserAccountService.cs b/OpenSim/Services/UserAccountService/UserAccountService.cs index 772ab97..987a07d 100644 --- a/OpenSim/Services/UserAccountService/UserAccountService.cs +++ b/OpenSim/Services/UserAccountService/UserAccountService.cs | |||
@@ -98,7 +98,12 @@ namespace OpenSim.Services.UserAccountService | |||
98 | MainConsole.Instance.Commands.AddCommand("Users", false, | 98 | MainConsole.Instance.Commands.AddCommand("Users", false, |
99 | "reset user password", | 99 | "reset user password", |
100 | "reset user password [<first> [<last> [<password>]]]", | 100 | "reset user password [<first> [<last> [<password>]]]", |
101 | "Reset a user password", HandleResetUserPassword); | 101 | "Reset a user password", HandleResetUserPassword); |
102 | |||
103 | MainConsole.Instance.Commands.AddCommand("Users", false, | ||
104 | "reset user email", | ||
105 | "reset user email [<first> [<last> [<email>]]]", | ||
106 | "Reset a user email address", HandleResetUserEmail); | ||
102 | 107 | ||
103 | MainConsole.Instance.Commands.AddCommand("Users", false, | 108 | MainConsole.Instance.Commands.AddCommand("Users", false, |
104 | "set user level", | 109 | "set user level", |
@@ -260,6 +265,10 @@ namespace OpenSim.Services.UserAccountService | |||
260 | return MakeUserAccount(d[0]); | 265 | return MakeUserAccount(d[0]); |
261 | } | 266 | } |
262 | 267 | ||
268 | public void InvalidateCache(UUID userID) | ||
269 | { | ||
270 | } | ||
271 | |||
263 | public bool StoreUserAccount(UserAccount data) | 272 | public bool StoreUserAccount(UserAccount data) |
264 | { | 273 | { |
265 | // m_log.DebugFormat( | 274 | // m_log.DebugFormat( |
@@ -435,6 +444,43 @@ namespace OpenSim.Services.UserAccountService | |||
435 | MainConsole.Instance.OutputFormat("Password reset for user {0} {1}", firstName, lastName); | 444 | MainConsole.Instance.OutputFormat("Password reset for user {0} {1}", firstName, lastName); |
436 | } | 445 | } |
437 | 446 | ||
447 | protected void HandleResetUserEmail(string module, string[] cmdparams) | ||
448 | { | ||
449 | string firstName; | ||
450 | string lastName; | ||
451 | string newEmail; | ||
452 | |||
453 | if (cmdparams.Length < 4) | ||
454 | firstName = MainConsole.Instance.CmdPrompt("First name"); | ||
455 | else firstName = cmdparams[3]; | ||
456 | |||
457 | if (cmdparams.Length < 5) | ||
458 | lastName = MainConsole.Instance.CmdPrompt("Last name"); | ||
459 | else lastName = cmdparams[4]; | ||
460 | |||
461 | if (cmdparams.Length < 6) | ||
462 | newEmail = MainConsole.Instance.PasswdPrompt("New Email"); | ||
463 | else newEmail = cmdparams[5]; | ||
464 | |||
465 | UserAccount account = GetUserAccount(UUID.Zero, firstName, lastName); | ||
466 | if (account == null) | ||
467 | { | ||
468 | MainConsole.Instance.OutputFormat("No such user as {0} {1}", firstName, lastName); | ||
469 | return; | ||
470 | } | ||
471 | |||
472 | bool success = false; | ||
473 | |||
474 | account.Email = newEmail; | ||
475 | |||
476 | success = StoreUserAccount(account); | ||
477 | if (!success) | ||
478 | MainConsole.Instance.OutputFormat("Unable to set Email for account {0} {1}.", firstName, lastName); | ||
479 | else | ||
480 | MainConsole.Instance.OutputFormat("User Email set for user {0} {1} to {2}", firstName, lastName, account.Email); | ||
481 | } | ||
482 | |||
483 | |||
438 | protected void HandleSetUserLevel(string module, string[] cmdparams) | 484 | protected void HandleSetUserLevel(string module, string[] cmdparams) |
439 | { | 485 | { |
440 | string firstName; | 486 | string firstName; |
@@ -495,7 +541,6 @@ namespace OpenSim.Services.UserAccountService | |||
495 | { | 541 | { |
496 | account.ServiceURLs = new Dictionary<string, object>(); | 542 | account.ServiceURLs = new Dictionary<string, object>(); |
497 | account.ServiceURLs["HomeURI"] = string.Empty; | 543 | account.ServiceURLs["HomeURI"] = string.Empty; |
498 | account.ServiceURLs["GatekeeperURI"] = string.Empty; | ||
499 | account.ServiceURLs["InventoryServerURI"] = string.Empty; | 544 | account.ServiceURLs["InventoryServerURI"] = string.Empty; |
500 | account.ServiceURLs["AssetServerURI"] = string.Empty; | 545 | account.ServiceURLs["AssetServerURI"] = string.Empty; |
501 | } | 546 | } |
@@ -569,7 +614,7 @@ namespace OpenSim.Services.UserAccountService | |||
569 | { | 614 | { |
570 | m_log.DebugFormat("[USER ACCOUNT SERVICE]: Creating default appearance items for {0}", principalID); | 615 | m_log.DebugFormat("[USER ACCOUNT SERVICE]: Creating default appearance items for {0}", principalID); |
571 | 616 | ||
572 | InventoryFolderBase bodyPartsFolder = m_InventoryService.GetFolderForType(principalID, AssetType.Bodypart); | 617 | InventoryFolderBase bodyPartsFolder = m_InventoryService.GetFolderForType(principalID, FolderType.BodyPart); |
573 | 618 | ||
574 | InventoryItemBase eyes = new InventoryItemBase(UUID.Random(), principalID); | 619 | InventoryItemBase eyes = new InventoryItemBase(UUID.Random(), principalID); |
575 | eyes.AssetID = new UUID("4bb6fa4d-1cd2-498a-a84c-95c1a0e745a7"); | 620 | eyes.AssetID = new UUID("4bb6fa4d-1cd2-498a-a84c-95c1a0e745a7"); |
@@ -631,7 +676,7 @@ namespace OpenSim.Services.UserAccountService | |||
631 | hair.Flags = (uint)WearableType.Hair; | 676 | hair.Flags = (uint)WearableType.Hair; |
632 | m_InventoryService.AddItem(hair); | 677 | m_InventoryService.AddItem(hair); |
633 | 678 | ||
634 | InventoryFolderBase clothingFolder = m_InventoryService.GetFolderForType(principalID, AssetType.Clothing); | 679 | InventoryFolderBase clothingFolder = m_InventoryService.GetFolderForType(principalID, FolderType.Clothing); |
635 | 680 | ||
636 | InventoryItemBase shirt = new InventoryItemBase(UUID.Random(), principalID); | 681 | InventoryItemBase shirt = new InventoryItemBase(UUID.Random(), principalID); |
637 | shirt.AssetID = AvatarWearable.DEFAULT_SHIRT_ASSET; | 682 | shirt.AssetID = AvatarWearable.DEFAULT_SHIRT_ASSET; |
diff --git a/OpenSim/Services/UserProfilesService/UserProfilesService.cs b/OpenSim/Services/UserProfilesService/UserProfilesService.cs index 038e993..35fe31b 100644 --- a/OpenSim/Services/UserProfilesService/UserProfilesService.cs +++ b/OpenSim/Services/UserProfilesService/UserProfilesService.cs | |||
@@ -37,7 +37,6 @@ using OpenSim.Data; | |||
37 | using OpenMetaverse; | 37 | using OpenMetaverse; |
38 | using OpenMetaverse.StructuredData; | 38 | using OpenMetaverse.StructuredData; |
39 | using OpenSim.Framework; | 39 | using OpenSim.Framework; |
40 | using OpenSim.Services.UserAccountService; | ||
41 | 40 | ||
42 | namespace OpenSim.Services.ProfilesService | 41 | namespace OpenSim.Services.ProfilesService |
43 | { | 42 | { |
@@ -48,7 +47,6 @@ namespace OpenSim.Services.ProfilesService | |||
48 | MethodBase.GetCurrentMethod().DeclaringType); | 47 | MethodBase.GetCurrentMethod().DeclaringType); |
49 | 48 | ||
50 | IUserAccountService userAccounts; | 49 | IUserAccountService userAccounts; |
51 | IAuthenticationService authService; | ||
52 | 50 | ||
53 | public UserProfilesService(IConfigSource config, string configName): | 51 | public UserProfilesService(IConfigSource config, string configName): |
54 | base(config, configName) | 52 | base(config, configName) |
@@ -56,7 +54,7 @@ namespace OpenSim.Services.ProfilesService | |||
56 | IConfig Config = config.Configs[configName]; | 54 | IConfig Config = config.Configs[configName]; |
57 | if (Config == null) | 55 | if (Config == null) |
58 | { | 56 | { |
59 | m_log.Warn("[PROFILES]: No configuration found!"); | 57 | m_log.Warn("[PROFILES SERVICE]: No configuration found!"); |
60 | return; | 58 | return; |
61 | } | 59 | } |
62 | Object[] args = null; | 60 | Object[] args = null; |
@@ -67,9 +65,6 @@ namespace OpenSim.Services.ProfilesService | |||
67 | userAccounts = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args); | 65 | userAccounts = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args); |
68 | 66 | ||
69 | args = new Object[] { config }; | 67 | args = new Object[] { config }; |
70 | string authServiceConfig = Config.GetString("AuthenticationServiceModule", String.Empty); | ||
71 | if (accountService != string.Empty) | ||
72 | authService = ServerUtils.LoadPlugin<IAuthenticationService>(authServiceConfig, args); | ||
73 | } | 68 | } |
74 | 69 | ||
75 | #region Classifieds | 70 | #region Classifieds |
@@ -178,23 +173,22 @@ namespace OpenSim.Services.ProfilesService | |||
178 | account = userAccounts.GetUserAccount(UUID.Zero, pref.UserId); | 173 | account = userAccounts.GetUserAccount(UUID.Zero, pref.UserId); |
179 | if(string.IsNullOrEmpty(account.Email)) | 174 | if(string.IsNullOrEmpty(account.Email)) |
180 | { | 175 | { |
181 | result = "No Email address on record!"; | 176 | pref.EMail = string.Empty; |
182 | return false; | ||
183 | } | 177 | } |
184 | else | 178 | else |
185 | pref.EMail = account.Email; | 179 | pref.EMail = account.Email; |
186 | } | 180 | } |
187 | catch | 181 | catch |
188 | { | 182 | { |
189 | m_log.Info ("[PROFILES]: UserAccountService Exception: Could not get user account"); | 183 | m_log.Error ("[PROFILES SERVICE]: UserAccountService Exception: Could not get user account"); |
190 | result = "Missing Email address!"; | 184 | result = "UserAccountService settings error in UserProfileService!"; |
191 | return false; | 185 | return false; |
192 | } | 186 | } |
193 | } | 187 | } |
194 | else | 188 | else |
195 | { | 189 | { |
196 | m_log.Info ("[PROFILES]: UserAccountService: Could not get user account"); | 190 | m_log.Error ("[PROFILES SERVICE]: UserAccountService: Could not get user account"); |
197 | result = "Missing Email address!"; | 191 | result = "UserAccountService settings error in UserProfileService!"; |
198 | return false; | 192 | return false; |
199 | } | 193 | } |
200 | } | 194 | } |
@@ -203,6 +197,9 @@ namespace OpenSim.Services.ProfilesService | |||
203 | 197 | ||
204 | public bool UserPreferencesRequest(ref UserPreferences pref, ref string result) | 198 | public bool UserPreferencesRequest(ref UserPreferences pref, ref string result) |
205 | { | 199 | { |
200 | if (!ProfilesData.GetUserPreferences(ref pref, ref result)) | ||
201 | return false; | ||
202 | |||
206 | if(string.IsNullOrEmpty(pref.EMail)) | 203 | if(string.IsNullOrEmpty(pref.EMail)) |
207 | { | 204 | { |
208 | UserAccount account = new UserAccount(); | 205 | UserAccount account = new UserAccount(); |
@@ -213,27 +210,33 @@ namespace OpenSim.Services.ProfilesService | |||
213 | account = userAccounts.GetUserAccount(UUID.Zero, pref.UserId); | 210 | account = userAccounts.GetUserAccount(UUID.Zero, pref.UserId); |
214 | if(string.IsNullOrEmpty(account.Email)) | 211 | if(string.IsNullOrEmpty(account.Email)) |
215 | { | 212 | { |
216 | result = "No Email address on record!"; | 213 | pref.EMail = string.Empty; |
217 | return false; | ||
218 | } | 214 | } |
219 | else | 215 | else |
216 | { | ||
220 | pref.EMail = account.Email; | 217 | pref.EMail = account.Email; |
218 | UserPreferencesUpdate(ref pref, ref result); | ||
219 | } | ||
221 | } | 220 | } |
222 | catch | 221 | catch |
223 | { | 222 | { |
224 | m_log.Info ("[PROFILES]: UserAccountService Exception: Could not get user account"); | 223 | m_log.Error ("[PROFILES SERVICE]: UserAccountService Exception: Could not get user account"); |
225 | result = "Missing Email address!"; | 224 | result = "UserAccountService settings error in UserProfileService!"; |
226 | return false; | 225 | return false; |
227 | } | 226 | } |
228 | } | 227 | } |
229 | else | 228 | else |
230 | { | 229 | { |
231 | m_log.Info ("[PROFILES]: UserAccountService: Could not get user account"); | 230 | m_log.Error ("[PROFILES SERVICE]: UserAccountService: Could not get user account"); |
232 | result = "Missing Email address!"; | 231 | result = "UserAccountService settings error in UserProfileService!"; |
233 | return false; | 232 | return false; |
234 | } | 233 | } |
235 | } | 234 | } |
236 | return ProfilesData.GetUserPreferences(ref pref, ref result); | 235 | |
236 | if(string.IsNullOrEmpty(pref.EMail)) | ||
237 | pref.EMail = "No Email Address On Record"; | ||
238 | |||
239 | return true; | ||
237 | } | 240 | } |
238 | #endregion User Preferences | 241 | #endregion User Preferences |
239 | */ | 242 | */ |
diff --git a/OpenSim/Services/UserProfilesService/UserProfilesServiceBase.cs b/OpenSim/Services/UserProfilesService/UserProfilesServiceBase.cs index 927f7c9..c31578f 100644 --- a/OpenSim/Services/UserProfilesService/UserProfilesServiceBase.cs +++ b/OpenSim/Services/UserProfilesService/UserProfilesServiceBase.cs | |||
@@ -52,7 +52,7 @@ namespace OpenSim.Services.ProfilesService | |||
52 | { | 52 | { |
53 | if(string.IsNullOrEmpty(configName)) | 53 | if(string.IsNullOrEmpty(configName)) |
54 | { | 54 | { |
55 | m_log.WarnFormat("[PROFILES]: Configuration section not given!"); | 55 | m_log.WarnFormat("[PROFILES SERVICE]: Configuration section not given!"); |
56 | return; | 56 | return; |
57 | } | 57 | } |
58 | 58 | ||
@@ -72,6 +72,7 @@ namespace OpenSim.Services.ProfilesService | |||
72 | IConfig ProfilesConfig = config.Configs[configName]; | 72 | IConfig ProfilesConfig = config.Configs[configName]; |
73 | if (ProfilesConfig != null) | 73 | if (ProfilesConfig != null) |
74 | { | 74 | { |
75 | dllName = ProfilesConfig.GetString("StorageProvider", dllName); | ||
75 | connString = ProfilesConfig.GetString("ConnectionString", connString); | 76 | connString = ProfilesConfig.GetString("ConnectionString", connString); |
76 | realm = ProfilesConfig.GetString("Realm", realm); | 77 | realm = ProfilesConfig.GetString("Realm", realm); |
77 | } | 78 | } |