From eebddcd5e693a4b56af326546d4222bd594286e0 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 28 Dec 2009 01:24:15 +0000 Subject: Change FriendsModule, InstantMessageModule, MessageTransferModule, MuteListModule, OfflineMessageModule, PresenceModule, InventoryTransferModule and LureModule to new style. Reduce FriendsModule and PresenceModule to shells. --- .../Avatar/InstantMessage/MessageTransferModule.cs | 55 ++++++++++++---------- 1 file changed, 30 insertions(+), 25 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs') diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs index e5159b3..b5019f1 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs @@ -40,18 +40,17 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion; namespace OpenSim.Region.CoreModules.Avatar.InstantMessage { - public class MessageTransferModule : IRegionModule, IMessageTransferModule + public class MessageTransferModule : ISharedRegionModule, IMessageTransferModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - // private bool m_Enabled = false; - protected bool m_Gridmode = false; + private bool m_Enabled = false; protected List m_Scenes = new List(); protected Dictionary m_UserRegionMap = new Dictionary(); public event UndeliveredMessage OnUndeliveredMessage; - public virtual void Initialise(Scene scene, IConfigSource config) + public virtual void Initialise(IConfigSource config) { IConfig cnf = config.Configs["Messaging"]; if (cnf != null && cnf.GetString( @@ -62,20 +61,19 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage return; } - cnf = config.Configs["Startup"]; - if (cnf != null) - m_Gridmode = cnf.GetBoolean("gridmode", false); + MainServer.Instance.AddXmlRPCHandler( + "grid_instant_message", processXMLRPCGridInstantMessage); - // m_Enabled = true; + m_Enabled = true; + } + + public virtual void AddRegion(Scene scene) + { + if (!m_Enabled) + return; lock (m_Scenes) { - if (m_Scenes.Count == 0) - { - MainServer.Instance.AddXmlRPCHandler( - "grid_instant_message", processXMLRPCGridInstantMessage); - } - m_log.Debug("[MESSAGE TRANSFER]: Message transfer module active"); scene.RegisterModuleInterface(this); m_Scenes.Add(scene); @@ -86,6 +84,21 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage { } + public virtual void RegionLoaded(Scene scene) + { + } + + public virtual void RemoveRegion(Scene scene) + { + if (!m_Enabled) + return; + + lock(m_Scenes) + { + m_Scenes.Remove(scene); + } + } + public virtual void Close() { } @@ -95,9 +108,9 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage get { return "MessageTransferModule"; } } - public virtual bool IsSharedModule + public virtual Type ReplaceableInterface { - get { return true; } + get { return null; } } public virtual void SendInstantMessage(GridInstantMessage im, MessageResultNotification result) @@ -148,15 +161,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage } } - if (m_Gridmode) - { - //m_log.DebugFormat("[INSTANT MESSAGE]: Delivering via grid"); - // Still here, try send via Grid - SendGridInstantMessageViaXMLRPC(im, result); - return; - } - - HandleUndeliveredMessage(im, result); + SendGridInstantMessageViaXMLRPC(im, result); return; } -- cgit v1.1