diff options
Diffstat (limited to 'OpenSim/Region')
4 files changed, 105 insertions, 44 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs index 337644d..47c9db5 100644 --- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs | |||
@@ -37,7 +37,7 @@ using OpenSim.Region.Framework.Scenes; | |||
37 | 37 | ||
38 | namespace OpenSim.Region.CoreModules.Avatar.Chat | 38 | namespace OpenSim.Region.CoreModules.Avatar.Chat |
39 | { | 39 | { |
40 | public class ChatModule : IRegionModule | 40 | public class ChatModule : ISharedRegionModule |
41 | { | 41 | { |
42 | private static readonly ILog m_log = | 42 | private static readonly ILog m_log = |
43 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 43 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
@@ -50,27 +50,39 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
50 | private int m_whisperdistance = 10; | 50 | private int m_whisperdistance = 10; |
51 | private List<Scene> m_scenes = new List<Scene>(); | 51 | private List<Scene> m_scenes = new List<Scene>(); |
52 | 52 | ||
53 | internal object m_syncInit = new object(); | 53 | internal object m_syncy = new object(); |
54 | 54 | ||
55 | #region IRegionModule Members | 55 | internal IConfig m_config; |
56 | public virtual void Initialise(Scene scene, IConfigSource config) | 56 | |
57 | #region ISharedRegionModule Members | ||
58 | public virtual void Initialise(IConfigSource config) | ||
57 | { | 59 | { |
58 | // wrap this in a try block so that defaults will work if | ||
59 | // the config file doesn't specify otherwise. | ||
60 | try | ||
61 | { | ||
62 | m_enabled = config.Configs["Chat"].GetBoolean("enabled", m_enabled); | ||
63 | if (!m_enabled) return; | ||
64 | 60 | ||
65 | m_whisperdistance = config.Configs["Chat"].GetInt("whisper_distance", m_whisperdistance); | 61 | m_config = config.Configs["Chat"]; |
66 | m_saydistance = config.Configs["Chat"].GetInt("say_distance", m_saydistance); | 62 | |
67 | m_shoutdistance = config.Configs["Chat"].GetInt("shout_distance", m_shoutdistance); | 63 | if (null == m_config) |
64 | { | ||
65 | m_log.Info("[CHAT]: no config found, plugin disabled"); | ||
66 | return; | ||
68 | } | 67 | } |
69 | catch (Exception) | 68 | |
69 | if (!m_config.GetBoolean("enabled", false)) | ||
70 | { | 70 | { |
71 | m_log.Info("[CHAT]: plugin disabled by configuration"); | ||
72 | return; | ||
71 | } | 73 | } |
74 | m_enabled = true; | ||
72 | 75 | ||
73 | lock (m_syncInit) | 76 | m_whisperdistance = config.Configs["Chat"].GetInt("whisper_distance", m_whisperdistance); |
77 | m_saydistance = config.Configs["Chat"].GetInt("say_distance", m_saydistance); | ||
78 | m_shoutdistance = config.Configs["Chat"].GetInt("shout_distance", m_shoutdistance); | ||
79 | } | ||
80 | |||
81 | public virtual void AddRegion(Scene scene) | ||
82 | { | ||
83 | if (!m_enabled) return; | ||
84 | |||
85 | lock (m_syncy) | ||
74 | { | 86 | { |
75 | if (!m_scenes.Contains(scene)) | 87 | if (!m_scenes.Contains(scene)) |
76 | { | 88 | { |
@@ -84,23 +96,38 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
84 | m_log.InfoFormat("[CHAT]: Initialized for {0} w:{1} s:{2} S:{3}", scene.RegionInfo.RegionName, | 96 | m_log.InfoFormat("[CHAT]: Initialized for {0} w:{1} s:{2} S:{3}", scene.RegionInfo.RegionName, |
85 | m_whisperdistance, m_saydistance, m_shoutdistance); | 97 | m_whisperdistance, m_saydistance, m_shoutdistance); |
86 | } | 98 | } |
87 | 99 | ||
88 | public virtual void PostInitialise() | 100 | public virtual void RegionLoaded(Scene scene) |
89 | { | 101 | { |
90 | } | 102 | } |
91 | 103 | ||
104 | public virtual void RemoveRegion(Scene scene) | ||
105 | { | ||
106 | if (!m_enabled) return; | ||
107 | |||
108 | lock (m_syncy) | ||
109 | { | ||
110 | if (m_scenes.Contains(scene)) | ||
111 | { | ||
112 | scene.EventManager.OnNewClient -= OnNewClient; | ||
113 | scene.EventManager.OnChatFromWorld -= OnChatFromWorld; | ||
114 | scene.EventManager.OnChatBroadcast -= OnChatBroadcast; | ||
115 | m_scenes.Remove(scene); | ||
116 | } | ||
117 | } | ||
118 | } | ||
119 | |||
92 | public virtual void Close() | 120 | public virtual void Close() |
93 | { | 121 | { |
94 | } | 122 | } |
95 | 123 | ||
96 | public virtual string Name | 124 | public virtual void PostInitialise() |
97 | { | 125 | { |
98 | get { return "ChatModule"; } | ||
99 | } | 126 | } |
100 | 127 | ||
101 | public virtual bool IsSharedModule | 128 | public virtual string Name |
102 | { | 129 | { |
103 | get { return true; } | 130 | get { return "ChatModule"; } |
104 | } | 131 | } |
105 | 132 | ||
106 | #endregion | 133 | #endregion |
diff --git a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml index 3b6c1dc..6c80598 100644 --- a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml +++ b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml | |||
@@ -18,6 +18,7 @@ | |||
18 | <RegionModule id="HGAssetBroker" type="OpenSim.Region.CoreModules.ServiceConnectors.Asset.HGAssetBroker" /> | 18 | <RegionModule id="HGAssetBroker" type="OpenSim.Region.CoreModules.ServiceConnectors.Asset.HGAssetBroker" /> |
19 | <RegionModule id="CoreAssetCache" type="OpenSim.Region.CoreModules.Asset.CoreAssetCache" /> | 19 | <RegionModule id="CoreAssetCache" type="OpenSim.Region.CoreModules.Asset.CoreAssetCache" /> |
20 | <RegionModule id="UrlModule" type="OpenSim.Region.CoreModules.Scripting.LSLHttp.UrlModule" /> | 20 | <RegionModule id="UrlModule" type="OpenSim.Region.CoreModules.Scripting.LSLHttp.UrlModule" /> |
21 | <RegionModule id="Chat" type="OpenSim.Region.CoreModules.Avatar.Chat.ChatModule" /> | ||
21 | </Extension> | 22 | </Extension> |
22 | 23 | ||
23 | <Extension path = "/OpenSim/WindModule"> | 24 | <Extension path = "/OpenSim/WindModule"> |
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 | ||
48 | namespace OpenSim.Region.OptionalModules.Avatar.Concierge | 48 | namespace 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 |
diff --git a/OpenSim/Region/OptionalModules/Resources/OptionalModules.addin.xml b/OpenSim/Region/OptionalModules/Resources/OptionalModules.addin.xml index 69d3e57..01a5d8b 100644 --- a/OpenSim/Region/OptionalModules/Resources/OptionalModules.addin.xml +++ b/OpenSim/Region/OptionalModules/Resources/OptionalModules.addin.xml | |||
@@ -9,6 +9,7 @@ | |||
9 | 9 | ||
10 | <Extension path = "/OpenSim/RegionModules"> | 10 | <Extension path = "/OpenSim/RegionModules"> |
11 | <RegionModule id="IRCBridge" type="OpenSim.Region.OptionalModules.Avatar.Chat.IRCBridgeModule" /> | 11 | <RegionModule id="IRCBridge" type="OpenSim.Region.OptionalModules.Avatar.Chat.IRCBridgeModule" /> |
12 | <RegionModule id="Concierge" type="OpenSim.Region.OptionalModules.Avatar.Concierge.ConciergeModule" /> | ||
12 | <RegionModule id="XmlRpcGroups" type="OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups.XmlRpcGroupsModule" /> | 13 | <RegionModule id="XmlRpcGroups" type="OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups.XmlRpcGroupsModule" /> |
13 | <RegionModule id="XmlRpcGroupsMessaging" type="OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups.XmlRpcGroupsMessaging" /> | 14 | <RegionModule id="XmlRpcGroupsMessaging" type="OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups.XmlRpcGroupsMessaging" /> |
14 | </Extension> | 15 | </Extension> |