diff options
author | Revolution | 2010-01-22 18:09:33 -0600 |
---|---|---|
committer | Melanie | 2010-01-23 15:18:52 +0000 |
commit | ec3c31e61e5e540f822891110df9bc978655bbaf (patch) | |
tree | b0b34a239eab48e163a3ca064edcd7567948423c /OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs | |
parent | add a target position to agent updates to ScenePresence to support alternativ... (diff) | |
download | opensim-SC_OLD-ec3c31e61e5e540f822891110df9bc978655bbaf.zip opensim-SC_OLD-ec3c31e61e5e540f822891110df9bc978655bbaf.tar.gz opensim-SC_OLD-ec3c31e61e5e540f822891110df9bc978655bbaf.tar.bz2 opensim-SC_OLD-ec3c31e61e5e540f822891110df9bc978655bbaf.tar.xz |
Updates all IRegionModules to the new style region modules.
Signed-off-by: Melanie <melanie@t-data.com>
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs | 61 |
1 files changed, 46 insertions, 15 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs b/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs index 261bd6c..973d27f 100644 --- a/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using log4net; | 31 | using log4net; |
32 | using Mono.Addins; | ||
32 | using Nini.Config; | 33 | using Nini.Config; |
33 | using OpenMetaverse; | 34 | using OpenMetaverse; |
34 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
@@ -37,36 +38,72 @@ using OpenSim.Region.Framework.Scenes; | |||
37 | 38 | ||
38 | namespace OpenSim.Region.CoreModules.Avatar.Lure | 39 | namespace OpenSim.Region.CoreModules.Avatar.Lure |
39 | { | 40 | { |
40 | public class LureModule : IRegionModule | 41 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] |
42 | public class LureModule : ISharedRegionModule | ||
41 | { | 43 | { |
42 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
43 | 45 | ||
44 | private readonly List<Scene> m_scenes = new List<Scene>(); | 46 | private readonly List<Scene> m_scenes = new List<Scene>(); |
45 | 47 | ||
48 | private bool m_enabled = true; | ||
49 | |||
46 | private IMessageTransferModule m_TransferModule = null; | 50 | private IMessageTransferModule m_TransferModule = null; |
47 | 51 | ||
48 | public void Initialise(Scene scene, IConfigSource config) | 52 | public void Initialise(IConfigSource config) |
49 | { | 53 | { |
50 | if (config.Configs["Messaging"] != null) | 54 | if (config.Configs["Messaging"] != null) |
51 | { | 55 | { |
52 | if (config.Configs["Messaging"].GetString( | 56 | if (config.Configs["Messaging"].GetString( |
53 | "LureModule", "LureModule") != | 57 | "LureModule", "LureModule") != |
54 | "LureModule") | 58 | "LureModule") |
55 | return; | 59 | m_enabled = false; |
56 | } | 60 | } |
61 | } | ||
62 | |||
63 | public Type ReplaceableInterface | ||
64 | { | ||
65 | get { return null; } | ||
66 | } | ||
57 | 67 | ||
58 | lock (m_scenes) | 68 | public void AddRegion(Scene scene) |
69 | { | ||
70 | if (m_enabled) | ||
59 | { | 71 | { |
60 | if (!m_scenes.Contains(scene)) | 72 | lock (m_scenes) |
61 | { | 73 | { |
62 | m_scenes.Add(scene); | 74 | if (!m_scenes.Contains(scene)) |
63 | scene.EventManager.OnNewClient += OnNewClient; | 75 | { |
64 | scene.EventManager.OnIncomingInstantMessage += | 76 | m_scenes.Add(scene); |
65 | OnGridInstantMessage; | 77 | scene.EventManager.OnNewClient += OnNewClient; |
78 | scene.EventManager.OnIncomingInstantMessage += | ||
79 | OnGridInstantMessage; | ||
80 | } | ||
66 | } | 81 | } |
67 | } | 82 | } |
68 | } | 83 | } |
69 | 84 | ||
85 | public void RegionLoaded(Scene scene) | ||
86 | { | ||
87 | if (m_enabled) | ||
88 | { | ||
89 | m_TransferModule = | ||
90 | m_scenes[0].RequestModuleInterface<IMessageTransferModule>(); | ||
91 | |||
92 | if (m_TransferModule == null) | ||
93 | m_log.Error("[INSTANT MESSAGE]: No message transfer module, " + | ||
94 | "lures will not work!"); | ||
95 | } | ||
96 | } | ||
97 | |||
98 | public void RemoveRegion(Scene scene) | ||
99 | { | ||
100 | if (m_scenes.Contains(scene)) | ||
101 | m_scenes.Remove(scene); | ||
102 | scene.EventManager.OnNewClient -= OnNewClient; | ||
103 | scene.EventManager.OnIncomingInstantMessage -= | ||
104 | OnGridInstantMessage; | ||
105 | } | ||
106 | |||
70 | void OnNewClient(IClientAPI client) | 107 | void OnNewClient(IClientAPI client) |
71 | { | 108 | { |
72 | client.OnInstantMessage += OnInstantMessage; | 109 | client.OnInstantMessage += OnInstantMessage; |
@@ -76,12 +113,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure | |||
76 | 113 | ||
77 | public void PostInitialise() | 114 | public void PostInitialise() |
78 | { | 115 | { |
79 | m_TransferModule = | ||
80 | m_scenes[0].RequestModuleInterface<IMessageTransferModule>(); | ||
81 | |||
82 | if (m_TransferModule == null) | ||
83 | m_log.Error("[INSTANT MESSAGE]: No message transfer module, "+ | ||
84 | "lures will not work!"); | ||
85 | } | 116 | } |
86 | 117 | ||
87 | public void Close() | 118 | public void Close() |