From 92a40129b5dfde0d8ef798941f5efb31ca3a73fd Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 28 Dec 2009 17:34:42 +0000 Subject: Database and presence changes. Untested --- OpenSim/Data/IPresenceData.cs | 2 +- .../Presence/LocalPresenceServiceConnector.cs | 6 +-- .../Presence/RemotePresenceServiceConnector.cs | 6 +-- .../Handlers/Presence/PresenceServerPostHandler.cs | 9 ++-- .../Presence/PresenceServiceConnector.cs | 4 +- OpenSim/Services/Interfaces/IPresenceService.cs | 10 ++--- .../Services/PresenceService/PresenceService.cs | 48 ++++++++++------------ .../PresenceService/PresenceServiceBase.cs | 2 +- 8 files changed, 41 insertions(+), 46 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Data/IPresenceData.cs b/OpenSim/Data/IPresenceData.cs index 1ccabcc..98353ed 100644 --- a/OpenSim/Data/IPresenceData.cs +++ b/OpenSim/Data/IPresenceData.cs @@ -35,7 +35,7 @@ namespace OpenSim.Data // This MUST be a ref type! public class PresenceData { - public UUID PrincipalID; + public string UserID; public UUID RegionID; public UUID SessionID; public Dictionary Data; diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/LocalPresenceServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/LocalPresenceServiceConnector.cs index 8aad7e0..a80a355 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/LocalPresenceServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/LocalPresenceServiceConnector.cs @@ -148,7 +148,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence #region IPresenceService - public bool LoginAgent(UUID principalID, UUID sessionID, UUID secureSessionID) + public bool LoginAgent(string userID, UUID sessionID, UUID secureSessionID) { m_log.Warn("[LOCAL PRESENCE CONNECTOR]: LoginAgent connector not implemented at the simulators"); return false; @@ -175,9 +175,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence return m_PresenceService.GetAgent(sessionID); } - public PresenceInfo[] GetAgents(string[] principalIDs) + public PresenceInfo[] GetAgents(string[] userIDs) { - return m_PresenceService.GetAgents(principalIDs); + return m_PresenceService.GetAgents(userIDs); } #endregion diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/RemotePresenceServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/RemotePresenceServiceConnector.cs index 6a674ce..e652773 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/RemotePresenceServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/RemotePresenceServiceConnector.cs @@ -121,7 +121,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence #region IPresenceService - public bool LoginAgent(UUID principalID, UUID sessionID, UUID secureSessionID) + public bool LoginAgent(string userID, UUID sessionID, UUID secureSessionID) { m_log.Warn("[REMOTE PRESENCE CONNECTOR]: LoginAgent connector not implemented at the simulators"); return false; @@ -148,9 +148,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence return m_RemoteConnector.GetAgent(sessionID); } - public PresenceInfo[] GetAgents(string[] principalIDs) + public PresenceInfo[] GetAgents(string[] userIDs) { - return m_RemoteConnector.GetAgents(principalIDs); + return m_RemoteConnector.GetAgents(userIDs); } #endregion diff --git a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs index b02c2ed..580cb15 100644 --- a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs @@ -104,15 +104,14 @@ namespace OpenSim.Server.Handlers.Presence byte[] LoginAgent(Dictionary request) { - UUID principal = UUID.Zero; + string user = String.Empty; UUID session = UUID.Zero; UUID ssession = UUID.Zero; - if (!request.ContainsKey("PrincipalID") || !request.ContainsKey("SessionID")) + if (!request.ContainsKey("UserID") || !request.ContainsKey("SessionID")) return FailureResult(); - if (!UUID.TryParse(request["PrincipalID"].ToString(), out principal)) - return FailureResult(); + user = request["UserID"].ToString(); if (!UUID.TryParse(request["SessionID"].ToString(), out session)) return FailureResult(); @@ -121,7 +120,7 @@ namespace OpenSim.Server.Handlers.Presence // If it's malformed, we go on with a Zero on it UUID.TryParse(request["SecureSessionID"].ToString(), out ssession); - if (m_PresenceService.LoginAgent(principal, session, ssession)) + if (m_PresenceService.LoginAgent(user, session, ssession)) return SuccessResult(); return FailureResult(); diff --git a/OpenSim/Services/Connectors/Presence/PresenceServiceConnector.cs b/OpenSim/Services/Connectors/Presence/PresenceServiceConnector.cs index 906d6bd..4ad457f 100644 --- a/OpenSim/Services/Connectors/Presence/PresenceServiceConnector.cs +++ b/OpenSim/Services/Connectors/Presence/PresenceServiceConnector.cs @@ -86,7 +86,7 @@ namespace OpenSim.Services.Connectors #region IPresenceService - public bool LoginAgent(UUID principalID, UUID sessionID, UUID secureSessionID) + public bool LoginAgent(string userID, UUID sessionID, UUID secureSessionID) { Dictionary sendData = new Dictionary(); //sendData["SCOPEID"] = scopeID.ToString(); @@ -94,7 +94,7 @@ namespace OpenSim.Services.Connectors sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString(); sendData["METHOD"] = "login"; - sendData["PrincipalID"] = principalID.ToString(); + sendData["UserID"] = userID; sendData["SessionID"] = sessionID.ToString(); sendData["SecureSessionID"] = secureSessionID.ToString(); diff --git a/OpenSim/Services/Interfaces/IPresenceService.cs b/OpenSim/Services/Interfaces/IPresenceService.cs index 56d8f15..de3813a 100644 --- a/OpenSim/Services/Interfaces/IPresenceService.cs +++ b/OpenSim/Services/Interfaces/IPresenceService.cs @@ -34,7 +34,7 @@ namespace OpenSim.Services.Interfaces { public class PresenceInfo { - public UUID PrincipalID; + public string UserID; public UUID RegionID; public bool Online; public DateTime Login; @@ -48,8 +48,8 @@ namespace OpenSim.Services.Interfaces public PresenceInfo(Dictionary kvp) { - if (kvp.ContainsKey("PrincipalID")) - UUID.TryParse(kvp["PrincipalID"].ToString(), out PrincipalID); + if (kvp.ContainsKey("UserID")) + UserID = kvp["UserID"].ToString(); if (kvp.ContainsKey("RegionID")) UUID.TryParse(kvp["RegionID"].ToString(), out RegionID); if (kvp.ContainsKey("login")) @@ -68,7 +68,7 @@ namespace OpenSim.Services.Interfaces public Dictionary ToKeyValuePairs() { Dictionary result = new Dictionary(); - result["PrincipalID"] = PrincipalID.ToString(); + result["UserID"] = UserID; result["RegionID"] = RegionID.ToString(); result["online"] = Online.ToString(); result["login"] = Login.ToString(); @@ -82,7 +82,7 @@ namespace OpenSim.Services.Interfaces public interface IPresenceService { - bool LoginAgent(UUID principalID, UUID sessionID, UUID secureSessionID); + bool LoginAgent(string userID, UUID sessionID, UUID secureSessionID); bool LogoutAgent(UUID sessionID); bool LogoutRegionAgents(UUID regionID); diff --git a/OpenSim/Services/PresenceService/PresenceService.cs b/OpenSim/Services/PresenceService/PresenceService.cs index 0529d3d..fe36bd0 100644 --- a/OpenSim/Services/PresenceService/PresenceService.cs +++ b/OpenSim/Services/PresenceService/PresenceService.cs @@ -50,7 +50,7 @@ namespace OpenSim.Services.PresenceService { } - public bool LoginAgent(UUID principalID, UUID sessionID, + public bool LoginAgent(string userID, UUID sessionID, UUID secureSessionID) { // We have just logged in. If there is any info in the table @@ -58,7 +58,7 @@ namespace OpenSim.Services.PresenceService // PresenceData data = new PresenceData(); - data.PrincipalID = principalID; + data.UserID = userID; data.RegionID = UUID.Zero; data.SessionID = sessionID; data.Data["SecureSessionID"] = secureSessionID.ToString(); @@ -105,7 +105,7 @@ namespace OpenSim.Services.PresenceService if (data == null) return null; - ret.PrincipalID = data.PrincipalID; + ret.UserID = data.UserID; ret.RegionID = data.RegionID; ret.Online = bool.Parse(data.Data["Online"]); ret.Login = Util.ToDateTime(Convert.ToInt32(data.Data["Login"])); @@ -116,34 +116,30 @@ namespace OpenSim.Services.PresenceService return ret; } - public PresenceInfo[] GetAgents(string[] principalIDs) + public PresenceInfo[] GetAgents(string[] userIDs) { List info = new List(); - foreach (string principalIDStr in principalIDs) + foreach (string userIDStr in userIDs) { - UUID principalID = UUID.Zero; - if (UUID.TryParse(principalIDStr, out principalID)) + PresenceData[] data = m_Database.Get("UserID", + userIDStr); + + foreach (PresenceData d in data) { - PresenceData[] data = m_Database.Get("PrincipalID", - principalID.ToString()); - - foreach (PresenceData d in data) - { - PresenceInfo ret = new PresenceInfo(); - - ret.PrincipalID = d.PrincipalID; - ret.RegionID = d.RegionID; - ret.Online = bool.Parse(d.Data["Online"]); - ret.Login = Util.ToDateTime(Convert.ToInt32( - d.Data["Login"])); - ret.Logout = Util.ToDateTime(Convert.ToInt32( - d.Data["Logout"])); - ret.Position = Vector3.Parse(d.Data["Position"]); - ret.LookAt = Vector3.Parse(d.Data["LookAt"]); - - info.Add(ret); - } + PresenceInfo ret = new PresenceInfo(); + + ret.UserID = d.UserID; + ret.RegionID = d.RegionID; + ret.Online = bool.Parse(d.Data["Online"]); + ret.Login = Util.ToDateTime(Convert.ToInt32( + d.Data["Login"])); + ret.Logout = Util.ToDateTime(Convert.ToInt32( + d.Data["Logout"])); + ret.Position = Vector3.Parse(d.Data["Position"]); + ret.LookAt = Vector3.Parse(d.Data["LookAt"]); + + info.Add(ret); } } diff --git a/OpenSim/Services/PresenceService/PresenceServiceBase.cs b/OpenSim/Services/PresenceService/PresenceServiceBase.cs index 60a246b..41e2d9c 100644 --- a/OpenSim/Services/PresenceService/PresenceServiceBase.cs +++ b/OpenSim/Services/PresenceService/PresenceServiceBase.cs @@ -44,7 +44,7 @@ namespace OpenSim.Services.PresenceService { string dllName = String.Empty; string connString = String.Empty; - string realm = "agents"; + string realm = "Presence"; // // Try reading the [DatabaseService] section, if it exists -- cgit v1.1