From b03ec6137f462486a3469f6ba4bbd363dc85295f Mon Sep 17 00:00:00 2001 From: BlueWall Date: Mon, 16 Dec 2013 15:10:09 -0500 Subject: Populate user preferences with UserAccount email if it is present, else return an error indicating no email is on record for the user. --- .../UserProfilesService/UserProfilesService.cs | 61 ++++++++++++++++++++++ 1 file changed, 61 insertions(+) (limited to 'OpenSim/Services') diff --git a/OpenSim/Services/UserProfilesService/UserProfilesService.cs b/OpenSim/Services/UserProfilesService/UserProfilesService.cs index 69c7b91..dd26cdc 100644 --- a/OpenSim/Services/UserProfilesService/UserProfilesService.cs +++ b/OpenSim/Services/UserProfilesService/UserProfilesService.cs @@ -37,6 +37,7 @@ using OpenSim.Data; using OpenMetaverse; using OpenMetaverse.StructuredData; using OpenSim.Framework; +using OpenSim.Services.UserAccountService; namespace OpenSim.Services.ProfilesService { @@ -166,11 +167,71 @@ namespace OpenSim.Services.ProfilesService #region User Preferences public bool UserPreferencesUpdate(ref UserPreferences pref, ref string result) { + if(string.IsNullOrEmpty(pref.EMail)) + { + UserAccount account = new UserAccount(); + if(userAccounts is UserAccountService.UserAccountService) + { + try + { + account = userAccounts.GetUserAccount(UUID.Zero, pref.UserId); + if(string.IsNullOrEmpty(account.Email)) + { + result = "No Email address on record!"; + return false; + } + else + pref.EMail = account.Email; + } + catch + { + m_log.Info ("[PROFILES]: UserAccountService Exception: Could not get user account"); + result = "Missing Email address!"; + return false; + } + } + else + { + m_log.Info ("[PROFILES]: UserAccountService: Could not get user account"); + result = "Missing Email address!"; + return false; + } + } return ProfilesData.UpdateUserPreferences(ref pref, ref result); } public bool UserPreferencesRequest(ref UserPreferences pref, ref string result) { + if(string.IsNullOrEmpty(pref.EMail)) + { + UserAccount account = new UserAccount(); + if(userAccounts is UserAccountService.UserAccountService) + { + try + { + account = userAccounts.GetUserAccount(UUID.Zero, pref.UserId); + if(string.IsNullOrEmpty(account.Email)) + { + result = "No Email address on record!"; + return false; + } + else + pref.EMail = account.Email; + } + catch + { + m_log.Info ("[PROFILES]: UserAccountService Exception: Could not get user account"); + result = "Missing Email address!"; + return false; + } + } + else + { + m_log.Info ("[PROFILES]: UserAccountService: Could not get user account"); + result = "Missing Email address!"; + return false; + } + } return ProfilesData.GetUserPreferences(ref pref, ref result); } #endregion User Preferences -- cgit v1.1 From 6869633d76b2a6664743a608e4284b8dd7df85a6 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sat, 28 Dec 2013 06:58:15 -0800 Subject: Add serialization/deserialization of region size to RegionInfo, GridRegion, and RegionData. This does not modify interfaces or handling of variable sized regions. This only enables the loading and storing of the region size and the reporting of the region size in grid service responses. The database tables already have the code to load and store the region size. --- OpenSim/Services/GridService/GridService.cs | 14 ++++++++++++-- OpenSim/Services/Interfaces/IGridService.cs | 25 +++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) (limited to 'OpenSim/Services') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index e72b7f9..137ce04 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -313,8 +313,9 @@ namespace OpenSim.Services.GridService if (region != null) { // Not really? Maybe? - List rdatas = m_Database.Get(region.posX - (int)Constants.RegionSize - 1, region.posY - (int)Constants.RegionSize - 1, - region.posX + (int)Constants.RegionSize + 1, region.posY + (int)Constants.RegionSize + 1, scopeID); + List rdatas = m_Database.Get( + region.posX - region.sizeX - 1, region.posY - region.sizeY - 1, + region.posX + region.sizeX + 1, region.posY + region.sizeY + 1, scopeID); foreach (RegionData rdata in rdatas) { @@ -347,6 +348,11 @@ namespace OpenSim.Services.GridService return null; } + // Get a region given its base coordinates. + // NOTE: this is NOT 'get a region by some point in the region'. The coordinate MUST + // be the base coordinate of the region. + // The snapping is technically unnecessary but is harmless because regions are always + // multiples of the legacy region size (256). public GridRegion GetRegionByPosition(UUID scopeID, int x, int y) { int snapX = (int)(x / Constants.RegionSize) * (int)Constants.RegionSize; @@ -441,6 +447,8 @@ namespace OpenSim.Services.GridService RegionData rdata = new RegionData(); rdata.posX = (int)rinfo.RegionLocX; rdata.posY = (int)rinfo.RegionLocY; + rdata.sizeX = rinfo.RegionSizeX; + rdata.sizeY = rinfo.RegionSizeY; rdata.RegionID = rinfo.RegionID; rdata.RegionName = rinfo.RegionName; rdata.Data = rinfo.ToKeyValuePairs(); @@ -454,6 +462,8 @@ namespace OpenSim.Services.GridService GridRegion rinfo = new GridRegion(rdata.Data); rinfo.RegionLocX = rdata.posX; rinfo.RegionLocY = rdata.posY; + rinfo.RegionSizeX = rdata.sizeX; + rinfo.RegionSizeY = rdata.sizeY; rinfo.RegionID = rdata.RegionID; rinfo.RegionName = rdata.RegionName; rinfo.ScopeID = rdata.ScopeID; diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs index 88ac5b3..651bd97 100644 --- a/OpenSim/Services/Interfaces/IGridService.cs +++ b/OpenSim/Services/Interfaces/IGridService.cs @@ -177,6 +177,7 @@ namespace OpenSim.Services.Interfaces /// /// The location of this region in meters. + /// DANGER DANGER! Note that this name means something different in RegionInfo. /// public int RegionLocX { @@ -185,8 +186,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 { @@ -218,10 +223,13 @@ namespace OpenSim.Services.Interfaces 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; @@ -231,16 +239,21 @@ 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); + RegionSizeX = (int)Constants.RegionSize; + RegionSizeY = (int)Constants.RegionSize; } public GridRegion(RegionInfo ConvertFrom) @@ -248,6 +261,8 @@ namespace OpenSim.Services.Interfaces m_regionName = ConvertFrom.RegionName; m_regionLocX = (int)(ConvertFrom.RegionLocX * Constants.RegionSize); m_regionLocY = (int)(ConvertFrom.RegionLocY * Constants.RegionSize); + RegionSizeX = (int)ConvertFrom.RegionSizeX; + RegionSizeY = (int)ConvertFrom.RegionSizeY; m_internalEndPoint = ConvertFrom.InternalEndPoint; m_externalHostName = ConvertFrom.ExternalHostName; m_httpPort = ConvertFrom.HttpPort; @@ -266,6 +281,8 @@ namespace OpenSim.Services.Interfaces m_regionName = ConvertFrom.RegionName; 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; @@ -373,6 +390,8 @@ namespace OpenSim.Services.Interfaces kvp["uuid"] = RegionID.ToString(); kvp["locX"] = RegionLocX.ToString(); kvp["locY"] = RegionLocY.ToString(); + kvp["sizeX"] = RegionSizeX.ToString(); + kvp["sizeY"] = RegionSizeY.ToString(); kvp["regionName"] = RegionName; kvp["serverIP"] = ExternalHostName; //ExternalEndPoint.Address.ToString(); kvp["serverHttpPort"] = HttpPort.ToString(); @@ -399,6 +418,12 @@ namespace OpenSim.Services.Interfaces if (kvp.ContainsKey("locY")) RegionLocY = Convert.ToInt32((string)kvp["locY"]); + if (kvp.ContainsKey("sizeX")) + RegionSizeX = Convert.ToInt32((string)kvp["sizeX"]); + + if (kvp.ContainsKey("sizeY")) + RegionSizeY = Convert.ToInt32((string)kvp["sizeY"]); + if (kvp.ContainsKey("regionName")) RegionName = (string)kvp["regionName"]; -- cgit v1.1 From eab9390e05920ac848df4e4c9681858b70858b34 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sat, 28 Dec 2013 07:20:14 -0800 Subject: Initialize default region size in GridRegion in the no parameter constructor as is used by the grid connector tests. --- OpenSim/Services/Interfaces/IGridService.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenSim/Services') diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs index 651bd97..59d6167 100644 --- a/OpenSim/Services/Interfaces/IGridService.cs +++ b/OpenSim/Services/Interfaces/IGridService.cs @@ -220,6 +220,8 @@ namespace OpenSim.Services.Interfaces public GridRegion() { + RegionSizeX = (int)Constants.RegionSize; + RegionSizeY = (int)Constants.RegionSize; m_serverURI = string.Empty; } -- cgit v1.1 From 004ecee3147cde699adbedcb2fcd88caee87527a Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sat, 2 Nov 2013 15:42:26 -0700 Subject: varregion: send region size in LLLoginResponse. --- OpenSim/Services/LLLoginService/LLLoginResponse.cs | 11 ++++++++++- OpenSim/Services/LLLoginService/LLLoginService.cs | 3 +++ 2 files changed, 13 insertions(+), 1 deletion(-) (limited to 'OpenSim/Services') diff --git a/OpenSim/Services/LLLoginService/LLLoginResponse.cs b/OpenSim/Services/LLLoginService/LLLoginResponse.cs index 6ab5258..f96480c 100644 --- a/OpenSim/Services/LLLoginService/LLLoginResponse.cs +++ b/OpenSim/Services/LLLoginService/LLLoginResponse.cs @@ -254,11 +254,12 @@ namespace OpenSim.Services.LLLoginService Currency = currency; ClassifiedFee = classifiedFee; - FillOutHomeData(pinfo, home); LookAt = String.Format("[r{0},r{1},r{2}]", lookAt.X, lookAt.Y, lookAt.Z); FillOutRegionData(destination); + m_log.DebugFormat("[LOGIN RESPONSE] LLLoginResponse create. sizeX={0}, sizeY={1}", RegionSizeX, RegionSizeY); + Util.PrintCallStack(); FillOutSeedCap(aCircuit, destination, clientIP); @@ -384,6 +385,8 @@ namespace OpenSim.Services.LLLoginService SimPort = (uint)endPoint.Port; RegionX = (uint)destination.RegionLocX; RegionY = (uint)destination.RegionLocY; + RegionSizeX = destination.RegionSizeX; + RegionSizeY = destination.RegionSizeY; } private void FillOutSeedCap(AgentCircuitData aCircuit, GridRegion destination, IPEndPoint ipepClient) @@ -529,6 +532,9 @@ namespace OpenSim.Services.LLLoginService responseData["message"] = welcomeMessage; responseData["region_x"] = (Int32)(RegionX); responseData["region_y"] = (Int32)(RegionY); + responseData["region_size_x"] = (Int32)RegionSizeX; + responseData["region_size_y"] = (Int32)RegionSizeY; + m_log.DebugFormat("[LOGIN RESPONSE] returning sizeX={0}, sizeY={1}", RegionSizeX, RegionSizeY); if (searchURL != String.Empty) responseData["search"] = searchURL; @@ -918,6 +924,9 @@ namespace OpenSim.Services.LLLoginService set { regionY = value; } } + public int RegionSizeX { get; private set; } + public int RegionSizeY { get; private set; } + public string SunTexture { get { return sunTexture; } diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index fe43582..e2f9966 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs @@ -50,6 +50,8 @@ namespace OpenSim.Services.LLLoginService public class LLLoginService : ILoginService { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private static readonly string LogHeader = "[LLOGIN SERVICE]"; + private static bool Initialized = false; protected IUserAccountService m_UserAccountService; @@ -389,6 +391,7 @@ namespace OpenSim.Services.LLLoginService if (guinfo == null) { // something went wrong, make something up, so that we don't have to test this anywhere else + m_log.DebugFormat("{0} Failed to fetch GridUserInfo. Creating empty GridUserInfo as home", LogHeader); guinfo = new GridUserInfo(); guinfo.LastPosition = guinfo.HomePosition = new Vector3(128, 128, 30); } -- cgit v1.1 From 7e32313a491defe8f5fb62ce0036c1692d4b4af9 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Fri, 3 Jan 2014 07:41:06 -0800 Subject: varregion: Add region size to teleport event messages (EnableSimulator, CorssRegion, TeleportFinishEvent). Have Simian grid service return the region size. Many teleport related debug log messages. Can be removed when teleport works (like that's ever going to happen). Conflicts: OpenSim/Framework/RegionInfo.cs --- .../Connectors/SimianGrid/SimianGridServiceConnector.cs | 6 +++++- OpenSim/Services/Interfaces/IGridService.cs | 14 ++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) (limited to 'OpenSim/Services') diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs index 816591b..c928f16 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs @@ -443,9 +443,13 @@ namespace OpenSim.Services.Connectors.SimianGrid region.RegionName = response["Name"].AsString(); Vector3d minPosition = response["MinPosition"].AsVector3d(); + Vector3d maxPosition = response["MaxPosition"].AsVector3d(); region.RegionLocX = (int)minPosition.X; region.RegionLocY = (int)minPosition.Y; - + + region.RegionSizeX = (int)maxPosition.X - (int)minPosition.X; + region.RegionSizeY = (int)maxPosition.Y - (int)minPosition.Y; + if ( ! extraData["HyperGrid"] ) { Uri httpAddress = response["Address"].AsUri(); region.ExternalHostName = httpAddress.Host; diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs index 59d6167..9459ecd 100644 --- a/OpenSim/Services/Interfaces/IGridService.cs +++ b/OpenSim/Services/Interfaces/IGridService.cs @@ -29,9 +29,13 @@ using System; 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 @@ -119,6 +123,9 @@ namespace OpenSim.Services.Interfaces public class GridRegion { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private static readonly string LogHeader = "[GRID REGION]"; + /// /// The port by which http communication occurs with the region /// @@ -422,9 +429,13 @@ namespace OpenSim.Services.Interfaces 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"]; @@ -473,6 +484,9 @@ namespace OpenSim.Services.Interfaces 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); } } } -- cgit v1.1 From 8ff2ff1a3667a679c4e8e8502a80e03e7e2ca69d Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sat, 4 Jan 2014 15:10:35 -0800 Subject: Remove some chatty DebugFormat statements. No functional changes. --- OpenSim/Services/Interfaces/IGridService.cs | 4 ++-- OpenSim/Services/LLLoginService/LLLoginResponse.cs | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'OpenSim/Services') diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs index 9459ecd..739e279 100644 --- a/OpenSim/Services/Interfaces/IGridService.cs +++ b/OpenSim/Services/Interfaces/IGridService.cs @@ -485,8 +485,8 @@ namespace OpenSim.Services.Interfaces 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); + // m_log.DebugFormat("{0} New GridRegion. id={1}, loc=<{2},{3}>, size=<{4},{5}>", + // LogHeader, RegionID, RegionLocX, RegionLocY, RegionSizeX, RegionSizeY); } } } diff --git a/OpenSim/Services/LLLoginService/LLLoginResponse.cs b/OpenSim/Services/LLLoginService/LLLoginResponse.cs index f96480c..5256b74 100644 --- a/OpenSim/Services/LLLoginService/LLLoginResponse.cs +++ b/OpenSim/Services/LLLoginService/LLLoginResponse.cs @@ -258,8 +258,7 @@ namespace OpenSim.Services.LLLoginService LookAt = String.Format("[r{0},r{1},r{2}]", lookAt.X, lookAt.Y, lookAt.Z); FillOutRegionData(destination); - m_log.DebugFormat("[LOGIN RESPONSE] LLLoginResponse create. sizeX={0}, sizeY={1}", RegionSizeX, RegionSizeY); - Util.PrintCallStack(); + // m_log.DebugFormat("[LOGIN RESPONSE] LLLoginResponse create. sizeX=<{0},{1}>", RegionSizeX, RegionSizeY); FillOutSeedCap(aCircuit, destination, clientIP); @@ -534,7 +533,7 @@ namespace OpenSim.Services.LLLoginService responseData["region_y"] = (Int32)(RegionY); responseData["region_size_x"] = (Int32)RegionSizeX; responseData["region_size_y"] = (Int32)RegionSizeY; - m_log.DebugFormat("[LOGIN RESPONSE] returning sizeX={0}, sizeY={1}", RegionSizeX, RegionSizeY); + // m_log.DebugFormat("[LOGIN RESPONSE] returning sizeX=<{0},{1}>", RegionSizeX, RegionSizeY); if (searchURL != String.Empty) responseData["search"] = searchURL; -- cgit v1.1