mirror of
https://github.com/opensim/opensim.git
synced 2026-08-12 20:55:43 +08:00
Merge commit '3c77b8f463a852aecf3cb29fe4e5f4614f474dbf' into careminster
This commit is contained in:
@@ -106,7 +106,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
return m_ExportedAppearances;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#region ISharedRegionModule
|
||||
|
||||
@@ -149,9 +148,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
base.AddRegion(scene);
|
||||
|
||||
if (m_Enabled)
|
||||
{
|
||||
scene.RegisterModuleInterface<IUserAgentVerificationModule>(this);
|
||||
|
||||
scene.EventManager.OnIncomingSceneObject += OnIncomingSceneObject;
|
||||
scene.EventManager.OnIncomingSceneObject += OnIncomingSceneObject;
|
||||
}
|
||||
}
|
||||
|
||||
void OnIncomingSceneObject(SceneObjectGroup so)
|
||||
@@ -245,6 +245,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
{
|
||||
// Log them out of this grid
|
||||
Scene.PresenceService.LogoutAgent(sp.ControllingClient.SessionId);
|
||||
string userId = Scene.UserManagementModule.GetUserUUI(sp.UUID);
|
||||
Scene.GridUserService.LoggedOut(userId, UUID.Zero, Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -137,6 +137,9 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
|
||||
ud.FirstName = words[0];
|
||||
ud.LastName = "@" + words[1];
|
||||
users.Add(ud);
|
||||
// WARNING! that uriStr is not quite right... it may be missing the / at the end,
|
||||
// which will cause trouble (duplicate entries on some tables). We should
|
||||
// get the UUI instead from the UAS. TO BE FIXED.
|
||||
AddUser(userID, names[0], names[1], uriStr);
|
||||
m_log.DebugFormat("[USER MANAGEMENT MODULE]: User {0}@{1} found", words[0], words[1]);
|
||||
}
|
||||
|
||||
@@ -429,8 +429,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
|
||||
|
||||
public void AddUser(UUID uuid, string first, string last, string homeURL)
|
||||
{
|
||||
// m_log.DebugFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, first {1}, last {2}, url {3}", uuid, first, last, homeURL);
|
||||
|
||||
//m_log.DebugFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, first {1}, last {2}, url {3}", uuid, first, last, homeURL);
|
||||
AddUser(uuid, homeURL + ";" + first + " " + last);
|
||||
}
|
||||
|
||||
@@ -553,8 +552,8 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
|
||||
MainConsole.Instance.Output("-----------------------------------------------------------------------------");
|
||||
foreach (KeyValuePair<UUID, UserData> kvp in m_UserCache)
|
||||
{
|
||||
MainConsole.Instance.Output(String.Format("{0} {1} {2}",
|
||||
kvp.Key, kvp.Value.FirstName, kvp.Value.LastName));
|
||||
MainConsole.Instance.Output(String.Format("{0} {1} {2} ({3})",
|
||||
kvp.Key, kvp.Value.FirstName, kvp.Value.LastName, kvp.Value.HomeURL));
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
@@ -65,11 +65,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser
|
||||
|
||||
public void OnMakeRootAgent(ScenePresence sp)
|
||||
{
|
||||
// m_log.DebugFormat("[ACTIVITY DETECTOR]: Detected root presence {0} in {1}", sp.UUID, sp.Scene.RegionInfo.RegionName);
|
||||
|
||||
if (sp.PresenceType != PresenceType.Npc)
|
||||
{
|
||||
string userid = sp.Scene.UserManagementModule.GetUserUUI(sp.UUID);
|
||||
//m_log.DebugFormat("[ACTIVITY DETECTOR]: Detected root presence {0} in {1}", userid, sp.Scene.RegionInfo.RegionName);
|
||||
m_GridUserService.SetLastPosition(
|
||||
sp.UUID.ToString(), UUID.Zero, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat);
|
||||
userid, UUID.Zero, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnNewClient(IClientAPI client)
|
||||
@@ -82,9 +84,16 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser
|
||||
if (client.SceneAgent.IsChildAgent)
|
||||
return;
|
||||
|
||||
// m_log.DebugFormat("[ACTIVITY DETECTOR]: Detected client logout {0} in {1}", client.AgentId, client.Scene.RegionInfo.RegionName);
|
||||
string userId = client.AgentId.ToString();
|
||||
if (client.Scene is Scene)
|
||||
{
|
||||
Scene s = (Scene)client.Scene;
|
||||
userId = s.UserManagementModule.GetUserUUI(client.AgentId);
|
||||
}
|
||||
//m_log.DebugFormat("[ACTIVITY DETECTOR]: Detected client logout {0} in {1}", userId, client.Scene.RegionInfo.RegionName);
|
||||
|
||||
m_GridUserService.LoggedOut(
|
||||
client.AgentId.ToString(), client.SessionId, client.Scene.RegionInfo.RegionID,
|
||||
userId, client.SessionId, client.Scene.RegionInfo.RegionID,
|
||||
client.SceneAgent.AbsolutePosition, client.SceneAgent.Lookat);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,6 +44,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private const int KEEPTIME = 30; // 30 secs
|
||||
private ExpiringCache<string, GridUserInfo> m_Infos = new ExpiringCache<string, GridUserInfo>();
|
||||
|
||||
#region ISharedRegionModule
|
||||
|
||||
private bool m_Enabled = false;
|
||||
@@ -128,23 +131,60 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser
|
||||
|
||||
public bool LoggedOut(string userID, UUID sessionID, UUID region, Vector3 position, Vector3 lookat)
|
||||
{
|
||||
if (m_Infos.Contains(userID))
|
||||
m_Infos.Remove(userID);
|
||||
|
||||
return m_RemoteConnector.LoggedOut(userID, sessionID, region, position, lookat);
|
||||
}
|
||||
|
||||
|
||||
public bool SetHome(string userID, UUID regionID, Vector3 position, Vector3 lookAt)
|
||||
{
|
||||
return m_RemoteConnector.SetHome(userID, regionID, position, lookAt);
|
||||
if (m_RemoteConnector.SetHome(userID, regionID, position, lookAt))
|
||||
{
|
||||
// Update the cache too
|
||||
GridUserInfo info = null;
|
||||
if (m_Infos.TryGetValue(userID, out info))
|
||||
{
|
||||
info.HomeRegionID = regionID;
|
||||
info.HomePosition = position;
|
||||
info.HomeLookAt = lookAt;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool SetLastPosition(string userID, UUID sessionID, UUID regionID, Vector3 position, Vector3 lookAt)
|
||||
{
|
||||
return m_RemoteConnector.SetLastPosition(userID, sessionID, regionID, position, lookAt);
|
||||
if (m_RemoteConnector.SetLastPosition(userID, sessionID, regionID, position, lookAt))
|
||||
{
|
||||
// Update the cache too
|
||||
GridUserInfo info = null;
|
||||
if (m_Infos.TryGetValue(userID, out info))
|
||||
{
|
||||
info.LastRegionID = regionID;
|
||||
info.LastPosition = position;
|
||||
info.LastLookAt = lookAt;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public GridUserInfo GetGridUserInfo(string userID)
|
||||
{
|
||||
return m_RemoteConnector.GetGridUserInfo(userID);
|
||||
GridUserInfo info = null;
|
||||
if (m_Infos.TryGetValue(userID, out info))
|
||||
return info;
|
||||
|
||||
info = m_RemoteConnector.GetGridUserInfo(userID);
|
||||
|
||||
m_Infos.AddOrUpdate(userID, info, KEEPTIME);
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
public GridUserInfo[] GetGridUserInfo(string[] userID)
|
||||
|
||||
Reference in New Issue
Block a user