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 /// 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). /// is connected).
/// </summary> /// </summary>
ISceneAgent SceneAgent { get; } ISceneAgent SceneAgent { get; set; }
UUID SessionId { get; } UUID SessionId { get; }

View File

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

View File

@ -261,6 +261,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
client.OnTerminateFriendship += (thisClient, agentID, exfriendID) => RemoveFriendship(thisClient, exfriendID); client.OnTerminateFriendship += (thisClient, agentID, exfriendID) => RemoveFriendship(thisClient, exfriendID);
client.OnGrantUserRights += OnGrantUserRights; 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 // Do not do this asynchronously. If we do, then subsequent code can outrace CacheFriends() and
// return misleading results from the still empty friends cache. // 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 // 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. /// Triggered when a new client is added to the scene.
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// This is triggered for both child and root agent client connections.
/// Triggered before OnClientLogin. /// Triggered before OnClientLogin.
/// </remarks> /// </remarks>
public event OnNewClientDelegate OnNewClient; public event OnNewClientDelegate OnNewClient;
@ -191,7 +192,7 @@ namespace OpenSim.Region.Framework.Scenes
public delegate void ClientClosed(UUID clientID, Scene scene); public delegate void ClientClosed(UUID clientID, Scene scene);
/// <summary> /// <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> /// </summary>
/// <remarks> /// <remarks>
/// At the point of firing, the scene still contains the client's scene presence. /// 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); 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(); m_LastLogin = Util.EnvironmentTickCount();
// Cache the user's name // Cache the user's name

View File

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

View File

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

View File

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