aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/Avatar
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/OptionalModules/Avatar')
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs78
1 files changed, 55 insertions, 23 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs b/OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs
index 604b21d..687b2da 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs
@@ -47,7 +47,7 @@ using OpenSim.Region.CoreModules.Avatar.Chat;
47 47
48namespace OpenSim.Region.OptionalModules.Avatar.Concierge 48namespace OpenSim.Region.OptionalModules.Avatar.Concierge
49{ 49{
50 public class ConciergeModule : ChatModule, IRegionModule 50 public class ConciergeModule : ChatModule, ISharedRegionModule
51 { 51 {
52 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 52 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
53 53
@@ -76,28 +76,26 @@ namespace OpenSim.Region.OptionalModules.Avatar.Concierge
76 76
77 internal object m_syncy = new object(); 77 internal object m_syncy = new object();
78 78
79 #region IRegionModule Members 79 internal bool m_enabled = false;
80 public override void Initialise(Scene scene, IConfigSource config) 80
81 #region ISharedRegionModule Members
82 public override void Initialise(IConfigSource config)
81 { 83 {
82 try 84 m_config = config.Configs["Concierge"];
83 {
84 if ((m_config = config.Configs["Concierge"]) == null)
85 {
86 //_log.InfoFormat("[Concierge]: no configuration section [Concierge] in OpenSim.ini: module not configured");
87 return;
88 }
89 85
90 if (!m_config.GetBoolean("enabled", false)) 86 if (null == m_config)
91 { 87 {
92 //_log.InfoFormat("[Concierge]: module disabled by OpenSim.ini configuration"); 88 m_log.Info("[Concierge]: no config found, plugin disabled");
93 return; 89 return;
94 }
95 } 90 }
96 catch (Exception) 91
92 if (!m_config.GetBoolean("enabled", false))
97 { 93 {
98 m_log.Info("[Concierge]: module not configured"); 94 m_log.Info("[Concierge]: plugin disabled by configuration");
99 return; 95 return;
100 } 96 }
97 m_enabled = true;
98
101 99
102 // check whether ChatModule has been disabled: if yes, 100 // check whether ChatModule has been disabled: if yes,
103 // then we'll "stand in" 101 // then we'll "stand in"
@@ -140,6 +138,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.Concierge
140 m_regions = new Regex(@regions, RegexOptions.Compiled | RegexOptions.IgnoreCase); 138 m_regions = new Regex(@regions, RegexOptions.Compiled | RegexOptions.IgnoreCase);
141 } 139 }
142 } 140 }
141 }
142
143
144 public override void AddRegion(Scene scene)
145 {
146 if (!m_enabled) return;
143 147
144 scene.CommsManager.HttpServer.AddXmlRPCHandler("concierge_update_welcome", XmlRpcUpdateWelcomeMethod, false); 148 scene.CommsManager.HttpServer.AddXmlRPCHandler("concierge_update_welcome", XmlRpcUpdateWelcomeMethod, false);
145 149
@@ -169,6 +173,40 @@ namespace OpenSim.Region.OptionalModules.Avatar.Concierge
169 m_log.InfoFormat("[Concierge]: initialized for {0}", scene.RegionInfo.RegionName); 173 m_log.InfoFormat("[Concierge]: initialized for {0}", scene.RegionInfo.RegionName);
170 } 174 }
171 175
176 public override void RemoveRegion(Scene scene)
177 {
178 if (!m_enabled) return;
179
180 scene.CommsManager.HttpServer.RemoveXmlRPCHandler("concierge_update_welcome");
181
182 lock (m_syncy)
183 {
184 // unsubscribe from NewClient events
185 scene.EventManager.OnNewClient -= OnNewClient;
186
187 // unsubscribe from *Chat events
188 scene.EventManager.OnChatFromWorld -= OnChatFromWorld;
189 if (!m_replacingChatModule)
190 scene.EventManager.OnChatFromClient -= OnChatFromClient;
191 scene.EventManager.OnChatBroadcast -= OnChatBroadcast;
192
193 // unsubscribe from agent change events
194 scene.EventManager.OnMakeRootAgent -= OnMakeRootAgent;
195 scene.EventManager.OnMakeChildAgent -= OnMakeChildAgent;
196
197 if (m_scenes.Contains(scene))
198 {
199 m_scenes.Remove(scene);
200 }
201
202 if (m_conciergedScenes.Contains(scene))
203 {
204 m_conciergedScenes.Remove(scene);
205 }
206 }
207 m_log.InfoFormat("[Concierge]: removed {0}", scene.RegionInfo.RegionName);
208 }
209
172 public override void PostInitialise() 210 public override void PostInitialise()
173 { 211 {
174 } 212 }
@@ -181,12 +219,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Concierge
181 { 219 {
182 get { return "ConciergeModule"; } 220 get { return "ConciergeModule"; }
183 } 221 }
184
185 public override bool IsSharedModule
186 {
187 get { return true; }
188 }
189
190 #endregion 222 #endregion
191 223
192 #region ISimChat Members 224 #region ISimChat Members