aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment
diff options
context:
space:
mode:
authorMelanie Thielker2008-11-01 18:18:19 +0000
committerMelanie Thielker2008-11-01 18:18:19 +0000
commit388c053dcb8de3d9b89c99989af1990296cf2001 (patch)
treea1d12cae14606bf30a59532de7d6e996a51f469e /OpenSim/Region/Environment
parentRevert last checkin. Avatars fall through non-physical prims now. (diff)
downloadopensim-SC-388c053dcb8de3d9b89c99989af1990296cf2001.zip
opensim-SC-388c053dcb8de3d9b89c99989af1990296cf2001.tar.gz
opensim-SC-388c053dcb8de3d9b89c99989af1990296cf2001.tar.bz2
opensim-SC-388c053dcb8de3d9b89c99989af1990296cf2001.tar.xz
Make the IM and friends modules optional. Clean up some code that dealt
with the old Grid Instant Message over OGS1. Refactor the EventManager to be independent of the rigid module structure design imposed by the current implementation. Message routing is now done in the destination module rather than in the event manager. This way, more or less granular solutions are possible without core changes.
Diffstat (limited to 'OpenSim/Region/Environment')
-rw-r--r--OpenSim/Region/Environment/Modules/Avatar/Friends/FriendsModule.cs7
-rw-r--r--OpenSim/Region/Environment/Modules/Avatar/Groups/GroupsModule.cs7
-rw-r--r--OpenSim/Region/Environment/Modules/Avatar/InstantMessage/InstantMessageModule.cs19
-rw-r--r--OpenSim/Region/Environment/Modules/InterGrid/OpenGridProtocolModule.cs6
-rw-r--r--OpenSim/Region/Environment/Scenes/EventManager.cs28
5 files changed, 32 insertions, 35 deletions
diff --git a/OpenSim/Region/Environment/Modules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/Environment/Modules/Avatar/Friends/FriendsModule.cs
index c51bcc1..a380700 100644
--- a/OpenSim/Region/Environment/Modules/Avatar/Friends/FriendsModule.cs
+++ b/OpenSim/Region/Environment/Modules/Avatar/Friends/FriendsModule.cs
@@ -67,7 +67,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
67 m_scene.Add(scene); 67 m_scene.Add(scene);
68 } 68 }
69 scene.EventManager.OnNewClient += OnNewClient; 69 scene.EventManager.OnNewClient += OnNewClient;
70 scene.EventManager.OnGridInstantMessageToFriendsModule += OnGridInstantMessage; 70 scene.EventManager.OnGridInstantMessage += OnGridInstantMessage;
71 scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel; 71 scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel;
72 scene.EventManager.OnMakeChildAgent += MakeChildAgent; 72 scene.EventManager.OnMakeChildAgent += MakeChildAgent;
73 scene.EventManager.OnClientClosed += ClientLoggedOut; 73 scene.EventManager.OnClientClosed += ClientLoggedOut;
@@ -620,8 +620,11 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
620 // TODO: Inform the client that the ExFriend is offline 620 // TODO: Inform the client that the ExFriend is offline
621 } 621 }
622 622
623 private void OnGridInstantMessage(GridInstantMessage msg) 623 private void OnGridInstantMessage(GridInstantMessage msg, InstantMessageReceiver whichModule)
624 { 624 {
625 if ((whichModule & InstantMessageReceiver.FriendsModule) == 0)
626 return;
627
625 // Trigger the above event handler 628 // Trigger the above event handler
626 OnInstantMessage(null, new UUID(msg.fromAgentID), new UUID(msg.fromAgentSession), 629 OnInstantMessage(null, new UUID(msg.fromAgentID), new UUID(msg.fromAgentSession),
627 new UUID(msg.toAgentID), new UUID(msg.imSessionID), msg.timestamp, msg.fromAgentName, 630 new UUID(msg.toAgentID), new UUID(msg.imSessionID), msg.timestamp, msg.fromAgentName,
diff --git a/OpenSim/Region/Environment/Modules/Avatar/Groups/GroupsModule.cs b/OpenSim/Region/Environment/Modules/Avatar/Groups/GroupsModule.cs
index 1824134..d9a5393 100644
--- a/OpenSim/Region/Environment/Modules/Avatar/Groups/GroupsModule.cs
+++ b/OpenSim/Region/Environment/Modules/Avatar/Groups/GroupsModule.cs
@@ -99,7 +99,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Groups
99 99
100 scene.EventManager.OnNewClient += OnNewClient; 100 scene.EventManager.OnNewClient += OnNewClient;
101 scene.EventManager.OnClientClosed += OnClientClosed; 101 scene.EventManager.OnClientClosed += OnClientClosed;
102 scene.EventManager.OnGridInstantMessageToGroupsModule += 102 scene.EventManager.OnGridInstantMessage +=
103 OnGridInstantMessage; 103 OnGridInstantMessage;
104 } 104 }
105 105
@@ -187,8 +187,11 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Groups
187 { 187 {
188 } 188 }
189 189
190 private void OnGridInstantMessage(GridInstantMessage msg) 190 private void OnGridInstantMessage(GridInstantMessage msg, InstantMessageReceiver whichModule)
191 { 191 {
192 if ((whichModule & InstantMessageReceiver.GroupsModule) == 0)
193 return;
194
192 // Trigger the above event handler 195 // Trigger the above event handler
193 OnInstantMessage(null, new UUID(msg.fromAgentID), 196 OnInstantMessage(null, new UUID(msg.fromAgentID),
194 new UUID(msg.fromAgentSession), 197 new UUID(msg.fromAgentSession),
diff --git a/OpenSim/Region/Environment/Modules/Avatar/InstantMessage/InstantMessageModule.cs b/OpenSim/Region/Environment/Modules/Avatar/InstantMessage/InstantMessageModule.cs
index 2553266..adf1103 100644
--- a/OpenSim/Region/Environment/Modules/Avatar/InstantMessage/InstantMessageModule.cs
+++ b/OpenSim/Region/Environment/Modules/Avatar/InstantMessage/InstantMessageModule.cs
@@ -54,6 +54,14 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
54 54
55 public void Initialise(Scene scene, IConfigSource config) 55 public void Initialise(Scene scene, IConfigSource config)
56 { 56 {
57 if (config.Configs["Messaging"] != null)
58 {
59 if (config.Configs["Messaging"].GetString(
60 "InstantMessageModule", "InstantMessageModule") !=
61 "InstantMessageModule")
62 return;
63 }
64
57 lock (m_scenes) 65 lock (m_scenes)
58 { 66 {
59 if (m_scenes.Count == 0) 67 if (m_scenes.Count == 0)
@@ -67,7 +75,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
67 { 75 {
68 m_scenes.Add(scene); 76 m_scenes.Add(scene);
69 scene.EventManager.OnNewClient += OnNewClient; 77 scene.EventManager.OnNewClient += OnNewClient;
70 scene.EventManager.OnGridInstantMessageToIMModule += OnGridInstantMessage; 78 scene.EventManager.OnGridInstantMessage += OnGridInstantMessage;
71 } 79 }
72 } 80 }
73 } 81 }
@@ -114,7 +122,9 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
114 byte[] binaryBucket) 122 byte[] binaryBucket)
115 { 123 {
116 bool dialogHandledElsewhere 124 bool dialogHandledElsewhere
117 = ((dialog == 38) || (dialog == 39) || (dialog == 40) 125 = ( dialog == (byte) InstantMessageDialog.FriendshipOffered
126 || dialog == (byte) InstantMessageDialog.FriendshipAccepted
127 || dialog == (byte) InstantMessageDialog.FriendshipDeclined
118 || dialog == (byte) InstantMessageDialog.InventoryOffered 128 || dialog == (byte) InstantMessageDialog.InventoryOffered
119 || dialog == (byte) InstantMessageDialog.InventoryAccepted 129 || dialog == (byte) InstantMessageDialog.InventoryAccepted
120 || dialog == (byte) InstantMessageDialog.InventoryDeclined 130 || dialog == (byte) InstantMessageDialog.InventoryDeclined
@@ -197,8 +207,11 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
197 /// 207 ///
198 /// </summary> 208 /// </summary>
199 /// <param name="msg"></param> 209 /// <param name="msg"></param>
200 private void OnGridInstantMessage(GridInstantMessage msg) 210 private void OnGridInstantMessage(GridInstantMessage msg, InstantMessageReceiver which)
201 { 211 {
212 if ((which & InstantMessageReceiver.IMModule) == 0)
213 return;
214
202 // Trigger the above event handler 215 // Trigger the above event handler
203 OnInstantMessage(null, new UUID(msg.fromAgentID), new UUID(msg.fromAgentSession), 216 OnInstantMessage(null, new UUID(msg.fromAgentID), new UUID(msg.fromAgentSession),
204 new UUID(msg.toAgentID), new UUID(msg.imSessionID), msg.timestamp, msg.fromAgentName, 217 new UUID(msg.toAgentID), new UUID(msg.imSessionID), msg.timestamp, msg.fromAgentName,
diff --git a/OpenSim/Region/Environment/Modules/InterGrid/OpenGridProtocolModule.cs b/OpenSim/Region/Environment/Modules/InterGrid/OpenGridProtocolModule.cs
index 85e60d7..ba40571 100644
--- a/OpenSim/Region/Environment/Modules/InterGrid/OpenGridProtocolModule.cs
+++ b/OpenSim/Region/Environment/Modules/InterGrid/OpenGridProtocolModule.cs
@@ -195,12 +195,6 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
195 } 195 }
196 } 196 }
197 } 197 }
198 // Of interest to this module potentially
199 //scene.EventManager.OnNewClient += OnNewClient;
200 //scene.EventManager.OnGridInstantMessageToFriendsModule += OnGridInstantMessage;
201 // scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel;
202 //scene.EventManager.OnMakeChildAgent += MakeChildAgent;
203 //scene.EventManager.OnClientClosed += ClientLoggedOut;
204 } 198 }
205 199
206 public void PostInitialise() 200 public void PostInitialise()
diff --git a/OpenSim/Region/Environment/Scenes/EventManager.cs b/OpenSim/Region/Environment/Scenes/EventManager.cs
index c629faf..99aac93 100644
--- a/OpenSim/Region/Environment/Scenes/EventManager.cs
+++ b/OpenSim/Region/Environment/Scenes/EventManager.cs
@@ -135,13 +135,9 @@ namespace OpenSim.Region.Environment.Scenes
135 135
136 public event SignificantClientMovement OnSignificantClientMovement; 136 public event SignificantClientMovement OnSignificantClientMovement;
137 137
138 public delegate void NewGridInstantMessage(GridInstantMessage message); 138 public delegate void NewGridInstantMessage(GridInstantMessage message, InstantMessageReceiver whichModule);
139 139
140 public event NewGridInstantMessage OnGridInstantMessageToIMModule; 140 public event NewGridInstantMessage OnGridInstantMessage;
141
142 public event NewGridInstantMessage OnGridInstantMessageToFriendsModule;
143
144 public event NewGridInstantMessage OnGridInstantMessageToGroupsModule;
145 141
146 public delegate void ClientClosed(UUID clientID); 142 public delegate void ClientClosed(UUID clientID);
147 143
@@ -346,8 +342,7 @@ namespace OpenSim.Region.Environment.Scenes
346 private LandObjectAdded handlerLandObjectAdded = null; //OnLandObjectAdded; 342 private LandObjectAdded handlerLandObjectAdded = null; //OnLandObjectAdded;
347 private LandObjectRemoved handlerLandObjectRemoved = null; //OnLandObjectRemoved; 343 private LandObjectRemoved handlerLandObjectRemoved = null; //OnLandObjectRemoved;
348 private AvatarEnteringNewParcel handlerAvatarEnteringNewParcel = null; //OnAvatarEnteringNewParcel; 344 private AvatarEnteringNewParcel handlerAvatarEnteringNewParcel = null; //OnAvatarEnteringNewParcel;
349 private NewGridInstantMessage handlerGridInstantMessageToIM = null; //OnGridInstantMessageToIMModule; 345 private NewGridInstantMessage handlerGridInstantMessage = null; //OnGridInstantMessage;
350 private NewGridInstantMessage handlerGridInstantMessageToFriends = null; //OnGridInstantMessageToFriendsModule;
351 private ClientClosed handlerClientClosed = null; //OnClientClosed; 346 private ClientClosed handlerClientClosed = null; //OnClientClosed;
352 private OnMakeChildAgentDelegate handlerMakeChildAgent = null; //OnMakeChildAgent; 347 private OnMakeChildAgentDelegate handlerMakeChildAgent = null; //OnMakeChildAgent;
353 private OnMakeRootAgentDelegate handlerMakeRootAgent = null; //OnMakeRootAgent; 348 private OnMakeRootAgentDelegate handlerMakeRootAgent = null; //OnMakeRootAgent;
@@ -635,21 +630,10 @@ namespace OpenSim.Region.Environment.Scenes
635 ///<param name="whichModule">A bit vector containing the modules to send the message to</param> 630 ///<param name="whichModule">A bit vector containing the modules to send the message to</param>
636 public void TriggerGridInstantMessage(GridInstantMessage message, InstantMessageReceiver whichModule) 631 public void TriggerGridInstantMessage(GridInstantMessage message, InstantMessageReceiver whichModule)
637 { 632 {
638 if ((whichModule & InstantMessageReceiver.IMModule) != 0) 633 handlerGridInstantMessage = OnGridInstantMessage;
639 { 634 if (handlerGridInstantMessage != null)
640 handlerGridInstantMessageToIM = OnGridInstantMessageToIMModule;
641 if (handlerGridInstantMessageToIM != null)
642 {
643 handlerGridInstantMessageToIM(message);
644 }
645 }
646 if ((whichModule & InstantMessageReceiver.FriendsModule) != 0)
647 { 635 {
648 handlerGridInstantMessageToFriends = OnGridInstantMessageToFriendsModule; 636 handlerGridInstantMessage(message, whichModule);
649 if (handlerGridInstantMessageToFriends != null)
650 {
651 handlerGridInstantMessageToFriends(message);
652 }
653 } 637 }
654 } 638 }
655 639