From 982e3ff5d927df498c1d14111e2c61f0251c09d4 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 27 Dec 2009 01:27:51 +0000 Subject: Presence Step 1 --- OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'OpenSim/Server/Handlers/Presence') diff --git a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs index 2558fa0..d41ee28 100644 --- a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs @@ -95,7 +95,6 @@ namespace OpenSim.Server.Handlers.Presence byte[] Report(Dictionary request) { PresenceInfo info = new PresenceInfo(); - info.Data = new Dictionary(); if (request["PrincipalID"] == null || request["RegionID"] == null) return FailureResult(); @@ -108,15 +107,6 @@ namespace OpenSim.Server.Handlers.Presence out info.RegionID)) return FailureResult(); - foreach (KeyValuePair kvp in request) - { - if (kvp.Key == "METHOD" || - kvp.Key == "PrincipalID" || - kvp.Key == "RegionID") - continue; - - info.Data[kvp.Key] = kvp.Value; - } if (m_PresenceService.Report(info)) return SuccessResult(); -- cgit v1.1 From 490c09363641c6f90b8c4fc574d47daee6074a63 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 27 Dec 2009 02:11:25 +0000 Subject: Just make it compile :) --- OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Server/Handlers/Presence') diff --git a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs index d41ee28..8a68169 100644 --- a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs @@ -108,8 +108,8 @@ namespace OpenSim.Server.Handlers.Presence return FailureResult(); - if (m_PresenceService.Report(info)) - return SuccessResult(); +// if (m_PresenceService.ReportAgent(info)) +// return SuccessResult(); return FailureResult(); } -- cgit v1.1 From 9cef5f92a1c3edf2ef475706931f1536f2c8524f Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 27 Dec 2009 03:31:53 +0000 Subject: Change the signature of the forms requester data in preparation to getting to where lists can be sent as requests --- OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim/Server/Handlers/Presence') diff --git a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs index 8a68169..d914d32 100644 --- a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs @@ -68,13 +68,13 @@ namespace OpenSim.Server.Handlers.Presence try { - Dictionary request = + Dictionary request = ServerUtils.ParseQueryString(body); if (!request.ContainsKey("METHOD")) return FailureResult(); - string method = request["METHOD"]; + string method = request["METHOD"].ToString(); switch (method) { @@ -92,11 +92,11 @@ namespace OpenSim.Server.Handlers.Presence } - byte[] Report(Dictionary request) + byte[] Report(Dictionary request) { PresenceInfo info = new PresenceInfo(); - if (request["PrincipalID"] == null || request["RegionID"] == null) + if (!request.ContainsKey("PrincipalID") || !request.ContainsKey("RegionID")) return FailureResult(); if (!UUID.TryParse(request["PrincipalID"].ToString(), -- cgit v1.1 From 3ef513e863097bdccffa8c84283ab8ffc0915a8f Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 27 Dec 2009 20:34:42 -0800 Subject: Presence remote connector and handler. Presence HG Broker. Nothing tested, just compiles. --- .../Handlers/Presence/PresenceServerPostHandler.cs | 152 +++++++++++++++++++-- 1 file changed, 144 insertions(+), 8 deletions(-) (limited to 'OpenSim/Server/Handlers/Presence') diff --git a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs index d914d32..b02c2ed 100644 --- a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs @@ -78,8 +78,18 @@ namespace OpenSim.Server.Handlers.Presence switch (method) { + case "login": + return LoginAgent(request); + case "logout": + return LogoutAgent(request); + case "logoutregion": + return LogoutRegionAgents(request); case "report": return Report(request); + case "getagent": + return GetAgent(request); + case "getagents": + return GetAgents(request); } m_log.DebugFormat("[PRESENCE HANDLER]: unknown method request: {0}", method); } @@ -92,28 +102,154 @@ namespace OpenSim.Server.Handlers.Presence } + byte[] LoginAgent(Dictionary request) + { + UUID principal = UUID.Zero; + UUID session = UUID.Zero; + UUID ssession = UUID.Zero; + + if (!request.ContainsKey("PrincipalID") || !request.ContainsKey("SessionID")) + return FailureResult(); + + if (!UUID.TryParse(request["PrincipalID"].ToString(), out principal)) + return FailureResult(); + + if (!UUID.TryParse(request["SessionID"].ToString(), out session)) + return FailureResult(); + + if (request.ContainsKey("SecureSessionID")) + // 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)) + return SuccessResult(); + + return FailureResult(); + } + + byte[] LogoutAgent(Dictionary request) + { + UUID session = UUID.Zero; + + if (!request.ContainsKey("SessionID")) + return FailureResult(); + + if (!UUID.TryParse(request["SessionID"].ToString(), out session)) + return FailureResult(); + + if (m_PresenceService.LogoutAgent(session)) + return SuccessResult(); + + return FailureResult(); + } + + byte[] LogoutRegionAgents(Dictionary request) + { + UUID region = UUID.Zero; + + if (!request.ContainsKey("RegionID")) + return FailureResult(); + + if (!UUID.TryParse(request["RegionID"].ToString(), out region)) + return FailureResult(); + + if (m_PresenceService.LogoutRegionAgents(region)) + return SuccessResult(); + + return FailureResult(); + } + byte[] Report(Dictionary request) { - PresenceInfo info = new PresenceInfo(); + UUID session = UUID.Zero; + UUID region = UUID.Zero; + Vector3 position = new Vector3(128, 128, 70); + Vector3 look = Vector3.Zero; - if (!request.ContainsKey("PrincipalID") || !request.ContainsKey("RegionID")) + if (!request.ContainsKey("SessionID") || !request.ContainsKey("RegionID")) return FailureResult(); - if (!UUID.TryParse(request["PrincipalID"].ToString(), - out info.PrincipalID)) + if (!UUID.TryParse(request["SessionID"].ToString(), out session)) return FailureResult(); - if (!UUID.TryParse(request["RegionID"].ToString(), - out info.RegionID)) + if (!UUID.TryParse(request["RegionID"].ToString(), out region)) return FailureResult(); + if (request.ContainsKey("position")) + Vector3.TryParse(request["position"].ToString(), out position); -// if (m_PresenceService.ReportAgent(info)) -// return SuccessResult(); + if (request.ContainsKey("lookAt")) + Vector3.TryParse(request["lookAt"].ToString(), out look); + + if (m_PresenceService.ReportAgent(session, region, position, look)) + return SuccessResult(); return FailureResult(); } + byte[] GetAgent(Dictionary request) + { + UUID session = UUID.Zero; + + if (!request.ContainsKey("SessionID")) + return FailureResult(); + + if (!UUID.TryParse(request["SessionID"].ToString(), out session)) + return FailureResult(); + + PresenceInfo pinfo = m_PresenceService.GetAgent(session); + + Dictionary result = new Dictionary(); + if (pinfo == null) + result["result"] = "null"; + else + result["result"] = pinfo.ToKeyValuePairs(); + + string xmlString = ServerUtils.BuildXmlResponse(result); + //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); + UTF8Encoding encoding = new UTF8Encoding(); + return encoding.GetBytes(xmlString); + } + + byte[] GetAgents(Dictionary request) + { + + string[] userIDs; + + if (!request.ContainsKey("uuids")) + return FailureResult(); + + if (!(request["uuids"] is List)) + { + m_log.DebugFormat("[PRESENCE HANDLER]: GetAgents input argument was of unexpected type {0}", request["uuids"].GetType().ToString()); + return FailureResult(); + } + + userIDs = ((List)request["uuids"]).ToArray(); + + PresenceInfo[] pinfos = m_PresenceService.GetAgents(userIDs); + + Dictionary result = new Dictionary(); + if ((pinfos == null) || ((pinfos != null) && (pinfos.Length == 0))) + result["result"] = "null"; + else + { + int i = 0; + foreach (PresenceInfo pinfo in pinfos) + { + Dictionary rinfoDict = pinfo.ToKeyValuePairs(); + result["presence" + i] = rinfoDict; + i++; + } + } + + string xmlString = ServerUtils.BuildXmlResponse(result); + //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); + UTF8Encoding encoding = new UTF8Encoding(); + return encoding.GetBytes(xmlString); + } + + private byte[] SuccessResult() { XmlDocument doc = new XmlDocument(); -- cgit v1.1 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/Server/Handlers/Presence/PresenceServerPostHandler.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'OpenSim/Server/Handlers/Presence') 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(); -- cgit v1.1 From e0fc854f05b137c353196356e5b26d11b6ee6867 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 28 Dec 2009 23:42:08 +0000 Subject: Adding new fields and home location methid to presence. Adding cleanup (deleting all but one presence record) on logout so that they don't pile up. --- .../Handlers/Presence/PresenceServerPostHandler.cs | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'OpenSim/Server/Handlers/Presence') diff --git a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs index 580cb15..bb00a00 100644 --- a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs @@ -90,6 +90,8 @@ namespace OpenSim.Server.Handlers.Presence return GetAgent(request); case "getagents": return GetAgents(request); + case "sethome": + return SetHome(request); } m_log.DebugFormat("[PRESENCE HANDLER]: unknown method request: {0}", method); } @@ -303,5 +305,32 @@ namespace OpenSim.Server.Handlers.Presence return ms.ToArray(); } + + byte[] SetHome(Dictionary request) + { + UUID region = UUID.Zero; + Vector3 position = new Vector3(128, 128, 70); + Vector3 look = Vector3.Zero; + + if (!request.ContainsKey("SessionID") || !request.ContainsKey("RegionID")) + return FailureResult(); + + string user = request["UserID"].ToString(); + + if (!UUID.TryParse(request["RegionID"].ToString(), out region)) + return FailureResult(); + + if (request.ContainsKey("position")) + Vector3.TryParse(request["position"].ToString(), out position); + + if (request.ContainsKey("lookAt")) + Vector3.TryParse(request["lookAt"].ToString(), out look); + + if (m_PresenceService.SetHomeLocation(user, region, position, look)) + return SuccessResult(); + + return FailureResult(); + } + } } -- cgit v1.1 From b4483df2701483aabd43fc7d03ebd74770d70170 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 29 Dec 2009 15:58:40 -0800 Subject: * All modules and connectors for user account service are in place. Untested. * Cleaned up a few things on presence connectors --- OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Server/Handlers/Presence') diff --git a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs index bb00a00..11adc4a 100644 --- a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs @@ -265,7 +265,7 @@ namespace OpenSim.Server.Handlers.Presence doc.AppendChild(rootElement); - XmlElement result = doc.CreateElement("", "Result", ""); + XmlElement result = doc.CreateElement("", "result", ""); result.AppendChild(doc.CreateTextNode("Success")); rootElement.AppendChild(result); @@ -287,7 +287,7 @@ namespace OpenSim.Server.Handlers.Presence doc.AppendChild(rootElement); - XmlElement result = doc.CreateElement("", "Result", ""); + XmlElement result = doc.CreateElement("", "result", ""); result.AppendChild(doc.CreateTextNode("Failure")); rootElement.AppendChild(result); -- cgit v1.1 From 08b507517b8dc33f66de1e0815af330bb3c54696 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 2 Jan 2010 18:18:13 -0800 Subject: Test client for remote presence connector, and for the service itself. Connector seems to work well. --- OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Server/Handlers/Presence') diff --git a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs index 11adc4a..6e47b22 100644 --- a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs @@ -312,7 +312,7 @@ namespace OpenSim.Server.Handlers.Presence Vector3 position = new Vector3(128, 128, 70); Vector3 look = Vector3.Zero; - if (!request.ContainsKey("SessionID") || !request.ContainsKey("RegionID")) + if (!request.ContainsKey("UserID") || !request.ContainsKey("RegionID")) return FailureResult(); string user = request["UserID"].ToString(); -- cgit v1.1 From 4dd523b45d1e635c66eb4e556764fabe29dbfc58 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 10 Jan 2010 15:34:56 -0800 Subject: * Changed IPresenceService Logout, so that it takes a position and a lookat * CommsManager.AvatarService rerouted --- OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'OpenSim/Server/Handlers/Presence') diff --git a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs index 6e47b22..926c195 100644 --- a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs @@ -131,6 +131,8 @@ namespace OpenSim.Server.Handlers.Presence byte[] LogoutAgent(Dictionary request) { UUID session = UUID.Zero; + Vector3 position = Vector3.Zero; + Vector3 lookat = Vector3.Zero; if (!request.ContainsKey("SessionID")) return FailureResult(); @@ -138,7 +140,12 @@ namespace OpenSim.Server.Handlers.Presence if (!UUID.TryParse(request["SessionID"].ToString(), out session)) return FailureResult(); - if (m_PresenceService.LogoutAgent(session)) + if (request.ContainsKey("Position") && request["Position"] != null) + Vector3.TryParse(request["Position"].ToString(), out position); + if (request.ContainsKey("LookAt") && request["Position"] != null) + Vector3.TryParse(request["LookAt"].ToString(), out lookat); + + if (m_PresenceService.LogoutAgent(session, position, lookat)) return SuccessResult(); return FailureResult(); -- cgit v1.1 From 7356860b487febd12c2e0de2f009a6df9ea0aeec Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 13 Jan 2010 09:17:30 -0800 Subject: Several more buglets removed. --- OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'OpenSim/Server/Handlers/Presence') diff --git a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs index 926c195..d180bbb 100644 --- a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs @@ -65,7 +65,7 @@ namespace OpenSim.Server.Handlers.Presence body = body.Trim(); //m_log.DebugFormat("[XXX]: query String: {0}", body); - + string method = string.Empty; try { Dictionary request = @@ -74,7 +74,7 @@ namespace OpenSim.Server.Handlers.Presence if (!request.ContainsKey("METHOD")) return FailureResult(); - string method = request["METHOD"].ToString(); + method = request["METHOD"].ToString(); switch (method) { @@ -97,7 +97,7 @@ namespace OpenSim.Server.Handlers.Presence } catch (Exception e) { - m_log.Debug("[PRESENCE HANDLER]: Exception {0}" + e); + m_log.DebugFormat("[PRESENCE HANDLER]: Exception in method {0}: {1}", method, e); } return FailureResult(); @@ -188,9 +188,11 @@ namespace OpenSim.Server.Handlers.Presence if (request.ContainsKey("lookAt")) Vector3.TryParse(request["lookAt"].ToString(), out look); - + if (m_PresenceService.ReportAgent(session, region, position, look)) + { return SuccessResult(); + } return FailureResult(); } -- cgit v1.1 From bbb43f9bdeda4994653c72fac62f9023d6dbdcdc Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 26 Feb 2010 10:35:23 -0800 Subject: Now showing friends online upon grid login. --- OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Server/Handlers/Presence') diff --git a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs index d180bbb..4ebf933 100644 --- a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs @@ -227,7 +227,10 @@ namespace OpenSim.Server.Handlers.Presence string[] userIDs; if (!request.ContainsKey("uuids")) + { + m_log.DebugFormat("[PRESENCE HANDLER]: GetAgents called without required uuids argument"); return FailureResult(); + } if (!(request["uuids"] is List)) { -- cgit v1.1