Add back parts of reverted changes that were not concerned with child agent caching.

This adds ScenePresence to IClientAPI.SceneAgent earlier on in the add client process so that its information is available to EventManager.OnNewClient() and OnClientLogin()
Also add a code comment as to why we're caching friend information for child agents.
0.7.3-extended
Justin Clark-Casey (justincc) 2012-03-29 01:26:30 +01:00
parent a06c8fb7b2
commit 81fb0b4f07
8 changed files with 16 additions and 8 deletions

View File

@ -710,7 +710,7 @@ namespace OpenSim.Framework
/// The scene agent for this client. This will only be set if the client has an agent in a scene (i.e. if it
/// is connected).
/// </summary>
ISceneAgent SceneAgent { get; }
ISceneAgent SceneAgent { get; set; }
UUID SessionId { get; }

View File

@ -385,7 +385,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
set { m_startpos = value; }
}
public UUID AgentId { get { return m_agentId; } }
public ISceneAgent SceneAgent { get; private set; }
public ISceneAgent SceneAgent { get; set; }
public UUID ActiveGroupId { get { return m_activeGroupID; } }
public string ActiveGroupName { get { return m_activeGroupName; } }
public ulong ActiveGroupPowers { get { return m_activeGroupPowers; } }
@ -698,7 +698,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public virtual void Start()
{
SceneAgent = m_scene.AddNewClient(this, PresenceType.User);
m_scene.AddNewClient(this, PresenceType.User);
RefreshGroupMembership();
}

View File

@ -261,6 +261,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
client.OnTerminateFriendship += (thisClient, agentID, exfriendID) => RemoveFriendship(thisClient, exfriendID);
client.OnGrantUserRights += OnGrantUserRights;
// We need to cache information for child agents as well as root agents so that friend edit/move/delete
// permissions will work across borders where both regions are on different simulators.
//
// Do not do this asynchronously. If we do, then subsequent code can outrace CacheFriends() and
// return misleading results from the still empty friends cache.
// If we absolutely need to do this asynchronously, then a signalling mechanism is needed so that calls

View File

@ -71,6 +71,7 @@ namespace OpenSim.Region.Framework.Scenes
/// Triggered when a new client is added to the scene.
/// </summary>
/// <remarks>
/// This is triggered for both child and root agent client connections.
/// Triggered before OnClientLogin.
/// </remarks>
public event OnNewClientDelegate OnNewClient;
@ -191,7 +192,7 @@ namespace OpenSim.Region.Framework.Scenes
public delegate void ClientClosed(UUID clientID, Scene scene);
/// <summary>
/// Fired when a client is removed from a scene.
/// Fired when a client is removed from a scene whether it's a child or a root agent.
/// </summary>
/// <remarks>
/// At the point of firing, the scene still contains the client's scene presence.

View File

@ -2675,6 +2675,10 @@ namespace OpenSim.Region.Framework.Scenes
sp.IsChildAgent ? "child" : "root", sp.Name, RegionInfo.RegionName);
}
// We must set this here so that TriggerOnNewClient and TriggerOnClientLogin can determine whether the
// client is for a root or child agent.
client.SceneAgent = sp;
m_LastLogin = Util.EnvironmentTickCount();
// Cache the user's name

View File

@ -55,7 +55,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
private UUID m_agentID = UUID.Random();
public ISceneAgent SceneAgent { get; private set; }
public ISceneAgent SceneAgent { get; set; }
private string m_username;
private string m_nick;
@ -895,7 +895,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
public void Start()
{
SceneAgent = m_scene.AddNewClient(this, PresenceType.User);
m_scene.AddNewClient(this, PresenceType.User);
// Mimicking LLClientView which gets always set appearance from client.
AvatarAppearance appearance;

View File

@ -69,7 +69,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
get { return m_ownerID; }
}
public ISceneAgent SceneAgent { get { throw new NotImplementedException(); } }
public ISceneAgent SceneAgent { get; set; }
public void Say(string message)
{

View File

@ -327,7 +327,7 @@ namespace OpenSim.Tests.Common.Mock
/// </value>
private UUID m_agentId;
public ISceneAgent SceneAgent { get { throw new NotImplementedException(); } }
public ISceneAgent SceneAgent { get; set; }
/// <value>
/// The last caps seed url that this client was given.