diff options
Diffstat (limited to 'OpenSim/Region/Environment')
-rw-r--r-- | OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs | 45 |
1 files changed, 39 insertions, 6 deletions
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 | |||
36 | { | 36 | { |
37 | public class AvatarProfilesModule : IRegionModule | 37 | public class AvatarProfilesModule : IRegionModule |
38 | { | 38 | { |
39 | private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | ||
39 | private Scene m_scene; | 40 | private Scene m_scene; |
40 | 41 | ||
41 | public AvatarProfilesModule() | 42 | public AvatarProfilesModule() |
@@ -69,11 +70,13 @@ namespace OpenSim.Region.Environment.Modules | |||
69 | public void NewClient(IClientAPI client) | 70 | public void NewClient(IClientAPI client) |
70 | { | 71 | { |
71 | client.OnRequestAvatarProperties += RequestAvatarProperty; | 72 | client.OnRequestAvatarProperties += RequestAvatarProperty; |
73 | client.OnUpdateAvatarProperties += UpdateAvatarProperties; | ||
72 | } | 74 | } |
73 | 75 | ||
74 | public void RemoveClient(IClientAPI client) | 76 | public void RemoveClient(IClientAPI client) |
75 | { | 77 | { |
76 | client.OnRequestAvatarProperties -= RequestAvatarProperty; | 78 | client.OnRequestAvatarProperties -= RequestAvatarProperty; |
79 | client.OnUpdateAvatarProperties -= UpdateAvatarProperties; | ||
77 | } | 80 | } |
78 | 81 | ||
79 | /// <summary> | 82 | /// <summary> |
@@ -83,12 +86,42 @@ namespace OpenSim.Region.Environment.Modules | |||
83 | /// <param name="avatarID"></param> | 86 | /// <param name="avatarID"></param> |
84 | public void RequestAvatarProperty(IClientAPI remoteClient, LLUUID avatarID) | 87 | public void RequestAvatarProperty(IClientAPI remoteClient, LLUUID avatarID) |
85 | { | 88 | { |
86 | string about = "OpenSim crash test dummy"; | 89 | // FIXME: finish adding fields such as url, masking, etc. |
87 | string bornOn = "Before now"; | ||
88 | string flAbout = "First life? What is one of those? OpenSim is my life!"; | ||
89 | LLUUID partner = new LLUUID("11111111-1111-0000-0000-000100bba000"); | 90 | LLUUID partner = new LLUUID("11111111-1111-0000-0000-000100bba000"); |
90 | remoteClient.SendAvatarProperties(avatarID, about, bornOn, System.String.Empty, flAbout, 0, LLUUID.Zero, LLUUID.Zero, System.String.Empty, | 91 | UserProfileData profile = m_scene.CommsManager.UserService.GetUserProfile(avatarID); |
91 | partner); | 92 | if (null != profile) |
93 | { | ||
94 | remoteClient.SendAvatarProperties(profile.UUID, profile.profileAboutText, | ||
95 | Util.ToDateTime(profile.created).ToString(), | ||
96 | System.String.Empty, profile.profileFirstText, profile.profileCanDoMask, | ||
97 | profile.profileFirstImage, profile.profileImage, System.String.Empty, partner); | ||
98 | } | ||
99 | else | ||
100 | { | ||
101 | m_log.Debug("[AvatarProfilesModule]: Got null for profile for " + avatarID.ToString()); | ||
102 | } | ||
103 | } | ||
104 | |||
105 | public void UpdateAvatarProperties(IClientAPI remoteClient, UserProfileData newProfile) | ||
106 | { | ||
107 | UserProfileData Profile = m_scene.CommsManager.UserService.GetUserProfile(newProfile.UUID); | ||
108 | |||
109 | // if it's the profile of the user requesting the update, then we change only a few things. | ||
110 | if (remoteClient.AgentId.CompareTo(Profile.UUID) == 0) | ||
111 | { | ||
112 | Profile.profileImage = newProfile.profileImage; | ||
113 | Profile.profileFirstImage = newProfile.profileFirstImage; | ||
114 | Profile.profileAboutText = newProfile.profileAboutText; | ||
115 | Profile.profileFirstText = newProfile.profileFirstText; | ||
116 | } | ||
117 | else | ||
118 | { | ||
119 | return; | ||
120 | } | ||
121 | if (m_scene.CommsManager.UserService.UpdateUserProfileProperties(Profile)) | ||
122 | { | ||
123 | RequestAvatarProperty(remoteClient, newProfile.UUID); | ||
124 | } | ||
92 | } | 125 | } |
93 | } | 126 | } |
94 | } \ No newline at end of file | 127 | } |