From 134f86e8d5c414409631b25b8c6f0ee45fbd8631 Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Thu, 3 Nov 2016 21:44:39 +1000 Subject: Initial update to OpenSim 0.8.2.1 source code. --- .../Interfaces/IAgentPreferencesService.cs | 115 +++++++++ OpenSim/Services/Interfaces/IAssetService.cs | 9 +- OpenSim/Services/Interfaces/IAvatarService.cs | 46 +++- .../Services/Interfaces/IBakedTextureService.cs | 38 +++ OpenSim/Services/Interfaces/IBansService.cs | 48 ++++ OpenSim/Services/Interfaces/IEstateDataService.cs | 115 +++++++++ OpenSim/Services/Interfaces/IGridService.cs | 286 +++++++++++++-------- OpenSim/Services/Interfaces/IHypergridServices.cs | 66 ++++- OpenSim/Services/Interfaces/IInventoryService.cs | 36 ++- OpenSim/Services/Interfaces/IMapImageService.cs | 1 + OpenSim/Services/Interfaces/IOfflineIMService.cs | 7 + OpenSim/Services/Interfaces/ISimulationService.cs | 39 ++- OpenSim/Services/Interfaces/IUserAccountService.cs | 2 + OpenSim/Services/Interfaces/IUserManagement.cs | 97 +++++++ .../Services/Interfaces/IUserProfilesService.cs | 80 ++++++ OpenSim/Services/Interfaces/OpenProfileClient.cs | 134 ++++++++++ .../Services/Interfaces/Properties/AssemblyInfo.cs | 4 +- 17 files changed, 972 insertions(+), 151 deletions(-) create mode 100644 OpenSim/Services/Interfaces/IAgentPreferencesService.cs create mode 100644 OpenSim/Services/Interfaces/IBakedTextureService.cs create mode 100644 OpenSim/Services/Interfaces/IBansService.cs create mode 100644 OpenSim/Services/Interfaces/IEstateDataService.cs create mode 100644 OpenSim/Services/Interfaces/IUserManagement.cs create mode 100644 OpenSim/Services/Interfaces/IUserProfilesService.cs create mode 100644 OpenSim/Services/Interfaces/OpenProfileClient.cs (limited to 'OpenSim/Services/Interfaces') 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 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using OpenMetaverse; + +namespace OpenSim.Services.Interfaces +{ + public class AgentPrefs + { + public AgentPrefs(UUID principalID) + { + PrincipalID = principalID; + } + + public AgentPrefs(Dictionary kvp) + { + if (kvp.ContainsKey("PrincipalID")) + UUID.TryParse(kvp["PrincipalID"], out PrincipalID); + if (kvp.ContainsKey("AccessPrefs")) + AccessPrefs = kvp["AccessPrefs"]; + if (kvp.ContainsKey("HoverHeight")) + HoverHeight = double.Parse(kvp["HoverHeight"]); + if (kvp.ContainsKey("Language")) + Language = kvp["Language"]; + if (kvp.ContainsKey("LanguageIsPublic")) + LanguageIsPublic = bool.Parse(kvp["LanguageIsPublic"]); + if (kvp.ContainsKey("PermEveryone")) + PermEveryone = int.Parse(kvp["PermEveryone"]); + if (kvp.ContainsKey("PermGroup")) + PermGroup = int.Parse(kvp["PermGroup"]); + if (kvp.ContainsKey("PermNextOwner")) + PermNextOwner = int.Parse(kvp["PermNextOwner"]); + } + + public AgentPrefs(Dictionary kvp) + { + if (kvp.ContainsKey("PrincipalID")) + UUID.TryParse(kvp["PrincipalID"].ToString(), out PrincipalID); + if (kvp.ContainsKey("AccessPrefs")) + AccessPrefs = kvp["AccessPrefs"].ToString(); + if (kvp.ContainsKey("HoverHeight")) + HoverHeight = double.Parse(kvp["HoverHeight"].ToString()); + if (kvp.ContainsKey("Language")) + Language = kvp["Language"].ToString(); + if (kvp.ContainsKey("LanguageIsPublic")) + LanguageIsPublic = bool.Parse(kvp["LanguageIsPublic"].ToString()); + if (kvp.ContainsKey("PermEveryone")) + PermEveryone = int.Parse(kvp["PermEveryone"].ToString()); + if (kvp.ContainsKey("PermGroup")) + PermGroup = int.Parse(kvp["PermGroup"].ToString()); + if (kvp.ContainsKey("PermNextOwner")) + PermNextOwner = int.Parse(kvp["PermNextOwner"].ToString()); + } + + public Dictionary ToKeyValuePairs() + { + Dictionary result = new Dictionary(); + result["PrincipalID"] = PrincipalID.ToString(); + result["AccessPrefs"] = AccessPrefs.ToString(); + result["HoverHeight"] = HoverHeight.ToString(); + result["Language"] = Language.ToString(); + result["LanguageIsPublic"] = LanguageIsPublic.ToString(); + result["PermEveryone"] = PermEveryone.ToString(); + result["PermGroup"] = PermGroup.ToString(); + result["PermNextOwner"] = PermNextOwner.ToString(); + return result; + } + + public UUID PrincipalID = UUID.Zero; + public string AccessPrefs = "M"; + //public int GodLevel; // *TODO: Implement GodLevel (Unused by the viewer, afaict - 6/11/2015) + public double HoverHeight = 0.0; + public string Language = "en-us"; + public bool LanguageIsPublic = true; + // DefaultObjectPermMasks + public int PermEveryone = 0; + public int PermGroup = 0; + public int PermNextOwner = 532480; + } + + public interface IAgentPreferencesService + { + AgentPrefs GetAgentPreferences(UUID principalID); + bool StoreAgentPreferences(AgentPrefs data); + + string GetLang(UUID principalID); + } +} + 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 /// /// True if the id was parseable, false otherwise bool Get(string id, Object sender, AssetRetrieved handler); + + /// + /// Check if assets exist in the database. + /// + /// The assets' IDs + /// For each asset: true if it exists, false otherwise + bool[] AssetsExist(string[] ids); /// /// Creates a new asset @@ -83,7 +90,7 @@ namespace OpenSim.Services.Interfaces /// Returns a random ID if none is passed via the asset argument. /// /// - /// + /// The Asset ID, or string.Empty if an error occurred string Store(AssetBase asset); /// 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 } // Visual Params - string[] vps = new string[AvatarAppearance.VISUALPARAM_COUNT]; + //string[] vps = new string[AvatarAppearance.VISUALPARAM_COUNT]; + //byte[] binary = appearance.VisualParams; + + // for (int i = 0 ; i < AvatarAppearance.VISUALPARAM_COUNT ; i++) + byte[] binary = appearance.VisualParams; + string[] vps = new string[binary.Length]; - for (int i = 0 ; i < AvatarAppearance.VISUALPARAM_COUNT ; i++) + for (int i = 0; i < binary.Length; i++) { vps[i] = binary[i].ToString(); } @@ -174,11 +179,18 @@ namespace OpenSim.Services.Interfaces // Attachments List attachments = appearance.GetAttachments(); + Dictionary> atts = new Dictionary>(); foreach (AvatarAttachment attach in attachments) { if (attach.ItemID != UUID.Zero) - Data["_ap_" + attach.AttachPoint] = attach.ItemID.ToString(); + { + if (!atts.ContainsKey(attach.AttachPoint)) + atts[attach.AttachPoint] = new List(); + atts[attach.AttachPoint].Add(attach.ItemID.ToString()); + } } + foreach (KeyValuePair> kvp in atts) + Data["_ap_" + kvp.Key] = string.Join(",", kvp.Value.ToArray()); } public AvatarAppearance ToAvatarAppearance() @@ -195,7 +207,13 @@ namespace OpenSim.Services.Interfaces appearance.Serial = Int32.Parse(Data["Serial"]); if (Data.ContainsKey("AvatarHeight")) - appearance.AvatarHeight = float.Parse(Data["AvatarHeight"]); + { + float h = float.Parse(Data["AvatarHeight"]); + if( h == 0f) + h = 1.9f; + + appearance.AvatarHeight = h; + } // Legacy Wearables if (Data.ContainsKey("BodyItem")) @@ -266,9 +284,13 @@ namespace OpenSim.Services.Interfaces if (Data.ContainsKey("VisualParams")) { string[] vps = Data["VisualParams"].Split(new char[] {','}); - byte[] binary = new byte[AvatarAppearance.VISUALPARAM_COUNT]; + //byte[] binary = new byte[AvatarAppearance.VISUALPARAM_COUNT]; - for (int i = 0 ; i < vps.Length && i < binary.Length ; i++) + //for (int i = 0 ; i < vps.Length && i < binary.Length ; i++) + + byte[] binary = new byte[vps.Length]; + + for (int i = 0; i < vps.Length; i++) binary[i] = (byte)Convert.ToInt32(vps[i]); appearance.VisualParams = binary; @@ -304,10 +326,16 @@ namespace OpenSim.Services.Interfaces if (!Int32.TryParse(pointStr, out point)) continue; - UUID uuid = UUID.Zero; - UUID.TryParse(_kvp.Value, out uuid); + List idList = new List(_kvp.Value.Split(new char[] {','})); - appearance.SetAttachment(point, uuid, UUID.Zero); + appearance.SetAttachment(point, UUID.Zero, UUID.Zero); + foreach (string id in idList) + { + UUID uuid = UUID.Zero; + UUID.TryParse(id, out uuid); + + appearance.SetAttachment(point | 0x80, uuid, UUID.Zero); + } } 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 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using Nini.Config; + +namespace OpenSim.Services.Interfaces +{ + public interface IBakedTextureService + { + string Get(string id); + void Store(string id, string data); + } +} 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 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +using System; +using System.Collections.Generic; + +using OpenSim.Framework; +using OpenMetaverse; + +namespace OpenSim.Services.Interfaces +{ + public interface IBansService + { + /// + /// Are any of the given arguments banned from the grid? + /// + /// + /// + /// + /// + /// + bool IsBanned(string userID, string ip, string id0, string origin); + } + +} 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 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using OpenSim.Framework; +using OpenMetaverse; + +namespace OpenSim.Services.Interfaces +{ + public interface IEstateDataService + { + /// + /// Load estate settings for a region. + /// + /// + /// If true, then an estate is created if one is not found. + /// + EstateSettings LoadEstateSettings(UUID regionID, bool create); + + /// + /// Load estate settings for an estate ID. + /// + /// + /// + EstateSettings LoadEstateSettings(int estateID); + + /// + /// Create a new estate. + /// + /// + /// A + /// + EstateSettings CreateNewEstate(); + + /// + /// Load/Get all estate settings. + /// + /// An empty list if no estates were found. + List LoadEstateSettingsAll(); + + /// + /// Store estate settings. + /// + /// + /// This is also called by EstateSettings.Save() + /// + void StoreEstateSettings(EstateSettings es); + + /// + /// Get estate IDs. + /// + /// Name of estate to search for. This is the exact name, no parttern matching is done. + /// + List GetEstates(string search); + + /// + /// Get the IDs of all estates owned by the given user. + /// + /// An empty list if no estates were found. + List GetEstatesByOwner(UUID ownerID); + + /// + /// Get the IDs of all estates. + /// + /// An empty list if no estates were found. + List GetEstatesAll(); + + /// + /// Link a region to an estate. + /// + /// + /// + /// true if the link succeeded, false otherwise + bool LinkRegion(UUID regionID, int estateID); + + /// + /// Get the UUIDs of all the regions in an estate. + /// + /// + /// + List GetRegions(int estateID); + + /// + /// Delete an estate + /// + /// + /// true if the delete succeeded, false otherwise + bool DeleteEstate(int estateID); + } +} \ 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 @@ */ using System; +using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Sockets; +using System.Reflection; + using OpenSim.Framework; using OpenMetaverse; +using log4net; + namespace OpenSim.Services.Interfaces { public interface IGridService @@ -97,6 +102,7 @@ namespace OpenSim.Services.Interfaces List GetRegionRange(UUID scopeID, int xmin, int xmax, int ymin, int ymax); List GetDefaultRegions(UUID scopeID); + List GetDefaultHypergridRegions(UUID scopeID); List GetFallbackRegions(UUID scopeID, int x, int y); List GetHyperlinks(UUID scopeID); @@ -114,19 +120,28 @@ namespace OpenSim.Services.Interfaces /// /// int GetRegionFlags(UUID scopeID, UUID regionID); + + Dictionary GetExtraFeatures(); + } + + public interface IHypergridLinker + { + GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, UUID ownerID, out string reason); + bool TryUnlinkRegion(string mapName); } public class GridRegion { +// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + +#pragma warning disable 414 + private static readonly string LogHeader = "[GRID REGION]"; +#pragma warning restore 414 + /// /// The port by which http communication occurs with the region /// - public uint HttpPort - { - get { return m_httpPort; } - set { m_httpPort = value; } - } - protected uint m_httpPort; + public uint HttpPort { get; set; } /// /// A well-formed URI for the host region server (namely "http://" + ExternalHostName) @@ -134,14 +149,17 @@ namespace OpenSim.Services.Interfaces public string ServerURI { get { - if ( m_serverURI != string.Empty ) { + if (!String.IsNullOrEmpty(m_serverURI)) { return m_serverURI; } else { - return "http://" + m_externalHostName + ":" + m_httpPort + "/"; + if (HttpPort == 0) + return "http://" + m_externalHostName + "/"; + else + return "http://" + m_externalHostName + ":" + HttpPort + "/"; } } set { - if ( value.EndsWith("/") ) { + if (value.EndsWith("/")) { m_serverURI = value; } else { m_serverURI = value + '/'; @@ -150,6 +168,16 @@ namespace OpenSim.Services.Interfaces } protected string m_serverURI; + /// + /// Provides direct access to the 'm_serverURI' field, without returning a generated URL if m_serverURI is missing. + /// + public string RawServerURI + { + get { return m_serverURI; } + set { m_serverURI = value; } + } + + public string RegionName { get { return m_regionName; } @@ -157,22 +185,34 @@ namespace OpenSim.Services.Interfaces } protected string m_regionName = String.Empty; + /// + /// Region flags. + /// + /// + /// If not set (chiefly if a robust service is running code pre OpenSim 0.8.1) then this will be null and + /// should be ignored. If you require flags information please use the separate IGridService.GetRegionFlags() call + /// XXX: This field is currently ignored when used in RegisterRegion, but could potentially be + /// used to set flags at this point. + /// + public OpenSim.Framework.RegionFlags? RegionFlags { get; set; } + protected string m_externalHostName; protected IPEndPoint m_internalEndPoint; /// - /// The co-ordinate of this region. + /// The co-ordinate of this region in region units. /// - public int RegionCoordX { get { return RegionLocX / (int)Constants.RegionSize; } } + public int RegionCoordX { get { return (int)Util.WorldToRegionLoc((uint)RegionLocX); } } /// - /// The co-ordinate of this region + /// The co-ordinate of this region in region units /// - public int RegionCoordY { get { return RegionLocY / (int)Constants.RegionSize; } } + public int RegionCoordY { get { return (int)Util.WorldToRegionLoc((uint)RegionLocY); } } /// /// The location of this region in meters. + /// DANGER DANGER! Note that this name means something different in RegionInfo. /// public int RegionLocX { @@ -181,8 +221,12 @@ namespace OpenSim.Services.Interfaces } protected int m_regionLocX; + public int RegionSizeX { get; set; } + public int RegionSizeY { get; set; } + /// /// The location of this region in meters. + /// DANGER DANGER! Note that this name means something different in RegionInfo. /// public int RegionLocY { @@ -211,13 +255,18 @@ namespace OpenSim.Services.Interfaces public GridRegion() { + RegionSizeX = (int)Constants.RegionSize; + RegionSizeY = (int)Constants.RegionSize; m_serverURI = string.Empty; } + /* public GridRegion(int regionLocX, int regionLocY, IPEndPoint internalEndPoint, string externalUri) { m_regionLocX = regionLocX; m_regionLocY = regionLocY; + RegionSizeX = (int)Constants.RegionSize; + RegionSizeY = (int)Constants.RegionSize; m_internalEndPoint = internalEndPoint; m_externalHostName = externalUri; @@ -227,26 +276,33 @@ namespace OpenSim.Services.Interfaces { m_regionLocX = regionLocX; m_regionLocY = regionLocY; + RegionSizeX = (int)Constants.RegionSize; + RegionSizeY = (int)Constants.RegionSize; m_externalHostName = externalUri; m_internalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int)port); } + */ public GridRegion(uint xcell, uint ycell) { - m_regionLocX = (int)(xcell * Constants.RegionSize); - m_regionLocY = (int)(ycell * Constants.RegionSize); + m_regionLocX = (int)Util.RegionToWorldLoc(xcell); + m_regionLocY = (int)Util.RegionToWorldLoc(ycell); + RegionSizeX = (int)Constants.RegionSize; + RegionSizeY = (int)Constants.RegionSize; } public GridRegion(RegionInfo ConvertFrom) { m_regionName = ConvertFrom.RegionName; - m_regionLocX = (int)(ConvertFrom.RegionLocX * Constants.RegionSize); - m_regionLocY = (int)(ConvertFrom.RegionLocY * Constants.RegionSize); + m_regionLocX = (int)(ConvertFrom.WorldLocX); + m_regionLocY = (int)(ConvertFrom.WorldLocY); + RegionSizeX = (int)ConvertFrom.RegionSizeX; + RegionSizeY = (int)ConvertFrom.RegionSizeY; m_internalEndPoint = ConvertFrom.InternalEndPoint; m_externalHostName = ConvertFrom.ExternalHostName; - m_httpPort = ConvertFrom.HttpPort; + HttpPort = ConvertFrom.HttpPort; RegionID = ConvertFrom.RegionID; ServerURI = ConvertFrom.ServerURI; TerrainImage = ConvertFrom.RegionSettings.TerrainImageID; @@ -260,11 +316,14 @@ namespace OpenSim.Services.Interfaces public GridRegion(GridRegion ConvertFrom) { m_regionName = ConvertFrom.RegionName; + RegionFlags = ConvertFrom.RegionFlags; m_regionLocX = ConvertFrom.RegionLocX; m_regionLocY = ConvertFrom.RegionLocY; + RegionSizeX = ConvertFrom.RegionSizeX; + RegionSizeY = ConvertFrom.RegionSizeY; m_internalEndPoint = ConvertFrom.InternalEndPoint; m_externalHostName = ConvertFrom.ExternalHostName; - m_httpPort = ConvertFrom.HttpPort; + HttpPort = ConvertFrom.HttpPort; RegionID = ConvertFrom.RegionID; ServerURI = ConvertFrom.ServerURI; TerrainImage = ConvertFrom.TerrainImage; @@ -274,8 +333,112 @@ namespace OpenSim.Services.Interfaces RegionSecret = ConvertFrom.RegionSecret; EstateOwner = ConvertFrom.EstateOwner; } + + public GridRegion(Dictionary kvp) + { + if (kvp.ContainsKey("uuid")) + RegionID = new UUID((string)kvp["uuid"]); + + if (kvp.ContainsKey("locX")) + RegionLocX = Convert.ToInt32((string)kvp["locX"]); + + if (kvp.ContainsKey("locY")) + RegionLocY = Convert.ToInt32((string)kvp["locY"]); + + if (kvp.ContainsKey("sizeX")) + RegionSizeX = Convert.ToInt32((string)kvp["sizeX"]); + else + RegionSizeX = (int)Constants.RegionSize; + + if (kvp.ContainsKey("sizeY")) + RegionSizeY = Convert.ToInt32((string)kvp["sizeY"]); + else + RegionSizeX = (int)Constants.RegionSize; + + if (kvp.ContainsKey("regionName")) + RegionName = (string)kvp["regionName"]; + + if (kvp.ContainsKey("flags") && kvp["flags"] != null) + RegionFlags = (OpenSim.Framework.RegionFlags?)Convert.ToInt32((string)kvp["flags"]); + + if (kvp.ContainsKey("serverIP")) + { + //int port = 0; + //Int32.TryParse((string)kvp["serverPort"], out port); + //IPEndPoint ep = new IPEndPoint(IPAddress.Parse((string)kvp["serverIP"]), port); + ExternalHostName = (string)kvp["serverIP"]; + } + else + ExternalHostName = "127.0.0.1"; + + if (kvp.ContainsKey("serverPort")) + { + Int32 port = 0; + Int32.TryParse((string)kvp["serverPort"], out port); + InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), port); + } + + if (kvp.ContainsKey("serverHttpPort")) + { + UInt32 port = 0; + UInt32.TryParse((string)kvp["serverHttpPort"], out port); + HttpPort = port; + } + + if (kvp.ContainsKey("serverURI")) + ServerURI = (string)kvp["serverURI"]; + + if (kvp.ContainsKey("regionMapTexture")) + UUID.TryParse((string)kvp["regionMapTexture"], out TerrainImage); + + if (kvp.ContainsKey("parcelMapTexture")) + UUID.TryParse((string)kvp["parcelMapTexture"], out ParcelImage); + + if (kvp.ContainsKey("access")) + Access = Byte.Parse((string)kvp["access"]); + + if (kvp.ContainsKey("regionSecret")) + RegionSecret =(string)kvp["regionSecret"]; + + if (kvp.ContainsKey("owner_uuid")) + EstateOwner = new UUID(kvp["owner_uuid"].ToString()); + + if (kvp.ContainsKey("Token")) + Token = kvp["Token"].ToString(); + + // m_log.DebugFormat("{0} New GridRegion. id={1}, loc=<{2},{3}>, size=<{4},{5}>", + // LogHeader, RegionID, RegionLocX, RegionLocY, RegionSizeX, RegionSizeY); + } + + public Dictionary ToKeyValuePairs() + { + Dictionary kvp = new Dictionary(); + kvp["uuid"] = RegionID.ToString(); + kvp["locX"] = RegionLocX.ToString(); + kvp["locY"] = RegionLocY.ToString(); + kvp["sizeX"] = RegionSizeX.ToString(); + kvp["sizeY"] = RegionSizeY.ToString(); + kvp["regionName"] = RegionName; - # region Definition of equality + if (RegionFlags != null) + kvp["flags"] = ((int)RegionFlags).ToString(); + + kvp["serverIP"] = ExternalHostName; //ExternalEndPoint.Address.ToString(); + kvp["serverHttpPort"] = HttpPort.ToString(); + kvp["serverURI"] = ServerURI; + kvp["serverPort"] = InternalEndPoint.Port.ToString(); + kvp["regionMapTexture"] = TerrainImage.ToString(); + kvp["parcelMapTexture"] = ParcelImage.ToString(); + kvp["access"] = Access.ToString(); + kvp["regionSecret"] = RegionSecret; + kvp["owner_uuid"] = EstateOwner.ToString(); + kvp["Token"] = Token.ToString(); + // Maturity doesn't seem to exist in the DB + + return kvp; + } + + #region Definition of equality /// /// Define equality as two regions having the same, non-zero UUID. @@ -362,86 +525,5 @@ namespace OpenSim.Services.Interfaces { get { return Util.UIntsToLong((uint)RegionLocX, (uint)RegionLocY); } } - - public Dictionary ToKeyValuePairs() - { - Dictionary kvp = new Dictionary(); - kvp["uuid"] = RegionID.ToString(); - kvp["locX"] = RegionLocX.ToString(); - kvp["locY"] = RegionLocY.ToString(); - kvp["regionName"] = RegionName; - kvp["serverIP"] = ExternalHostName; //ExternalEndPoint.Address.ToString(); - kvp["serverHttpPort"] = HttpPort.ToString(); - kvp["serverURI"] = ServerURI; - kvp["serverPort"] = InternalEndPoint.Port.ToString(); - kvp["regionMapTexture"] = TerrainImage.ToString(); - kvp["parcelMapTexture"] = ParcelImage.ToString(); - kvp["access"] = Access.ToString(); - kvp["regionSecret"] = RegionSecret; - kvp["owner_uuid"] = EstateOwner.ToString(); - kvp["Token"] = Token.ToString(); - // Maturity doesn't seem to exist in the DB - return kvp; - } - - public GridRegion(Dictionary kvp) - { - if (kvp.ContainsKey("uuid")) - RegionID = new UUID((string)kvp["uuid"]); - - if (kvp.ContainsKey("locX")) - RegionLocX = Convert.ToInt32((string)kvp["locX"]); - - if (kvp.ContainsKey("locY")) - RegionLocY = Convert.ToInt32((string)kvp["locY"]); - - if (kvp.ContainsKey("regionName")) - RegionName = (string)kvp["regionName"]; - - if (kvp.ContainsKey("serverIP")) - { - //int port = 0; - //Int32.TryParse((string)kvp["serverPort"], out port); - //IPEndPoint ep = new IPEndPoint(IPAddress.Parse((string)kvp["serverIP"]), port); - ExternalHostName = (string)kvp["serverIP"]; - } - else - ExternalHostName = "127.0.0.1"; - - if (kvp.ContainsKey("serverPort")) - { - Int32 port = 0; - Int32.TryParse((string)kvp["serverPort"], out port); - InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), port); - } - - if (kvp.ContainsKey("serverHttpPort")) - { - UInt32 port = 0; - UInt32.TryParse((string)kvp["serverHttpPort"], out port); - HttpPort = port; - } - - if (kvp.ContainsKey("serverURI")) - ServerURI = (string)kvp["serverURI"]; - - if (kvp.ContainsKey("regionMapTexture")) - UUID.TryParse((string)kvp["regionMapTexture"], out TerrainImage); - - if (kvp.ContainsKey("parcelMapTexture")) - UUID.TryParse((string)kvp["parcelMapTexture"], out ParcelImage); - - if (kvp.ContainsKey("access")) - Access = Byte.Parse((string)kvp["access"]); - - if (kvp.ContainsKey("regionSecret")) - RegionSecret =(string)kvp["regionSecret"]; - - if (kvp.ContainsKey("owner_uuid")) - EstateOwner = new UUID(kvp["owner_uuid"].ToString()); - - if (kvp.ContainsKey("Token")) - Token = kvp["Token"].ToString(); - } } -} +} \ 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 @@ -/* +/* * Copyright (c) Contributors, http://opensimulator.org/ * See CONTRIBUTORS.TXT for a full list of copyright holders. * @@ -37,31 +37,71 @@ namespace OpenSim.Services.Interfaces public interface IGatekeeperService { bool LinkRegion(string regionDescriptor, out UUID regionID, out ulong regionHandle, out string externalName, out string imageURL, out string reason); - GridRegion GetHyperlinkRegion(UUID regionID); + + /// + /// Returns the region a Hypergrid visitor should enter. + /// + /// + /// Usually the returned region will be the requested region. But the grid can choose to + /// redirect the user to another region: e.g., a default gateway region. + /// + /// The region the visitor *wants* to enter + /// The visitor's User ID. Will be missing (UUID.Zero) in older OpenSims. + /// The visitor's Home URI. Will be missing (null) in older OpenSims. + /// [out] A message to show to the user (optional, may be null) + /// The region the visitor should enter, or null if no region can be found / is allowed + GridRegion GetHyperlinkRegion(UUID regionID, UUID agentID, string agentHomeURI, out string message); - bool LoginAgent(AgentCircuitData aCircuit, GridRegion destination, out string reason); + bool LoginAgent(GridRegion source, AgentCircuitData aCircuit, GridRegion destination, out string reason); } - /// - /// HG1.5 only - /// public interface IUserAgentService { - // called by login service only - bool LoginAgentToGrid(AgentCircuitData agent, GridRegion gatekeeper, GridRegion finalDestination, IPEndPoint clientIP, out string reason); - // called by simulators - bool LoginAgentToGrid(AgentCircuitData agent, GridRegion gatekeeper, GridRegion finalDestination, out string reason); + bool LoginAgentToGrid(GridRegion source, AgentCircuitData agent, GridRegion gatekeeper, GridRegion finalDestination, bool fromLogin, out string reason); + void LogoutAgent(UUID userID, UUID sessionID); + + /// + /// Returns the home region of a remote user. + /// + /// On success: the user's home region. If the user doesn't exist: null. + /// Throws an exception if an error occurs (e.g., can't contact the server). GridRegion GetHomeRegion(UUID userID, out Vector3 position, out Vector3 lookAt); + + /// + /// Returns the Server URLs of a remote user. + /// + /// On success: the user's Server URLs. If the user doesn't exist: an empty dictionary. + /// Throws an exception if an error occurs (e.g., can't contact the server). Dictionary GetServerURLs(UUID userID); - Dictionary GetUserInfo(UUID userID); + /// + /// Returns the UserInfo of a remote user. + /// + /// On success: the user's UserInfo. If the user doesn't exist: an empty dictionary. + /// Throws an exception if an error occurs (e.g., can't contact the server). + Dictionary GetUserInfo(UUID userID); + + /// + /// Returns the current location of a remote user. + /// + /// On success: the user's Server URLs. If the user doesn't exist: "". + /// Throws an exception if an error occurs (e.g., can't contact the server). string LocateUser(UUID userID); - // Tries to get the universal user identifier for the targetUserId - // on behalf of the userID + + /// + /// Returns the Universal User Identifier for 'targetUserID' on behalf of 'userID'. + /// + /// On success: the user's UUI. If the user doesn't exist: "". + /// Throws an exception if an error occurs (e.g., can't contact the server). string GetUUI(UUID userID, UUID targetUserID); + /// + /// Returns the remote user that has the given name. + /// + /// On success: the user's UUID. If the user doesn't exist: UUID.Zero. + /// Throws an exception if an error occurs (e.g., can't contact the server). UUID GetUUID(String first, String last); // 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 List GetInventorySkeleton(UUID userId); /// - /// Synchronous inventory fetch. - /// - /// - /// - [Obsolete] - InventoryCollection GetUserInventory(UUID userID); - - /// - /// Request the inventory for a user. This is an asynchronous operation that will call the callback when the - /// inventory has been received - /// - /// - /// - [Obsolete] - void GetUserInventory(UUID userID, InventoryReceiptCallback callback); - - /// /// Retrieve the root inventory folder for the given user. /// /// @@ -84,15 +67,23 @@ namespace OpenSim.Services.Interfaces /// /// /// - InventoryFolderBase GetFolderForType(UUID userID, AssetType type); + InventoryFolderBase GetFolderForType(UUID userID, FolderType type); /// /// Gets everything (folders and items) inside a folder /// /// /// - /// + /// Inventory content. null if the request failed. InventoryCollection GetFolderContent(UUID userID, UUID folderID); + + /// + /// Gets everything (folders and items) inside a folder + /// + /// + /// + /// Inventory content. + InventoryCollection[] GetMultipleFoldersContent(UUID userID, UUID[] folderIDs); /// /// Gets the items inside a folder @@ -173,6 +164,13 @@ namespace OpenSim.Services.Interfaces InventoryItemBase GetItem(InventoryItemBase item); /// + /// Get multiple items, given by their UUIDs + /// + /// + /// null if no item was found, otherwise the found item + InventoryItemBase[] GetMultipleItems(UUID userID, UUID[] ids); + + /// /// Get a folder, given by its UUID /// /// 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 { //List GetMapBlocks(UUID scopeID, int minX, int minY, int maxX, int maxY); bool AddMapTile(int x, int y, byte[] imageData, out string reason); + bool RemoveMapTile(int x, int y, out string reason); byte[] GetMapTile(string fileName, out string format); } } 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 public interface IOfflineIMService { List GetMessages(UUID principalID); + bool StoreMessage(GridInstantMessage im, out string reason); + + /// + /// Delete messages to or from this user (or group). + /// + /// A user or group ID + void DeleteMessages(UUID userID); } 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 @@ */ using System; +using System.Collections.Generic; using OpenSim.Framework; using OpenMetaverse; @@ -33,6 +34,20 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion; namespace OpenSim.Services.Interfaces { + public class EntityTransferContext + { + public EntityTransferContext() + { + InboundVersion = VersionInfo.SimulationServiceVersionAcceptedMax; + OutboundVersion = VersionInfo.SimulationServiceVersionSupportedMax; + VariableWearablesSupported = false; + } + + public float InboundVersion { get; set; } + public float OutboundVersion { get; set; } + public bool VariableWearablesSupported { get; set; } + } + public interface ISimulationService { /// @@ -53,11 +68,13 @@ namespace OpenSim.Services.Interfaces /// /// Ask the simulator hosting the destination to create an agent on that region. /// + /// The region that the user is coming from. Will be null if the user + /// logged-in directly, or arrived from a simulator that doesn't send this parameter. /// /// /// /// Reason message in the event of a failure. - bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint flags, out string reason); + bool CreateAgent(GridRegion source, GridRegion destination, AgentCircuitData aCircuit, uint flags, out string reason); /// /// Full child agent update. @@ -75,9 +92,21 @@ namespace OpenSim.Services.Interfaces /// bool UpdateAgent(GridRegion destination, AgentPosition data); - bool RetrieveAgent(GridRegion destination, UUID id, out IAgentData agent); - - bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string version, out string reason); + /// + /// Returns whether a propspective user is allowed to visit the region. + /// + /// Desired destination + /// The visitor's User ID + /// The visitor's Home URI. Will be missing (null) in older OpenSims. + /// True: via teleport; False: via cross (walking) + /// Position in the region + /// + /// Version that the requesting simulator is runing. If null then no version check is carried out. + /// + /// Version that the target simulator is running + /// [out] Optional error message + /// True: ok; False: not allowed + bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, List features, EntityTransferContext ctx, out string reason); /// /// Message from receiving region to departing region, telling it got contacted by the client. @@ -95,7 +124,7 @@ namespace OpenSim.Services.Interfaces /// /// /// - bool CloseAgent(GridRegion destination, UUID id); + bool CloseAgent(GridRegion destination, UUID id, string auth_token); #endregion Agents 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 /// /// bool StoreUserAccount(UserAccount data); + + void InvalidateCache(UUID userID); } } 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 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; + +using OpenMetaverse; + +namespace OpenSim.Services.Interfaces +{ + /// + /// This maintains the relationship between a UUID and a user name. + /// + public interface IUserManagement + { + string GetUserName(UUID uuid); + string GetUserHomeURL(UUID uuid); + string GetUserUUI(UUID uuid); + bool GetUserUUI(UUID userID, out string uui); + string GetUserServerURL(UUID uuid, string serverType); + + /// + /// Get user ID by the given name. + /// + /// + /// UUID.Zero if no user with that name is found or if the name is "Unknown User" + UUID GetUserIdByName(string name); + + /// + /// Get user ID by the given name. + /// + /// + /// + /// UUID.Zero if no user with that name is found or if the name is "Unknown User" + UUID GetUserIdByName(string firstName, string lastName); + + /// + /// Add a user. + /// + /// + /// If an account is found for the UUID, then the names in this will be used rather than any information + /// extracted from creatorData. + /// + /// + /// The creator data for this user. + void AddUser(UUID uuid, string creatorData); + + /// + /// Add a user. + /// + /// + /// The UUID is related to the name without any other checks being performed, such as user account presence. + /// + /// + /// + /// + void AddUser(UUID uuid, string firstName, string lastName); + + /// + /// Add a user. + /// + /// + /// The arguments apart from uuid are formed into a creatorData string and processing proceeds as for the + /// AddUser(UUID uuid, string creatorData) method. + /// + /// + /// + /// + void AddUser(UUID uuid, string firstName, string lastName, string homeURL); + + bool IsLocalGridUser(UUID uuid); + } +} 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 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using OpenSim.Framework; +using OpenMetaverse; +using OpenMetaverse.StructuredData; + +namespace OpenSim.Services.Interfaces +{ + public interface IUserProfilesService + { + #region Classifieds + OSD AvatarClassifiedsRequest(UUID creatorId); + bool ClassifiedUpdate(UserClassifiedAdd ad, ref string result); + bool ClassifiedInfoRequest(ref UserClassifiedAdd ad, ref string result); + bool ClassifiedDelete(UUID recordId); + #endregion Classifieds + + #region Picks + OSD AvatarPicksRequest(UUID creatorId); + bool PickInfoRequest(ref UserProfilePick pick, ref string result); + bool PicksUpdate(ref UserProfilePick pick, ref string result); + bool PicksDelete(UUID pickId); + #endregion Picks + + #region Notes + bool AvatarNotesRequest(ref UserProfileNotes note); + bool NotesUpdate(ref UserProfileNotes note, ref string result); + #endregion Notes + + #region Profile Properties + bool AvatarPropertiesRequest(ref UserProfileProperties prop, ref string result); + bool AvatarPropertiesUpdate(ref UserProfileProperties prop, ref string result); + #endregion Profile Properties + + #region User Preferences + bool UserPreferencesRequest(ref UserPreferences pref, ref string result); + bool UserPreferencesUpdate(ref UserPreferences pref, ref string result); + #endregion User Preferences + + #region Interests + bool AvatarInterestsUpdate(UserProfileProperties prop, ref string result); + #endregion Interests + + #region Utility + OSD AvatarImageAssetsRequest(UUID avatarId); + #endregion Utility + + #region UserData + bool RequestUserAppData(ref UserAppData prop, ref string result); + bool SetUserAppData(UserAppData prop, ref string result); + #endregion UserData + } +} + 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 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Net; +using System.Net.Sockets; +using System.Reflection; +using System.Text; +using System.Xml; +using log4net; +using OpenMetaverse; +using OpenSim.Framework; + +namespace OpenSim.Services.UserProfilesService +{ + /// + /// A client for accessing a profile server using the OpenProfile protocol. + /// + /// + /// This class was adapted from the full OpenProfile class. Since it's only a client, and not a server, + /// it's much simpler. + /// + public class OpenProfileClient + { +// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + private string m_serverURI; + + /// + /// Creates a client for accessing a foreign grid's profile server using the OpenProfile protocol. + /// + /// The grid's profile server URL + public OpenProfileClient(string serverURI) + { + m_serverURI = serverURI; + } + + /// + /// Gets an avatar's profile using the OpenProfile protocol. + /// + /// On success, this will contain the avatar's profile + /// Success/failure + /// + /// There are two profile modules currently in use in OpenSim: the older one is OpenProfile, and the newer + /// one is UserProfileModule (this file). This method attempts to read an avatar's profile from a foreign + /// grid using the OpenProfile protocol. + /// + public bool RequestAvatarPropertiesUsingOpenProfile(ref UserProfileProperties props) + { + Hashtable ReqHash = new Hashtable(); + ReqHash["avatar_id"] = props.UserId.ToString(); + + Hashtable profileData = XMLRPCRequester.SendRequest(ReqHash, "avatar_properties_request", m_serverURI); + + if (profileData == null) + return false; + if (!profileData.ContainsKey("data")) + return false; + + ArrayList dataArray = (ArrayList)profileData["data"]; + + if (dataArray == null || dataArray[0] == null) + return false; + profileData = (Hashtable)dataArray[0]; + + props.WebUrl = string.Empty; + props.AboutText = String.Empty; + props.FirstLifeText = String.Empty; + props.ImageId = UUID.Zero; + props.FirstLifeImageId = UUID.Zero; + props.PartnerId = UUID.Zero; + + if (profileData["ProfileUrl"] != null) + props.WebUrl = profileData["ProfileUrl"].ToString(); + if (profileData["AboutText"] != null) + props.AboutText = profileData["AboutText"].ToString(); + if (profileData["FirstLifeAboutText"] != null) + props.FirstLifeText = profileData["FirstLifeAboutText"].ToString(); + if (profileData["Image"] != null) + props.ImageId = new UUID(profileData["Image"].ToString()); + if (profileData["FirstLifeImage"] != null) + props.FirstLifeImageId = new UUID(profileData["FirstLifeImage"].ToString()); + if (profileData["Partner"] != null) + props.PartnerId = new UUID(profileData["Partner"].ToString()); + + props.WantToMask = 0; + props.WantToText = String.Empty; + props.SkillsMask = 0; + props.SkillsText = String.Empty; + props.Language = String.Empty; + + if (profileData["wantmask"] != null) + props.WantToMask = Convert.ToInt32(profileData["wantmask"].ToString()); + if (profileData["wanttext"] != null) + props.WantToText = profileData["wanttext"].ToString(); + + if (profileData["skillsmask"] != null) + props.SkillsMask = Convert.ToInt32(profileData["skillsmask"].ToString()); + if (profileData["skillstext"] != null) + props.SkillsText = profileData["skillstext"].ToString(); + + if (profileData["languages"] != null) + props.Language = profileData["languages"].ToString(); + + return true; + } + } +} \ 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; // Build Number // Revision // -[assembly: AssemblyVersion("0.7.5.*")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyVersion("0.8.3.*")] + -- cgit v1.1