From e06acae965d918ac0ece14a8aae2e1cf5be37d07 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 21 Oct 2010 22:04:31 +0100
Subject: Allow region modules to know which agents actually receive chat
---
OpenSim/Region/Framework/Scenes/EventManager.cs | 35 +++++++++++++++++++++++++
1 file changed, 35 insertions(+)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index 437b91a..4feb3fc 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -293,6 +293,17 @@ namespace OpenSim.Region.Framework.Scenes
public event ChatFromClientEvent OnChatFromClient;
///
+ /// ChatToClientsEvent is triggered via ChatModule (or
+ /// substitutes thereof) when a chat message is actually sent to clients. Clients will only be sent a
+ /// received chat message if they satisfy various conditions (within audible range, etc.)
+ ///
+ public delegate void ChatToClientsEvent(
+ UUID senderID, HashSet receiverIDs,
+ string message, ChatTypeEnum type, Vector3 fromPos, string fromName,
+ ChatSourceType src, ChatAudibleLevel level);
+ public event ChatToClientsEvent OnChatToClients;
+
+ ///
/// ChatBroadcastEvent is called via Scene when a broadcast chat message
/// from world comes in
///
@@ -1603,6 +1614,30 @@ namespace OpenSim.Region.Framework.Scenes
}
}
}
+
+ public void TriggerOnChatToClients(
+ UUID senderID, HashSet receiverIDs,
+ string message, ChatTypeEnum type, Vector3 fromPos, string fromName,
+ ChatSourceType src, ChatAudibleLevel level)
+ {
+ ChatToClientsEvent handler = OnChatToClients;
+ if (handler != null)
+ {
+ foreach (ChatToClientsEvent d in handler.GetInvocationList())
+ {
+ try
+ {
+ d(senderID, receiverIDs, message, type, fromPos, fromName, src, level);
+ }
+ catch (Exception e)
+ {
+ m_log.ErrorFormat(
+ "[EVENT MANAGER]: Delegate for TriggerOnChatToClients failed - continuing. {0} {1}",
+ e.Message, e.StackTrace);
+ }
+ }
+ }
+ }
public void TriggerOnChatBroadcast(Object sender, OSChatMessage chat)
{
--
cgit v1.1