diff options
Diffstat (limited to 'OpenSim/Services/PresenceService/PresenceService.cs')
-rw-r--r-- | OpenSim/Services/PresenceService/PresenceService.cs | 34 |
1 files changed, 30 insertions, 4 deletions
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 | |||
54 | public bool LoginAgent(string userID, UUID sessionID, | 54 | public bool LoginAgent(string userID, UUID sessionID, |
55 | UUID secureSessionID) | 55 | UUID secureSessionID) |
56 | { | 56 | { |
57 | // We have just logged in. If there is any info in the table | 57 | m_Database.Prune(userID); |
58 | // it's OK to overwrite. So we won't bother reading it first | 58 | |
59 | // | 59 | PresenceData[] d = m_Database.Get("UserID", userID); |
60 | |||
60 | PresenceData data = new PresenceData(); | 61 | PresenceData data = new PresenceData(); |
61 | 62 | ||
62 | data.UserID = userID; | 63 | data.UserID = userID; |
@@ -64,6 +65,12 @@ namespace OpenSim.Services.PresenceService | |||
64 | data.SessionID = sessionID; | 65 | data.SessionID = sessionID; |
65 | data.Data["SecureSessionID"] = secureSessionID.ToString(); | 66 | data.Data["SecureSessionID"] = secureSessionID.ToString(); |
66 | data.Data["Login"] = Util.UnixTimeSinceEpoch().ToString(); | 67 | data.Data["Login"] = Util.UnixTimeSinceEpoch().ToString(); |
68 | if (d.Length > 0) | ||
69 | { | ||
70 | data.Data["HomeRegionID"] = d[0].Data["HomeRegionID"]; | ||
71 | data.Data["HomePosition"] = d[0].Data["HomePosition"]; | ||
72 | data.Data["HomeLookAt"] = d[0].Data["HomeLookAt"]; | ||
73 | } | ||
67 | 74 | ||
68 | m_Database.Store(data); | 75 | m_Database.Store(data); |
69 | 76 | ||
@@ -76,12 +83,20 @@ namespace OpenSim.Services.PresenceService | |||
76 | if (data == null) | 83 | if (data == null) |
77 | return false; | 84 | return false; |
78 | 85 | ||
86 | PresenceData[] d = m_Database.Get("UserID", data.UserID); | ||
87 | |||
88 | if (d.Length > 1) | ||
89 | { | ||
90 | m_Database.Delete("SessionID", sessionID.ToString()); | ||
91 | return true; | ||
92 | } | ||
93 | |||
79 | data.Data["Online"] = "false"; | 94 | data.Data["Online"] = "false"; |
80 | data.Data["Logout"] = Util.UnixTimeSinceEpoch().ToString(); | 95 | data.Data["Logout"] = Util.UnixTimeSinceEpoch().ToString(); |
81 | 96 | ||
82 | m_Database.Store(data); | 97 | m_Database.Store(data); |
83 | 98 | ||
84 | return false; | 99 | return true; |
85 | } | 100 | } |
86 | 101 | ||
87 | public bool LogoutRegionAgents(UUID regionID) | 102 | public bool LogoutRegionAgents(UUID regionID) |
@@ -114,6 +129,9 @@ namespace OpenSim.Services.PresenceService | |||
114 | ret.Logout = Util.ToDateTime(Convert.ToInt32(data.Data["Logout"])); | 129 | ret.Logout = Util.ToDateTime(Convert.ToInt32(data.Data["Logout"])); |
115 | ret.Position = Vector3.Parse(data.Data["Position"]); | 130 | ret.Position = Vector3.Parse(data.Data["Position"]); |
116 | ret.LookAt = Vector3.Parse(data.Data["LookAt"]); | 131 | ret.LookAt = Vector3.Parse(data.Data["LookAt"]); |
132 | ret.HomeRegionID = new UUID(data.Data["HomeRegionID"]); | ||
133 | ret.HomePosition = Vector3.Parse(data.Data["HomePosition"]); | ||
134 | ret.HomeLookAt = Vector3.Parse(data.Data["HomeLookAt"]); | ||
117 | 135 | ||
118 | return ret; | 136 | return ret; |
119 | } | 137 | } |
@@ -140,6 +158,9 @@ namespace OpenSim.Services.PresenceService | |||
140 | d.Data["Logout"])); | 158 | d.Data["Logout"])); |
141 | ret.Position = Vector3.Parse(d.Data["Position"]); | 159 | ret.Position = Vector3.Parse(d.Data["Position"]); |
142 | ret.LookAt = Vector3.Parse(d.Data["LookAt"]); | 160 | ret.LookAt = Vector3.Parse(d.Data["LookAt"]); |
161 | ret.HomeRegionID = new UUID(d.Data["HomeRegionID"]); | ||
162 | ret.HomePosition = Vector3.Parse(d.Data["HomePosition"]); | ||
163 | ret.HomeLookAt = Vector3.Parse(d.Data["HomeLookAt"]); | ||
143 | 164 | ||
144 | info.Add(ret); | 165 | info.Add(ret); |
145 | } | 166 | } |
@@ -147,5 +168,10 @@ namespace OpenSim.Services.PresenceService | |||
147 | 168 | ||
148 | return info.ToArray(); | 169 | return info.ToArray(); |
149 | } | 170 | } |
171 | |||
172 | public bool SetHomeLocation(string userID, UUID regionID, Vector3 position, Vector3 lookAt) | ||
173 | { | ||
174 | return m_Database.SetHomeLocation(userID, regionID, position, lookAt); | ||
175 | } | ||
150 | } | 176 | } |
151 | } | 177 | } |