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