aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Client/Linden/LLStandaloneLoginModule.cs
diff options
context:
space:
mode:
authorDiva Canto2010-01-08 20:31:29 -0800
committerDiva Canto2010-01-08 20:31:29 -0800
commit6b60f3cce5b9dc8c005c9fdb53731dc4e3e45ee8 (patch)
tree4608042e707df452c7e59363927f5bd87249d34b /OpenSim/Client/Linden/LLStandaloneLoginModule.cs
parentAdd migrations to add fields to user and auth tables (diff)
downloadopensim-SC_OLD-6b60f3cce5b9dc8c005c9fdb53731dc4e3e45ee8.zip
opensim-SC_OLD-6b60f3cce5b9dc8c005c9fdb53731dc4e3e45ee8.tar.gz
opensim-SC_OLD-6b60f3cce5b9dc8c005c9fdb53731dc4e3e45ee8.tar.bz2
opensim-SC_OLD-6b60f3cce5b9dc8c005c9fdb53731dc4e3e45ee8.tar.xz
A few more inches... Old friends things removed. Less references to UserProfileService.
Diffstat (limited to 'OpenSim/Client/Linden/LLStandaloneLoginModule.cs')
-rw-r--r--OpenSim/Client/Linden/LLStandaloneLoginModule.cs305
1 files changed, 0 insertions, 305 deletions
diff --git a/OpenSim/Client/Linden/LLStandaloneLoginModule.cs b/OpenSim/Client/Linden/LLStandaloneLoginModule.cs
deleted file mode 100644
index 8047f74..0000000
--- a/OpenSim/Client/Linden/LLStandaloneLoginModule.cs
+++ /dev/null
@@ -1,305 +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
28using System;
29using System.Collections;
30using System.Collections.Generic;
31using System.Net;
32using System.Reflection;
33using System.Text.RegularExpressions;
34using log4net;
35using Nini.Config;
36using OpenMetaverse;
37using OpenSim.Framework;
38using OpenSim.Framework.Communications;
39using OpenSim.Framework.Communications.Cache;
40using OpenSim.Framework.Capabilities;
41using OpenSim.Framework.Servers.HttpServer;
42using OpenSim.Region.Framework.Scenes;
43using OpenSim.Region.Framework.Interfaces;
44
45namespace OpenSim.Client.Linden
46{
47 public class LLStandaloneLoginModule : ISharedRegionModule, ILoginServiceToRegionsConnector
48 {
49 //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
50
51 protected List<Scene> m_scenes = new List<Scene>();
52 protected Scene m_firstScene;
53
54 protected bool m_enabled = false; // Module is only enabled if running in standalone mode
55
56 protected bool authenticate;
57 protected string welcomeMessage;
58
59 public bool RegionLoginsEnabled
60 {
61 get
62 {
63 if (m_firstScene != null)
64 {
65 return m_firstScene.SceneGridService.RegionLoginsEnabled;
66 }
67 else
68 {
69 return false;
70 }
71 }
72 }
73
74 protected LLStandaloneLoginService m_loginService;
75
76 #region IRegionModule Members
77
78 public void Initialise(IConfigSource source)
79 {
80 IConfig startupConfig = source.Configs["Startup"];
81 if (startupConfig != null)
82 {
83 m_enabled = !startupConfig.GetBoolean("gridmode", false);
84 }
85
86 if (m_enabled)
87 {
88 authenticate = true;
89 welcomeMessage = "Welcome to OpenSim";
90 IConfig standaloneConfig = source.Configs["StandAlone"];
91 if (standaloneConfig != null)
92 {
93 authenticate = standaloneConfig.GetBoolean("accounts_authenticate", true);
94 welcomeMessage = standaloneConfig.GetString("welcome_message");
95 }
96 }
97 }
98
99 public void AddRegion(Scene scene)
100 {
101 }
102
103 public void RemoveRegion(Scene scene)
104 {
105 if (m_enabled)
106 {
107 RemoveScene(scene);
108 }
109 }
110
111 public void PostInitialise()
112 {
113
114 }
115
116 public void Close()
117 {
118
119 }
120
121 public void RegionLoaded(Scene scene)
122 {
123 if (m_firstScene == null)
124 {
125 m_firstScene = scene;
126
127 if (m_enabled)
128 {
129 //TODO: fix casting.
130 LibraryRootFolder rootFolder
131 = m_firstScene.CommsManager.UserProfileCacheService.LibraryRoot as LibraryRootFolder;
132
133 IHttpServer httpServer = MainServer.Instance;
134
135 //TODO: fix the casting of the user service, maybe by registering the userManagerBase with scenes, or refactoring so we just need a IUserService reference
136 m_loginService
137 = new LLStandaloneLoginService(
138 (UserManagerBase)m_firstScene.CommsManager.UserAdminService, welcomeMessage,
139 m_firstScene.InventoryService, m_firstScene.CommsManager.NetworkServersInfo, authenticate,
140 rootFolder, this);
141
142 httpServer.AddXmlRPCHandler("login_to_simulator", m_loginService.XmlRpcLoginMethod);
143
144 // provides the web form login
145 httpServer.AddHTTPHandler("login", m_loginService.ProcessHTMLLogin);
146
147 // Provides the LLSD login
148 httpServer.SetDefaultLLSDHandler(m_loginService.LLSDLoginMethod);
149 }
150 }
151
152 if (m_enabled)
153 {
154 AddScene(scene);
155 }
156 }
157
158 public Type ReplaceableInterface
159 {
160 get { return null; }
161 }
162
163 public string Name
164 {
165 get { return "LLStandaloneLoginModule"; }
166 }
167
168 public bool IsSharedModule
169 {
170 get { return true; }
171 }
172
173 #endregion
174
175 protected void AddScene(Scene scene)
176 {
177 lock (m_scenes)
178 {
179 if (!m_scenes.Contains(scene))
180 {
181 m_scenes.Add(scene);
182 }
183 }
184 }
185
186 protected void RemoveScene(Scene scene)
187 {
188 lock (m_scenes)
189 {
190 if (m_scenes.Contains(scene))
191 {
192 m_scenes.Remove(scene);
193 }
194 }
195 }
196
197 public bool NewUserConnection(ulong regionHandle, AgentCircuitData agent, out string reason)
198 {
199 Scene scene;
200 if (TryGetRegion(regionHandle, out scene))
201 {
202 return scene.NewUserConnection(agent, (uint)TeleportFlags.ViaLogin, out reason);
203 }
204 reason = "Region not found.";
205 return false;
206 }
207
208 public void LogOffUserFromGrid(ulong regionHandle, UUID AvatarID, UUID RegionSecret, string message)
209 {
210 Scene scene;
211 if (TryGetRegion(regionHandle, out scene))
212 {
213 scene.HandleLogOffUserFromGrid(AvatarID, RegionSecret, message);
214 }
215 }
216
217 public RegionInfo RequestNeighbourInfo(ulong regionhandle)
218 {
219 Scene scene;
220 if (TryGetRegion(regionhandle, out scene))
221 {
222 return scene.RegionInfo;
223 }
224 return null;
225 }
226
227 public RegionInfo RequestClosestRegion(string region)
228 {
229 Scene scene;
230 if (TryGetRegion(region, out scene))
231 {
232 return scene.RegionInfo;
233 }
234 else if (m_scenes.Count > 0)
235 {
236 return m_scenes[0].RegionInfo;
237 }
238 return null;
239 }
240
241 public RegionInfo RequestNeighbourInfo(UUID regionID)
242 {
243 Scene scene;
244 if (TryGetRegion(regionID, out scene))
245 {
246 return scene.RegionInfo;
247 }
248 return null;
249 }
250
251 protected bool TryGetRegion(ulong regionHandle, out Scene scene)
252 {
253 lock (m_scenes)
254 {
255 foreach (Scene nextScene in m_scenes)
256 {
257 if (nextScene.RegionInfo.RegionHandle == regionHandle)
258 {
259 scene = nextScene;
260 return true;
261 }
262 }
263 }
264
265 scene = null;
266 return false;
267 }
268
269 protected bool TryGetRegion(UUID regionID, out Scene scene)
270 {
271 lock (m_scenes)
272 {
273 foreach (Scene nextScene in m_scenes)
274 {
275 if (nextScene.RegionInfo.RegionID == regionID)
276 {
277 scene = nextScene;
278 return true;
279 }
280 }
281 }
282
283 scene = null;
284 return false;
285 }
286
287 protected bool TryGetRegion(string regionName, out Scene scene)
288 {
289 lock (m_scenes)
290 {
291 foreach (Scene nextScene in m_scenes)
292 {
293 if (nextScene.RegionInfo.RegionName.Equals(regionName, StringComparison.InvariantCultureIgnoreCase))
294 {
295 scene = nextScene;
296 return true;
297 }
298 }
299 }
300
301 scene = null;
302 return false;
303 }
304 }
305}