diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index ce1a72fa8a..a3008a53c2 100755 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -93,7 +93,7 @@ namespace OpenSim.Framework public delegate void RequestAvatarProperties(IClientAPI remoteClient, UUID avatarID); - public delegate void UpdateAvatarProperties(IClientAPI remoteClient, UserProfileData ProfileData); + public delegate void UpdateAvatarProperties(IClientAPI remoteClient, UserProfileProperties ProfileData); public delegate void SetAlwaysRun(IClientAPI remoteClient, bool SetAlwaysRun); diff --git a/OpenSim/Framework/UserProfiles.cs b/OpenSim/Framework/UserProfiles.cs index a8a46832c3..16982de810 100644 --- a/OpenSim/Framework/UserProfiles.cs +++ b/OpenSim/Framework/UserProfiles.cs @@ -34,16 +34,16 @@ namespace OpenSim.Framework { public class UserClassifiedAdd { - public UUID ClassifiedId = UUID.Zero; - public UUID CreatorId = UUID.Zero; - public int CreationDate = 0; - public int ExpirationDate = 0; - public int Category = 0; + public UUID ClassifiedId; + public UUID CreatorId; + public int CreationDate; + public int ExpirationDate; + public int Category; public string Name = string.Empty; public string Description = string.Empty; - public UUID ParcelId = UUID.Zero; + public UUID ParcelId; public int ParentEstate = 0; - public UUID SnapshotId = UUID.Zero; + public UUID SnapshotId; public string SimName = string.Empty; public string GlobalPos = "<0,0,0>"; public string ParcelName = string.Empty; @@ -53,32 +53,32 @@ namespace OpenSim.Framework public class UserProfileProperties { - public UUID UserId = UUID.Zero; - public UUID PartnerId = UUID.Zero; - public bool PublishProfile = false; - public bool PublishMature = false; + public UUID UserId; + public UUID PartnerId; + public bool PublishProfile; + public bool PublishMature; public string WebUrl = string.Empty; public int WantToMask = 0; public string WantToText = string.Empty; public int SkillsMask = 0; public string SkillsText = string.Empty; public string Language = string.Empty; - public UUID ImageId = UUID.Zero; + public UUID ImageId; public string AboutText = string.Empty; - public UUID FirstLifeImageId = UUID.Zero; + public UUID FirstLifeImageId; public string FirstLifeText = string.Empty; } public class UserProfilePick { - public UUID PickId = UUID.Zero; - public UUID CreatorId = UUID.Zero; - public bool TopPick = false; + public UUID PickId; + public UUID CreatorId; + public bool TopPick; public string Name = string.Empty; public string OriginalName = string.Empty; public string Desc = string.Empty; - public UUID ParcelId = UUID.Zero; - public UUID SnapshotId = UUID.Zero; + public UUID ParcelId; + public UUID SnapshotId; public string ParcelName = string.Empty; public string SimName = string.Empty; public string GlobalPos = "<0,0,0>"; @@ -97,8 +97,8 @@ namespace OpenSim.Framework public class UserPreferences { public UUID UserId; - public bool IMViaEmail = false; - public bool Visible = false; + public bool IMViaEmail; + public bool Visible; public string EMail = string.Empty; } diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 2057104a75..e3a0eb9908 100755 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -8582,17 +8582,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP return; AvatarPropertiesUpdatePacket.PropertiesDataBlock Properties = avatarProps.PropertiesData; - UserProfileData UserProfile = new UserProfileData(); - UserProfile.ID = m_agentId; - UserProfile.AboutText = Utils.BytesToString(Properties.AboutText); - UserProfile.FirstLifeAboutText = Utils.BytesToString(Properties.FLAboutText); - UserProfile.FirstLifeImage = Properties.FLImageID; - UserProfile.Image = Properties.ImageID; - UserProfile.ProfileUrl = Utils.BytesToString(Properties.ProfileURL); - UserProfile.UserFlags &= ~3; - UserProfile.UserFlags |= Properties.AllowPublish ? 1 : 0; - UserProfile.UserFlags |= Properties.MaturePublish ? 2 : 0; - + UserProfileProperties UserProfile = new UserProfileProperties + { + UserId = AgentId, + WebUrl = Utils.BytesToString(Properties.ProfileURL), + ImageId = Properties.ImageID, + FirstLifeImageId = Properties.FLImageID, + AboutText = Utils.BytesToString(Properties.AboutText), + FirstLifeText = Utils.BytesToString(Properties.FLAboutText), + PublishProfile = Properties.AllowPublish, + PublishMature = Properties.MaturePublish + }; OnUpdateAvatarProperties?.Invoke(this, UserProfile); } diff --git a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs index 648e9ba4ef..f0092778b3 100644 --- a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs @@ -1463,7 +1463,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles uce.props = null; } } - + RequestAvatarProperties(remoteClient, remoteClient.AgentId); } public void RequestAvatarProperties(IClientAPI remoteClient, UUID avatarID) @@ -1672,46 +1672,33 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles /// /// New profile. /// - public void AvatarPropertiesUpdate(IClientAPI remoteClient, UserProfileData newProfile) + public void AvatarPropertiesUpdate(IClientAPI remoteClient, UserProfileProperties newProfile) { - if (remoteClient.AgentId == newProfile.ID) + GetUserProfileServerURI(remoteClient.AgentId, out string serverURI); + if (string.IsNullOrWhiteSpace(serverURI)) + return; + + if (!m_allowUserProfileWebURLs) + newProfile.WebUrl = string.Empty; + + object Prop = newProfile; + if(!rpc.JsonRpcRequest(ref Prop, "avatar_properties_update", serverURI, UUID.Random().ToString())) { - UserProfileProperties prop = new UserProfileProperties(); - - prop.UserId = remoteClient.AgentId; - prop.WebUrl = newProfile.ProfileUrl; - prop.ImageId = newProfile.Image; - prop.AboutText = newProfile.AboutText; - prop.FirstLifeImageId = newProfile.FirstLifeImage; - prop.FirstLifeText = newProfile.FirstLifeAboutText; - - if(!m_allowUserProfileWebURLs) - prop.WebUrl =""; - - string serverURI = string.Empty; - GetUserProfileServerURI(remoteClient.AgentId, out serverURI); - - object Prop = prop; - - if(!rpc.JsonRpcRequest(ref Prop, "avatar_properties_update", serverURI, UUID.Random().ToString())) - { - remoteClient.SendAgentAlertMessage( - "Error updating properties", false); - return; - } - - // flush cache - UserProfileCacheEntry uce = null; - lock(m_profilesCache) - { - if(m_profilesCache.TryGetValue(remoteClient.AgentId, out uce) && uce != null) - { - uce.props = null; - } - } - - RequestAvatarProperties(remoteClient, newProfile.ID); + remoteClient.SendAgentAlertMessage("Error updating properties", false); + return; } + + // flush cache + UserProfileCacheEntry uce = null; + lock(m_profilesCache) + { + if(m_profilesCache.TryGetValue(remoteClient.AgentId, out uce) && uce != null) + { + uce.props = null; + } + } + + RequestAvatarProperties(remoteClient, remoteClient.AgentId); } ///