aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Avatar/Lure
diff options
context:
space:
mode:
authorMelanie2010-01-29 07:20:13 +0000
committerMelanie2010-01-29 07:21:06 +0000
commita87a247f0548d39a8c39b1d28123d7da8db44598 (patch)
tree7f9f77c38a224bc6d4bea7ccced1d4710c8a91b1 /OpenSim/Region/CoreModules/Avatar/Lure
parentMerge branch 'master' of melanie@opensimulator.org:/var/git/opensim (diff)
downloadopensim-SC-a87a247f0548d39a8c39b1d28123d7da8db44598.zip
opensim-SC-a87a247f0548d39a8c39b1d28123d7da8db44598.tar.gz
opensim-SC-a87a247f0548d39a8c39b1d28123d7da8db44598.tar.bz2
opensim-SC-a87a247f0548d39a8c39b1d28123d7da8db44598.tar.xz
Revert "Updates all IRegionModules to the new style region modules."
This reverts commit ec3c31e61e5e540f822891110df9bc978655bbaf.
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Lure')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs61
1 files changed, 15 insertions, 46 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs b/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs
index 973d27f..261bd6c 100644
--- a/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs
@@ -29,7 +29,6 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Reflection; 30using System.Reflection;
31using log4net; 31using log4net;
32using Mono.Addins;
33using Nini.Config; 32using Nini.Config;
34using OpenMetaverse; 33using OpenMetaverse;
35using OpenSim.Framework; 34using OpenSim.Framework;
@@ -38,72 +37,36 @@ using OpenSim.Region.Framework.Scenes;
38 37
39namespace OpenSim.Region.CoreModules.Avatar.Lure 38namespace OpenSim.Region.CoreModules.Avatar.Lure
40{ 39{
41 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 40 public class LureModule : IRegionModule
42 public class LureModule : ISharedRegionModule
43 { 41 {
44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 42 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45 43
46 private readonly List<Scene> m_scenes = new List<Scene>(); 44 private readonly List<Scene> m_scenes = new List<Scene>();
47 45
48 private bool m_enabled = true;
49
50 private IMessageTransferModule m_TransferModule = null; 46 private IMessageTransferModule m_TransferModule = null;
51 47
52 public void Initialise(IConfigSource config) 48 public void Initialise(Scene scene, IConfigSource config)
53 { 49 {
54 if (config.Configs["Messaging"] != null) 50 if (config.Configs["Messaging"] != null)
55 { 51 {
56 if (config.Configs["Messaging"].GetString( 52 if (config.Configs["Messaging"].GetString(
57 "LureModule", "LureModule") != 53 "LureModule", "LureModule") !=
58 "LureModule") 54 "LureModule")
59 m_enabled = false; 55 return;
60 } 56 }
61 }
62
63 public Type ReplaceableInterface
64 {
65 get { return null; }
66 }
67 57
68 public void AddRegion(Scene scene) 58 lock (m_scenes)
69 {
70 if (m_enabled)
71 { 59 {
72 lock (m_scenes) 60 if (!m_scenes.Contains(scene))
73 { 61 {
74 if (!m_scenes.Contains(scene)) 62 m_scenes.Add(scene);
75 { 63 scene.EventManager.OnNewClient += OnNewClient;
76 m_scenes.Add(scene); 64 scene.EventManager.OnIncomingInstantMessage +=
77 scene.EventManager.OnNewClient += OnNewClient; 65 OnGridInstantMessage;
78 scene.EventManager.OnIncomingInstantMessage +=
79 OnGridInstantMessage;
80 }
81 } 66 }
82 } 67 }
83 } 68 }
84 69
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
107 void OnNewClient(IClientAPI client) 70 void OnNewClient(IClientAPI client)
108 { 71 {
109 client.OnInstantMessage += OnInstantMessage; 72 client.OnInstantMessage += OnInstantMessage;
@@ -113,6 +76,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure
113 76
114 public void PostInitialise() 77 public void PostInitialise()
115 { 78 {
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!");
116 } 85 }
117 86
118 public void Close() 87 public void Close()