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.
This commit is contained in:
Melanie Thielker
2008-11-01 18:18:19 +00:00
parent 9299be0080
commit 388c053dcb
5 changed files with 32 additions and 35 deletions

View File

@@ -54,6 +54,14 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
public void Initialise(Scene scene, IConfigSource config)
{
if (config.Configs["Messaging"] != null)
{
if (config.Configs["Messaging"].GetString(
"InstantMessageModule", "InstantMessageModule") !=
"InstantMessageModule")
return;
}
lock (m_scenes)
{
if (m_scenes.Count == 0)
@@ -67,7 +75,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
{
m_scenes.Add(scene);
scene.EventManager.OnNewClient += OnNewClient;
scene.EventManager.OnGridInstantMessageToIMModule += OnGridInstantMessage;
scene.EventManager.OnGridInstantMessage += OnGridInstantMessage;
}
}
}
@@ -114,7 +122,9 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
byte[] binaryBucket)
{
bool dialogHandledElsewhere
= ((dialog == 38) || (dialog == 39) || (dialog == 40)
= ( dialog == (byte) InstantMessageDialog.FriendshipOffered
|| dialog == (byte) InstantMessageDialog.FriendshipAccepted
|| dialog == (byte) InstantMessageDialog.FriendshipDeclined
|| dialog == (byte) InstantMessageDialog.InventoryOffered
|| dialog == (byte) InstantMessageDialog.InventoryAccepted
|| dialog == (byte) InstantMessageDialog.InventoryDeclined
@@ -197,8 +207,11 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
///
/// </summary>
/// <param name="msg"></param>
private void OnGridInstantMessage(GridInstantMessage msg)
private void OnGridInstantMessage(GridInstantMessage msg, InstantMessageReceiver which)
{
if ((which & InstantMessageReceiver.IMModule) == 0)
return;
// Trigger the above event handler
OnInstantMessage(null, new UUID(msg.fromAgentID), new UUID(msg.fromAgentSession),
new UUID(msg.toAgentID), new UUID(msg.imSessionID), msg.timestamp, msg.fromAgentName,