aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/Null/NullPresenceData.cs
diff options
context:
space:
mode:
authorDiva Canto2010-05-07 21:29:56 -0700
committerDiva Canto2010-05-07 21:29:56 -0700
commita58859a0d4206c194c9c56212218e2cafc2cc373 (patch)
treefed51a4e40c344b76f6b8b4d5c5b2ec0d2e142e4 /OpenSim/Data/Null/NullPresenceData.cs
parentimprove handling of undersize sculpt textures (diff)
downloadopensim-SC_OLD-a58859a0d4206c194c9c56212218e2cafc2cc373.zip
opensim-SC_OLD-a58859a0d4206c194c9c56212218e2cafc2cc373.tar.gz
opensim-SC_OLD-a58859a0d4206c194c9c56212218e2cafc2cc373.tar.bz2
opensim-SC_OLD-a58859a0d4206c194c9c56212218e2cafc2cc373.tar.xz
GridUserService in place. Replaces the contrived concept of storing user's home and position info in the presence service. WARNING: I violated a taboo by deleting 2 migration files and simplifying the original table creation for Presence. This should not cause any problems to anyone, though. Things will work with the new simplified table, as well as with the previous contrived one. If there are any problems, solving them is as easy as dropping the presence table and deleting its row in the migrations table. The presence info only exists during a user's session anyway.
BTW, the Meshing files want to be committed too -- EOFs.
Diffstat (limited to 'OpenSim/Data/Null/NullPresenceData.cs')
-rw-r--r--OpenSim/Data/Null/NullPresenceData.cs62
1 files changed, 2 insertions, 60 deletions
diff --git a/OpenSim/Data/Null/NullPresenceData.cs b/OpenSim/Data/Null/NullPresenceData.cs
index b98b5c9..91f1cc5 100644
--- a/OpenSim/Data/Null/NullPresenceData.cs
+++ b/OpenSim/Data/Null/NullPresenceData.cs
@@ -96,45 +96,20 @@ namespace OpenSim.Data.Null
96 m_presenceData.Remove(u); 96 m_presenceData.Remove(u);
97 } 97 }
98 98
99 public bool ReportAgent(UUID sessionID, UUID regionID, string position, string lookAt) 99 public bool ReportAgent(UUID sessionID, UUID regionID)
100 { 100 {
101 if (Instance != this) 101 if (Instance != this)
102 return Instance.ReportAgent(sessionID, regionID, position, lookAt); 102 return Instance.ReportAgent(sessionID, regionID);
103 103
104 if (m_presenceData.ContainsKey(sessionID)) 104 if (m_presenceData.ContainsKey(sessionID))
105 { 105 {
106 m_presenceData[sessionID].RegionID = regionID; 106 m_presenceData[sessionID].RegionID = regionID;
107 m_presenceData[sessionID].Data["Position"] = position;
108 m_presenceData[sessionID].Data["LookAt"] = lookAt;
109 return true; 107 return true;
110 } 108 }
111 109
112 return false; 110 return false;
113 } 111 }
114 112
115 public bool SetHomeLocation(string userID, UUID regionID, Vector3 position, Vector3 lookAt)
116 {
117 if (Instance != this)
118 return Instance.SetHomeLocation(userID, regionID, position, lookAt);
119
120 bool foundone = false;
121 foreach (PresenceData p in m_presenceData.Values)
122 {
123 if (p.UserID == userID)
124 {
125// m_log.DebugFormat(
126// "[NULL PRESENCE DATA]: Setting home location {0} {1} {2} for {3}",
127// regionID, position, lookAt, p.UserID);
128
129 p.Data["HomeRegionID"] = regionID.ToString();
130 p.Data["HomePosition"] = position.ToString();
131 p.Data["HomeLookAt"] = lookAt.ToString();
132 foundone = true;
133 }
134 }
135
136 return foundone;
137 }
138 113
139 public PresenceData[] Get(string field, string data) 114 public PresenceData[] Get(string field, string data)
140 { 115 {
@@ -193,39 +168,6 @@ namespace OpenSim.Data.Null
193 return presences.ToArray(); 168 return presences.ToArray();
194 } 169 }
195 170
196 public void Prune(string userID)
197 {
198 if (Instance != this)
199 {
200 Instance.Prune(userID);
201 return;
202 }
203
204// m_log.DebugFormat("[NULL PRESENCE DATA]: Prune called for {0}", userID);
205
206 List<UUID> deleteSessions = new List<UUID>();
207 int online = 0;
208
209 foreach (KeyValuePair<UUID, PresenceData> kvp in m_presenceData)
210 {
211// m_log.DebugFormat("Online: {0}", kvp.Value.Data["Online"]);
212
213 bool on = false;
214 if (bool.TryParse(kvp.Value.Data["Online"], out on) && on)
215 online++;
216 else
217 deleteSessions.Add(kvp.Key);
218 }
219
220// m_log.DebugFormat("[NULL PRESENCE DATA]: online [{0}], deleteSession.Count [{1}]", online, deleteSessions.Count);
221
222 // Leave one session behind so that we can pick up details such as home location
223 if (online == 0 && deleteSessions.Count > 0)
224 deleteSessions.RemoveAt(0);
225
226 foreach (UUID s in deleteSessions)
227 m_presenceData.Remove(s);
228 }
229 171
230 public bool Delete(string field, string data) 172 public bool Delete(string field, string data)
231 { 173 {