diff options
author | Melanie | 2009-12-28 23:42:08 +0000 |
---|---|---|
committer | Melanie | 2009-12-28 23:42:08 +0000 |
commit | e0fc854f05b137c353196356e5b26d11b6ee6867 (patch) | |
tree | 9a1c0a29178a9f3e10b10f5e184f46bce1c61078 /OpenSim/Services/PresenceService | |
parent | Add the second step of the friends migration to pull data from the old table ... (diff) | |
download | opensim-SC_OLD-e0fc854f05b137c353196356e5b26d11b6ee6867.zip opensim-SC_OLD-e0fc854f05b137c353196356e5b26d11b6ee6867.tar.gz opensim-SC_OLD-e0fc854f05b137c353196356e5b26d11b6ee6867.tar.bz2 opensim-SC_OLD-e0fc854f05b137c353196356e5b26d11b6ee6867.tar.xz |
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.
Diffstat (limited to 'OpenSim/Services/PresenceService')
-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 | } |