diff options
author | Dr Scofield | 2008-05-23 10:24:26 +0000 |
---|---|---|
committer | Dr Scofield | 2008-05-23 10:24:26 +0000 |
commit | bf23e5d66cf091d310c660877380f3727d0b0234 (patch) | |
tree | 79126b3d3a900d47cae0bf6a59f19de22a0faada /OpenSim/Region/Environment/Scenes | |
parent | Thank you kindly, Melanie, for: (diff) | |
download | opensim-SC_OLD-bf23e5d66cf091d310c660877380f3727d0b0234.zip opensim-SC_OLD-bf23e5d66cf091d310c660877380f3727d0b0234.tar.gz opensim-SC_OLD-bf23e5d66cf091d310c660877380f3727d0b0234.tar.bz2 opensim-SC_OLD-bf23e5d66cf091d310c660877380f3727d0b0234.tar.xz |
i've refactored the ChatModule into two modules: ChatModule and IRCBridgeModule.
ChatModule is now only doing in-world chat. IRCBridgeModule is only doing, well,
bridging chat to/from IRC. Both modules are now using a new OnChatFromWorld event
handler (which Scene.PacketHandler is feeding for chat from in-world instead of
going via the Interface method). This refactoring will allow us to easily add
other bridge modules (e.g., an XMPP bridge module).
there is still a bug in IRCBridgeModule (inherited from the old ChatModule)
where FindClientRegion does not really find the client region...
Diffstat (limited to 'OpenSim/Region/Environment/Scenes')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/EventManager.cs | 18 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs | 33 |
2 files changed, 33 insertions, 18 deletions
diff --git a/OpenSim/Region/Environment/Scenes/EventManager.cs b/OpenSim/Region/Environment/Scenes/EventManager.cs index 7ff9213..e0a24a6 100644 --- a/OpenSim/Region/Environment/Scenes/EventManager.cs +++ b/OpenSim/Region/Environment/Scenes/EventManager.cs | |||
@@ -182,6 +182,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
182 | /// </summary> | 182 | /// </summary> |
183 | public delegate void DeregisterCapsEvent(LLUUID agentID, Caps caps); | 183 | public delegate void DeregisterCapsEvent(LLUUID agentID, Caps caps); |
184 | public event DeregisterCapsEvent OnDeregisterCaps; | 184 | public event DeregisterCapsEvent OnDeregisterCaps; |
185 | /// <summary> | ||
186 | /// ChatFromWorldEvent is called via Scene when a chat message | ||
187 | /// from world comes in (chat from viewer is available via | ||
188 | /// client.OnChatFromViewer). | ||
189 | /// </summary> | ||
190 | public delegate void ChatFromWorldEvent(Object sender, ChatFromViewerArgs chat); | ||
191 | public event ChatFromWorldEvent OnChatFromWorld; | ||
185 | 192 | ||
186 | public class MoneyTransferArgs : EventArgs | 193 | public class MoneyTransferArgs : EventArgs |
187 | { | 194 | { |
@@ -283,6 +290,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
283 | private OnTerrainTickDelegate handlerTerrainTick = null; // OnTerainTick; | 290 | private OnTerrainTickDelegate handlerTerrainTick = null; // OnTerainTick; |
284 | private RegisterCapsEvent handlerRegisterCaps = null; // OnRegisterCaps; | 291 | private RegisterCapsEvent handlerRegisterCaps = null; // OnRegisterCaps; |
285 | private DeregisterCapsEvent handlerDeregisterCaps = null; // OnDeregisterCaps; | 292 | private DeregisterCapsEvent handlerDeregisterCaps = null; // OnDeregisterCaps; |
293 | private ChatFromWorldEvent handlerChatFromWorld = null; // OnChatFromWorld; | ||
286 | private NewInventoryItemUploadComplete handlerNewInventoryItemUpdateComplete = null; | 294 | private NewInventoryItemUploadComplete handlerNewInventoryItemUpdateComplete = null; |
287 | private RequestChangeWaterHeight handlerRequestChangeWaterHeight = null; //OnRequestChangeWaterHeight | 295 | private RequestChangeWaterHeight handlerRequestChangeWaterHeight = null; //OnRequestChangeWaterHeight |
288 | private ScriptControlEvent handlerScriptControlEvent = null; | 296 | private ScriptControlEvent handlerScriptControlEvent = null; |
@@ -625,6 +633,16 @@ namespace OpenSim.Region.Environment.Scenes | |||
625 | 633 | ||
626 | } | 634 | } |
627 | } | 635 | } |
636 | |||
637 | public void TriggerOnChatFromWorld(Object sender, ChatFromViewerArgs chat) | ||
638 | { | ||
639 | handlerChatFromWorld = OnChatFromWorld; | ||
640 | if (handlerChatFromWorld != null) | ||
641 | { | ||
642 | handlerChatFromWorld(sender, chat); | ||
643 | } | ||
644 | } | ||
645 | |||
628 | internal void TriggerControlEvent(uint p, LLUUID scriptUUID, LLUUID avatarID, uint held, uint _changed) | 646 | internal void TriggerControlEvent(uint p, LLUUID scriptUUID, LLUUID avatarID, uint held, uint _changed) |
629 | { | 647 | { |
630 | handlerScriptControlEvent = OnScriptControlEvent; | 648 | handlerScriptControlEvent = OnScriptControlEvent; |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs index 1b25f13..9eb86cb 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs | |||
@@ -45,28 +45,25 @@ namespace OpenSim.Region.Environment.Scenes | |||
45 | public void SimChat(byte[] message, ChatTypeEnum type, int channel, LLVector3 fromPos, string fromName, | 45 | public void SimChat(byte[] message, ChatTypeEnum type, int channel, LLVector3 fromPos, string fromName, |
46 | LLUUID fromAgentID) | 46 | LLUUID fromAgentID) |
47 | { | 47 | { |
48 | if (m_simChatModule != null) | 48 | ChatFromViewerArgs args = new ChatFromViewerArgs(); |
49 | { | ||
50 | ChatFromViewerArgs args = new ChatFromViewerArgs(); | ||
51 | |||
52 | args.Message = Helpers.FieldToUTF8String(message); | ||
53 | args.Channel = channel; | ||
54 | args.Type = type; | ||
55 | args.Position = fromPos; | ||
56 | args.SenderUUID = fromAgentID; | ||
57 | 49 | ||
50 | args.Message = Helpers.FieldToUTF8String(message); | ||
51 | args.Channel = channel; | ||
52 | args.Type = type; | ||
53 | args.Position = fromPos; | ||
54 | args.SenderUUID = fromAgentID; | ||
55 | args.Scene = this; | ||
58 | 56 | ||
59 | ScenePresence user = GetScenePresence(fromAgentID); | 57 | ScenePresence user = GetScenePresence(fromAgentID); |
60 | if (user != null) | 58 | if (user != null) |
61 | args.Sender = user.ControllingClient; | 59 | args.Sender = user.ControllingClient; |
62 | else | 60 | else |
63 | args.Sender = null; | 61 | args.Sender = null; |
64 | 62 | ||
65 | args.From = fromName; | 63 | args.From = fromName; |
66 | //args. | 64 | //args. |
67 | 65 | ||
68 | m_simChatModule.SimChat(this, args); | 66 | EventManager.TriggerOnChatFromWorld(this, args); |
69 | } | ||
70 | } | 67 | } |
71 | 68 | ||
72 | /// <summary> | 69 | /// <summary> |