From a58859a0d4206c194c9c56212218e2cafc2cc373 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 7 May 2010 21:29:56 -0700 Subject: GridUserService in place. Replaces the contrived concept of storing user's home and position info in the presence service. WARNING: I violated a taboo by deleting 2 migration files and simplifying the original table creation for Presence. This should not cause any problems to anyone, though. Things will work with the new simplified table, as well as with the previous contrived one. If there are any problems, solving them is as easy as dropping the presence table and deleting its row in the migrations table. The presence info only exists during a user's session anyway. BTW, the Meshing files want to be committed too -- EOFs. --- OpenSim/Services/Interfaces/IGridUserService.cs | 42 ++++++++++++++++++++++++- OpenSim/Services/Interfaces/IPresenceService.cs | 24 ++------------ 2 files changed, 43 insertions(+), 23 deletions(-) (limited to 'OpenSim/Services/Interfaces') diff --git a/OpenSim/Services/Interfaces/IGridUserService.cs b/OpenSim/Services/Interfaces/IGridUserService.cs index a7c2c6f..e629dff 100644 --- a/OpenSim/Services/Interfaces/IGridUserService.cs +++ b/OpenSim/Services/Interfaces/IGridUserService.cs @@ -37,39 +37,79 @@ namespace OpenSim.Services.Interfaces public class GridUserInfo { public string UserID; + public UUID HomeRegionID; public Vector3 HomePosition; public Vector3 HomeLookAt; + public UUID LastRegionID; + public Vector3 LastPosition; + public Vector3 LastLookAt; + + public bool Online; + public DateTime Login; + public DateTime Logout; + public GridUserInfo() {} public GridUserInfo(Dictionary kvp) { if (kvp.ContainsKey("UserID")) UserID = kvp["UserID"].ToString(); + if (kvp.ContainsKey("HomeRegionID")) UUID.TryParse(kvp["HomeRegionID"].ToString(), out HomeRegionID); if (kvp.ContainsKey("HomePosition")) Vector3.TryParse(kvp["HomePosition"].ToString(), out HomePosition); if (kvp.ContainsKey("HomeLookAt")) Vector3.TryParse(kvp["HomeLookAt"].ToString(), out HomeLookAt); + + if (kvp.ContainsKey("LastRegionID")) + UUID.TryParse(kvp["LastRegionID"].ToString(), out HomeRegionID); + if (kvp.ContainsKey("LastPosition")) + Vector3.TryParse(kvp["LastPosition"].ToString(), out LastPosition); + if (kvp.ContainsKey("LastLookAt")) + Vector3.TryParse(kvp["LastLookAt"].ToString(), out LastLookAt); + + if (kvp.ContainsKey("Login")) + DateTime.TryParse(kvp["Login"].ToString(), out Login); + if (kvp.ContainsKey("Logout")) + DateTime.TryParse(kvp["Logout"].ToString(), out Logout); + if (kvp.ContainsKey("Online")) + Boolean.TryParse(kvp["Online"].ToString(), out Online); + } public Dictionary ToKeyValuePairs() { Dictionary result = new Dictionary(); result["UserID"] = UserID; + result["HomeRegionID"] = HomeRegionID.ToString(); result["HomePosition"] = HomePosition.ToString(); result["HomeLookAt"] = HomeLookAt.ToString(); + result["LastRegionID"] = LastRegionID.ToString(); + result["LastPosition"] = LastPosition.ToString(); + result["LastLookAt"] = LastLookAt.ToString(); + + result["Online"] = Online.ToString(); + result["Login"] = Login.ToString(); + result["Logout"] = Logout.ToString(); + + return result; } } public interface IGridUserService { + GridUserInfo LoggedIn(string userID); + bool LoggedOut(string userID, UUID regionID, Vector3 lastPosition, Vector3 lastLookAt); + + bool SetHome(string userID, UUID homeID, Vector3 homePosition, Vector3 homeLookAt); + bool SetLastPosition(string userID, UUID regionID, Vector3 lastPosition, Vector3 lastLookAt); + GridUserInfo GetGridUserInfo(string userID); - bool StoreGridUserInfo(GridUserInfo info); } } \ No newline at end of file diff --git a/OpenSim/Services/Interfaces/IPresenceService.cs b/OpenSim/Services/Interfaces/IPresenceService.cs index b4c1859..9687d22 100644 --- a/OpenSim/Services/Interfaces/IPresenceService.cs +++ b/OpenSim/Services/Interfaces/IPresenceService.cs @@ -55,23 +55,10 @@ namespace OpenSim.Services.Interfaces UserID = kvp["UserID"].ToString(); if (kvp.ContainsKey("RegionID")) UUID.TryParse(kvp["RegionID"].ToString(), out RegionID); - if (kvp.ContainsKey("login")) - DateTime.TryParse(kvp["login"].ToString(), out Login); - if (kvp.ContainsKey("logout")) - DateTime.TryParse(kvp["logout"].ToString(), out Logout); if (kvp.ContainsKey("lookAt")) Vector3.TryParse(kvp["lookAt"].ToString(), out LookAt); - if (kvp.ContainsKey("online")) - Boolean.TryParse(kvp["online"].ToString(), out Online); if (kvp.ContainsKey("position")) Vector3.TryParse(kvp["position"].ToString(), out Position); - if (kvp.ContainsKey("HomeRegionID")) - UUID.TryParse(kvp["HomeRegionID"].ToString(), out HomeRegionID); - if (kvp.ContainsKey("HomePosition")) - Vector3.TryParse(kvp["HomePosition"].ToString(), out HomePosition); - if (kvp.ContainsKey("HomeLookAt")) - Vector3.TryParse(kvp["HomeLookAt"].ToString(), out HomeLookAt); - } public Dictionary ToKeyValuePairs() @@ -79,14 +66,8 @@ namespace OpenSim.Services.Interfaces Dictionary result = new Dictionary(); result["UserID"] = UserID; result["RegionID"] = RegionID.ToString(); - result["online"] = Online.ToString(); - result["login"] = Login.ToString(); - result["logout"] = Logout.ToString(); result["position"] = Position.ToString(); result["lookAt"] = LookAt.ToString(); - result["HomeRegionID"] = HomeRegionID.ToString(); - result["HomePosition"] = HomePosition.ToString(); - result["HomeLookAt"] = HomeLookAt.ToString(); return result; } @@ -115,11 +96,10 @@ namespace OpenSim.Services.Interfaces public interface IPresenceService { bool LoginAgent(string userID, UUID sessionID, UUID secureSessionID); - bool LogoutAgent(UUID sessionID, Vector3 position, Vector3 lookAt); + bool LogoutAgent(UUID sessionID); bool LogoutRegionAgents(UUID regionID); - bool ReportAgent(UUID sessionID, UUID regionID, Vector3 position, Vector3 lookAt); - bool SetHomeLocation(string userID, UUID regionID, Vector3 position, Vector3 lookAt); + bool ReportAgent(UUID sessionID, UUID regionID); PresenceInfo GetAgent(UUID sessionID); PresenceInfo[] GetAgents(string[] userIDs); -- cgit v1.1 From bfb7a4999010eb9449cd8855236daac67a469f11 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 7 May 2010 21:56:14 -0700 Subject: Fixed Presence unit test. Removed unnecessary packing/unpacking of obsolete fields. --- OpenSim/Services/Interfaces/IPresenceService.cs | 6 ------ 1 file changed, 6 deletions(-) (limited to 'OpenSim/Services/Interfaces') diff --git a/OpenSim/Services/Interfaces/IPresenceService.cs b/OpenSim/Services/Interfaces/IPresenceService.cs index 9687d22..abbae2c 100644 --- a/OpenSim/Services/Interfaces/IPresenceService.cs +++ b/OpenSim/Services/Interfaces/IPresenceService.cs @@ -55,10 +55,6 @@ namespace OpenSim.Services.Interfaces UserID = kvp["UserID"].ToString(); if (kvp.ContainsKey("RegionID")) UUID.TryParse(kvp["RegionID"].ToString(), out RegionID); - if (kvp.ContainsKey("lookAt")) - Vector3.TryParse(kvp["lookAt"].ToString(), out LookAt); - if (kvp.ContainsKey("position")) - Vector3.TryParse(kvp["position"].ToString(), out Position); } public Dictionary ToKeyValuePairs() @@ -66,8 +62,6 @@ namespace OpenSim.Services.Interfaces Dictionary result = new Dictionary(); result["UserID"] = UserID; result["RegionID"] = RegionID.ToString(); - result["position"] = Position.ToString(); - result["lookAt"] = LookAt.ToString(); return result; } -- cgit v1.1