aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorDiva Canto2011-05-27 07:00:36 -0700
committerDiva Canto2011-05-27 07:00:36 -0700
commit36f9d55c363f0b6877a4eeb4a9d37ba989257393 (patch)
tree8f568aa15b165db067d443e7d8790ece81ac11e4 /OpenSim/Region
parentAdded missing config vars to StandaloneCommon.ini.example and fixed the ones ... (diff)
downloadopensim-SC-36f9d55c363f0b6877a4eeb4a9d37ba989257393.zip
opensim-SC-36f9d55c363f0b6877a4eeb4a9d37ba989257393.tar.gz
opensim-SC-36f9d55c363f0b6877a4eeb4a9d37ba989257393.tar.bz2
opensim-SC-36f9d55c363f0b6877a4eeb4a9d37ba989257393.tar.xz
Added a BasicProfilemodule so that the profile-based actions (like give inventory, etc) work. This is just a mock profile, the same for all users, and with no DB backend behind it -- meaning that nothing will be saved. For serious profiles, use 3rd party implementations.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs173
1 files changed, 173 insertions, 0 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs
new file mode 100644
index 0000000..e04fff6
--- /dev/null
+++ b/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs
@@ -0,0 +1,173 @@
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 */
27using System;
28using System.Collections;
29using System.Collections.Generic;
30using System.Globalization;
31using System.Reflection;
32
33using OpenMetaverse;
34using log4net;
35using Nini.Config;
36using Mono.Addins;
37
38using OpenSim.Framework;
39using OpenSim.Region.Framework.Interfaces;
40using OpenSim.Region.Framework.Scenes;
41using OpenSim.Services.Interfaces;
42
43namespace OpenSim.Region.CoreModules.Avatar.Profile
44{
45 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
46 public class BasicProfileModule : 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 if (config.Configs["Profiles"] != null)
61 {
62 if (config.Configs["Profiles"].GetString("Module", string.Empty) != "BasicProfileModule")
63 return;
64 }
65
66 m_log.DebugFormat("[PROFILE MODULE]: Basic Profile Module enabled");
67 m_Enabled = true;
68
69 }
70
71 public void AddRegion(Scene scene)
72 {
73 if (!m_Enabled)
74 return;
75
76 lock (m_Scenes)
77 {
78 if (!m_Scenes.Contains(scene))
79 {
80 m_Scenes.Add(scene);
81 // Hook up events
82 scene.EventManager.OnNewClient += OnNewClient;
83 }
84 }
85 }
86
87 public void RegionLoaded(Scene scene)
88 {
89 if (!m_Enabled)
90 return;
91 }
92
93 public void RemoveRegion(Scene scene)
94 {
95 if (!m_Enabled)
96 return;
97
98 lock (m_Scenes)
99 {
100 m_Scenes.Remove(scene);
101 }
102 }
103
104 public void PostInitialise()
105 {
106 }
107
108 public void Close()
109 {
110 }
111
112 public string Name
113 {
114 get { return "BasicProfileModule"; }
115 }
116
117 public Type ReplaceableInterface
118 {
119 get { return null; }
120 }
121
122 #endregion
123
124 /// New Client Event Handler
125 private void OnNewClient(IClientAPI client)
126 {
127 //Profile
128 client.OnRequestAvatarProperties += RequestAvatarProperties;
129 }
130
131 public void RequestAvatarProperties(IClientAPI remoteClient, UUID avatarID)
132 {
133 IScene s = remoteClient.Scene;
134 if (!(s is Scene))
135 return;
136
137 Scene scene = (Scene)s;
138
139 string profileUrl = String.Empty;
140 string aboutText = String.Empty;
141 string firstLifeAboutText = String.Empty;
142 UUID image = UUID.Zero;
143 UUID firstLifeImage = UUID.Zero;
144 UUID partner = UUID.Zero;
145 uint wantMask = 0;
146 string wantText = String.Empty;
147 uint skillsMask = 0;
148 string skillsText = String.Empty;
149 string languages = String.Empty;
150
151 Byte[] charterMember = Utils.StringToBytes("Avatar");
152
153 profileUrl = "No profile data";
154 aboutText = string.Empty;
155 firstLifeAboutText = string.Empty;
156 image = UUID.Zero;
157 firstLifeImage = UUID.Zero;
158 partner = UUID.Zero;
159
160 remoteClient.SendAvatarProperties(avatarID, aboutText,
161 Util.ToDateTime(0).ToString(
162 "M/d/yyyy", CultureInfo.InvariantCulture),
163 charterMember, firstLifeAboutText,
164 (uint)(0 & 0xff),
165 firstLifeImage, image, profileUrl, partner);
166
167 //Viewer expects interest data when it asks for properties.
168 remoteClient.SendAvatarInterestsReply(avatarID, wantMask, wantText,
169 skillsMask, skillsText, languages);
170 }
171
172 }
173} \ No newline at end of file