diff options
author | David Walter Seikel | 2016-11-03 21:44:39 +1000 |
---|---|---|
committer | David Walter Seikel | 2016-11-03 21:44:39 +1000 |
commit | 134f86e8d5c414409631b25b8c6f0ee45fbd8631 (patch) | |
tree | 216b89d3fb89acfb81be1e440c25c41ab09fa96d /OpenSim/Services/Interfaces | |
parent | More changing to production grid. Double oops. (diff) | |
download | opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.zip opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.gz opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.bz2 opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.xz |
Initial update to OpenSim 0.8.2.1 source code.
Diffstat (limited to 'OpenSim/Services/Interfaces')
17 files changed, 972 insertions, 151 deletions
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/IAvatarService.cs b/OpenSim/Services/Interfaces/IAvatarService.cs index 863fd93..892e0b4 100644 --- a/OpenSim/Services/Interfaces/IAvatarService.cs +++ b/OpenSim/Services/Interfaces/IAvatarService.cs | |||
@@ -162,10 +162,15 @@ namespace OpenSim.Services.Interfaces | |||
162 | } | 162 | } |
163 | 163 | ||
164 | // Visual Params | 164 | // Visual Params |
165 | string[] vps = new string[AvatarAppearance.VISUALPARAM_COUNT]; | 165 | //string[] vps = new string[AvatarAppearance.VISUALPARAM_COUNT]; |
166 | //byte[] binary = appearance.VisualParams; | ||
167 | |||
168 | // for (int i = 0 ; i < AvatarAppearance.VISUALPARAM_COUNT ; i++) | ||
169 | |||
166 | byte[] binary = appearance.VisualParams; | 170 | byte[] binary = appearance.VisualParams; |
171 | string[] vps = new string[binary.Length]; | ||
167 | 172 | ||
168 | for (int i = 0 ; i < AvatarAppearance.VISUALPARAM_COUNT ; i++) | 173 | for (int i = 0; i < binary.Length; i++) |
169 | { | 174 | { |
170 | vps[i] = binary[i].ToString(); | 175 | vps[i] = binary[i].ToString(); |
171 | } | 176 | } |
@@ -174,11 +179,18 @@ namespace OpenSim.Services.Interfaces | |||
174 | 179 | ||
175 | // Attachments | 180 | // Attachments |
176 | List<AvatarAttachment> attachments = appearance.GetAttachments(); | 181 | List<AvatarAttachment> attachments = appearance.GetAttachments(); |
182 | Dictionary<int, List<string>> atts = new Dictionary<int, List<string>>(); | ||
177 | foreach (AvatarAttachment attach in attachments) | 183 | foreach (AvatarAttachment attach in attachments) |
178 | { | 184 | { |
179 | if (attach.ItemID != UUID.Zero) | 185 | if (attach.ItemID != UUID.Zero) |
180 | Data["_ap_" + attach.AttachPoint] = attach.ItemID.ToString(); | 186 | { |
187 | if (!atts.ContainsKey(attach.AttachPoint)) | ||
188 | atts[attach.AttachPoint] = new List<string>(); | ||
189 | atts[attach.AttachPoint].Add(attach.ItemID.ToString()); | ||
190 | } | ||
181 | } | 191 | } |
192 | foreach (KeyValuePair<int, List<string>> kvp in atts) | ||
193 | Data["_ap_" + kvp.Key] = string.Join(",", kvp.Value.ToArray()); | ||
182 | } | 194 | } |
183 | 195 | ||
184 | public AvatarAppearance ToAvatarAppearance() | 196 | public AvatarAppearance ToAvatarAppearance() |
@@ -195,7 +207,13 @@ namespace OpenSim.Services.Interfaces | |||
195 | appearance.Serial = Int32.Parse(Data["Serial"]); | 207 | appearance.Serial = Int32.Parse(Data["Serial"]); |
196 | 208 | ||
197 | if (Data.ContainsKey("AvatarHeight")) | 209 | if (Data.ContainsKey("AvatarHeight")) |
198 | appearance.AvatarHeight = float.Parse(Data["AvatarHeight"]); | 210 | { |
211 | float h = float.Parse(Data["AvatarHeight"]); | ||
212 | if( h == 0f) | ||
213 | h = 1.9f; | ||
214 | |||
215 | appearance.AvatarHeight = h; | ||
216 | } | ||
199 | 217 | ||
200 | // Legacy Wearables | 218 | // Legacy Wearables |
201 | if (Data.ContainsKey("BodyItem")) | 219 | if (Data.ContainsKey("BodyItem")) |
@@ -266,9 +284,13 @@ namespace OpenSim.Services.Interfaces | |||
266 | if (Data.ContainsKey("VisualParams")) | 284 | if (Data.ContainsKey("VisualParams")) |
267 | { | 285 | { |
268 | string[] vps = Data["VisualParams"].Split(new char[] {','}); | 286 | string[] vps = Data["VisualParams"].Split(new char[] {','}); |
269 | byte[] binary = new byte[AvatarAppearance.VISUALPARAM_COUNT]; | 287 | //byte[] binary = new byte[AvatarAppearance.VISUALPARAM_COUNT]; |
270 | 288 | ||
271 | for (int i = 0 ; i < vps.Length && i < binary.Length ; i++) | 289 | //for (int i = 0 ; i < vps.Length && i < binary.Length ; i++) |
290 | |||
291 | byte[] binary = new byte[vps.Length]; | ||
292 | |||
293 | for (int i = 0; i < vps.Length; i++) | ||
272 | binary[i] = (byte)Convert.ToInt32(vps[i]); | 294 | binary[i] = (byte)Convert.ToInt32(vps[i]); |
273 | 295 | ||
274 | appearance.VisualParams = binary; | 296 | appearance.VisualParams = binary; |
@@ -304,10 +326,16 @@ namespace OpenSim.Services.Interfaces | |||
304 | if (!Int32.TryParse(pointStr, out point)) | 326 | if (!Int32.TryParse(pointStr, out point)) |
305 | continue; | 327 | continue; |
306 | 328 | ||
307 | UUID uuid = UUID.Zero; | 329 | List<string> idList = new List<string>(_kvp.Value.Split(new char[] {','})); |
308 | UUID.TryParse(_kvp.Value, out uuid); | ||
309 | 330 | ||
310 | appearance.SetAttachment(point, uuid, UUID.Zero); | 331 | appearance.SetAttachment(point, UUID.Zero, UUID.Zero); |
332 | foreach (string id in idList) | ||
333 | { | ||
334 | UUID uuid = UUID.Zero; | ||
335 | UUID.TryParse(id, out uuid); | ||
336 | |||
337 | appearance.SetAttachment(point | 0x80, uuid, UUID.Zero); | ||
338 | } | ||
311 | } | 339 | } |
312 | 340 | ||
313 | if (appearance.Wearables[AvatarWearable.BODY].Count == 0) | 341 | if (appearance.Wearables[AvatarWearable.BODY].Count == 0) |
diff --git a/OpenSim/Services/Interfaces/IBakedTextureService.cs b/OpenSim/Services/Interfaces/IBakedTextureService.cs new file mode 100644 index 0000000..69df4a0 --- /dev/null +++ b/OpenSim/Services/Interfaces/IBakedTextureService.cs | |||
@@ -0,0 +1,38 @@ | |||
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 Nini.Config; | ||
30 | |||
31 | namespace OpenSim.Services.Interfaces | ||
32 | { | ||
33 | public interface IBakedTextureService | ||
34 | { | ||
35 | string Get(string id); | ||
36 | void Store(string id, string data); | ||
37 | } | ||
38 | } | ||
diff --git a/OpenSim/Services/Interfaces/IBansService.cs b/OpenSim/Services/Interfaces/IBansService.cs new file mode 100644 index 0000000..8fd3521 --- /dev/null +++ b/OpenSim/Services/Interfaces/IBansService.cs | |||
@@ -0,0 +1,48 @@ | |||
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 | |||
30 | using OpenSim.Framework; | ||
31 | using OpenMetaverse; | ||
32 | |||
33 | namespace OpenSim.Services.Interfaces | ||
34 | { | ||
35 | public interface IBansService | ||
36 | { | ||
37 | /// <summary> | ||
38 | /// Are any of the given arguments banned from the grid? | ||
39 | /// </summary> | ||
40 | /// <param name="userID"></param> | ||
41 | /// <param name="ip"></param> | ||
42 | /// <param name="id0"></param> | ||
43 | /// <param name="origin"></param> | ||
44 | /// <returns></returns> | ||
45 | bool IsBanned(string userID, string ip, string id0, string origin); | ||
46 | } | ||
47 | |||
48 | } | ||
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 d7da056..f5f1f75 100644 --- a/OpenSim/Services/Interfaces/IGridService.cs +++ b/OpenSim/Services/Interfaces/IGridService.cs | |||
@@ -26,12 +26,17 @@ | |||
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; |
33 | using System.Reflection; | ||
34 | |||
32 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
33 | using OpenMetaverse; | 36 | using OpenMetaverse; |
34 | 37 | ||
38 | using log4net; | ||
39 | |||
35 | namespace OpenSim.Services.Interfaces | 40 | namespace OpenSim.Services.Interfaces |
36 | { | 41 | { |
37 | public interface IGridService | 42 | public interface IGridService |
@@ -97,6 +102,7 @@ namespace OpenSim.Services.Interfaces | |||
97 | List<GridRegion> GetRegionRange(UUID scopeID, int xmin, int xmax, int ymin, int ymax); | 102 | List<GridRegion> GetRegionRange(UUID scopeID, int xmin, int xmax, int ymin, int ymax); |
98 | 103 | ||
99 | List<GridRegion> GetDefaultRegions(UUID scopeID); | 104 | List<GridRegion> GetDefaultRegions(UUID scopeID); |
105 | List<GridRegion> GetDefaultHypergridRegions(UUID scopeID); | ||
100 | List<GridRegion> GetFallbackRegions(UUID scopeID, int x, int y); | 106 | List<GridRegion> GetFallbackRegions(UUID scopeID, int x, int y); |
101 | List<GridRegion> GetHyperlinks(UUID scopeID); | 107 | List<GridRegion> GetHyperlinks(UUID scopeID); |
102 | 108 | ||
@@ -114,19 +120,28 @@ namespace OpenSim.Services.Interfaces | |||
114 | /// <param name='scopeID'></param> | 120 | /// <param name='scopeID'></param> |
115 | /// <param name='regionID'></param> | 121 | /// <param name='regionID'></param> |
116 | 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); | ||
117 | } | 131 | } |
118 | 132 | ||
119 | public class GridRegion | 133 | public class GridRegion |
120 | { | 134 | { |
135 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
136 | |||
137 | #pragma warning disable 414 | ||
138 | private static readonly string LogHeader = "[GRID REGION]"; | ||
139 | #pragma warning restore 414 | ||
140 | |||
121 | /// <summary> | 141 | /// <summary> |
122 | /// The port by which http communication occurs with the region | 142 | /// The port by which http communication occurs with the region |
123 | /// </summary> | 143 | /// </summary> |
124 | public uint HttpPort | 144 | public uint HttpPort { get; set; } |
125 | { | ||
126 | get { return m_httpPort; } | ||
127 | set { m_httpPort = value; } | ||
128 | } | ||
129 | protected uint m_httpPort; | ||
130 | 145 | ||
131 | /// <summary> | 146 | /// <summary> |
132 | /// 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) |
@@ -134,14 +149,17 @@ namespace OpenSim.Services.Interfaces | |||
134 | public string ServerURI | 149 | public string ServerURI |
135 | { | 150 | { |
136 | get { | 151 | get { |
137 | if ( m_serverURI != string.Empty ) { | 152 | if (!String.IsNullOrEmpty(m_serverURI)) { |
138 | return m_serverURI; | 153 | return m_serverURI; |
139 | } else { | 154 | } else { |
140 | return "http://" + m_externalHostName + ":" + m_httpPort + "/"; | 155 | if (HttpPort == 0) |
156 | return "http://" + m_externalHostName + "/"; | ||
157 | else | ||
158 | return "http://" + m_externalHostName + ":" + HttpPort + "/"; | ||
141 | } | 159 | } |
142 | } | 160 | } |
143 | set { | 161 | set { |
144 | if ( value.EndsWith("/") ) { | 162 | if (value.EndsWith("/")) { |
145 | m_serverURI = value; | 163 | m_serverURI = value; |
146 | } else { | 164 | } else { |
147 | m_serverURI = value + '/'; | 165 | m_serverURI = value + '/'; |
@@ -150,6 +168,16 @@ namespace OpenSim.Services.Interfaces | |||
150 | } | 168 | } |
151 | protected string m_serverURI; | 169 | protected string m_serverURI; |
152 | 170 | ||
171 | /// <summary> | ||
172 | /// Provides direct access to the 'm_serverURI' field, without returning a generated URL if m_serverURI is missing. | ||
173 | /// </summary> | ||
174 | public string RawServerURI | ||
175 | { | ||
176 | get { return m_serverURI; } | ||
177 | set { m_serverURI = value; } | ||
178 | } | ||
179 | |||
180 | |||
153 | public string RegionName | 181 | public string RegionName |
154 | { | 182 | { |
155 | get { return m_regionName; } | 183 | get { return m_regionName; } |
@@ -157,22 +185,34 @@ namespace OpenSim.Services.Interfaces | |||
157 | } | 185 | } |
158 | protected string m_regionName = String.Empty; | 186 | protected string m_regionName = String.Empty; |
159 | 187 | ||
188 | /// <summary> | ||
189 | /// Region flags. | ||
190 | /// </summary> | ||
191 | /// <remarks> | ||
192 | /// If not set (chiefly if a robust service is running code pre OpenSim 0.8.1) then this will be null and | ||
193 | /// should be ignored. If you require flags information please use the separate IGridService.GetRegionFlags() call | ||
194 | /// XXX: This field is currently ignored when used in RegisterRegion, but could potentially be | ||
195 | /// used to set flags at this point. | ||
196 | /// </remarks> | ||
197 | public OpenSim.Framework.RegionFlags? RegionFlags { get; set; } | ||
198 | |||
160 | protected string m_externalHostName; | 199 | protected string m_externalHostName; |
161 | 200 | ||
162 | protected IPEndPoint m_internalEndPoint; | 201 | protected IPEndPoint m_internalEndPoint; |
163 | 202 | ||
164 | /// <summary> | 203 | /// <summary> |
165 | /// The co-ordinate of this region. | 204 | /// The co-ordinate of this region in region units. |
166 | /// </summary> | 205 | /// </summary> |
167 | public int RegionCoordX { get { return RegionLocX / (int)Constants.RegionSize; } } | 206 | public int RegionCoordX { get { return (int)Util.WorldToRegionLoc((uint)RegionLocX); } } |
168 | 207 | ||
169 | /// <summary> | 208 | /// <summary> |
170 | /// The co-ordinate of this region | 209 | /// The co-ordinate of this region in region units |
171 | /// </summary> | 210 | /// </summary> |
172 | public int RegionCoordY { get { return RegionLocY / (int)Constants.RegionSize; } } | 211 | public int RegionCoordY { get { return (int)Util.WorldToRegionLoc((uint)RegionLocY); } } |
173 | 212 | ||
174 | /// <summary> | 213 | /// <summary> |
175 | /// The location of this region in meters. | 214 | /// The location of this region in meters. |
215 | /// DANGER DANGER! Note that this name means something different in RegionInfo. | ||
176 | /// </summary> | 216 | /// </summary> |
177 | public int RegionLocX | 217 | public int RegionLocX |
178 | { | 218 | { |
@@ -181,8 +221,12 @@ namespace OpenSim.Services.Interfaces | |||
181 | } | 221 | } |
182 | protected int m_regionLocX; | 222 | protected int m_regionLocX; |
183 | 223 | ||
224 | public int RegionSizeX { get; set; } | ||
225 | public int RegionSizeY { get; set; } | ||
226 | |||
184 | /// <summary> | 227 | /// <summary> |
185 | /// The location of this region in meters. | 228 | /// The location of this region in meters. |
229 | /// DANGER DANGER! Note that this name means something different in RegionInfo. | ||
186 | /// </summary> | 230 | /// </summary> |
187 | public int RegionLocY | 231 | public int RegionLocY |
188 | { | 232 | { |
@@ -211,13 +255,18 @@ namespace OpenSim.Services.Interfaces | |||
211 | 255 | ||
212 | public GridRegion() | 256 | public GridRegion() |
213 | { | 257 | { |
258 | RegionSizeX = (int)Constants.RegionSize; | ||
259 | RegionSizeY = (int)Constants.RegionSize; | ||
214 | m_serverURI = string.Empty; | 260 | m_serverURI = string.Empty; |
215 | } | 261 | } |
216 | 262 | ||
263 | /* | ||
217 | public GridRegion(int regionLocX, int regionLocY, IPEndPoint internalEndPoint, string externalUri) | 264 | public GridRegion(int regionLocX, int regionLocY, IPEndPoint internalEndPoint, string externalUri) |
218 | { | 265 | { |
219 | m_regionLocX = regionLocX; | 266 | m_regionLocX = regionLocX; |
220 | m_regionLocY = regionLocY; | 267 | m_regionLocY = regionLocY; |
268 | RegionSizeX = (int)Constants.RegionSize; | ||
269 | RegionSizeY = (int)Constants.RegionSize; | ||
221 | 270 | ||
222 | m_internalEndPoint = internalEndPoint; | 271 | m_internalEndPoint = internalEndPoint; |
223 | m_externalHostName = externalUri; | 272 | m_externalHostName = externalUri; |
@@ -227,26 +276,33 @@ namespace OpenSim.Services.Interfaces | |||
227 | { | 276 | { |
228 | m_regionLocX = regionLocX; | 277 | m_regionLocX = regionLocX; |
229 | m_regionLocY = regionLocY; | 278 | m_regionLocY = regionLocY; |
279 | RegionSizeX = (int)Constants.RegionSize; | ||
280 | RegionSizeY = (int)Constants.RegionSize; | ||
230 | 281 | ||
231 | m_externalHostName = externalUri; | 282 | m_externalHostName = externalUri; |
232 | 283 | ||
233 | m_internalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int)port); | 284 | m_internalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int)port); |
234 | } | 285 | } |
286 | */ | ||
235 | 287 | ||
236 | public GridRegion(uint xcell, uint ycell) | 288 | public GridRegion(uint xcell, uint ycell) |
237 | { | 289 | { |
238 | m_regionLocX = (int)(xcell * Constants.RegionSize); | 290 | m_regionLocX = (int)Util.RegionToWorldLoc(xcell); |
239 | m_regionLocY = (int)(ycell * Constants.RegionSize); | 291 | m_regionLocY = (int)Util.RegionToWorldLoc(ycell); |
292 | RegionSizeX = (int)Constants.RegionSize; | ||
293 | RegionSizeY = (int)Constants.RegionSize; | ||
240 | } | 294 | } |
241 | 295 | ||
242 | public GridRegion(RegionInfo ConvertFrom) | 296 | public GridRegion(RegionInfo ConvertFrom) |
243 | { | 297 | { |
244 | m_regionName = ConvertFrom.RegionName; | 298 | m_regionName = ConvertFrom.RegionName; |
245 | m_regionLocX = (int)(ConvertFrom.RegionLocX * Constants.RegionSize); | 299 | m_regionLocX = (int)(ConvertFrom.WorldLocX); |
246 | m_regionLocY = (int)(ConvertFrom.RegionLocY * Constants.RegionSize); | 300 | m_regionLocY = (int)(ConvertFrom.WorldLocY); |
301 | RegionSizeX = (int)ConvertFrom.RegionSizeX; | ||
302 | RegionSizeY = (int)ConvertFrom.RegionSizeY; | ||
247 | m_internalEndPoint = ConvertFrom.InternalEndPoint; | 303 | m_internalEndPoint = ConvertFrom.InternalEndPoint; |
248 | m_externalHostName = ConvertFrom.ExternalHostName; | 304 | m_externalHostName = ConvertFrom.ExternalHostName; |
249 | m_httpPort = ConvertFrom.HttpPort; | 305 | HttpPort = ConvertFrom.HttpPort; |
250 | RegionID = ConvertFrom.RegionID; | 306 | RegionID = ConvertFrom.RegionID; |
251 | ServerURI = ConvertFrom.ServerURI; | 307 | ServerURI = ConvertFrom.ServerURI; |
252 | TerrainImage = ConvertFrom.RegionSettings.TerrainImageID; | 308 | TerrainImage = ConvertFrom.RegionSettings.TerrainImageID; |
@@ -260,11 +316,14 @@ namespace OpenSim.Services.Interfaces | |||
260 | public GridRegion(GridRegion ConvertFrom) | 316 | public GridRegion(GridRegion ConvertFrom) |
261 | { | 317 | { |
262 | m_regionName = ConvertFrom.RegionName; | 318 | m_regionName = ConvertFrom.RegionName; |
319 | RegionFlags = ConvertFrom.RegionFlags; | ||
263 | m_regionLocX = ConvertFrom.RegionLocX; | 320 | m_regionLocX = ConvertFrom.RegionLocX; |
264 | m_regionLocY = ConvertFrom.RegionLocY; | 321 | m_regionLocY = ConvertFrom.RegionLocY; |
322 | RegionSizeX = ConvertFrom.RegionSizeX; | ||
323 | RegionSizeY = ConvertFrom.RegionSizeY; | ||
265 | m_internalEndPoint = ConvertFrom.InternalEndPoint; | 324 | m_internalEndPoint = ConvertFrom.InternalEndPoint; |
266 | m_externalHostName = ConvertFrom.ExternalHostName; | 325 | m_externalHostName = ConvertFrom.ExternalHostName; |
267 | m_httpPort = ConvertFrom.HttpPort; | 326 | HttpPort = ConvertFrom.HttpPort; |
268 | RegionID = ConvertFrom.RegionID; | 327 | RegionID = ConvertFrom.RegionID; |
269 | ServerURI = ConvertFrom.ServerURI; | 328 | ServerURI = ConvertFrom.ServerURI; |
270 | TerrainImage = ConvertFrom.TerrainImage; | 329 | TerrainImage = ConvertFrom.TerrainImage; |
@@ -274,8 +333,112 @@ namespace OpenSim.Services.Interfaces | |||
274 | RegionSecret = ConvertFrom.RegionSecret; | 333 | RegionSecret = ConvertFrom.RegionSecret; |
275 | EstateOwner = ConvertFrom.EstateOwner; | 334 | EstateOwner = ConvertFrom.EstateOwner; |
276 | } | 335 | } |
336 | |||
337 | public GridRegion(Dictionary<string, object> kvp) | ||
338 | { | ||
339 | if (kvp.ContainsKey("uuid")) | ||
340 | RegionID = new UUID((string)kvp["uuid"]); | ||
341 | |||
342 | if (kvp.ContainsKey("locX")) | ||
343 | RegionLocX = Convert.ToInt32((string)kvp["locX"]); | ||
344 | |||
345 | if (kvp.ContainsKey("locY")) | ||
346 | RegionLocY = Convert.ToInt32((string)kvp["locY"]); | ||
347 | |||
348 | if (kvp.ContainsKey("sizeX")) | ||
349 | RegionSizeX = Convert.ToInt32((string)kvp["sizeX"]); | ||
350 | else | ||
351 | RegionSizeX = (int)Constants.RegionSize; | ||
352 | |||
353 | if (kvp.ContainsKey("sizeY")) | ||
354 | RegionSizeY = Convert.ToInt32((string)kvp["sizeY"]); | ||
355 | else | ||
356 | RegionSizeX = (int)Constants.RegionSize; | ||
357 | |||
358 | if (kvp.ContainsKey("regionName")) | ||
359 | RegionName = (string)kvp["regionName"]; | ||
360 | |||
361 | if (kvp.ContainsKey("flags") && kvp["flags"] != null) | ||
362 | RegionFlags = (OpenSim.Framework.RegionFlags?)Convert.ToInt32((string)kvp["flags"]); | ||
363 | |||
364 | if (kvp.ContainsKey("serverIP")) | ||
365 | { | ||
366 | //int port = 0; | ||
367 | //Int32.TryParse((string)kvp["serverPort"], out port); | ||
368 | //IPEndPoint ep = new IPEndPoint(IPAddress.Parse((string)kvp["serverIP"]), port); | ||
369 | ExternalHostName = (string)kvp["serverIP"]; | ||
370 | } | ||
371 | else | ||
372 | ExternalHostName = "127.0.0.1"; | ||
373 | |||
374 | if (kvp.ContainsKey("serverPort")) | ||
375 | { | ||
376 | Int32 port = 0; | ||
377 | Int32.TryParse((string)kvp["serverPort"], out port); | ||
378 | InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), port); | ||
379 | } | ||
380 | |||
381 | if (kvp.ContainsKey("serverHttpPort")) | ||
382 | { | ||
383 | UInt32 port = 0; | ||
384 | UInt32.TryParse((string)kvp["serverHttpPort"], out port); | ||
385 | HttpPort = port; | ||
386 | } | ||
387 | |||
388 | if (kvp.ContainsKey("serverURI")) | ||
389 | ServerURI = (string)kvp["serverURI"]; | ||
390 | |||
391 | if (kvp.ContainsKey("regionMapTexture")) | ||
392 | UUID.TryParse((string)kvp["regionMapTexture"], out TerrainImage); | ||
393 | |||
394 | if (kvp.ContainsKey("parcelMapTexture")) | ||
395 | UUID.TryParse((string)kvp["parcelMapTexture"], out ParcelImage); | ||
396 | |||
397 | if (kvp.ContainsKey("access")) | ||
398 | Access = Byte.Parse((string)kvp["access"]); | ||
399 | |||
400 | if (kvp.ContainsKey("regionSecret")) | ||
401 | RegionSecret =(string)kvp["regionSecret"]; | ||
402 | |||
403 | if (kvp.ContainsKey("owner_uuid")) | ||
404 | EstateOwner = new UUID(kvp["owner_uuid"].ToString()); | ||
405 | |||
406 | if (kvp.ContainsKey("Token")) | ||
407 | Token = kvp["Token"].ToString(); | ||
408 | |||
409 | // m_log.DebugFormat("{0} New GridRegion. id={1}, loc=<{2},{3}>, size=<{4},{5}>", | ||
410 | // LogHeader, RegionID, RegionLocX, RegionLocY, RegionSizeX, RegionSizeY); | ||
411 | } | ||
412 | |||
413 | public Dictionary<string, object> ToKeyValuePairs() | ||
414 | { | ||
415 | Dictionary<string, object> kvp = new Dictionary<string, object>(); | ||
416 | kvp["uuid"] = RegionID.ToString(); | ||
417 | kvp["locX"] = RegionLocX.ToString(); | ||
418 | kvp["locY"] = RegionLocY.ToString(); | ||
419 | kvp["sizeX"] = RegionSizeX.ToString(); | ||
420 | kvp["sizeY"] = RegionSizeY.ToString(); | ||
421 | kvp["regionName"] = RegionName; | ||
277 | 422 | ||
278 | # region Definition of equality | 423 | if (RegionFlags != null) |
424 | kvp["flags"] = ((int)RegionFlags).ToString(); | ||
425 | |||
426 | kvp["serverIP"] = ExternalHostName; //ExternalEndPoint.Address.ToString(); | ||
427 | kvp["serverHttpPort"] = HttpPort.ToString(); | ||
428 | kvp["serverURI"] = ServerURI; | ||
429 | kvp["serverPort"] = InternalEndPoint.Port.ToString(); | ||
430 | kvp["regionMapTexture"] = TerrainImage.ToString(); | ||
431 | kvp["parcelMapTexture"] = ParcelImage.ToString(); | ||
432 | kvp["access"] = Access.ToString(); | ||
433 | kvp["regionSecret"] = RegionSecret; | ||
434 | kvp["owner_uuid"] = EstateOwner.ToString(); | ||
435 | kvp["Token"] = Token.ToString(); | ||
436 | // Maturity doesn't seem to exist in the DB | ||
437 | |||
438 | return kvp; | ||
439 | } | ||
440 | |||
441 | #region Definition of equality | ||
279 | 442 | ||
280 | /// <summary> | 443 | /// <summary> |
281 | /// Define equality as two regions having the same, non-zero UUID. | 444 | /// Define equality as two regions having the same, non-zero UUID. |
@@ -362,86 +525,5 @@ namespace OpenSim.Services.Interfaces | |||
362 | { | 525 | { |
363 | get { return Util.UIntsToLong((uint)RegionLocX, (uint)RegionLocY); } | 526 | get { return Util.UIntsToLong((uint)RegionLocX, (uint)RegionLocY); } |
364 | } | 527 | } |
365 | |||
366 | public Dictionary<string, object> ToKeyValuePairs() | ||
367 | { | ||
368 | Dictionary<string, object> kvp = new Dictionary<string, object>(); | ||
369 | kvp["uuid"] = RegionID.ToString(); | ||
370 | kvp["locX"] = RegionLocX.ToString(); | ||
371 | kvp["locY"] = RegionLocY.ToString(); | ||
372 | kvp["regionName"] = RegionName; | ||
373 | kvp["serverIP"] = ExternalHostName; //ExternalEndPoint.Address.ToString(); | ||
374 | kvp["serverHttpPort"] = HttpPort.ToString(); | ||
375 | kvp["serverURI"] = ServerURI; | ||
376 | kvp["serverPort"] = InternalEndPoint.Port.ToString(); | ||
377 | kvp["regionMapTexture"] = TerrainImage.ToString(); | ||
378 | kvp["parcelMapTexture"] = ParcelImage.ToString(); | ||
379 | kvp["access"] = Access.ToString(); | ||
380 | kvp["regionSecret"] = RegionSecret; | ||
381 | kvp["owner_uuid"] = EstateOwner.ToString(); | ||
382 | kvp["Token"] = Token.ToString(); | ||
383 | // Maturity doesn't seem to exist in the DB | ||
384 | return kvp; | ||
385 | } | ||
386 | |||
387 | public GridRegion(Dictionary<string, object> kvp) | ||
388 | { | ||
389 | if (kvp.ContainsKey("uuid")) | ||
390 | RegionID = new UUID((string)kvp["uuid"]); | ||
391 | |||
392 | if (kvp.ContainsKey("locX")) | ||
393 | RegionLocX = Convert.ToInt32((string)kvp["locX"]); | ||
394 | |||
395 | if (kvp.ContainsKey("locY")) | ||
396 | RegionLocY = Convert.ToInt32((string)kvp["locY"]); | ||
397 | |||
398 | if (kvp.ContainsKey("regionName")) | ||
399 | RegionName = (string)kvp["regionName"]; | ||
400 | |||
401 | if (kvp.ContainsKey("serverIP")) | ||
402 | { | ||
403 | //int port = 0; | ||
404 | //Int32.TryParse((string)kvp["serverPort"], out port); | ||
405 | //IPEndPoint ep = new IPEndPoint(IPAddress.Parse((string)kvp["serverIP"]), port); | ||
406 | ExternalHostName = (string)kvp["serverIP"]; | ||
407 | } | ||
408 | else | ||
409 | ExternalHostName = "127.0.0.1"; | ||
410 | |||
411 | if (kvp.ContainsKey("serverPort")) | ||
412 | { | ||
413 | Int32 port = 0; | ||
414 | Int32.TryParse((string)kvp["serverPort"], out port); | ||
415 | InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), port); | ||
416 | } | ||
417 | |||
418 | if (kvp.ContainsKey("serverHttpPort")) | ||
419 | { | ||
420 | UInt32 port = 0; | ||
421 | UInt32.TryParse((string)kvp["serverHttpPort"], out port); | ||
422 | HttpPort = port; | ||
423 | } | ||
424 | |||
425 | if (kvp.ContainsKey("serverURI")) | ||
426 | ServerURI = (string)kvp["serverURI"]; | ||
427 | |||
428 | if (kvp.ContainsKey("regionMapTexture")) | ||
429 | UUID.TryParse((string)kvp["regionMapTexture"], out TerrainImage); | ||
430 | |||
431 | if (kvp.ContainsKey("parcelMapTexture")) | ||
432 | UUID.TryParse((string)kvp["parcelMapTexture"], out ParcelImage); | ||
433 | |||
434 | if (kvp.ContainsKey("access")) | ||
435 | Access = Byte.Parse((string)kvp["access"]); | ||
436 | |||
437 | if (kvp.ContainsKey("regionSecret")) | ||
438 | RegionSecret =(string)kvp["regionSecret"]; | ||
439 | |||
440 | if (kvp.ContainsKey("owner_uuid")) | ||
441 | EstateOwner = new UUID(kvp["owner_uuid"].ToString()); | ||
442 | |||
443 | if (kvp.ContainsKey("Token")) | ||
444 | Token = kvp["Token"].ToString(); | ||
445 | } | ||
446 | } | 528 | } |
447 | } | 529 | } \ No newline at end of file |
diff --git a/OpenSim/Services/Interfaces/IHypergridServices.cs b/OpenSim/Services/Interfaces/IHypergridServices.cs index 3dc877a..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,31 +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 | /// <summary> | ||
47 | /// HG1.5 only | ||
48 | /// </summary> | ||
49 | public interface IUserAgentService | 59 | public interface IUserAgentService |
50 | { | 60 | { |
51 | // called by login service only | 61 | bool LoginAgentToGrid(GridRegion source, AgentCircuitData agent, GridRegion gatekeeper, GridRegion finalDestination, bool fromLogin, out string reason); |
52 | bool LoginAgentToGrid(AgentCircuitData agent, GridRegion gatekeeper, GridRegion finalDestination, IPEndPoint clientIP, out string reason); | 62 | |
53 | // called by simulators | ||
54 | bool LoginAgentToGrid(AgentCircuitData agent, GridRegion gatekeeper, GridRegion finalDestination, out string reason); | ||
55 | 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> | ||
56 | 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> | ||
57 | Dictionary<string, object> GetServerURLs(UUID userID); | 77 | Dictionary<string, object> GetServerURLs(UUID userID); |
58 | Dictionary<string,object> GetUserInfo(UUID userID); | ||
59 | 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> | ||
60 | string LocateUser(UUID userID); | 91 | string LocateUser(UUID userID); |
61 | // Tries to get the universal user identifier for the targetUserId | 92 | |
62 | // 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> | ||
63 | string GetUUI(UUID userID, UUID targetUserID); | 98 | string GetUUI(UUID userID, UUID targetUserID); |
64 | 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> | ||
65 | UUID GetUUID(String first, String last); | 105 | UUID GetUUID(String first, String last); |
66 | 106 | ||
67 | // 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 a7b2cf1..78daa5f 100644 --- a/OpenSim/Services/Interfaces/IMapImageService.cs +++ b/OpenSim/Services/Interfaces/IMapImageService.cs | |||
@@ -35,6 +35,7 @@ namespace OpenSim.Services.Interfaces | |||
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 | bool AddMapTile(int x, int y, byte[] imageData, out string reason); | 37 | bool AddMapTile(int x, int y, byte[] imageData, out string reason); |
38 | bool RemoveMapTile(int x, int y, out string reason); | ||
38 | byte[] GetMapTile(string fileName, out string format); | 39 | byte[] GetMapTile(string fileName, out string format); |
39 | } | 40 | } |
40 | } | 41 | } |
diff --git a/OpenSim/Services/Interfaces/IOfflineIMService.cs b/OpenSim/Services/Interfaces/IOfflineIMService.cs index 2848967..588aaaf 100644 --- a/OpenSim/Services/Interfaces/IOfflineIMService.cs +++ b/OpenSim/Services/Interfaces/IOfflineIMService.cs | |||
@@ -35,7 +35,14 @@ namespace OpenSim.Services.Interfaces | |||
35 | public interface IOfflineIMService | 35 | public interface IOfflineIMService |
36 | { | 36 | { |
37 | List<GridInstantMessage> GetMessages(UUID principalID); | 37 | List<GridInstantMessage> GetMessages(UUID principalID); |
38 | |||
38 | bool StoreMessage(GridInstantMessage im, out string reason); | 39 | bool StoreMessage(GridInstantMessage im, out string reason); |
40 | |||
41 | /// <summary> | ||
42 | /// Delete messages to or from this user (or group). | ||
43 | /// </summary> | ||
44 | /// <param name="userID">A user or group ID</param> | ||
45 | void DeleteMessages(UUID userID); | ||
39 | } | 46 | } |
40 | 47 | ||
41 | public class OfflineIMDataUtils | 48 | public class OfflineIMDataUtils |
diff --git a/OpenSim/Services/Interfaces/ISimulationService.cs b/OpenSim/Services/Interfaces/ISimulationService.cs index b10a85c..8a25509 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 | ||
@@ -33,6 +34,20 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion; | |||
33 | 34 | ||
34 | namespace OpenSim.Services.Interfaces | 35 | namespace OpenSim.Services.Interfaces |
35 | { | 36 | { |
37 | public class EntityTransferContext | ||
38 | { | ||
39 | public EntityTransferContext() | ||
40 | { | ||
41 | InboundVersion = VersionInfo.SimulationServiceVersionAcceptedMax; | ||
42 | OutboundVersion = VersionInfo.SimulationServiceVersionSupportedMax; | ||
43 | VariableWearablesSupported = false; | ||
44 | } | ||
45 | |||
46 | public float InboundVersion { get; set; } | ||
47 | public float OutboundVersion { get; set; } | ||
48 | public bool VariableWearablesSupported { get; set; } | ||
49 | } | ||
50 | |||
36 | public interface ISimulationService | 51 | public interface ISimulationService |
37 | { | 52 | { |
38 | /// <summary> | 53 | /// <summary> |
@@ -53,11 +68,13 @@ namespace OpenSim.Services.Interfaces | |||
53 | /// <summary> | 68 | /// <summary> |
54 | /// Ask the simulator hosting the destination to create an agent on that region. | 69 | /// Ask the simulator hosting the destination to create an agent on that region. |
55 | /// </summary> | 70 | /// </summary> |
71 | /// <param name="source">The region that the user is coming from. Will be null if the user | ||
72 | /// logged-in directly, or arrived from a simulator that doesn't send this parameter.</param> | ||
56 | /// <param name="destination"></param> | 73 | /// <param name="destination"></param> |
57 | /// <param name="aCircuit"></param> | 74 | /// <param name="aCircuit"></param> |
58 | /// <param name="flags"></param> | 75 | /// <param name="flags"></param> |
59 | /// <param name="reason">Reason message in the event of a failure.</param> | 76 | /// <param name="reason">Reason message in the event of a failure.</param> |
60 | bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint flags, out string reason); | 77 | bool CreateAgent(GridRegion source, GridRegion destination, AgentCircuitData aCircuit, uint flags, out string reason); |
61 | 78 | ||
62 | /// <summary> | 79 | /// <summary> |
63 | /// Full child agent update. | 80 | /// Full child agent update. |
@@ -75,9 +92,21 @@ namespace OpenSim.Services.Interfaces | |||
75 | /// <returns></returns> | 92 | /// <returns></returns> |
76 | bool UpdateAgent(GridRegion destination, AgentPosition data); | 93 | bool UpdateAgent(GridRegion destination, AgentPosition data); |
77 | 94 | ||
78 | bool RetrieveAgent(GridRegion destination, UUID id, out IAgentData agent); | 95 | /// <summary> |
79 | 96 | /// Returns whether a propspective user is allowed to visit the region. | |
80 | bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string version, out string reason); | 97 | /// </summary> |
98 | /// <param name="destination">Desired destination</param> | ||
99 | /// <param name="agentID">The visitor's User ID</param> | ||
100 | /// <param name="agentHomeURI">The visitor's Home URI. Will be missing (null) in older OpenSims.</param> | ||
101 | /// <param name="viaTeleport">True: via teleport; False: via cross (walking)</param> | ||
102 | /// <param name="position">Position in the region</param> | ||
103 | /// <param name="sversion"> | ||
104 | /// Version that the requesting simulator is runing. If null then no version check is carried out. | ||
105 | /// </param> | ||
106 | /// <param name="version">Version that the target simulator is running</param> | ||
107 | /// <param name="reason">[out] Optional error message</param> | ||
108 | /// <returns>True: ok; False: not allowed</returns> | ||
109 | bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, List<UUID> features, EntityTransferContext ctx, out string reason); | ||
81 | 110 | ||
82 | /// <summary> | 111 | /// <summary> |
83 | /// Message from receiving region to departing region, telling it got contacted by the client. | 112 | /// Message from receiving region to departing region, telling it got contacted by the client. |
@@ -95,7 +124,7 @@ namespace OpenSim.Services.Interfaces | |||
95 | /// <param name="regionHandle"></param> | 124 | /// <param name="regionHandle"></param> |
96 | /// <param name="id"></param> | 125 | /// <param name="id"></param> |
97 | /// <returns></returns> | 126 | /// <returns></returns> |
98 | bool CloseAgent(GridRegion destination, UUID id); | 127 | bool CloseAgent(GridRegion destination, UUID id, string auth_token); |
99 | 128 | ||
100 | #endregion Agents | 129 | #endregion Agents |
101 | 130 | ||
diff --git a/OpenSim/Services/Interfaces/IUserAccountService.cs b/OpenSim/Services/Interfaces/IUserAccountService.cs index 1b85980..2f7702c 100644 --- a/OpenSim/Services/Interfaces/IUserAccountService.cs +++ b/OpenSim/Services/Interfaces/IUserAccountService.cs | |||
@@ -189,5 +189,7 @@ namespace OpenSim.Services.Interfaces | |||
189 | /// <param name="data"></param> | 189 | /// <param name="data"></param> |
190 | /// <returns></returns> | 190 | /// <returns></returns> |
191 | bool StoreUserAccount(UserAccount data); | 191 | bool StoreUserAccount(UserAccount data); |
192 | |||
193 | void InvalidateCache(UUID userID); | ||
192 | } | 194 | } |
193 | } | 195 | } |
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/IUserProfilesService.cs b/OpenSim/Services/Interfaces/IUserProfilesService.cs new file mode 100644 index 0000000..121baa8 --- /dev/null +++ b/OpenSim/Services/Interfaces/IUserProfilesService.cs | |||
@@ -0,0 +1,80 @@ | |||
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 OpenSim.Framework; | ||
30 | using OpenMetaverse; | ||
31 | using OpenMetaverse.StructuredData; | ||
32 | |||
33 | namespace OpenSim.Services.Interfaces | ||
34 | { | ||
35 | public interface IUserProfilesService | ||
36 | { | ||
37 | #region Classifieds | ||
38 | OSD AvatarClassifiedsRequest(UUID creatorId); | ||
39 | bool ClassifiedUpdate(UserClassifiedAdd ad, ref string result); | ||
40 | bool ClassifiedInfoRequest(ref UserClassifiedAdd ad, ref string result); | ||
41 | bool ClassifiedDelete(UUID recordId); | ||
42 | #endregion Classifieds | ||
43 | |||
44 | #region Picks | ||
45 | OSD AvatarPicksRequest(UUID creatorId); | ||
46 | bool PickInfoRequest(ref UserProfilePick pick, ref string result); | ||
47 | bool PicksUpdate(ref UserProfilePick pick, ref string result); | ||
48 | bool PicksDelete(UUID pickId); | ||
49 | #endregion Picks | ||
50 | |||
51 | #region Notes | ||
52 | bool AvatarNotesRequest(ref UserProfileNotes note); | ||
53 | bool NotesUpdate(ref UserProfileNotes note, ref string result); | ||
54 | #endregion Notes | ||
55 | |||
56 | #region Profile Properties | ||
57 | bool AvatarPropertiesRequest(ref UserProfileProperties prop, ref string result); | ||
58 | bool AvatarPropertiesUpdate(ref UserProfileProperties prop, ref string result); | ||
59 | #endregion Profile Properties | ||
60 | |||
61 | #region User Preferences | ||
62 | bool UserPreferencesRequest(ref UserPreferences pref, ref string result); | ||
63 | bool UserPreferencesUpdate(ref UserPreferences pref, ref string result); | ||
64 | #endregion User Preferences | ||
65 | |||
66 | #region Interests | ||
67 | bool AvatarInterestsUpdate(UserProfileProperties prop, ref string result); | ||
68 | #endregion Interests | ||
69 | |||
70 | #region Utility | ||
71 | OSD AvatarImageAssetsRequest(UUID avatarId); | ||
72 | #endregion Utility | ||
73 | |||
74 | #region UserData | ||
75 | bool RequestUserAppData(ref UserAppData prop, ref string result); | ||
76 | bool SetUserAppData(UserAppData prop, ref string result); | ||
77 | #endregion UserData | ||
78 | } | ||
79 | } | ||
80 | |||
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 4723553..01cafbf 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.7.5.*")] | 32 | [assembly: AssemblyVersion("0.8.3.*")] |
33 | [assembly: AssemblyFileVersion("1.0.0.0")] | 33 | |