Merge branch 'master' into careminster-presence-refactor

avinationmerge
Melanie 2010-09-30 16:01:45 +01:00
commit 521e2c8355
14 changed files with 72 additions and 46 deletions

View File

@ -426,6 +426,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
if (part == null || part.ParentGroup == null) if (part == null || part.ParentGroup == null)
return; return;
if (part.ParentGroup.RootPart.AttachedAvatar != remoteClient.AgentId)
return;
UUID inventoryID = part.ParentGroup.GetFromItemID(); UUID inventoryID = part.ParentGroup.GetFromItemID();
ScenePresence presence; ScenePresence presence;

View File

@ -42,7 +42,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private IGridUserService m_GridUserService; private IGridUserService m_GridUserService;
private Scene m_aScene;
public ActivityDetector(IGridUserService guservice) public ActivityDetector(IGridUserService guservice)
{ {
@ -56,9 +55,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser
// But we could trigger the position update more often // But we could trigger the position update more often
scene.EventManager.OnMakeRootAgent += OnMakeRootAgent; scene.EventManager.OnMakeRootAgent += OnMakeRootAgent;
scene.EventManager.OnNewClient += OnNewClient; scene.EventManager.OnNewClient += OnNewClient;
if (m_aScene == null)
m_aScene = scene;
} }
public void RemoveRegion(Scene scene) public void RemoveRegion(Scene scene)
@ -70,8 +66,7 @@ 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); m_log.DebugFormat("[ACTIVITY DETECTOR]: Detected root presence {0} in {1}", sp.UUID, sp.Scene.RegionInfo.RegionName);
m_GridUserService.SetLastPosition(sp.UUID.ToString(), UUID.Zero, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat);
m_GridUserService.SetLastPosition(sp.UUID.ToString(), sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat);
} }
public void OnNewClient(IClientAPI client) public void OnNewClient(IClientAPI client)
@ -99,7 +94,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser
} }
} }
m_log.DebugFormat("[ACTIVITY DETECTOR]: Detected client logout {0} in {1}", client.AgentId, client.Scene.RegionInfo.RegionName); m_log.DebugFormat("[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.SessionId, client.Scene.RegionInfo.RegionID, position, lookat);
} }
} }

View File

@ -152,9 +152,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser
return m_GridUserService.LoggedIn(userID); return m_GridUserService.LoggedIn(userID);
} }
public bool LoggedOut(string userID, UUID regionID, Vector3 lastPosition, Vector3 lastLookAt) public bool LoggedOut(string userID, UUID sessionID, UUID regionID, Vector3 lastPosition, Vector3 lastLookAt)
{ {
return m_GridUserService.LoggedOut(userID, regionID, lastPosition, lastLookAt); return m_GridUserService.LoggedOut(userID, sessionID, regionID, lastPosition, lastLookAt);
} }
public bool SetHome(string userID, UUID homeID, Vector3 homePosition, Vector3 homeLookAt) public bool SetHome(string userID, UUID homeID, Vector3 homePosition, Vector3 homeLookAt)
@ -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)

View File

@ -126,9 +126,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser
return null; return null;
} }
public bool LoggedOut(string userID, UUID region, Vector3 position, Vector3 lookat) public bool LoggedOut(string userID, UUID sessionID, UUID region, Vector3 position, Vector3 lookat)
{ {
return m_RemoteConnector.LoggedOut(userID, region, position, lookat); return m_RemoteConnector.LoggedOut(userID, sessionID, region, position, lookat);
} }
@ -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)

View File

@ -104,7 +104,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
part.GetProperties(client); part.GetProperties(client);
} }
public bool BuyObject(IClientAPI remoteClient, UUID categoryID, uint localID, byte saleType) public bool BuyObject(IClientAPI remoteClient, UUID categoryID, uint localID, byte saleType, int salePrice)
{ {
SceneObjectPart part = m_scene.GetSceneObjectPart(localID); SceneObjectPart part = m_scene.GetSceneObjectPart(localID);
@ -114,6 +114,18 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
if (part.ParentGroup == null) if (part.ParentGroup == null)
return false; return false;
if (part.ObjectSaleType != saleType)
{
m_dialogModule.SendAlertToUser(remoteClient, "This item is not available for the type of sale specified");
return false;
}
if (part.SalePrice != salePrice)
{
m_dialogModule.SendAlertToUser(remoteClient, "This item is not available for the price specified");
return false;
}
SceneObjectGroup group = part.ParentGroup; SceneObjectGroup group = part.ParentGroup;
switch (saleType) switch (saleType)

View File

@ -42,6 +42,6 @@ namespace OpenSim.Region.Framework.Interfaces
/// <returns> /// <returns>
/// True on a successful purchase, false on failure /// True on a successful purchase, false on failure
/// </returns> /// </returns>
bool BuyObject(IClientAPI remoteClient, UUID categoryID, uint localID, byte saleType); bool BuyObject(IClientAPI remoteClient, UUID categoryID, uint localID, byte saleType, int salePrice);
} }
} }

View File

@ -814,7 +814,7 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule
IBuySellModule module = s.RequestModuleInterface<IBuySellModule>(); IBuySellModule module = s.RequestModuleInterface<IBuySellModule>();
if (module != null) if (module != null)
module.BuyObject(remoteClient, categoryID, localID, saleType); module.BuyObject(remoteClient, categoryID, localID, saleType, salePrice);
} }
} }

View File

@ -131,7 +131,7 @@ namespace OpenSim.Server.Handlers.GridUser
if (!UnpackArgs(request, out userID, out regionID, out position, out lookat)) if (!UnpackArgs(request, out userID, out regionID, out position, out lookat))
return FailureResult(); return FailureResult();
if (m_GridUserService.LoggedOut(userID, regionID, position, lookat)) if (m_GridUserService.LoggedOut(userID, UUID.Zero, regionID, position, lookat))
return SuccessResult(); return SuccessResult();
return FailureResult(); return FailureResult();
@ -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();

View File

@ -101,7 +101,7 @@ namespace OpenSim.Services.Connectors
} }
public bool LoggedOut(string userID, UUID region, Vector3 position, Vector3 lookat) public bool LoggedOut(string userID, UUID sessionID, UUID region, 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();
@ -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();

View File

@ -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,11 @@ 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;
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");
} }
@ -54,9 +54,6 @@ namespace OpenSim.Services.Connectors.SimianGrid
scene.EventManager.OnMakeRootAgent += OnMakeRootAgent; scene.EventManager.OnMakeRootAgent += OnMakeRootAgent;
scene.EventManager.OnNewClient += OnNewClient; scene.EventManager.OnNewClient += OnNewClient;
scene.EventManager.OnAvatarEnteringNewParcel += OnEnteringNewParcel; scene.EventManager.OnAvatarEnteringNewParcel += OnEnteringNewParcel;
if (m_aScene == null)
m_aScene = scene;
} }
public void RemoveRegion(Scene scene) public void RemoveRegion(Scene scene)
@ -101,9 +98,8 @@ 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.SessionId, client.Scene.RegionInfo.RegionID, position, lookat);
} }
} }
void OnEnteringNewParcel(ScenePresence sp, int localLandID, UUID regionID) void OnEnteringNewParcel(ScenePresence sp, int localLandID, UUID regionID)

View File

@ -260,8 +260,14 @@ namespace OpenSim.Services.Connectors.SimianGrid
return null; return null;
} }
public bool LoggedOut(string userID, UUID regionID, Vector3 lastPosition, Vector3 lastLookAt) public bool LoggedOut(string userID, UUID sessionID, UUID regionID, Vector3 lastPosition, Vector3 lastLookAt)
{ {
m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Logging out user " + userID);
// Remove the session to mark this user offline
if (!LogoutAgent(sessionID))
return false;
// Save our last position as user data // Save our last position as user data
NameValueCollection requestArgs = new NameValueCollection NameValueCollection requestArgs = new NameValueCollection
{ {
@ -304,12 +310,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);

View File

@ -232,7 +232,7 @@ namespace OpenSim.Services.HypergridService
GridUserInfo guinfo = m_GridUserService.GetGridUserInfo(userID.ToString()); GridUserInfo guinfo = m_GridUserService.GetGridUserInfo(userID.ToString());
if (guinfo != null) if (guinfo != null)
m_GridUserService.LoggedOut(userID.ToString(), guinfo.LastRegionID, guinfo.LastPosition, guinfo.LastLookAt); m_GridUserService.LoggedOut(userID.ToString(), sessionID, guinfo.LastRegionID, guinfo.LastPosition, guinfo.LastLookAt);
} }
// We need to prevent foreign users with the same UUID as a local user // We need to prevent foreign users with the same UUID as a local user

View File

@ -105,10 +105,30 @@ namespace OpenSim.Services.Interfaces
public interface IGridUserService public interface IGridUserService
{ {
GridUserInfo LoggedIn(string userID); GridUserInfo LoggedIn(string userID);
bool LoggedOut(string userID, UUID regionID, Vector3 lastPosition, Vector3 lastLookAt);
/// <summary>
/// Informs the grid that a user is logged out and to remove any session data for them
/// </summary>
/// <param name="userID">Ignore if your connector does not use userID for logouts</param>
/// <param name="sessionID">Ignore if your connector does not use sessionID for logouts</param>
/// <param name="regionID">RegionID where the user was last located</param>
/// <param name="lastPosition">Last region-relative position of the user</param>
/// <param name="lastLookAt">Last normalized look direction for the user</param>
/// <returns>True if the logout request was successfully processed, otherwise false</returns>
bool LoggedOut(string userID, UUID sessionID, 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);
} }

View File

@ -92,7 +92,7 @@ namespace OpenSim.Services.UserAccountService
return GetGridUserInfo(userID); return GetGridUserInfo(userID);
} }
public bool LoggedOut(string userID, UUID regionID, Vector3 lastPosition, Vector3 lastLookAt) public bool LoggedOut(string userID, UUID sessionID, UUID regionID, Vector3 lastPosition, Vector3 lastLookAt)
{ {
m_log.DebugFormat("[GRID USER SERVICE]: User {0} is offline", userID); m_log.DebugFormat("[GRID USER SERVICE]: User {0} is offline", userID);
GridUserData d = m_Database.Get(userID); GridUserData d = m_Database.Get(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);