aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Hypergrid
diff options
context:
space:
mode:
authorRevolution2010-01-22 18:09:33 -0600
committerMelanie2010-01-23 15:18:52 +0000
commitec3c31e61e5e540f822891110df9bc978655bbaf (patch)
treeb0b34a239eab48e163a3ca064edcd7567948423c /OpenSim/Region/CoreModules/Hypergrid
parentadd a target position to agent updates to ScenePresence to support alternativ... (diff)
downloadopensim-SC-ec3c31e61e5e540f822891110df9bc978655bbaf.zip
opensim-SC-ec3c31e61e5e540f822891110df9bc978655bbaf.tar.gz
opensim-SC-ec3c31e61e5e540f822891110df9bc978655bbaf.tar.bz2
opensim-SC-ec3c31e61e5e540f822891110df9bc978655bbaf.tar.xz
Updates all IRegionModules to the new style region modules.
Signed-off-by: Melanie <melanie@t-data.com>
Diffstat (limited to 'OpenSim/Region/CoreModules/Hypergrid')
-rw-r--r--OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs83
1 files changed, 52 insertions, 31 deletions
diff --git a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs
index 0b54746..f9c594b 100644
--- a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs
+++ b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
@@ -32,6 +32,7 @@ using System.Net;
32using System.Reflection; 32using System.Reflection;
33using System.Text.RegularExpressions; 33using System.Text.RegularExpressions;
34using log4net; 34using log4net;
35using Mono.Addins;
35using Nini.Config; 36using Nini.Config;
36using OpenMetaverse; 37using OpenMetaverse;
37using Nwc.XmlRpc; 38using Nwc.XmlRpc;
@@ -46,7 +47,8 @@ using OpenSim.Region.Framework.Interfaces;
46 47
47namespace OpenSim.Region.CoreModules.Hypergrid 48namespace OpenSim.Region.CoreModules.Hypergrid
48{ 49{
49 public class HGStandaloneLoginModule : IRegionModule, ILoginServiceToRegionsConnector 50 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
51 public class HGStandaloneLoginModule : ISharedRegionModule, ILoginServiceToRegionsConnector
50 { 52 {
51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 53 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
52 54
@@ -56,47 +58,58 @@ namespace OpenSim.Region.CoreModules.Hypergrid
56 protected bool m_enabled = false; // Module is only enabled if running in standalone mode 58 protected bool m_enabled = false; // Module is only enabled if running in standalone mode
57 59
58 protected HGLoginAuthService m_loginService; 60 protected HGLoginAuthService m_loginService;
61 private bool authenticate = true;
62 private string welcomeMessage = "Welcome to OpenSim";
63 private IConfig startupConfig;
64 private IConfig standaloneConfig;
65
66 #region ISharedRegionModule Members
67
68 public void Initialise(IConfigSource source)
69 {
70 startupConfig = source.Configs["Startup"];
71 standaloneConfig = source.Configs["StandAlone"];
72 if (standaloneConfig != null)
73 {
74 authenticate = standaloneConfig.GetBoolean("accounts_authenticate", true);
75 welcomeMessage = standaloneConfig.GetString("welcome_message");
76 }
77 m_enabled = !startupConfig.GetBoolean("gridmode", false);
78 }
79
80 public Type ReplaceableInterface
81 {
82 get { return null; }
83 }
59 84
60 #region IRegionModule Members 85 public void AddRegion(Scene scene)
86 {
87 }
61 88
62 public void Initialise(Scene scene, IConfigSource source) 89 public void RegionLoaded(Scene scene)
63 { 90 {
64 if (m_firstScene == null) 91 if (m_firstScene == null)
65 { 92 {
66 m_firstScene = scene; 93 m_firstScene = scene;
67 94
68 IConfig startupConfig = source.Configs["Startup"];
69 if (startupConfig != null)
70 {
71 m_enabled = !startupConfig.GetBoolean("gridmode", false);
72 }
73
74 if (m_enabled) 95 if (m_enabled)
75 { 96 {
76 m_log.Debug("[HGLogin]: HGlogin module enabled"); 97 m_log.Debug("[HGLogin]: HGlogin module enabled");
77 bool authenticate = true;
78 string welcomeMessage = "Welcome to OpenSim";
79 IConfig standaloneConfig = source.Configs["StandAlone"];
80 if (standaloneConfig != null)
81 {
82 authenticate = standaloneConfig.GetBoolean("accounts_authenticate", true);
83 welcomeMessage = standaloneConfig.GetString("welcome_message");
84 }
85 98
86 //TODO: fix casting. 99 //TODO: fix casting.
87 LibraryRootFolder rootFolder = m_firstScene.CommsManager.UserProfileCacheService.LibraryRoot as LibraryRootFolder; 100 LibraryRootFolder rootFolder = m_firstScene.CommsManager.UserProfileCacheService.LibraryRoot as LibraryRootFolder;
88 101
89 IHttpServer httpServer = MainServer.Instance; 102 IHttpServer httpServer = MainServer.Instance;
90 103
91 //TODO: fix the casting of the user service, maybe by registering the userManagerBase with scenes, or refactoring so we just need a IUserService reference 104 //TODO: fix the casting of the user service, maybe by registering the userManagerBase with scenes, or refactoring so we just need a IUserService reference
92 m_loginService 105 m_loginService
93 = new HGLoginAuthService( 106 = new HGLoginAuthService(
94 (UserManagerBase)m_firstScene.CommsManager.UserAdminService, 107 (UserManagerBase)m_firstScene.CommsManager.UserAdminService,
95 welcomeMessage, 108 welcomeMessage,
96 m_firstScene.CommsManager.InterServiceInventoryService, 109 m_firstScene.CommsManager.InterServiceInventoryService,
97 m_firstScene.CommsManager.NetworkServersInfo, 110 m_firstScene.CommsManager.NetworkServersInfo,
98 authenticate, 111 authenticate,
99 rootFolder, 112 rootFolder,
100 this); 113 this);
101 114
102 httpServer.AddXmlRPCHandler("hg_login", m_loginService.XmlRpcLoginMethod); 115 httpServer.AddXmlRPCHandler("hg_login", m_loginService.XmlRpcLoginMethod);
@@ -113,6 +126,19 @@ namespace OpenSim.Region.CoreModules.Hypergrid
113 } 126 }
114 } 127 }
115 128
129 public void RemoveRegion(Scene scene)
130 {
131 if (scene == m_firstScene)
132 {
133 IHttpServer httpServer = MainServer.Instance;
134 httpServer.RemoveXmlRPCHandler("hg_login");
135 httpServer.RemoveXmlRPCHandler("check_auth_session");
136 httpServer.RemoveXmlRPCHandler("get_avatar_appearance");
137 httpServer.RemoveXmlRPCHandler("update_avatar_appearance");
138 }
139 m_scenes.Remove(scene);
140 }
141
116 public void PostInitialise() 142 public void PostInitialise()
117 { 143 {
118 144
@@ -128,11 +154,6 @@ namespace OpenSim.Region.CoreModules.Hypergrid
128 get { return "HGStandaloneLoginModule"; } 154 get { return "HGStandaloneLoginModule"; }
129 } 155 }
130 156
131 public bool IsSharedModule
132 {
133 get { return true; }
134 }
135
136 #endregion 157 #endregion
137 158
138 protected void AddScene(Scene scene) 159 protected void AddScene(Scene scene)