From 87822c5d958f4ea10269d6eb646a6288681d4718 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Tue, 17 Mar 2009 23:52:30 +0000 Subject: [PATCH] Add an event to process undelivered IMs --- .../Avatar/InstantMessage/MessageTransferModule.cs | 14 ++++++++++++++ .../Framework/Interfaces/IMessageTransferModule.cs | 3 +++ 2 files changed, 17 insertions(+) diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs index 94a856b84d..f67bb0b304 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs @@ -48,6 +48,8 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage protected List m_Scenes = new List(); protected Dictionary m_UserRegionMap = new Dictionary(); + public event UndeliveredMessage OnUndeliveredMessage; + public virtual void Initialise(Scene scene, IConfigSource config) { IConfig cnf = config.Configs["Messaging"]; @@ -165,6 +167,18 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage return; } + UndeliveredMessage handlerUndeliveredMessage = OnUndeliveredMessage; + + // If this event has handlers, then the IM will be considered + // delivered. This will suppress the error message. + // + if (handlerUndeliveredMessage != null) + { + handlerUndeliveredMessage(im); + result(true); + return; + } + //m_log.DebugFormat("[INSTANT MESSAGE]: Undeliverable"); result(false); return; diff --git a/OpenSim/Region/Framework/Interfaces/IMessageTransferModule.cs b/OpenSim/Region/Framework/Interfaces/IMessageTransferModule.cs index 40c224d4d0..86dc236965 100644 --- a/OpenSim/Region/Framework/Interfaces/IMessageTransferModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IMessageTransferModule.cs @@ -30,9 +30,12 @@ using OpenSim.Framework; namespace OpenSim.Region.Framework.Interfaces { public delegate void MessageResultNotification(bool success); + public delegate void UndeliveredMessage(GridInstantMessage im); public interface IMessageTransferModule { + event UndeliveredMessage OnUndeliveredMessage; + void SendInstantMessage(GridInstantMessage im, MessageResultNotification result); } }