Initial Online friends notification seems to be working reliably now. All this needs more testing, but everything is there.

This commit is contained in:
Diva Canto
2010-02-28 12:07:38 -08:00
parent db24e57cab
commit 5c5966545d
14 changed files with 97 additions and 39 deletions

View File

@@ -66,13 +66,16 @@ namespace OpenSim.Region.Framework.Scenes
public event OnClientConnectCoreDelegate OnClientConnect;
public delegate void OnNewClientDelegate(IClientAPI client);
/// <summary>
/// Deprecated in favour of OnClientConnect.
/// Will be marked Obsolete after IClientCore has 100% of IClientAPI interfaces.
/// </summary>
public event OnNewClientDelegate OnNewClient;
public delegate void OnClientLoginDelegate(IClientAPI client);
public event OnClientLoginDelegate OnClientLogin;
public delegate void OnNewPresenceDelegate(ScenePresence presence);
public event OnNewPresenceDelegate OnNewPresence;
@@ -583,6 +586,28 @@ namespace OpenSim.Region.Framework.Scenes
}
}
public void TriggerOnClientLogin(IClientAPI client)
{
OnClientLoginDelegate handlerClientLogin = OnClientLogin;
if (handlerClientLogin != null)
{
foreach (OnClientLoginDelegate d in handlerClientLogin.GetInvocationList())
{
try
{
d(client);
}
catch (Exception e)
{
m_log.ErrorFormat(
"[EVENT MANAGER]: Delegate for TriggerOnClientLogin failed - continuing. {0} {1}",
e.Message, e.StackTrace);
}
}
}
}
public void TriggerOnNewPresence(ScenePresence presence)
{
OnNewPresenceDelegate handlerNewPresence = OnNewPresence;

View File

@@ -2422,6 +2422,8 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="client"></param>
public override void AddNewClient(IClientAPI client)
{
bool vialogin = false;
m_clientManager.Add(client);
CheckHeartbeat();
@@ -2463,6 +2465,7 @@ namespace OpenSim.Region.Framework.Scenes
if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0)
{
m_log.DebugFormat("[Scene]: Incoming client {0} {1} in region {2} via Login", aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName);
vialogin = true;
IUserAgentVerificationModule userVerification = RequestModuleInterface<IUserAgentVerificationModule>();
if (userVerification != null)
{
@@ -2512,7 +2515,8 @@ namespace OpenSim.Region.Framework.Scenes
m_LastLogin = Util.EnvironmentTickCount();
EventManager.TriggerOnNewClient(client);
if (vialogin)
EventManager.TriggerOnClientLogin(client);
}

View File

@@ -1114,7 +1114,7 @@ namespace OpenSim.Region.Framework.Scenes
/// This is called upon a very important packet sent from the client,
/// so it's client-controlled. Never call this method directly.
/// </summary>
public void CompleteMovement()
public void CompleteMovement(IClientAPI client)
{
//m_log.Debug("[SCENE PRESENCE]: CompleteMovement");
@@ -1159,6 +1159,10 @@ namespace OpenSim.Region.Framework.Scenes
m_agentTransfer.EnableChildAgents(this);
else
m_log.DebugFormat("[SCENE PRESENCE]: Unable to create child agents in neighbours, because AgentTransferModule is not active");
IFriendsModule friendsModule = m_scene.RequestModuleInterface<IFriendsModule>();
if (friendsModule != null)
friendsModule.SendFriendsOnlineIfNeeded(ControllingClient);
}
}