diff options
author | Melanie Thielker | 2008-11-01 18:18:19 +0000 |
---|---|---|
committer | Melanie Thielker | 2008-11-01 18:18:19 +0000 |
commit | 388c053dcb8de3d9b89c99989af1990296cf2001 (patch) | |
tree | a1d12cae14606bf30a59532de7d6e996a51f469e /OpenSim/Region/Environment/Modules | |
parent | Revert last checkin. Avatars fall through non-physical prims now. (diff) | |
download | opensim-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/Modules')
4 files changed, 26 insertions, 13 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() |