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/InstantMessage/InstantMessageModule.cs | |
parent | add a target position to agent updates to ScenePresence to support alternativ... (diff) | |
download | opensim-SC-ec3c31e61e5e540f822891110df9bc978655bbaf.zip opensim-SC-ec3c31e61e5e540f822891110df9bc978655bbaf.tar.gz opensim-SC-ec3c31e61e5e540f822891110df9bc978655bbaf.tar.bz2 opensim-SC-ec3c31e61e5e540f822891110df9bc978655bbaf.tar.xz |
Updates all IRegionModules to the new style region modules.
Signed-off-by: Melanie <melanie@t-data.com>
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs | 53 |
1 files changed, 36 insertions, 17 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs index 9a68749..e1bde4b 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs | |||
@@ -24,9 +24,12 @@ | |||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | |||
28 | using System; | ||
27 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
28 | using System.Reflection; | 30 | using System.Reflection; |
29 | using log4net; | 31 | using log4net; |
32 | using Mono.Addins; | ||
30 | using Nini.Config; | 33 | using Nini.Config; |
31 | using OpenMetaverse; | 34 | using OpenMetaverse; |
32 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
@@ -36,7 +39,8 @@ using OpenSim.Region.Framework.Scenes; | |||
36 | 39 | ||
37 | namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | 40 | namespace OpenSim.Region.CoreModules.Avatar.InstantMessage |
38 | { | 41 | { |
39 | public class InstantMessageModule : IRegionModule | 42 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] |
43 | public class InstantMessageModule : ISharedRegionModule | ||
40 | { | 44 | { |
41 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
42 | 46 | ||
@@ -47,11 +51,11 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
47 | 51 | ||
48 | private readonly List<Scene> m_scenes = new List<Scene>(); | 52 | private readonly List<Scene> m_scenes = new List<Scene>(); |
49 | 53 | ||
50 | #region IRegionModule Members | 54 | #region ISharedRegionModule Members |
51 | 55 | ||
52 | private IMessageTransferModule m_TransferModule = null; | 56 | private IMessageTransferModule m_TransferModule = null; |
53 | 57 | ||
54 | public void Initialise(Scene scene, IConfigSource config) | 58 | public void Initialise(IConfigSource config) |
55 | { | 59 | { |
56 | if (config.Configs["Messaging"] != null) | 60 | if (config.Configs["Messaging"] != null) |
57 | { | 61 | { |
@@ -62,7 +66,15 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
62 | } | 66 | } |
63 | 67 | ||
64 | m_enabled = true; | 68 | m_enabled = true; |
69 | } | ||
70 | |||
71 | public Type ReplaceableInterface | ||
72 | { | ||
73 | get { return null; } | ||
74 | } | ||
65 | 75 | ||
76 | public void AddRegion(Scene scene) | ||
77 | { | ||
66 | lock (m_scenes) | 78 | lock (m_scenes) |
67 | { | 79 | { |
68 | if (!m_scenes.Contains(scene)) | 80 | if (!m_scenes.Contains(scene)) |
@@ -74,6 +86,27 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
74 | } | 86 | } |
75 | } | 87 | } |
76 | 88 | ||
89 | public void RegionLoaded(Scene scene) | ||
90 | { | ||
91 | if (!m_enabled) | ||
92 | return; | ||
93 | |||
94 | m_TransferModule = | ||
95 | m_scenes[0].RequestModuleInterface<IMessageTransferModule>(); | ||
96 | |||
97 | if (m_TransferModule == null) | ||
98 | m_log.Error("[INSTANT MESSAGE]: No message transfer module, " + | ||
99 | "IM will not work!"); | ||
100 | } | ||
101 | |||
102 | public void RemoveRegion(Scene scene) | ||
103 | { | ||
104 | if (m_scenes.Contains(scene)) | ||
105 | m_scenes.Remove(scene); | ||
106 | scene.EventManager.OnClientConnect -= OnClientConnect; | ||
107 | scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage; | ||
108 | } | ||
109 | |||
77 | void OnClientConnect(IClientCore client) | 110 | void OnClientConnect(IClientCore client) |
78 | { | 111 | { |
79 | IClientIM clientIM; | 112 | IClientIM clientIM; |
@@ -85,15 +118,6 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
85 | 118 | ||
86 | public void PostInitialise() | 119 | public void PostInitialise() |
87 | { | 120 | { |
88 | if (!m_enabled) | ||
89 | return; | ||
90 | |||
91 | m_TransferModule = | ||
92 | m_scenes[0].RequestModuleInterface<IMessageTransferModule>(); | ||
93 | |||
94 | if (m_TransferModule == null) | ||
95 | m_log.Error("[INSTANT MESSAGE]: No message transfer module, "+ | ||
96 | "IM will not work!"); | ||
97 | } | 121 | } |
98 | 122 | ||
99 | public void Close() | 123 | public void Close() |
@@ -105,11 +129,6 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
105 | get { return "InstantMessageModule"; } | 129 | get { return "InstantMessageModule"; } |
106 | } | 130 | } |
107 | 131 | ||
108 | public bool IsSharedModule | ||
109 | { | ||
110 | get { return true; } | ||
111 | } | ||
112 | |||
113 | #endregion | 132 | #endregion |
114 | 133 | ||
115 | public void OnInstantMessage(IClientAPI client, GridInstantMessage im) | 134 | public void OnInstantMessage(IClientAPI client, GridInstantMessage im) |