diff options
author | Dr Scofield | 2008-10-03 14:53:11 +0000 |
---|---|---|
committer | Dr Scofield | 2008-10-03 14:53:11 +0000 |
commit | 5c0a0bc2e0951745fd52f5c01f2ee2c0aee49a3a (patch) | |
tree | 529c2c8e3ea8f1193f2495f905e542ff1462adb6 /OpenSim/Region/Environment/Scenes | |
parent | * minor: remove warnings (the code cleaners strike again) (diff) | |
download | opensim-SC-5c0a0bc2e0951745fd52f5c01f2ee2c0aee49a3a.zip opensim-SC-5c0a0bc2e0951745fd52f5c01f2ee2c0aee49a3a.tar.gz opensim-SC-5c0a0bc2e0951745fd52f5c01f2ee2c0aee49a3a.tar.bz2 opensim-SC-5c0a0bc2e0951745fd52f5c01f2ee2c0aee49a3a.tar.xz |
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.
Diffstat (limited to 'OpenSim/Region/Environment/Scenes')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/EventManager.cs | 22 |
1 files changed, 19 insertions, 3 deletions
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 | |||
230 | public event DeregisterCapsEvent OnDeregisterCaps; | 230 | public event DeregisterCapsEvent OnDeregisterCaps; |
231 | /// <summary> | 231 | /// <summary> |
232 | /// ChatFromWorldEvent is called via Scene when a chat message | 232 | /// ChatFromWorldEvent is called via Scene when a chat message |
233 | /// from world comes in (chat from viewer is available via | 233 | /// from world comes in. |
234 | /// client.OnChatFromViewer). | ||
235 | /// </summary> | 234 | /// </summary> |
236 | public delegate void ChatFromWorldEvent(Object sender, OSChatMessage chat); | 235 | public delegate void ChatFromWorldEvent(Object sender, OSChatMessage chat); |
237 | public event ChatFromWorldEvent OnChatFromWorld; | 236 | public event ChatFromWorldEvent OnChatFromWorld; |
238 | /// <summary> | 237 | /// <summary> |
238 | /// ChatFromClientEvent is triggered via ChatModule (or | ||
239 | /// substitutes thereof) when a chat message | ||
240 | /// from the client comes in. | ||
241 | /// </summary> | ||
242 | public delegate void ChatFromClientEvent(Object sender, OSChatMessage chat); | ||
243 | public event ChatFromClientEvent OnChatFromClient; | ||
244 | /// <summary> | ||
239 | /// ChatBroadcastEvent is called via Scene when a broadcast chat message | 245 | /// ChatBroadcastEvent is called via Scene when a broadcast chat message |
240 | /// from world comes in (chat from viewer is available via client.OnChatFromViewer). | 246 | /// from world comes in |
241 | /// </summary> | 247 | /// </summary> |
242 | public delegate void ChatBroadcastEvent(Object sender, OSChatMessage chat); | 248 | public delegate void ChatBroadcastEvent(Object sender, OSChatMessage chat); |
243 | public event ChatBroadcastEvent OnChatBroadcast; | 249 | public event ChatBroadcastEvent OnChatBroadcast; |
@@ -349,6 +355,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
349 | private RegisterCapsEvent handlerRegisterCaps = null; // OnRegisterCaps; | 355 | private RegisterCapsEvent handlerRegisterCaps = null; // OnRegisterCaps; |
350 | private DeregisterCapsEvent handlerDeregisterCaps = null; // OnDeregisterCaps; | 356 | private DeregisterCapsEvent handlerDeregisterCaps = null; // OnDeregisterCaps; |
351 | private ChatFromWorldEvent handlerChatFromWorld = null; // OnChatFromWorld; | 357 | private ChatFromWorldEvent handlerChatFromWorld = null; // OnChatFromWorld; |
358 | private ChatFromClientEvent handlerChatFromClient = null; // OnChatFromClient; | ||
352 | private ChatBroadcastEvent handlerChatBroadcast = null; // OnChatBroadcast; | 359 | private ChatBroadcastEvent handlerChatBroadcast = null; // OnChatBroadcast; |
353 | private NewInventoryItemUploadComplete handlerNewInventoryItemUpdateComplete = null; | 360 | private NewInventoryItemUploadComplete handlerNewInventoryItemUpdateComplete = null; |
354 | private RequestChangeWaterHeight handlerRequestChangeWaterHeight = null; //OnRequestChangeWaterHeight | 361 | private RequestChangeWaterHeight handlerRequestChangeWaterHeight = null; //OnRequestChangeWaterHeight |
@@ -772,6 +779,15 @@ namespace OpenSim.Region.Environment.Scenes | |||
772 | } | 779 | } |
773 | } | 780 | } |
774 | 781 | ||
782 | public void TriggerOnChatFromClient(Object sender, OSChatMessage chat) | ||
783 | { | ||
784 | handlerChatFromClient = OnChatFromClient; | ||
785 | if (handlerChatFromClient != null) | ||
786 | { | ||
787 | handlerChatFromClient(sender, chat); | ||
788 | } | ||
789 | } | ||
790 | |||
775 | public void TriggerOnChatBroadcast(Object sender, OSChatMessage chat) | 791 | public void TriggerOnChatBroadcast(Object sender, OSChatMessage chat) |
776 | { | 792 | { |
777 | handlerChatBroadcast = OnChatBroadcast; | 793 | handlerChatBroadcast = OnChatBroadcast; |