Add root agent tracking to presence module

0.6.1-post-fixes
Melanie Thielker 2008-11-22 23:38:25 +00:00
parent 2fa072b579
commit 7aa32ac6e0
3 changed files with 21 additions and 9 deletions

View File

@ -50,6 +50,9 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
private bool m_Gridmode = false; private bool m_Gridmode = false;
private List<Scene> m_Scenes = new List<Scene>(); private List<Scene> m_Scenes = new List<Scene>();
private Dictionary<UUID, Scene> m_RootAgents =
new Dictionary<UUID, Scene>();
public event PresenceChange OnPresenceChange; public event PresenceChange OnPresenceChange;
public event BulkPresenceData OnBulkPresenceData; public event BulkPresenceData OnBulkPresenceData;
@ -69,10 +72,6 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
lock (m_Scenes) lock (m_Scenes)
{ {
if (m_Scenes.Count == 0)
{
}
if (m_Gridmode) if (m_Gridmode)
NotifyMessageServerOfStartup(scene); NotifyMessageServerOfStartup(scene);
@ -119,10 +118,23 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
public void OnConnectionClosed(IClientAPI client) public void OnConnectionClosed(IClientAPI client)
{ {
if (!(client.Scene is Scene))
return;
if (!(m_RootAgents.ContainsKey(client.AgentId)))
return;
Scene scene = (Scene)client.Scene;
if (m_RootAgents[client.AgentId] != scene)
return;
m_RootAgents.Remove(client.AgentId);
} }
public void OnSetRootAgentScene(UUID agentID) public void OnSetRootAgentScene(UUID agentID, Scene scene)
{ {
m_RootAgents[agentID] = scene;
} }
private void NotifyMessageServerOfStartup(Scene scene) private void NotifyMessageServerOfStartup(Scene scene)

View File

@ -98,7 +98,7 @@ namespace OpenSim.Region.Environment.Scenes
public delegate void OnPermissionErrorDelegate(UUID user, string reason); public delegate void OnPermissionErrorDelegate(UUID user, string reason);
public delegate void OnSetRootAgentSceneDelegate(UUID agentID); public delegate void OnSetRootAgentSceneDelegate(UUID agentID, Scene scene);
public event OnSetRootAgentSceneDelegate OnSetRootAgentScene; public event OnSetRootAgentSceneDelegate OnSetRootAgentScene;
@ -919,11 +919,11 @@ namespace OpenSim.Region.Environment.Scenes
handlerCollidingEnd(localId, colliders); handlerCollidingEnd(localId, colliders);
} }
public void TriggerSetRootAgentScene(UUID agentID) public void TriggerSetRootAgentScene(UUID agentID, Scene scene)
{ {
handlerSetRootAgentScene = OnSetRootAgentScene; handlerSetRootAgentScene = OnSetRootAgentScene;
if (handlerSetRootAgentScene != null) if (handlerSetRootAgentScene != null)
handlerSetRootAgentScene(agentID); handlerSetRootAgentScene(agentID, scene);
} }
} }
} }

View File

@ -4215,7 +4215,7 @@ namespace OpenSim.Region.Environment.Scenes
inv.SetRootAgentScene(agentID, this); inv.SetRootAgentScene(agentID, this);
EventManager.TriggerSetRootAgentScene(agentID); EventManager.TriggerSetRootAgentScene(agentID, this);
} }
public bool NeedSceneCacheClear(UUID agentID) public bool NeedSceneCacheClear(UUID agentID)