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.0.6.0-stable
parent
9299be0080
commit
388c053dcb
|
@ -67,7 +67,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
|
|||
m_scene.Add(scene);
|
||||
}
|
||||
scene.EventManager.OnNewClient += OnNewClient;
|
||||
scene.EventManager.OnGridInstantMessageToFriendsModule += OnGridInstantMessage;
|
||||
scene.EventManager.OnGridInstantMessage += OnGridInstantMessage;
|
||||
scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel;
|
||||
scene.EventManager.OnMakeChildAgent += MakeChildAgent;
|
||||
scene.EventManager.OnClientClosed += ClientLoggedOut;
|
||||
|
@ -620,8 +620,11 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
|
|||
// TODO: Inform the client that the ExFriend is offline
|
||||
}
|
||||
|
||||
private void OnGridInstantMessage(GridInstantMessage msg)
|
||||
private void OnGridInstantMessage(GridInstantMessage msg, InstantMessageReceiver whichModule)
|
||||
{
|
||||
if ((whichModule & InstantMessageReceiver.FriendsModule) == 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,
|
||||
|
|
|
@ -99,7 +99,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Groups
|
|||
|
||||
scene.EventManager.OnNewClient += OnNewClient;
|
||||
scene.EventManager.OnClientClosed += OnClientClosed;
|
||||
scene.EventManager.OnGridInstantMessageToGroupsModule +=
|
||||
scene.EventManager.OnGridInstantMessage +=
|
||||
OnGridInstantMessage;
|
||||
}
|
||||
|
||||
|
@ -187,8 +187,11 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Groups
|
|||
{
|
||||
}
|
||||
|
||||
private void OnGridInstantMessage(GridInstantMessage msg)
|
||||
private void OnGridInstantMessage(GridInstantMessage msg, InstantMessageReceiver whichModule)
|
||||
{
|
||||
if ((whichModule & InstantMessageReceiver.GroupsModule) == 0)
|
||||
return;
|
||||
|
||||
// Trigger the above event handler
|
||||
OnInstantMessage(null, new UUID(msg.fromAgentID),
|
||||
new UUID(msg.fromAgentSession),
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -195,12 +195,6 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
|
|||
}
|
||||
}
|
||||
}
|
||||
// Of interest to this module potentially
|
||||
//scene.EventManager.OnNewClient += OnNewClient;
|
||||
//scene.EventManager.OnGridInstantMessageToFriendsModule += OnGridInstantMessage;
|
||||
// scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel;
|
||||
//scene.EventManager.OnMakeChildAgent += MakeChildAgent;
|
||||
//scene.EventManager.OnClientClosed += ClientLoggedOut;
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
|
|
|
@ -135,13 +135,9 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
|
||||
public event SignificantClientMovement OnSignificantClientMovement;
|
||||
|
||||
public delegate void NewGridInstantMessage(GridInstantMessage message);
|
||||
public delegate void NewGridInstantMessage(GridInstantMessage message, InstantMessageReceiver whichModule);
|
||||
|
||||
public event NewGridInstantMessage OnGridInstantMessageToIMModule;
|
||||
|
||||
public event NewGridInstantMessage OnGridInstantMessageToFriendsModule;
|
||||
|
||||
public event NewGridInstantMessage OnGridInstantMessageToGroupsModule;
|
||||
public event NewGridInstantMessage OnGridInstantMessage;
|
||||
|
||||
public delegate void ClientClosed(UUID clientID);
|
||||
|
||||
|
@ -346,8 +342,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
private LandObjectAdded handlerLandObjectAdded = null; //OnLandObjectAdded;
|
||||
private LandObjectRemoved handlerLandObjectRemoved = null; //OnLandObjectRemoved;
|
||||
private AvatarEnteringNewParcel handlerAvatarEnteringNewParcel = null; //OnAvatarEnteringNewParcel;
|
||||
private NewGridInstantMessage handlerGridInstantMessageToIM = null; //OnGridInstantMessageToIMModule;
|
||||
private NewGridInstantMessage handlerGridInstantMessageToFriends = null; //OnGridInstantMessageToFriendsModule;
|
||||
private NewGridInstantMessage handlerGridInstantMessage = null; //OnGridInstantMessage;
|
||||
private ClientClosed handlerClientClosed = null; //OnClientClosed;
|
||||
private OnMakeChildAgentDelegate handlerMakeChildAgent = null; //OnMakeChildAgent;
|
||||
private OnMakeRootAgentDelegate handlerMakeRootAgent = null; //OnMakeRootAgent;
|
||||
|
@ -635,21 +630,10 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
///<param name="whichModule">A bit vector containing the modules to send the message to</param>
|
||||
public void TriggerGridInstantMessage(GridInstantMessage message, InstantMessageReceiver whichModule)
|
||||
{
|
||||
if ((whichModule & InstantMessageReceiver.IMModule) != 0)
|
||||
handlerGridInstantMessage = OnGridInstantMessage;
|
||||
if (handlerGridInstantMessage != null)
|
||||
{
|
||||
handlerGridInstantMessageToIM = OnGridInstantMessageToIMModule;
|
||||
if (handlerGridInstantMessageToIM != null)
|
||||
{
|
||||
handlerGridInstantMessageToIM(message);
|
||||
}
|
||||
}
|
||||
if ((whichModule & InstantMessageReceiver.FriendsModule) != 0)
|
||||
{
|
||||
handlerGridInstantMessageToFriends = OnGridInstantMessageToFriendsModule;
|
||||
if (handlerGridInstantMessageToFriends != null)
|
||||
{
|
||||
handlerGridInstantMessageToFriends(message);
|
||||
}
|
||||
handlerGridInstantMessage(message, whichModule);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue