From 1e444b1449ffad4969709c039f7c606c9f8f484d Mon Sep 17 00:00:00 2001 From: AliciaRaven Date: Tue, 31 Mar 2015 12:35:55 +0100 Subject: [PATCH] Change UserProfiles so that the parcel name is used for a ProfilePick and not the parcel owners name. This change also fixes a bug where if the avatar enters and does not move, creating or editing a ProfilePick would set the parcelId as an empty UUID. This is because ScenePresence.currentParcelUUID is not set until the avatar moves. Signed-off-by: Michael Cerquoni --- OpenSim/Data/MySQL/MySQLUserProfilesData.cs | 6 +++-- OpenSim/Data/PGSQL/PGSQLUserProfilesData.cs | 4 +-- OpenSim/Data/SQLite/SQLiteUserProfilesData.cs | 4 +-- OpenSim/Framework/UserProfiles.cs | 2 +- .../Avatar/UserProfiles/UserProfileModule.cs | 26 +++++++------------ 5 files changed, 18 insertions(+), 24 deletions(-) diff --git a/OpenSim/Data/MySQL/MySQLUserProfilesData.cs b/OpenSim/Data/MySQL/MySQLUserProfilesData.cs index 86f2efee16..b35595d7d8 100644 --- a/OpenSim/Data/MySQL/MySQLUserProfilesData.cs +++ b/OpenSim/Data/MySQL/MySQLUserProfilesData.cs @@ -402,7 +402,7 @@ namespace OpenSim.Data.MySQL bool.TryParse((string)reader["enabled"], out pick.Enabled); pick.Name = (string)reader["name"]; pick.Desc = description; - pick.User = (string)reader["user"]; + pick.ParcelName = (string)reader["user"]; pick.OriginalName = (string)reader["originalname"]; pick.SimName = (string)reader["simname"]; pick.SortOrder = (int)reader["sortorder"]; @@ -443,6 +443,8 @@ namespace OpenSim.Data.MySQL query += "parceluuid=?ParcelId,"; query += "name=?Name,"; query += "description=?Desc,"; + query += "user=?User,"; + query += "simname=?SimName,"; query += "snapshotuuid=?SnapshotId,"; query += "pickuuid=?PickId,"; query += "posglobal=?GlobalPos,"; @@ -462,7 +464,7 @@ namespace OpenSim.Data.MySQL cmd.Parameters.AddWithValue("?Name", pick.Name.ToString()); cmd.Parameters.AddWithValue("?Desc", pick.Desc.ToString()); cmd.Parameters.AddWithValue("?SnapshotId", pick.SnapshotId.ToString()); - cmd.Parameters.AddWithValue("?User", pick.User.ToString()); + cmd.Parameters.AddWithValue("?User", pick.ParcelName.ToString()); cmd.Parameters.AddWithValue("?Original", pick.OriginalName.ToString()); cmd.Parameters.AddWithValue("?SimName",pick.SimName.ToString()); cmd.Parameters.AddWithValue("?GlobalPos", pick.GlobalPos); diff --git a/OpenSim/Data/PGSQL/PGSQLUserProfilesData.cs b/OpenSim/Data/PGSQL/PGSQLUserProfilesData.cs index d00c3cf885..a003e07dc9 100644 --- a/OpenSim/Data/PGSQL/PGSQLUserProfilesData.cs +++ b/OpenSim/Data/PGSQL/PGSQLUserProfilesData.cs @@ -385,7 +385,7 @@ namespace OpenSim.Data.PGSQL pick.Enabled = Convert.ToBoolean(reader["enabled"]); pick.Name = reader["name"].ToString (); pick.Desc = reader["description"].ToString(); - pick.User = reader["user"].ToString(); + pick.ParcelName = reader["user"].ToString(); pick.OriginalName = reader["originalname"].ToString(); pick.SimName = reader["simname"].ToString(); pick.SortOrder = (int)reader["sortorder"]; @@ -437,7 +437,7 @@ namespace OpenSim.Data.PGSQL cmd.Parameters.Add(m_database.CreateParameter("Name", pick.Name)); cmd.Parameters.Add(m_database.CreateParameter("Desc", pick.Desc)); cmd.Parameters.Add(m_database.CreateParameter("SnapshotId", pick.SnapshotId)); - cmd.Parameters.Add(m_database.CreateParameter("User", pick.User)); + cmd.Parameters.Add(m_database.CreateParameter("User", pick.ParcelName)); cmd.Parameters.Add(m_database.CreateParameter("Original", pick.OriginalName)); cmd.Parameters.Add(m_database.CreateParameter("SimName",pick.SimName)); cmd.Parameters.Add(m_database.CreateParameter("GlobalPos", pick.GlobalPos)); diff --git a/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs b/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs index 790843b70f..cd3e8b65c3 100644 --- a/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs +++ b/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs @@ -368,7 +368,7 @@ namespace OpenSim.Data.SQLite bool.TryParse((string)reader["enabled"].ToString(), out pick.Enabled); pick.Name = (string)reader["name"]; pick.Desc = description; - pick.User = (string)reader["user"]; + pick.ParcelName = (string)reader["user"]; pick.OriginalName = (string)reader["originalname"]; pick.SimName = (string)reader["simname"]; pick.SortOrder = (int)reader["sortorder"]; @@ -434,7 +434,7 @@ namespace OpenSim.Data.SQLite cmd.Parameters.AddWithValue(":Name", pick.Name.ToString()); cmd.Parameters.AddWithValue(":Desc", pick.Desc.ToString()); cmd.Parameters.AddWithValue(":SnapshotId", pick.SnapshotId.ToString()); - cmd.Parameters.AddWithValue(":User", pick.User.ToString()); + cmd.Parameters.AddWithValue(":User", pick.ParcelName.ToString()); cmd.Parameters.AddWithValue(":Original", pick.OriginalName.ToString()); cmd.Parameters.AddWithValue(":SimName",pick.SimName.ToString()); cmd.Parameters.AddWithValue(":GlobalPos", pick.GlobalPos); diff --git a/OpenSim/Framework/UserProfiles.cs b/OpenSim/Framework/UserProfiles.cs index bfc2f6ba8b..98ab651324 100644 --- a/OpenSim/Framework/UserProfiles.cs +++ b/OpenSim/Framework/UserProfiles.cs @@ -77,7 +77,7 @@ namespace OpenSim.Framework public string Desc = string.Empty; public UUID ParcelId = UUID.Zero; public UUID SnapshotId = UUID.Zero; - public string User = string.Empty; + public string ParcelName = string.Empty; public string SimName = string.Empty; public string GlobalPos = "<0,0,0>"; public string Gatekeeper = string.Empty; diff --git a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs index 48bb2df878..5a648a3d3b 100644 --- a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs @@ -671,7 +671,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles // Pull the rabbit out of the hat remoteClient.SendPickInfoReply(pick.PickId,pick.CreatorId,pick.TopPick,pick.ParcelId,pick.Name, - pick.Desc,pick.SnapshotId,pick.User,pick.OriginalName,pick.SimName, + pick.Desc,pick.SnapshotId,pick.ParcelName,pick.OriginalName,pick.SimName, globalPos,pick.SortOrder,pick.Enabled); } @@ -721,24 +721,16 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles remoteClient.Scene.RegionInfo.WorldLocY + avaPos.Y, avaPos.Z); - string landOwnerName = string.Empty; + string landParcelName = "My Parcel"; + UUID landParcelID = p.currentParcelUUID; + ILandObject land = p.Scene.LandChannel.GetLandObject(avaPos.X, avaPos.Y); if (land != null) { - if (land.LandData.IsGroupOwned) - { - IGroupsModule groupMod = p.Scene.RequestModuleInterface(); - UUID groupId = land.LandData.GroupID; - GroupRecord groupRecord = groupMod.GetGroupRecord(groupId); - landOwnerName = groupRecord.GroupName; - } - else - { - IUserAccountService accounts = p.Scene.RequestModuleInterface(); - UserAccount user = accounts.GetUserAccount(p.Scene.RegionInfo.ScopeID, land.LandData.OwnerID); - landOwnerName = user.Name; - } + // If land found, use parcel uuid from here because the value from SP will be blank if the avatar hasnt moved + landParcelName = land.LandData.Name; + landParcelID = land.LandData.GlobalID; } else { @@ -753,9 +745,9 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles pick.TopPick = topPick; pick.Name = name; pick.Desc = desc; - pick.ParcelId = p.currentParcelUUID; + pick.ParcelId = landParcelID; pick.SnapshotId = snapshotID; - pick.User = landOwnerName; + pick.ParcelName = landParcelName; pick.SimName = remoteClient.Scene.RegionInfo.RegionName; pick.Gatekeeper = MyGatekeeper; pick.GlobalPos = posGlobal.ToString();