take friends out of onMakeRoot if crossing

LSLKeyTest
UbitUmarov 2016-07-26 22:30:51 +01:00
parent f19b3d28bd
commit 800044cead
2 changed files with 34 additions and 15 deletions

View File

@ -217,7 +217,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
scene.EventManager.OnNewClient += OnNewClient; scene.EventManager.OnNewClient += OnNewClient;
scene.EventManager.OnClientClosed += OnClientClosed; scene.EventManager.OnClientClosed += OnClientClosed;
scene.EventManager.OnMakeRootAgent += OnMakeRootAgent; // scene.EventManager.OnMakeRootAgent += OnMakeRootAgent;
scene.EventManager.OnClientLogin += OnClientLogin; scene.EventManager.OnClientLogin += OnClientLogin;
} }
@ -255,6 +255,23 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
return 0; return 0;
} }
private void OnMakeRootAgent(ScenePresence sp)
{
if(sp.gotCrossUpdate)
return;
RecacheFriends(sp.ControllingClient);
lock (m_NeedsToNotifyStatus)
{
if (m_NeedsToNotifyStatus.Remove(sp.UUID))
{
// Inform the friends that this user is online. This can only be done once the client is a Root Agent.
StatusChange(sp.UUID, true);
}
}
}
private void OnNewClient(IClientAPI client) private void OnNewClient(IClientAPI client)
{ {
client.OnInstantMessage += OnInstantMessage; client.OnInstantMessage += OnInstantMessage;
@ -327,20 +344,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
} }
} }
private void OnMakeRootAgent(ScenePresence sp)
{
RecacheFriends(sp.ControllingClient);
lock (m_NeedsToNotifyStatus)
{
if (m_NeedsToNotifyStatus.Remove(sp.UUID))
{
// Inform the friends that this user is online. This can only be done once the client is a Root Agent.
StatusChange(sp.UUID, true);
}
}
}
private void OnClientLogin(IClientAPI client) private void OnClientLogin(IClientAPI client)
{ {
UUID agentID = client.AgentId; UUID agentID = client.AgentId;
@ -359,6 +362,20 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
m_NeedsListOfOnlineFriends.Add(agentID); m_NeedsListOfOnlineFriends.Add(agentID);
} }
public void IsNpwRoot(ScenePresence sp)
{
RecacheFriends(sp.ControllingClient);
lock (m_NeedsToNotifyStatus)
{
if (m_NeedsToNotifyStatus.Remove(sp.UUID))
{
// Inform the friends that this user is online. This can only be done once the client is a Root Agent.
StatusChange(sp.UUID, true);
}
}
}
public virtual bool SendFriendsOnlineIfNeeded(IClientAPI client) public virtual bool SendFriendsOnlineIfNeeded(IClientAPI client)
{ {
UUID agentID = client.AgentId; UUID agentID = client.AgentId;

View File

@ -28,6 +28,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using OpenMetaverse; using OpenMetaverse;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Region.Framework.Scenes;
using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; using FriendInfo = OpenSim.Services.Interfaces.FriendInfo;
namespace OpenSim.Region.Framework.Interfaces namespace OpenSim.Region.Framework.Interfaces
@ -93,6 +94,7 @@ namespace OpenSim.Region.Framework.Interfaces
/// <param name="perms">These come from the FriendRights enum.</param> /// <param name="perms">These come from the FriendRights enum.</param>
void GrantRights(IClientAPI remoteClient, UUID friendID, int perms); void GrantRights(IClientAPI remoteClient, UUID friendID, int perms);
void IsNpwRoot(ScenePresence sp);
bool SendFriendsOnlineIfNeeded(IClientAPI client); bool SendFriendsOnlineIfNeeded(IClientAPI client);
} }
} }