Removed redundant scene presence lookups in HGMessageTransferModule

remove-scene-viewer
Dan Lake 2011-10-05 12:58:24 -07:00
parent 38d205502a
commit 3142982353
1 changed files with 4 additions and 21 deletions

View File

@ -302,37 +302,20 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
return string.Empty; return string.Empty;
} }
/// <summary> /// <summary>
/// Find the scene for an agent /// Find the root client for a ID
/// </summary> /// </summary>
private Scene GetClientScene(UUID agentId) public IClientAPI LocateClientObject(UUID agentID)
{ {
lock (m_Scenes) lock (m_Scenes)
{ {
foreach (Scene scene in m_Scenes) foreach (Scene scene in m_Scenes)
{
ScenePresence presence = scene.GetScenePresence(agentId);
if (presence != null && !presence.IsChildAgent)
return scene;
}
}
return null;
}
/// <summary>
/// Find the client for a ID
/// </summary>
public IClientAPI LocateClientObject(UUID agentID)
{
Scene scene = GetClientScene(agentID);
if (scene != null)
{ {
ScenePresence presence = scene.GetScenePresence(agentID); ScenePresence presence = scene.GetScenePresence(agentID);
if (presence != null) if (presence != null && !presence.IsChildAgent)
return presence.ControllingClient; return presence.ControllingClient;
} }
}
return null; return null;
} }