diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Profiles/AvatarProfilesModule.cs | 169 |
1 files changed, 0 insertions, 169 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Profiles/AvatarProfilesModule.cs b/OpenSim/Region/CoreModules/Avatar/Profiles/AvatarProfilesModule.cs deleted file mode 100644 index 718ee2f..0000000 --- a/OpenSim/Region/CoreModules/Avatar/Profiles/AvatarProfilesModule.cs +++ /dev/null | |||
@@ -1,169 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Globalization; | ||
31 | using System.Reflection; | ||
32 | using log4net; | ||
33 | using Nini.Config; | ||
34 | using OpenMetaverse; | ||
35 | using OpenSim.Framework; | ||
36 | using OpenSim.Region.Framework.Interfaces; | ||
37 | using OpenSim.Region.Framework.Scenes; | ||
38 | |||
39 | namespace OpenSim.Region.CoreModules.Avatar.Profiles | ||
40 | { | ||
41 | public class AvatarProfilesModule : IRegionModule | ||
42 | { | ||
43 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
44 | private Scene m_scene; | ||
45 | private IProfileModule m_profileModule = null; | ||
46 | private bool m_enabled = true; | ||
47 | |||
48 | public AvatarProfilesModule() | ||
49 | { | ||
50 | } | ||
51 | |||
52 | #region IRegionModule Members | ||
53 | |||
54 | public void Initialise(Scene scene, IConfigSource config) | ||
55 | { | ||
56 | IConfig profileConfig = config.Configs["Profile"]; | ||
57 | if (profileConfig != null) | ||
58 | { | ||
59 | if (profileConfig.GetString("Module", Name) != Name) | ||
60 | { | ||
61 | m_enabled = false; | ||
62 | return; | ||
63 | } | ||
64 | } | ||
65 | |||
66 | m_scene = scene; | ||
67 | m_scene.EventManager.OnNewClient += NewClient; | ||
68 | } | ||
69 | |||
70 | public void PostInitialise() | ||
71 | { | ||
72 | if (!m_enabled) | ||
73 | return; | ||
74 | m_profileModule = m_scene.RequestModuleInterface<IProfileModule>(); | ||
75 | } | ||
76 | |||
77 | public void Close() | ||
78 | { | ||
79 | } | ||
80 | |||
81 | public string Name | ||
82 | { | ||
83 | get { return "AvatarProfilesModule"; } | ||
84 | } | ||
85 | |||
86 | public bool IsSharedModule | ||
87 | { | ||
88 | get { return false; } | ||
89 | } | ||
90 | |||
91 | #endregion | ||
92 | |||
93 | public void NewClient(IClientAPI client) | ||
94 | { | ||
95 | client.OnRequestAvatarProperties += RequestAvatarProperty; | ||
96 | client.OnUpdateAvatarProperties += UpdateAvatarProperties; | ||
97 | } | ||
98 | |||
99 | public void RemoveClient(IClientAPI client) | ||
100 | { | ||
101 | client.OnRequestAvatarProperties -= RequestAvatarProperty; | ||
102 | client.OnUpdateAvatarProperties -= UpdateAvatarProperties; | ||
103 | } | ||
104 | |||
105 | /// <summary> | ||
106 | /// | ||
107 | /// </summary> | ||
108 | /// <param name="remoteClient"></param> | ||
109 | /// <param name="avatarID"></param> | ||
110 | public void RequestAvatarProperty(IClientAPI remoteClient, UUID avatarID) | ||
111 | { | ||
112 | // FIXME: finish adding fields such as url, masking, etc. | ||
113 | UserProfileData profile = null; // m_scene.CommsManager.UserService.GetUserProfile(avatarID); | ||
114 | if (null != profile) | ||
115 | { | ||
116 | Byte[] charterMember; | ||
117 | if (profile.CustomType == "") | ||
118 | { | ||
119 | charterMember = new Byte[1]; | ||
120 | charterMember[0] = (Byte)((profile.UserFlags & 0xf00) >> 8); | ||
121 | } | ||
122 | else | ||
123 | { | ||
124 | charterMember = Utils.StringToBytes(profile.CustomType); | ||
125 | } | ||
126 | |||
127 | if (m_profileModule != null) | ||
128 | { | ||
129 | Hashtable profileData = m_profileModule.GetProfileData(remoteClient.AgentId); | ||
130 | if (profileData["ProfileUrl"] != null) | ||
131 | profile.ProfileUrl = profileData["ProfileUrl"].ToString(); | ||
132 | } | ||
133 | remoteClient.SendAvatarProperties(profile.ID, profile.AboutText, | ||
134 | Util.ToDateTime(profile.Created).ToString("M/d/yyyy", CultureInfo.InvariantCulture), | ||
135 | charterMember, profile.FirstLifeAboutText, (uint)(profile.UserFlags & 0xff), | ||
136 | profile.FirstLifeImage, profile.Image, profile.ProfileUrl, profile.Partner); | ||
137 | } | ||
138 | else | ||
139 | { | ||
140 | m_log.Debug("[AvatarProfilesModule]: Got null for profile for " + avatarID.ToString()); | ||
141 | } | ||
142 | } | ||
143 | |||
144 | public void UpdateAvatarProperties(IClientAPI remoteClient, UserProfileData newProfile) | ||
145 | { | ||
146 | return; | ||
147 | //UserProfileData Profile = m_scene.CommsManager.UserService.GetUserProfile(newProfile.ID); | ||
148 | |||
149 | //// if it's the profile of the user requesting the update, then we change only a few things. | ||
150 | //if (remoteClient.AgentId.CompareTo(Profile.ID) == 0) | ||
151 | //{ | ||
152 | // Profile.Image = newProfile.Image; | ||
153 | // Profile.FirstLifeImage = newProfile.FirstLifeImage; | ||
154 | // Profile.AboutText = newProfile.AboutText; | ||
155 | // Profile.FirstLifeAboutText = newProfile.FirstLifeAboutText; | ||
156 | // Profile.ProfileUrl = newProfile.ProfileUrl; | ||
157 | //} | ||
158 | //else | ||
159 | //{ | ||
160 | // return; | ||
161 | //} | ||
162 | |||
163 | //if (m_scene.CommsManager.UserService.UpdateUserProfile(Profile)) | ||
164 | //{ | ||
165 | // RequestAvatarProperty(remoteClient, newProfile.ID); | ||
166 | //} | ||
167 | } | ||
168 | } | ||
169 | } | ||