From 1b65020b414bca9120fe87998769b5e138c435cd Mon Sep 17 00:00:00 2001 From: MW Date: Thu, 19 Feb 2009 11:54:53 +0000 Subject: Added a event to IMessageTransferModule (and MessageTransferModule) so that other modules can capture IM messages and do custom handling of them. As just attaching to Client IM events doesn't really support this, as they would still get routed through the normal process and could give back errors. --- .../Avatar/InstantMessage/MessageTransferModule.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'OpenSim/Region/CoreModules') diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs index 38d2d21..b8e0c29 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs @@ -48,6 +48,10 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage private List m_Scenes = new List(); private Dictionary m_UserRegionMap = new Dictionary(); + public event ExternalHandleIM OnExternalIMCapture; + + private ExternalHandleIM handlerExternalIMCapture; + public void Initialise(Scene scene, IConfigSource config) { IConfig cnf = config.Configs["Messaging"]; @@ -95,6 +99,16 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage public void SendInstantMessage(GridInstantMessage im, MessageResultNotification result) { + handlerExternalIMCapture = OnExternalIMCapture; + if (handlerExternalIMCapture != null) + { + if (handlerExternalIMCapture(im)) + { + result(true); + return; + } + } + UUID toAgentID = new UUID(im.toAgentID); m_log.DebugFormat("[INSTANT MESSAGE]: Attempting delivery of IM from {0} to {1}", im.fromAgentName, toAgentID.ToString()); -- cgit v1.1