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/Services/PresenceService/PresenceService.cs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'OpenSim/Services/PresenceService/PresenceService.cs') diff --git a/OpenSim/Services/PresenceService/PresenceService.cs b/OpenSim/Services/PresenceService/PresenceService.cs index 2157462..04bcee6 100644 --- a/OpenSim/Services/PresenceService/PresenceService.cs +++ b/OpenSim/Services/PresenceService/PresenceService.cs @@ -55,11 +55,8 @@ namespace OpenSim.Services.PresenceService PresenceData p = new PresenceData(); p.Data = new Dictionary(); - p.UUID = presence.PrincipalID; - p.currentRegion = presence.RegionID; - - foreach (KeyValuePair kvp in presence.Data) - p.Data[kvp.Key] = kvp.Value; + p.PrincipalID = presence.PrincipalID; + p.RegionID = presence.RegionID; return false; } -- 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 :) --- .../Services/PresenceService/PresenceService.cs | 31 ++++++++++++++++++---- 1 file changed, 26 insertions(+), 5 deletions(-) (limited to 'OpenSim/Services/PresenceService/PresenceService.cs') diff --git a/OpenSim/Services/PresenceService/PresenceService.cs b/OpenSim/Services/PresenceService/PresenceService.cs index 04bcee6..9f0e4da 100644 --- a/OpenSim/Services/PresenceService/PresenceService.cs +++ b/OpenSim/Services/PresenceService/PresenceService.cs @@ -50,15 +50,36 @@ namespace OpenSim.Services.PresenceService { } - public bool Report(PresenceInfo presence) + public bool LoginAgent(UUID principalID, UUID sessionID, + UUID secureSessionID) { - PresenceData p = new PresenceData(); - p.Data = new Dictionary(); + return false; + } - p.PrincipalID = presence.PrincipalID; - p.RegionID = presence.RegionID; + public bool LogoutAgent(UUID sessionID) + { + return false; + } + public bool LogoutRegionAgents(UUID regionID) + { return false; } + + + public bool ReportAgent(UUID sessionID, UUID regionID, Vector3 position, Vector3 lookAt) + { + return false; + } + + public PresenceInfo GetAgent(UUID sessionID) + { + return null; + } + + public PresenceInfo[] GetAgents(UUID[] PrincipalIDs) + { + return null; + } } } -- cgit v1.1 From 8b9332e321d14815dbac8fcdc145480cddaf412c Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 27 Dec 2009 03:00:54 +0000 Subject: Finish the presence service --- .../Services/PresenceService/PresenceService.cs | 78 ++++++++++++++++++++-- 1 file changed, 73 insertions(+), 5 deletions(-) (limited to 'OpenSim/Services/PresenceService/PresenceService.cs') diff --git a/OpenSim/Services/PresenceService/PresenceService.cs b/OpenSim/Services/PresenceService/PresenceService.cs index 9f0e4da..56ec504 100644 --- a/OpenSim/Services/PresenceService/PresenceService.cs +++ b/OpenSim/Services/PresenceService/PresenceService.cs @@ -53,33 +53,101 @@ namespace OpenSim.Services.PresenceService public bool LoginAgent(UUID principalID, UUID sessionID, UUID secureSessionID) { - return false; + // We have just logged in. If there is any info in the table + // it's OK to overwrite. So we won't bother reading it first + // + PresenceData data = new PresenceData(); + + data.PrincipalID = principalID; + data.RegionID = UUID.Zero; + data.SessionID = sessionID; + data.Data["SecureSessionID"] = secureSessionID.ToString(); + data.Data["Login"] = Util.UnixTimeSinceEpoch().ToString(); + + m_Database.Store(data); + + return true; } public bool LogoutAgent(UUID sessionID) { + PresenceData data = m_Database.Get(sessionID); + if (data == null) + return false; + + data.Data["Online"] = "false"; + data.Data["Logout"] = Util.UnixTimeSinceEpoch().ToString(); + + m_Database.Store(data); + return false; } public bool LogoutRegionAgents(UUID regionID) { - return false; + m_Database.LogoutRegionAgents(regionID); + + return true; } public bool ReportAgent(UUID sessionID, UUID regionID, Vector3 position, Vector3 lookAt) { - return false; + return m_Database.ReportAgent(sessionID, regionID, + position.ToString(), lookAt.ToString()); } public PresenceInfo GetAgent(UUID sessionID) { - return null; + PresenceInfo ret = new PresenceInfo(); + + PresenceData data = m_Database.Get(sessionID); + if (data == null) + return null; + + ret.PrincipalID = data.PrincipalID; + ret.RegionID = data.RegionID; + ret.SessionID = data.SessionID; + ret.SecureSessionID = new UUID(data.Data["SecureSessionID"]); + ret.Online = bool.Parse(data.Data["Online"]); + ret.Login = Util.ToDateTime(Convert.ToInt32(data.Data["Login"])); + ret.Logout = Util.ToDateTime(Convert.ToInt32(data.Data["Logout"])); + ret.Position = Vector3.Parse(data.Data["Position"]); + ret.LookAt = Vector3.Parse(data.Data["LookAt"]); + + return ret; } public PresenceInfo[] GetAgents(UUID[] PrincipalIDs) { - return null; + List info = new List(); + + foreach (UUID principalID in PrincipalIDs) + { + 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.SessionID = d.SessionID; + ret.SecureSessionID = new UUID(d.Data["SecureSessionID"]); + 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); + } + } + + return info.ToArray(); } } } -- cgit v1.1 From 2f717fc796fcb2641369dc132d1fbc7a70d43d72 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 27 Dec 2009 18:03:59 +0000 Subject: Remove the sesion from returned presence info --- OpenSim/Services/PresenceService/PresenceService.cs | 4 ---- 1 file changed, 4 deletions(-) (limited to 'OpenSim/Services/PresenceService/PresenceService.cs') diff --git a/OpenSim/Services/PresenceService/PresenceService.cs b/OpenSim/Services/PresenceService/PresenceService.cs index 56ec504..6542c25 100644 --- a/OpenSim/Services/PresenceService/PresenceService.cs +++ b/OpenSim/Services/PresenceService/PresenceService.cs @@ -107,8 +107,6 @@ namespace OpenSim.Services.PresenceService ret.PrincipalID = data.PrincipalID; ret.RegionID = data.RegionID; - ret.SessionID = data.SessionID; - ret.SecureSessionID = new UUID(data.Data["SecureSessionID"]); ret.Online = bool.Parse(data.Data["Online"]); ret.Login = Util.ToDateTime(Convert.ToInt32(data.Data["Login"])); ret.Logout = Util.ToDateTime(Convert.ToInt32(data.Data["Logout"])); @@ -133,8 +131,6 @@ namespace OpenSim.Services.PresenceService ret.PrincipalID = d.PrincipalID; ret.RegionID = d.RegionID; - ret.SessionID = d.SessionID; - ret.SecureSessionID = new UUID(d.Data["SecureSessionID"]); ret.Online = bool.Parse(d.Data["Online"]); ret.Login = Util.ToDateTime(Convert.ToInt32( d.Data["Login"])); -- cgit v1.1 From b8dfccb2272e12942f5364fa327ffd721292d8ad Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 27 Dec 2009 16:07:16 -0800 Subject: Changed GetAgents to take string[] instead of UUID[] --- .../Services/PresenceService/PresenceService.cs | 42 ++++++++++++---------- 1 file changed, 23 insertions(+), 19 deletions(-) (limited to 'OpenSim/Services/PresenceService/PresenceService.cs') diff --git a/OpenSim/Services/PresenceService/PresenceService.cs b/OpenSim/Services/PresenceService/PresenceService.cs index 6542c25..0529d3d 100644 --- a/OpenSim/Services/PresenceService/PresenceService.cs +++ b/OpenSim/Services/PresenceService/PresenceService.cs @@ -116,30 +116,34 @@ namespace OpenSim.Services.PresenceService return ret; } - public PresenceInfo[] GetAgents(UUID[] PrincipalIDs) + public PresenceInfo[] GetAgents(string[] principalIDs) { List info = new List(); - foreach (UUID principalID in PrincipalIDs) + foreach (string principalIDStr in principalIDs) { - PresenceData[] data = m_Database.Get("PrincipalID", - principalID.ToString()); - - foreach (PresenceData d in data) + UUID principalID = UUID.Zero; + if (UUID.TryParse(principalIDStr, out principalID)) { - 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); + 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); + } } } -- 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 --- .../Services/PresenceService/PresenceService.cs | 48 ++++++++++------------ 1 file changed, 22 insertions(+), 26 deletions(-) (limited to 'OpenSim/Services/PresenceService/PresenceService.cs') 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); } } -- cgit v1.1 From 43691e827070f630a2acfbb70d88c1aa555f3f4d Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 28 Dec 2009 11:46:34 -0800 Subject: Added some more log messages. This is beginning to work. --- OpenSim/Services/PresenceService/PresenceService.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'OpenSim/Services/PresenceService/PresenceService.cs') diff --git a/OpenSim/Services/PresenceService/PresenceService.cs b/OpenSim/Services/PresenceService/PresenceService.cs index fe36bd0..adbf430 100644 --- a/OpenSim/Services/PresenceService/PresenceService.cs +++ b/OpenSim/Services/PresenceService/PresenceService.cs @@ -41,13 +41,14 @@ namespace OpenSim.Services.PresenceService { public class PresenceService : PresenceServiceBase, IPresenceService { -// private static readonly ILog m_log = -// LogManager.GetLogger( -// MethodBase.GetCurrentMethod().DeclaringType); + private static readonly ILog m_log = + LogManager.GetLogger( + MethodBase.GetCurrentMethod().DeclaringType); public PresenceService(IConfigSource config) : base(config) { + m_log.Debug("[PRESENCE SERVICE]: Starting presence service"); } public bool LoginAgent(string userID, UUID sessionID, @@ -93,8 +94,9 @@ namespace OpenSim.Services.PresenceService public bool ReportAgent(UUID sessionID, UUID regionID, Vector3 position, Vector3 lookAt) { + m_log.DebugFormat("[PRESENCE SERVICE]: ReportAgent with session {0} in region {1}", sessionID, regionID); return m_Database.ReportAgent(sessionID, regionID, - position.ToString(), lookAt.ToString()); + position.ToString(), lookAt.ToString()); } public PresenceInfo GetAgent(UUID sessionID) -- 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. --- .../Services/PresenceService/PresenceService.cs | 34 +++++++++++++++++++--- 1 file changed, 30 insertions(+), 4 deletions(-) (limited to 'OpenSim/Services/PresenceService/PresenceService.cs') diff --git a/OpenSim/Services/PresenceService/PresenceService.cs b/OpenSim/Services/PresenceService/PresenceService.cs index adbf430..b3d8194 100644 --- a/OpenSim/Services/PresenceService/PresenceService.cs +++ b/OpenSim/Services/PresenceService/PresenceService.cs @@ -54,9 +54,10 @@ namespace OpenSim.Services.PresenceService public bool LoginAgent(string userID, UUID sessionID, UUID secureSessionID) { - // We have just logged in. If there is any info in the table - // it's OK to overwrite. So we won't bother reading it first - // + m_Database.Prune(userID); + + PresenceData[] d = m_Database.Get("UserID", userID); + PresenceData data = new PresenceData(); data.UserID = userID; @@ -64,6 +65,12 @@ namespace OpenSim.Services.PresenceService data.SessionID = sessionID; data.Data["SecureSessionID"] = secureSessionID.ToString(); data.Data["Login"] = Util.UnixTimeSinceEpoch().ToString(); + if (d.Length > 0) + { + data.Data["HomeRegionID"] = d[0].Data["HomeRegionID"]; + data.Data["HomePosition"] = d[0].Data["HomePosition"]; + data.Data["HomeLookAt"] = d[0].Data["HomeLookAt"]; + } m_Database.Store(data); @@ -76,12 +83,20 @@ namespace OpenSim.Services.PresenceService if (data == null) return false; + PresenceData[] d = m_Database.Get("UserID", data.UserID); + + if (d.Length > 1) + { + m_Database.Delete("SessionID", sessionID.ToString()); + return true; + } + data.Data["Online"] = "false"; data.Data["Logout"] = Util.UnixTimeSinceEpoch().ToString(); m_Database.Store(data); - return false; + return true; } public bool LogoutRegionAgents(UUID regionID) @@ -114,6 +129,9 @@ namespace OpenSim.Services.PresenceService ret.Logout = Util.ToDateTime(Convert.ToInt32(data.Data["Logout"])); ret.Position = Vector3.Parse(data.Data["Position"]); ret.LookAt = Vector3.Parse(data.Data["LookAt"]); + ret.HomeRegionID = new UUID(data.Data["HomeRegionID"]); + ret.HomePosition = Vector3.Parse(data.Data["HomePosition"]); + ret.HomeLookAt = Vector3.Parse(data.Data["HomeLookAt"]); return ret; } @@ -140,6 +158,9 @@ namespace OpenSim.Services.PresenceService d.Data["Logout"])); ret.Position = Vector3.Parse(d.Data["Position"]); ret.LookAt = Vector3.Parse(d.Data["LookAt"]); + ret.HomeRegionID = new UUID(d.Data["HomeRegionID"]); + ret.HomePosition = Vector3.Parse(d.Data["HomePosition"]); + ret.HomeLookAt = Vector3.Parse(d.Data["HomeLookAt"]); info.Add(ret); } @@ -147,5 +168,10 @@ namespace OpenSim.Services.PresenceService return info.ToArray(); } + + public bool SetHomeLocation(string userID, UUID regionID, Vector3 position, Vector3 lookAt) + { + return m_Database.SetHomeLocation(userID, regionID, position, lookAt); + } } } -- cgit v1.1 From 1d2a332b96794e2011b0527cf590c3ceedcd8af4 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 30 Dec 2009 14:17:18 -0800 Subject: Unit tests for presence. They helped fix a couple of wrongnesses. --- .../Services/PresenceService/PresenceService.cs | 32 ++++++++++++++++------ 1 file changed, 23 insertions(+), 9 deletions(-) (limited to 'OpenSim/Services/PresenceService/PresenceService.cs') diff --git a/OpenSim/Services/PresenceService/PresenceService.cs b/OpenSim/Services/PresenceService/PresenceService.cs index b3d8194..fc6a6e1 100644 --- a/OpenSim/Services/PresenceService/PresenceService.cs +++ b/OpenSim/Services/PresenceService/PresenceService.cs @@ -64,6 +64,7 @@ namespace OpenSim.Services.PresenceService data.RegionID = UUID.Zero; data.SessionID = sessionID; data.Data["SecureSessionID"] = secureSessionID.ToString(); + data.Data["Online"] = "true"; data.Data["Login"] = Util.UnixTimeSinceEpoch().ToString(); if (d.Length > 0) { @@ -88,7 +89,6 @@ namespace OpenSim.Services.PresenceService if (d.Length > 1) { m_Database.Delete("SessionID", sessionID.ToString()); - return true; } data.Data["Online"] = "false"; @@ -110,6 +110,12 @@ namespace OpenSim.Services.PresenceService public bool ReportAgent(UUID sessionID, UUID regionID, Vector3 position, Vector3 lookAt) { m_log.DebugFormat("[PRESENCE SERVICE]: ReportAgent with session {0} in region {1}", sessionID, regionID); + PresenceData pdata = m_Database.Get(sessionID); + if (pdata == null) + return false; + if (pdata.Data["Online"] == "false") + return false; + return m_Database.ReportAgent(sessionID, regionID, position.ToString(), lookAt.ToString()); } @@ -124,14 +130,22 @@ namespace OpenSim.Services.PresenceService ret.UserID = data.UserID; ret.RegionID = data.RegionID; - ret.Online = bool.Parse(data.Data["Online"]); - ret.Login = Util.ToDateTime(Convert.ToInt32(data.Data["Login"])); - ret.Logout = Util.ToDateTime(Convert.ToInt32(data.Data["Logout"])); - ret.Position = Vector3.Parse(data.Data["Position"]); - ret.LookAt = Vector3.Parse(data.Data["LookAt"]); - ret.HomeRegionID = new UUID(data.Data["HomeRegionID"]); - ret.HomePosition = Vector3.Parse(data.Data["HomePosition"]); - ret.HomeLookAt = Vector3.Parse(data.Data["HomeLookAt"]); + if (data.Data.ContainsKey("Online")) + ret.Online = bool.Parse(data.Data["Online"]); + if (data.Data.ContainsKey("Login")) + ret.Login = Util.ToDateTime(Convert.ToInt32(data.Data["Login"])); + if (data.Data.ContainsKey("Logout")) + ret.Logout = Util.ToDateTime(Convert.ToInt32(data.Data["Logout"])); + if (data.Data.ContainsKey("Position")) + ret.Position = Vector3.Parse(data.Data["Position"]); + if (data.Data.ContainsKey("LookAt")) + ret.LookAt = Vector3.Parse(data.Data["LookAt"]); + if (data.Data.ContainsKey("HomeRegionID")) + ret.HomeRegionID = new UUID(data.Data["HomeRegionID"]); + if (data.Data.ContainsKey("HomePosition")) + ret.HomePosition = Vector3.Parse(data.Data["HomePosition"]); + if (data.Data.ContainsKey("HomeLookAt")) + ret.HomeLookAt = Vector3.Parse(data.Data["HomeLookAt"]); return ret; } -- cgit v1.1 From 4240f2dec6f7348a99aea0d1b040fca6ea9d493b Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 1 Jan 2010 16:54:24 -0800 Subject: New LL login service is working! -- tested in standalone only. Things still missing from response, namely Library and Friends. Appearance service is also missing. --- .../Services/PresenceService/PresenceService.cs | 40 +++++++++++++++++----- 1 file changed, 31 insertions(+), 9 deletions(-) (limited to 'OpenSim/Services/PresenceService/PresenceService.cs') diff --git a/OpenSim/Services/PresenceService/PresenceService.cs b/OpenSim/Services/PresenceService/PresenceService.cs index fc6a6e1..7da0f23 100644 --- a/OpenSim/Services/PresenceService/PresenceService.cs +++ b/OpenSim/Services/PresenceService/PresenceService.cs @@ -63,15 +63,22 @@ namespace OpenSim.Services.PresenceService data.UserID = userID; data.RegionID = UUID.Zero; data.SessionID = sessionID; + data.Data = new Dictionary(); data.Data["SecureSessionID"] = secureSessionID.ToString(); data.Data["Online"] = "true"; data.Data["Login"] = Util.UnixTimeSinceEpoch().ToString(); - if (d.Length > 0) + if (d != null && d.Length > 0) { data.Data["HomeRegionID"] = d[0].Data["HomeRegionID"]; data.Data["HomePosition"] = d[0].Data["HomePosition"]; data.Data["HomeLookAt"] = d[0].Data["HomeLookAt"]; } + else + { + data.Data["HomeRegionID"] = UUID.Zero.ToString(); + data.Data["HomePosition"] = new Vector3(128, 128, 0).ToString(); + data.Data["HomeLookAt"] = new Vector3(0, 1, 0).ToString(); + } m_Database.Store(data); @@ -86,9 +93,10 @@ namespace OpenSim.Services.PresenceService PresenceData[] d = m_Database.Get("UserID", data.UserID); + m_log.WarnFormat("[PRESENCE SERVICE]: LogoutAgent {0} with {1} sessions currently present", data.UserID, d.Length); if (d.Length > 1) { - m_Database.Delete("SessionID", sessionID.ToString()); + m_Database.Delete("UserID", data.UserID); } data.Data["Online"] = "false"; @@ -110,14 +118,28 @@ namespace OpenSim.Services.PresenceService public bool ReportAgent(UUID sessionID, UUID regionID, Vector3 position, Vector3 lookAt) { m_log.DebugFormat("[PRESENCE SERVICE]: ReportAgent with session {0} in region {1}", sessionID, regionID); - PresenceData pdata = m_Database.Get(sessionID); - if (pdata == null) - return false; - if (pdata.Data["Online"] == "false") - return false; + try + { + PresenceData pdata = m_Database.Get(sessionID); + if (pdata == null) + return false; + if (pdata.Data == null) + return false; + + if (!pdata.Data.ContainsKey("Online") || (pdata.Data.ContainsKey("Online") && pdata.Data["Online"] == "false")) + { + m_log.WarnFormat("[PRESENCE SERVICE]: Someone tried to report presence of an agent who's not online"); + return false; + } - return m_Database.ReportAgent(sessionID, regionID, - position.ToString(), lookAt.ToString()); + return m_Database.ReportAgent(sessionID, regionID, + position.ToString(), lookAt.ToString()); + } + catch (Exception e) + { + m_log.DebugFormat("[PRESENCE SERVICE]: ReportAgent threw exception {0}", e.StackTrace); + return false; + } } public PresenceInfo GetAgent(UUID sessionID) -- 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/Services/PresenceService/PresenceService.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'OpenSim/Services/PresenceService/PresenceService.cs') diff --git a/OpenSim/Services/PresenceService/PresenceService.cs b/OpenSim/Services/PresenceService/PresenceService.cs index 7da0f23..2884199 100644 --- a/OpenSim/Services/PresenceService/PresenceService.cs +++ b/OpenSim/Services/PresenceService/PresenceService.cs @@ -82,6 +82,8 @@ namespace OpenSim.Services.PresenceService m_Database.Store(data); + m_log.DebugFormat("[PRESENCE SERVICE]: LoginAgent {0} with session {1} and ssession {2}", + userID, sessionID, secureSessionID); return true; } @@ -93,7 +95,7 @@ namespace OpenSim.Services.PresenceService PresenceData[] d = m_Database.Get("UserID", data.UserID); - m_log.WarnFormat("[PRESENCE SERVICE]: LogoutAgent {0} with {1} sessions currently present", data.UserID, d.Length); + m_log.DebugFormat("[PRESENCE SERVICE]: LogoutAgent {0} with {1} sessions currently present", data.UserID, d.Length); if (d.Length > 1) { m_Database.Delete("UserID", data.UserID); @@ -117,7 +119,7 @@ namespace OpenSim.Services.PresenceService public bool ReportAgent(UUID sessionID, UUID regionID, Vector3 position, Vector3 lookAt) { - m_log.DebugFormat("[PRESENCE SERVICE]: ReportAgent with session {0} in region {1}", sessionID, regionID); + //m_log.DebugFormat("[PRESENCE SERVICE]: ReportAgent with session {0} in region {1}", sessionID, regionID); try { PresenceData pdata = m_Database.Get(sessionID); -- 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/Services/PresenceService/PresenceService.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'OpenSim/Services/PresenceService/PresenceService.cs') diff --git a/OpenSim/Services/PresenceService/PresenceService.cs b/OpenSim/Services/PresenceService/PresenceService.cs index 2884199..34a3154 100644 --- a/OpenSim/Services/PresenceService/PresenceService.cs +++ b/OpenSim/Services/PresenceService/PresenceService.cs @@ -87,7 +87,7 @@ namespace OpenSim.Services.PresenceService return true; } - public bool LogoutAgent(UUID sessionID) + public bool LogoutAgent(UUID sessionID, Vector3 position, Vector3 lookat) { PresenceData data = m_Database.Get(sessionID); if (data == null) @@ -103,6 +103,8 @@ namespace OpenSim.Services.PresenceService data.Data["Online"] = "false"; data.Data["Logout"] = Util.UnixTimeSinceEpoch().ToString(); + data.Data["Position"] = position.ToString(); + data.Data["LookAt"] = lookat.ToString(); m_Database.Store(data); -- 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/Services/PresenceService/PresenceService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Services/PresenceService/PresenceService.cs') diff --git a/OpenSim/Services/PresenceService/PresenceService.cs b/OpenSim/Services/PresenceService/PresenceService.cs index 34a3154..350eac8 100644 --- a/OpenSim/Services/PresenceService/PresenceService.cs +++ b/OpenSim/Services/PresenceService/PresenceService.cs @@ -121,7 +121,7 @@ namespace OpenSim.Services.PresenceService public bool ReportAgent(UUID sessionID, UUID regionID, Vector3 position, Vector3 lookAt) { - //m_log.DebugFormat("[PRESENCE SERVICE]: ReportAgent with session {0} in region {1}", sessionID, regionID); + m_log.DebugFormat("[PRESENCE SERVICE]: ReportAgent with session {0} in region {1}", sessionID, regionID); try { PresenceData pdata = m_Database.Get(sessionID); -- 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/Services/PresenceService/PresenceService.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Services/PresenceService/PresenceService.cs') diff --git a/OpenSim/Services/PresenceService/PresenceService.cs b/OpenSim/Services/PresenceService/PresenceService.cs index 350eac8..1a31965 100644 --- a/OpenSim/Services/PresenceService/PresenceService.cs +++ b/OpenSim/Services/PresenceService/PresenceService.cs @@ -206,6 +206,7 @@ namespace OpenSim.Services.PresenceService } } + m_log.DebugFormat("[PRESENCE SERVICE]: GetAgents for {0} userIDs found {1} presences", userIDs.Length, info.Count); return info.ToArray(); } -- cgit v1.1