diff options
author | Diva Canto | 2011-05-27 07:00:36 -0700 |
---|---|---|
committer | Diva Canto | 2011-05-27 07:00:36 -0700 |
commit | 36f9d55c363f0b6877a4eeb4a9d37ba989257393 (patch) | |
tree | 8f568aa15b165db067d443e7d8790ece81ac11e4 | |
parent | Added missing config vars to StandaloneCommon.ini.example and fixed the ones ... (diff) | |
download | opensim-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.cs | 173 | ||||
-rw-r--r-- | bin/config-include/Grid.ini | 3 | ||||
-rw-r--r-- | bin/config-include/GridHypergrid.ini | 2 | ||||
-rw-r--r-- | bin/config-include/Standalone.ini | 3 | ||||
-rw-r--r-- | bin/config-include/StandaloneHypergrid.ini | 3 |
5 files changed, 184 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 | */ | ||
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")] | ||
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 | ||
diff --git a/bin/config-include/Grid.ini b/bin/config-include/Grid.ini index ce5588e..baadbb8 100644 --- a/bin/config-include/Grid.ini +++ b/bin/config-include/Grid.ini | |||
@@ -27,6 +27,9 @@ | |||
27 | SimulationServiceInConnector = true | 27 | SimulationServiceInConnector = true |
28 | LibraryModule = true | 28 | LibraryModule = true |
29 | 29 | ||
30 | [Profiles] | ||
31 | Module = "BasicProfileModule" | ||
32 | |||
30 | [SimulationDataStore] | 33 | [SimulationDataStore] |
31 | LocalServiceModule = "OpenSim.Services.Connectors.dll:SimulationDataService" | 34 | LocalServiceModule = "OpenSim.Services.Connectors.dll:SimulationDataService" |
32 | 35 | ||
diff --git a/bin/config-include/GridHypergrid.ini b/bin/config-include/GridHypergrid.ini index d2cf898..72b7412 100644 --- a/bin/config-include/GridHypergrid.ini +++ b/bin/config-include/GridHypergrid.ini | |||
@@ -31,6 +31,8 @@ | |||
31 | SimulationServiceInConnector = true | 31 | SimulationServiceInConnector = true |
32 | LibraryModule = true | 32 | LibraryModule = true |
33 | 33 | ||
34 | [Profiles] | ||
35 | Module = "BasicProfileModule" | ||
34 | 36 | ||
35 | [SimulationDataStore] | 37 | [SimulationDataStore] |
36 | LocalServiceModule = "OpenSim.Services.Connectors.dll:SimulationDataService" | 38 | LocalServiceModule = "OpenSim.Services.Connectors.dll:SimulationDataService" |
diff --git a/bin/config-include/Standalone.ini b/bin/config-include/Standalone.ini index 6355d09..cfcf5ed 100644 --- a/bin/config-include/Standalone.ini +++ b/bin/config-include/Standalone.ini | |||
@@ -22,6 +22,9 @@ | |||
22 | LLLoginServiceInConnector = true | 22 | LLLoginServiceInConnector = true |
23 | GridInfoServiceInConnector = true | 23 | GridInfoServiceInConnector = true |
24 | 24 | ||
25 | [Profiles] | ||
26 | Module = "BasicProfileModule" | ||
27 | |||
25 | [SimulationDataStore] | 28 | [SimulationDataStore] |
26 | LocalServiceModule = "OpenSim.Services.Connectors.dll:SimulationDataService" | 29 | LocalServiceModule = "OpenSim.Services.Connectors.dll:SimulationDataService" |
27 | 30 | ||
diff --git a/bin/config-include/StandaloneHypergrid.ini b/bin/config-include/StandaloneHypergrid.ini index cd2d7a7..7d1ff60 100644 --- a/bin/config-include/StandaloneHypergrid.ini +++ b/bin/config-include/StandaloneHypergrid.ini | |||
@@ -32,6 +32,9 @@ | |||
32 | AuthenticationServiceInConnector = true | 32 | AuthenticationServiceInConnector = true |
33 | SimulationServiceInConnector = true | 33 | SimulationServiceInConnector = true |
34 | 34 | ||
35 | [Profiles] | ||
36 | Module = "BasicProfileModule" | ||
37 | |||
35 | [Messaging] | 38 | [Messaging] |
36 | MessageTransferModule = HGMessageTransferModule | 39 | MessageTransferModule = HGMessageTransferModule |
37 | 40 | ||