diff options
author | Diva Canto | 2009-12-30 14:17:18 -0800 |
---|---|---|
committer | Diva Canto | 2009-12-30 14:17:18 -0800 |
commit | 1d2a332b96794e2011b0527cf590c3ceedcd8af4 (patch) | |
tree | ba5f0c01661ef6a60247e35fb15d6d48e12e2fa0 /OpenSim/Services/PresenceService | |
parent | Merge branch 'presence-refactor' of ssh://diva@opensimulator.org/var/git/open... (diff) | |
download | opensim-SC_OLD-1d2a332b96794e2011b0527cf590c3ceedcd8af4.zip opensim-SC_OLD-1d2a332b96794e2011b0527cf590c3ceedcd8af4.tar.gz opensim-SC_OLD-1d2a332b96794e2011b0527cf590c3ceedcd8af4.tar.bz2 opensim-SC_OLD-1d2a332b96794e2011b0527cf590c3ceedcd8af4.tar.xz |
Unit tests for presence. They helped fix a couple of wrongnesses.
Diffstat (limited to 'OpenSim/Services/PresenceService')
-rw-r--r-- | OpenSim/Services/PresenceService/PresenceService.cs | 32 |
1 files changed, 23 insertions, 9 deletions
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 | |||
64 | data.RegionID = UUID.Zero; | 64 | data.RegionID = UUID.Zero; |
65 | data.SessionID = sessionID; | 65 | data.SessionID = sessionID; |
66 | data.Data["SecureSessionID"] = secureSessionID.ToString(); | 66 | data.Data["SecureSessionID"] = secureSessionID.ToString(); |
67 | data.Data["Online"] = "true"; | ||
67 | data.Data["Login"] = Util.UnixTimeSinceEpoch().ToString(); | 68 | data.Data["Login"] = Util.UnixTimeSinceEpoch().ToString(); |
68 | if (d.Length > 0) | 69 | if (d.Length > 0) |
69 | { | 70 | { |
@@ -88,7 +89,6 @@ namespace OpenSim.Services.PresenceService | |||
88 | if (d.Length > 1) | 89 | if (d.Length > 1) |
89 | { | 90 | { |
90 | m_Database.Delete("SessionID", sessionID.ToString()); | 91 | m_Database.Delete("SessionID", sessionID.ToString()); |
91 | return true; | ||
92 | } | 92 | } |
93 | 93 | ||
94 | data.Data["Online"] = "false"; | 94 | data.Data["Online"] = "false"; |
@@ -110,6 +110,12 @@ namespace OpenSim.Services.PresenceService | |||
110 | public bool ReportAgent(UUID sessionID, UUID regionID, Vector3 position, Vector3 lookAt) | 110 | public bool ReportAgent(UUID sessionID, UUID regionID, Vector3 position, Vector3 lookAt) |
111 | { | 111 | { |
112 | m_log.DebugFormat("[PRESENCE SERVICE]: ReportAgent with session {0} in region {1}", sessionID, regionID); | 112 | m_log.DebugFormat("[PRESENCE SERVICE]: ReportAgent with session {0} in region {1}", sessionID, regionID); |
113 | PresenceData pdata = m_Database.Get(sessionID); | ||
114 | if (pdata == null) | ||
115 | return false; | ||
116 | if (pdata.Data["Online"] == "false") | ||
117 | return false; | ||
118 | |||
113 | return m_Database.ReportAgent(sessionID, regionID, | 119 | return m_Database.ReportAgent(sessionID, regionID, |
114 | position.ToString(), lookAt.ToString()); | 120 | position.ToString(), lookAt.ToString()); |
115 | } | 121 | } |
@@ -124,14 +130,22 @@ namespace OpenSim.Services.PresenceService | |||
124 | 130 | ||
125 | ret.UserID = data.UserID; | 131 | ret.UserID = data.UserID; |
126 | ret.RegionID = data.RegionID; | 132 | ret.RegionID = data.RegionID; |
127 | ret.Online = bool.Parse(data.Data["Online"]); | 133 | if (data.Data.ContainsKey("Online")) |
128 | ret.Login = Util.ToDateTime(Convert.ToInt32(data.Data["Login"])); | 134 | ret.Online = bool.Parse(data.Data["Online"]); |
129 | ret.Logout = Util.ToDateTime(Convert.ToInt32(data.Data["Logout"])); | 135 | if (data.Data.ContainsKey("Login")) |
130 | ret.Position = Vector3.Parse(data.Data["Position"]); | 136 | ret.Login = Util.ToDateTime(Convert.ToInt32(data.Data["Login"])); |
131 | ret.LookAt = Vector3.Parse(data.Data["LookAt"]); | 137 | if (data.Data.ContainsKey("Logout")) |
132 | ret.HomeRegionID = new UUID(data.Data["HomeRegionID"]); | 138 | ret.Logout = Util.ToDateTime(Convert.ToInt32(data.Data["Logout"])); |
133 | ret.HomePosition = Vector3.Parse(data.Data["HomePosition"]); | 139 | if (data.Data.ContainsKey("Position")) |
134 | ret.HomeLookAt = Vector3.Parse(data.Data["HomeLookAt"]); | 140 | ret.Position = Vector3.Parse(data.Data["Position"]); |
141 | if (data.Data.ContainsKey("LookAt")) | ||
142 | ret.LookAt = Vector3.Parse(data.Data["LookAt"]); | ||
143 | if (data.Data.ContainsKey("HomeRegionID")) | ||
144 | ret.HomeRegionID = new UUID(data.Data["HomeRegionID"]); | ||
145 | if (data.Data.ContainsKey("HomePosition")) | ||
146 | ret.HomePosition = Vector3.Parse(data.Data["HomePosition"]); | ||
147 | if (data.Data.ContainsKey("HomeLookAt")) | ||
148 | ret.HomeLookAt = Vector3.Parse(data.Data["HomeLookAt"]); | ||
135 | 149 | ||
136 | return ret; | 150 | return ret; |
137 | } | 151 | } |