From 5c0a0bc2e0951745fd52f5c01f2ee2c0aee49a3a Mon Sep 17 00:00:00 2001
From: Dr Scofield
Date: Fri, 3 Oct 2008 14:53:11 +0000
Subject: This changeset changes the way chat from client is routed:
old way: each region module interested in chat from client had to
- subscribe to scene.EventManager.OnNewClient
- then in its OnNewClient delegate it would subscribe to
client.OnChatFromViewer to capture chat messages coming
new way: ChatModule is the only region module that uses the "old
way" approach but is now forwarding all client chat via
scene.EventManager.OnChatFromClient
- each region module interested in chat from client now only
subscribes to scene.EventManager.OnChatFromClient
this not only simplifies code, but also allows us to substitute
ChatModule with derived classes (ConciergeModule is going to be one
example).
Also, this changeset changes ChatFromViewer to ChatFromClient as it
doesn't necessarily have to be a viewer that is a chat source.
i've taken great care to only comment out those OnNewClient delegates
that were only used for getting at the client chat --- hope it's not
breaking anything.
---
OpenSim/Region/Environment/Scenes/EventManager.cs | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
(limited to 'OpenSim/Region/Environment/Scenes/EventManager.cs')
diff --git a/OpenSim/Region/Environment/Scenes/EventManager.cs b/OpenSim/Region/Environment/Scenes/EventManager.cs
index 87f3de1..c629faf 100644
--- a/OpenSim/Region/Environment/Scenes/EventManager.cs
+++ b/OpenSim/Region/Environment/Scenes/EventManager.cs
@@ -230,14 +230,20 @@ namespace OpenSim.Region.Environment.Scenes
public event DeregisterCapsEvent OnDeregisterCaps;
///
/// ChatFromWorldEvent is called via Scene when a chat message
- /// from world comes in (chat from viewer is available via
- /// client.OnChatFromViewer).
+ /// from world comes in.
///
public delegate void ChatFromWorldEvent(Object sender, OSChatMessage chat);
public event ChatFromWorldEvent OnChatFromWorld;
///
+ /// ChatFromClientEvent is triggered via ChatModule (or
+ /// substitutes thereof) when a chat message
+ /// from the client comes in.
+ ///
+ public delegate void ChatFromClientEvent(Object sender, OSChatMessage chat);
+ public event ChatFromClientEvent OnChatFromClient;
+ ///
/// ChatBroadcastEvent is called via Scene when a broadcast chat message
- /// from world comes in (chat from viewer is available via client.OnChatFromViewer).
+ /// from world comes in
///
public delegate void ChatBroadcastEvent(Object sender, OSChatMessage chat);
public event ChatBroadcastEvent OnChatBroadcast;
@@ -349,6 +355,7 @@ namespace OpenSim.Region.Environment.Scenes
private RegisterCapsEvent handlerRegisterCaps = null; // OnRegisterCaps;
private DeregisterCapsEvent handlerDeregisterCaps = null; // OnDeregisterCaps;
private ChatFromWorldEvent handlerChatFromWorld = null; // OnChatFromWorld;
+ private ChatFromClientEvent handlerChatFromClient = null; // OnChatFromClient;
private ChatBroadcastEvent handlerChatBroadcast = null; // OnChatBroadcast;
private NewInventoryItemUploadComplete handlerNewInventoryItemUpdateComplete = null;
private RequestChangeWaterHeight handlerRequestChangeWaterHeight = null; //OnRequestChangeWaterHeight
@@ -772,6 +779,15 @@ namespace OpenSim.Region.Environment.Scenes
}
}
+ public void TriggerOnChatFromClient(Object sender, OSChatMessage chat)
+ {
+ handlerChatFromClient = OnChatFromClient;
+ if (handlerChatFromClient != null)
+ {
+ handlerChatFromClient(sender, chat);
+ }
+ }
+
public void TriggerOnChatBroadcast(Object sender, OSChatMessage chat)
{
handlerChatBroadcast = OnChatBroadcast;
--
cgit v1.1