use UserProfileProperties instead of obsolete UserProfileData

This commit is contained in:
UbitUmarov
2022-06-21 00:03:12 +01:00
parent f085d5b3c1
commit 6566837f3b
4 changed files with 57 additions and 70 deletions

View File

@@ -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);

View File

@@ -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;
}

View File

@@ -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);
}

View File

@@ -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
/// <param name='newProfile'>
/// New profile.
/// </param>
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);
}
/// <summary>