diff options
author | Melanie | 2010-01-29 07:20:13 +0000 |
---|---|---|
committer | Melanie | 2010-01-29 07:21:06 +0000 |
commit | a87a247f0548d39a8c39b1d28123d7da8db44598 (patch) | |
tree | 7f9f77c38a224bc6d4bea7ccced1d4710c8a91b1 /OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs | |
parent | Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim (diff) | |
download | opensim-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/InstantMessage/MessageTransferModule.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs | 54 |
1 files changed, 17 insertions, 37 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs index 16bdfdd..e5159b3 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs | |||
@@ -30,7 +30,6 @@ using System.Collections.Generic; | |||
30 | using System.Net; | 30 | using System.Net; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using log4net; | 32 | using log4net; |
33 | using Mono.Addins; | ||
34 | using Nini.Config; | 33 | using Nini.Config; |
35 | using Nwc.XmlRpc; | 34 | using Nwc.XmlRpc; |
36 | using OpenMetaverse; | 35 | using OpenMetaverse; |
@@ -41,8 +40,7 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion; | |||
41 | 40 | ||
42 | namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | 41 | namespace OpenSim.Region.CoreModules.Avatar.InstantMessage |
43 | { | 42 | { |
44 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] | 43 | public class MessageTransferModule : IRegionModule, IMessageTransferModule |
45 | public class MessageTransferModule : ISharedRegionModule, IMessageTransferModule | ||
46 | { | 44 | { |
47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
48 | 46 | ||
@@ -52,9 +50,8 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
52 | protected Dictionary<UUID, ulong> m_UserRegionMap = new Dictionary<UUID, ulong>(); | 50 | protected Dictionary<UUID, ulong> m_UserRegionMap = new Dictionary<UUID, ulong>(); |
53 | 51 | ||
54 | public event UndeliveredMessage OnUndeliveredMessage; | 52 | public event UndeliveredMessage OnUndeliveredMessage; |
55 | private bool m_enabled = true; | ||
56 | 53 | ||
57 | public virtual void Initialise(IConfigSource config) | 54 | public virtual void Initialise(Scene scene, IConfigSource config) |
58 | { | 55 | { |
59 | IConfig cnf = config.Configs["Messaging"]; | 56 | IConfig cnf = config.Configs["Messaging"]; |
60 | if (cnf != null && cnf.GetString( | 57 | if (cnf != null && cnf.GetString( |
@@ -62,49 +59,27 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
62 | "MessageTransferModule") | 59 | "MessageTransferModule") |
63 | { | 60 | { |
64 | m_log.Debug("[MESSAGE TRANSFER]: Disabled by configuration"); | 61 | m_log.Debug("[MESSAGE TRANSFER]: Disabled by configuration"); |
65 | m_enabled = false; | 62 | return; |
66 | } | 63 | } |
67 | 64 | ||
68 | cnf = config.Configs["Startup"]; | 65 | cnf = config.Configs["Startup"]; |
69 | if (cnf != null) | 66 | if (cnf != null) |
70 | m_Gridmode = cnf.GetBoolean("gridmode", false); | 67 | m_Gridmode = cnf.GetBoolean("gridmode", false); |
71 | } | ||
72 | 68 | ||
73 | public Type ReplaceableInterface | 69 | // m_Enabled = true; |
74 | { | ||
75 | get { return null; } | ||
76 | } | ||
77 | 70 | ||
78 | public void AddRegion(Scene scene) | 71 | lock (m_Scenes) |
79 | { | ||
80 | if (m_enabled) | ||
81 | { | 72 | { |
82 | lock (m_Scenes) | 73 | if (m_Scenes.Count == 0) |
83 | { | 74 | { |
84 | if (m_Scenes.Count == 0) | 75 | MainServer.Instance.AddXmlRPCHandler( |
85 | { | 76 | "grid_instant_message", processXMLRPCGridInstantMessage); |
86 | MainServer.Instance.AddXmlRPCHandler( | ||
87 | "grid_instant_message", processXMLRPCGridInstantMessage); | ||
88 | } | ||
89 | |||
90 | m_log.Debug("[MESSAGE TRANSFER]: Message transfer module active"); | ||
91 | scene.RegisterModuleInterface<IMessageTransferModule>(this); | ||
92 | m_Scenes.Add(scene); | ||
93 | } | 77 | } |
94 | } | ||
95 | } | ||
96 | 78 | ||
97 | public void RegionLoaded(Scene scene) | 79 | m_log.Debug("[MESSAGE TRANSFER]: Message transfer module active"); |
98 | { | 80 | scene.RegisterModuleInterface<IMessageTransferModule>(this); |
99 | } | 81 | m_Scenes.Add(scene); |
100 | 82 | } | |
101 | public void RemoveRegion(Scene scene) | ||
102 | { | ||
103 | if (m_Scenes.Contains(scene)) | ||
104 | m_Scenes.Remove(scene); | ||
105 | MainServer.Instance.RemoveXmlRPCHandler( | ||
106 | "grid_instant_message"); | ||
107 | scene.UnregisterModuleInterface<IMessageTransferModule>(this); | ||
108 | } | 83 | } |
109 | 84 | ||
110 | public virtual void PostInitialise() | 85 | public virtual void PostInitialise() |
@@ -120,6 +95,11 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
120 | get { return "MessageTransferModule"; } | 95 | get { return "MessageTransferModule"; } |
121 | } | 96 | } |
122 | 97 | ||
98 | public virtual bool IsSharedModule | ||
99 | { | ||
100 | get { return true; } | ||
101 | } | ||
102 | |||
123 | public virtual void SendInstantMessage(GridInstantMessage im, MessageResultNotification result) | 103 | public virtual void SendInstantMessage(GridInstantMessage im, MessageResultNotification result) |
124 | { | 104 | { |
125 | UUID toAgentID = new UUID(im.toAgentID); | 105 | UUID toAgentID = new UUID(im.toAgentID); |