Made IGridUserService.SetLastPosition() more flexible to allow different possible implementations. This doesn't change any behavior or any Robust code, but it simplifies the SimianGrid connector by using the standard OpenSim interface for setting last position now
parent
0339d420e7
commit
9b7c99f0cf
|
@ -69,9 +69,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser
|
||||||
|
|
||||||
public void OnMakeRootAgent(ScenePresence sp)
|
public void OnMakeRootAgent(ScenePresence sp)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[ACTIVITY DETECTOR]: Detected root presence {0} in {1}", sp.UUID, sp.Scene.RegionInfo.RegionName);
|
UUID sessionID = UUID.Zero;
|
||||||
|
|
||||||
m_GridUserService.SetLastPosition(sp.UUID.ToString(), sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat);
|
IClientAPI client;
|
||||||
|
if (m_aScene.TryGetClient(sp.UUID, out client))
|
||||||
|
sessionID = client.SessionId;
|
||||||
|
|
||||||
|
m_log.DebugFormat("[ACTIVITY DETECTOR]: Detected root presence {0} in {1}", sp.UUID, sp.Scene.RegionInfo.RegionName);
|
||||||
|
m_GridUserService.SetLastPosition(sp.UUID.ToString(), sessionID, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnNewClient(IClientAPI client)
|
public void OnNewClient(IClientAPI client)
|
||||||
|
|
|
@ -162,9 +162,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser
|
||||||
return m_GridUserService.SetHome(userID, homeID, homePosition, homeLookAt);
|
return m_GridUserService.SetHome(userID, homeID, homePosition, homeLookAt);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool SetLastPosition(string userID, UUID regionID, Vector3 lastPosition, Vector3 lastLookAt)
|
public bool SetLastPosition(string userID, UUID sessionID, UUID regionID, Vector3 lastPosition, Vector3 lastLookAt)
|
||||||
{
|
{
|
||||||
return m_GridUserService.SetLastPosition(userID, regionID, lastPosition, lastLookAt);
|
return m_GridUserService.SetLastPosition(userID, sessionID, regionID, lastPosition, lastLookAt);
|
||||||
}
|
}
|
||||||
|
|
||||||
public GridUserInfo GetGridUserInfo(string userID)
|
public GridUserInfo GetGridUserInfo(string userID)
|
||||||
|
|
|
@ -137,9 +137,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser
|
||||||
return m_RemoteConnector.SetHome(userID, regionID, position, lookAt);
|
return m_RemoteConnector.SetHome(userID, regionID, position, lookAt);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool SetLastPosition(string userID, UUID regionID, Vector3 position, Vector3 lookAt)
|
public bool SetLastPosition(string userID, UUID sessionID, UUID regionID, Vector3 position, Vector3 lookAt)
|
||||||
{
|
{
|
||||||
return m_RemoteConnector.SetLastPosition(userID, regionID, position, lookAt);
|
return m_RemoteConnector.SetLastPosition(userID, sessionID, regionID, position, lookAt);
|
||||||
}
|
}
|
||||||
|
|
||||||
public GridUserInfo GetGridUserInfo(string userID)
|
public GridUserInfo GetGridUserInfo(string userID)
|
||||||
|
|
|
@ -166,7 +166,7 @@ namespace OpenSim.Server.Handlers.GridUser
|
||||||
if (!UnpackArgs(request, out user, out region, out position, out look))
|
if (!UnpackArgs(request, out user, out region, out position, out look))
|
||||||
return FailureResult();
|
return FailureResult();
|
||||||
|
|
||||||
if (m_GridUserService.SetLastPosition(user, region, position, look))
|
if (m_GridUserService.SetLastPosition(user, UUID.Zero, region, position, look))
|
||||||
return SuccessResult();
|
return SuccessResult();
|
||||||
|
|
||||||
return FailureResult();
|
return FailureResult();
|
||||||
|
|
|
@ -123,7 +123,7 @@ namespace OpenSim.Services.Connectors
|
||||||
return Set(sendData, userID, regionID, position, lookAt);
|
return Set(sendData, userID, regionID, position, lookAt);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool SetLastPosition(string userID, UUID regionID, Vector3 position, Vector3 lookAt)
|
public bool SetLastPosition(string userID, UUID sessionID, UUID regionID, Vector3 position, Vector3 lookAt)
|
||||||
{
|
{
|
||||||
Dictionary<string, object> sendData = new Dictionary<string, object>();
|
Dictionary<string, object> sendData = new Dictionary<string, object>();
|
||||||
//sendData["SCOPEID"] = scopeID.ToString();
|
//sendData["SCOPEID"] = scopeID.ToString();
|
||||||
|
|
|
@ -29,6 +29,7 @@ using System;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
using OpenSim.Services.Interfaces;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using log4net;
|
using log4net;
|
||||||
|
|
||||||
|
@ -38,12 +39,12 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private SimianPresenceServiceConnector m_GridUserService;
|
private IGridUserService m_GridUserService;
|
||||||
private Scene m_aScene;
|
private Scene m_aScene;
|
||||||
|
|
||||||
public SimianActivityDetector(SimianPresenceServiceConnector guservice)
|
public SimianActivityDetector(IGridUserService guService)
|
||||||
{
|
{
|
||||||
m_GridUserService = guservice;
|
m_GridUserService = guService;
|
||||||
m_log.DebugFormat("[SIMIAN ACTIVITY DETECTOR]: Started");
|
m_log.DebugFormat("[SIMIAN ACTIVITY DETECTOR]: Started");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,7 +104,6 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
m_log.DebugFormat("[SIMIAN ACTIVITY DETECTOR]: Detected client logout {0} in {1}", client.AgentId, client.Scene.RegionInfo.RegionName);
|
m_log.DebugFormat("[SIMIAN ACTIVITY DETECTOR]: Detected client logout {0} in {1}", client.AgentId, client.Scene.RegionInfo.RegionName);
|
||||||
m_GridUserService.LoggedOut(client.AgentId.ToString(), client.Scene.RegionInfo.RegionID, position, lookat);
|
m_GridUserService.LoggedOut(client.AgentId.ToString(), client.Scene.RegionInfo.RegionID, position, lookat);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnEnteringNewParcel(ScenePresence sp, int localLandID, UUID regionID)
|
void OnEnteringNewParcel(ScenePresence sp, int localLandID, UUID regionID)
|
||||||
|
|
|
@ -304,12 +304,6 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
return UpdateSession(sessionID, regionID, lastPosition, lastLookAt);
|
return UpdateSession(sessionID, regionID, lastPosition, lastLookAt);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool SetLastPosition(string userID, UUID regionID, Vector3 lastPosition, Vector3 lastLookAt)
|
|
||||||
{
|
|
||||||
// Never called
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public GridUserInfo GetGridUserInfo(string user)
|
public GridUserInfo GetGridUserInfo(string user)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting session data for agent " + user);
|
m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting session data for agent " + user);
|
||||||
|
|
|
@ -108,7 +108,17 @@ namespace OpenSim.Services.Interfaces
|
||||||
bool LoggedOut(string userID, UUID regionID, Vector3 lastPosition, Vector3 lastLookAt);
|
bool LoggedOut(string userID, UUID regionID, Vector3 lastPosition, Vector3 lastLookAt);
|
||||||
|
|
||||||
bool SetHome(string userID, UUID homeID, Vector3 homePosition, Vector3 homeLookAt);
|
bool SetHome(string userID, UUID homeID, Vector3 homePosition, Vector3 homeLookAt);
|
||||||
bool SetLastPosition(string userID, UUID regionID, Vector3 lastPosition, Vector3 lastLookAt);
|
|
||||||
|
/// <summary>
|
||||||
|
/// Stores the last known user position at the grid level
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userID">Ignore if your connector does not use userID for position updates</param>
|
||||||
|
/// <param name="sessionID">Ignore if your connector does not use sessionID for position updates</param>
|
||||||
|
/// <param name="regionID">RegionID where the user is currently located</param>
|
||||||
|
/// <param name="lastPosition">Region-relative position</param>
|
||||||
|
/// <param name="lastLookAt">Normalized look direction</param>
|
||||||
|
/// <returns>True if the user's last position was successfully updated, otherwise false</returns>
|
||||||
|
bool SetLastPosition(string userID, UUID sessionID, UUID regionID, Vector3 lastPosition, Vector3 lastLookAt);
|
||||||
|
|
||||||
GridUserInfo GetGridUserInfo(string userID);
|
GridUserInfo GetGridUserInfo(string userID);
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,7 +139,7 @@ namespace OpenSim.Services.UserAccountService
|
||||||
return m_Database.Store(d);
|
return m_Database.Store(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool SetLastPosition(string userID, UUID regionID, Vector3 lastPosition, Vector3 lastLookAt)
|
public bool SetLastPosition(string userID, UUID sessionID, UUID regionID, Vector3 lastPosition, Vector3 lastLookAt)
|
||||||
{
|
{
|
||||||
//m_log.DebugFormat("[Grid User Service]: SetLastPosition for {0}", userID);
|
//m_log.DebugFormat("[Grid User Service]: SetLastPosition for {0}", userID);
|
||||||
GridUserData d = m_Database.Get(userID);
|
GridUserData d = m_Database.Get(userID);
|
||||||
|
|
Loading…
Reference in New Issue