diff options
author | Dr Scofield | 2009-05-22 14:25:50 +0000 |
---|---|---|
committer | Dr Scofield | 2009-05-22 14:25:50 +0000 |
commit | 912be7a2acee6f49eeee2f06879d9fff7ca183ab (patch) | |
tree | aed0805bc5d282877db64bc0185ae5509fb76a05 /OpenSim/Region/CoreModules | |
parent | dropping sex from SceneBanner... (diff) | |
download | opensim-SC_OLD-912be7a2acee6f49eeee2f06879d9fff7ca183ab.zip opensim-SC_OLD-912be7a2acee6f49eeee2f06879d9fff7ca183ab.tar.gz opensim-SC_OLD-912be7a2acee6f49eeee2f06879d9fff7ca183ab.tar.bz2 opensim-SC_OLD-912be7a2acee6f49eeee2f06879d9fff7ca183ab.tar.xz |
converting Chat module and Concierge module to new style region modules
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs | 69 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml | 1 |
2 files changed, 49 insertions, 21 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"> |