diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs | 176 |
1 files changed, 0 insertions, 176 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs deleted file mode 100644 index bf24030..0000000 --- a/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs +++ /dev/null | |||
@@ -1,176 +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 | using System; | ||
28 | using System.Collections; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Globalization; | ||
31 | using System.Reflection; | ||
32 | |||
33 | using OpenMetaverse; | ||
34 | using log4net; | ||
35 | using Nini.Config; | ||
36 | using Mono.Addins; | ||
37 | |||
38 | using OpenSim.Framework; | ||
39 | using OpenSim.Region.Framework.Interfaces; | ||
40 | using OpenSim.Region.Framework.Scenes; | ||
41 | using OpenSim.Services.Interfaces; | ||
42 | |||
43 | namespace OpenSim.Region.CoreModules.Avatar.Profile | ||
44 | { | ||
45 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "BasicProfileModule")] | ||
46 | public class BasicProfileModule : IProfileModule, ISharedRegionModule | ||
47 | { | ||
48 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
49 | |||
50 | // | ||
51 | // Module vars | ||
52 | // | ||
53 | private List<Scene> m_Scenes = new List<Scene>(); | ||
54 | private bool m_Enabled = false; | ||
55 | |||
56 | #region ISharedRegionModule | ||
57 | |||
58 | public void Initialise(IConfigSource config) | ||
59 | { | ||
60 | m_log.DebugFormat("[PROFILE MODULE]: Basic Profile Module enabled"); | ||
61 | m_Enabled = true; | ||
62 | } | ||
63 | |||
64 | public void AddRegion(Scene scene) | ||
65 | { | ||
66 | if (!m_Enabled) | ||
67 | return; | ||
68 | |||
69 | lock (m_Scenes) | ||
70 | { | ||
71 | if (!m_Scenes.Contains(scene)) | ||
72 | { | ||
73 | m_Scenes.Add(scene); | ||
74 | // Hook up events | ||
75 | scene.EventManager.OnNewClient += OnNewClient; | ||
76 | scene.RegisterModuleInterface<IProfileModule>(this); | ||
77 | } | ||
78 | } | ||
79 | } | ||
80 | |||
81 | public void RegionLoaded(Scene scene) | ||
82 | { | ||
83 | if (!m_Enabled) | ||
84 | return; | ||
85 | } | ||
86 | |||
87 | public void RemoveRegion(Scene scene) | ||
88 | { | ||
89 | if (!m_Enabled) | ||
90 | return; | ||
91 | |||
92 | lock (m_Scenes) | ||
93 | { | ||
94 | m_Scenes.Remove(scene); | ||
95 | } | ||
96 | } | ||
97 | |||
98 | public void PostInitialise() | ||
99 | { | ||
100 | } | ||
101 | |||
102 | public void Close() | ||
103 | { | ||
104 | } | ||
105 | |||
106 | public string Name | ||
107 | { | ||
108 | get { return "BasicProfileModule"; } | ||
109 | } | ||
110 | |||
111 | public Type ReplaceableInterface | ||
112 | { | ||
113 | get { return typeof(IProfileModule); } | ||
114 | } | ||
115 | |||
116 | #endregion | ||
117 | |||
118 | /// New Client Event Handler | ||
119 | private void OnNewClient(IClientAPI client) | ||
120 | { | ||
121 | //Profile | ||
122 | client.OnRequestAvatarProperties += RequestAvatarProperties; | ||
123 | } | ||
124 | |||
125 | public void RequestAvatarProperties(IClientAPI remoteClient, UUID avatarID) | ||
126 | { | ||
127 | IScene s = remoteClient.Scene; | ||
128 | if (!(s is Scene)) | ||
129 | return; | ||
130 | |||
131 | // Scene scene = (Scene)s; | ||
132 | |||
133 | string profileUrl = String.Empty; | ||
134 | string aboutText = String.Empty; | ||
135 | string firstLifeAboutText = String.Empty; | ||
136 | UUID image = UUID.Zero; | ||
137 | UUID firstLifeImage = UUID.Zero; | ||
138 | UUID partner = UUID.Zero; | ||
139 | uint wantMask = 0; | ||
140 | string wantText = String.Empty; | ||
141 | uint skillsMask = 0; | ||
142 | string skillsText = String.Empty; | ||
143 | string languages = String.Empty; | ||
144 | |||
145 | UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, avatarID); | ||
146 | |||
147 | string name = "Avatar"; | ||
148 | int created = 0; | ||
149 | if (account != null) | ||
150 | { | ||
151 | name = account.FirstName + " " + account.LastName; | ||
152 | created = account.Created; | ||
153 | } | ||
154 | Byte[] charterMember = Utils.StringToBytes(name); | ||
155 | |||
156 | profileUrl = "No profile data"; | ||
157 | aboutText = string.Empty; | ||
158 | firstLifeAboutText = string.Empty; | ||
159 | image = UUID.Zero; | ||
160 | firstLifeImage = UUID.Zero; | ||
161 | partner = UUID.Zero; | ||
162 | |||
163 | remoteClient.SendAvatarProperties(avatarID, aboutText, | ||
164 | Util.ToDateTime(created).ToString( | ||
165 | "M/d/yyyy", CultureInfo.InvariantCulture), | ||
166 | charterMember, firstLifeAboutText, | ||
167 | (uint)(0 & 0xff), | ||
168 | firstLifeImage, image, profileUrl, partner); | ||
169 | |||
170 | //Viewer expects interest data when it asks for properties. | ||
171 | remoteClient.SendAvatarInterestsReply(avatarID, wantMask, wantText, | ||
172 | skillsMask, skillsText, languages); | ||
173 | } | ||
174 | |||
175 | } | ||
176 | } | ||