From fe49c96ee0db0974a91b9b175ac1b00aef035797 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Mon, 3 Mar 2008 08:30:36 +0000 Subject: * Applying Ahzz's profile patch. Thanks Ahzz! * Fixed a few bugs in the patch that are sim crashers. * There's still a bug in mySQL mode/ grid mode where the main userprofile text doesn't save. --- .../Environment/Modules/AvatarProfilesModule.cs | 45 +++++++++++++++++++--- 1 file changed, 39 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs') diff --git a/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs b/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs index 8f4a0a1..711236d 100644 --- a/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs +++ b/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs @@ -36,6 +36,7 @@ namespace OpenSim.Region.Environment.Modules { public class AvatarProfilesModule : IRegionModule { + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); private Scene m_scene; public AvatarProfilesModule() @@ -69,11 +70,13 @@ namespace OpenSim.Region.Environment.Modules public void NewClient(IClientAPI client) { client.OnRequestAvatarProperties += RequestAvatarProperty; + client.OnUpdateAvatarProperties += UpdateAvatarProperties; } public void RemoveClient(IClientAPI client) { client.OnRequestAvatarProperties -= RequestAvatarProperty; + client.OnUpdateAvatarProperties -= UpdateAvatarProperties; } /// @@ -83,12 +86,42 @@ namespace OpenSim.Region.Environment.Modules /// public void RequestAvatarProperty(IClientAPI remoteClient, LLUUID avatarID) { - string about = "OpenSim crash test dummy"; - string bornOn = "Before now"; - string flAbout = "First life? What is one of those? OpenSim is my life!"; + // FIXME: finish adding fields such as url, masking, etc. LLUUID partner = new LLUUID("11111111-1111-0000-0000-000100bba000"); - remoteClient.SendAvatarProperties(avatarID, about, bornOn, System.String.Empty, flAbout, 0, LLUUID.Zero, LLUUID.Zero, System.String.Empty, - partner); + UserProfileData profile = m_scene.CommsManager.UserService.GetUserProfile(avatarID); + if (null != profile) + { + remoteClient.SendAvatarProperties(profile.UUID, profile.profileAboutText, + Util.ToDateTime(profile.created).ToString(), + System.String.Empty, profile.profileFirstText, profile.profileCanDoMask, + profile.profileFirstImage, profile.profileImage, System.String.Empty, partner); + } + else + { + m_log.Debug("[AvatarProfilesModule]: Got null for profile for " + avatarID.ToString()); + } + } + + public void UpdateAvatarProperties(IClientAPI remoteClient, UserProfileData newProfile) + { + UserProfileData Profile = m_scene.CommsManager.UserService.GetUserProfile(newProfile.UUID); + + // if it's the profile of the user requesting the update, then we change only a few things. + if (remoteClient.AgentId.CompareTo(Profile.UUID) == 0) + { + Profile.profileImage = newProfile.profileImage; + Profile.profileFirstImage = newProfile.profileFirstImage; + Profile.profileAboutText = newProfile.profileAboutText; + Profile.profileFirstText = newProfile.profileFirstText; + } + else + { + return; + } + if (m_scene.CommsManager.UserService.UpdateUserProfileProperties(Profile)) + { + RequestAvatarProperty(remoteClient, newProfile.UUID); + } } } -} \ No newline at end of file +} -- cgit v1.1