aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/PresenceService
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/Services/PresenceService
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/Services/PresenceService')
-rw-r--r--OpenSim/Services/PresenceService/PresenceService.cs79
1 files changed, 5 insertions, 74 deletions
diff --git a/OpenSim/Services/PresenceService/PresenceService.cs b/OpenSim/Services/PresenceService/PresenceService.cs
index ea8d673..7e7e98e 100644
--- a/OpenSim/Services/PresenceService/PresenceService.cs
+++ b/OpenSim/Services/PresenceService/PresenceService.cs
@@ -54,8 +54,6 @@ 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 m_Database.Prune(userID);
58
59 PresenceData[] d = m_Database.Get("UserID", userID); 57 PresenceData[] d = m_Database.Get("UserID", userID);
60 58
61 PresenceData data = new PresenceData(); 59 PresenceData data = new PresenceData();
@@ -65,24 +63,6 @@ namespace OpenSim.Services.PresenceService
65 data.SessionID = sessionID; 63 data.SessionID = sessionID;
66 data.Data = new Dictionary<string, string>(); 64 data.Data = new Dictionary<string, string>();
67 data.Data["SecureSessionID"] = secureSessionID.ToString(); 65 data.Data["SecureSessionID"] = secureSessionID.ToString();
68 data.Data["Online"] = "true";
69 data.Data["Login"] = Util.UnixTimeSinceEpoch().ToString();
70 if (d != null && d.Length > 0)
71 {
72 data.Data["HomeRegionID"] = d[0].Data["HomeRegionID"];
73 data.Data["HomePosition"] = d[0].Data["HomePosition"];
74 data.Data["HomeLookAt"] = d[0].Data["HomeLookAt"];
75 data.Data["Position"] = d[0].Data["Position"];
76 data.Data["LookAt"] = d[0].Data["LookAt"];
77
78 data.RegionID = d[0].RegionID;
79 }
80 else
81 {
82 data.Data["HomeRegionID"] = UUID.Zero.ToString();
83 data.Data["HomePosition"] = new Vector3(128, 128, 0).ToString();
84 data.Data["HomeLookAt"] = new Vector3(0, 1, 0).ToString();
85 }
86 66
87 m_Database.Store(data); 67 m_Database.Store(data);
88 68
@@ -91,28 +71,10 @@ namespace OpenSim.Services.PresenceService
91 return true; 71 return true;
92 } 72 }
93 73
94 public bool LogoutAgent(UUID sessionID, Vector3 position, Vector3 lookat) 74 public bool LogoutAgent(UUID sessionID)
95 { 75 {
96 PresenceData data = m_Database.Get(sessionID); 76 m_log.DebugFormat("[PRESENCE SERVICE]: Session {0} logout", sessionID);
97 if (data == null) 77 return m_Database.Delete("SessionID", sessionID.ToString());
98 return false;
99
100 PresenceData[] d = m_Database.Get("UserID", data.UserID);
101
102 m_log.DebugFormat("[PRESENCE SERVICE]: LogoutAgent {0} with {1} sessions currently present", data.UserID, d.Length);
103 if (d.Length > 1)
104 {
105 m_Database.Delete("UserID", data.UserID);
106 }
107
108 data.Data["Online"] = "false";
109 data.Data["Logout"] = Util.UnixTimeSinceEpoch().ToString();
110 data.Data["Position"] = position.ToString();
111 data.Data["LookAt"] = lookat.ToString();
112
113 m_Database.Store(data);
114
115 return true;
116 } 78 }
117 79
118 public bool LogoutRegionAgents(UUID regionID) 80 public bool LogoutRegionAgents(UUID regionID)
@@ -123,7 +85,7 @@ namespace OpenSim.Services.PresenceService
123 } 85 }
124 86
125 87
126 public bool ReportAgent(UUID sessionID, UUID regionID, Vector3 position, Vector3 lookAt) 88 public bool ReportAgent(UUID sessionID, UUID regionID)
127 { 89 {
128 m_log.DebugFormat("[PRESENCE SERVICE]: ReportAgent with session {0} in region {1}", sessionID, regionID); 90 m_log.DebugFormat("[PRESENCE SERVICE]: ReportAgent with session {0} in region {1}", sessionID, regionID);
129 try 91 try
@@ -134,14 +96,7 @@ namespace OpenSim.Services.PresenceService
134 if (pdata.Data == null) 96 if (pdata.Data == null)
135 return false; 97 return false;
136 98
137 if (!pdata.Data.ContainsKey("Online") || (pdata.Data.ContainsKey("Online") && pdata.Data["Online"] == "false")) 99 return m_Database.ReportAgent(sessionID, regionID);
138 {
139 m_log.WarnFormat("[PRESENCE SERVICE]: Someone tried to report presence of an agent who's not online");
140 return false;
141 }
142
143 return m_Database.ReportAgent(sessionID, regionID,
144 position.ToString(), lookAt.ToString());
145 } 100 }
146 catch (Exception e) 101 catch (Exception e)
147 { 102 {
@@ -160,22 +115,10 @@ namespace OpenSim.Services.PresenceService
160 115
161 ret.UserID = data.UserID; 116 ret.UserID = data.UserID;
162 ret.RegionID = data.RegionID; 117 ret.RegionID = data.RegionID;
163 if (data.Data.ContainsKey("Online"))
164 ret.Online = bool.Parse(data.Data["Online"]);
165 if (data.Data.ContainsKey("Login"))
166 ret.Login = Util.ToDateTime(Convert.ToInt32(data.Data["Login"]));
167 if (data.Data.ContainsKey("Logout"))
168 ret.Logout = Util.ToDateTime(Convert.ToInt32(data.Data["Logout"]));
169 if (data.Data.ContainsKey("Position")) 118 if (data.Data.ContainsKey("Position"))
170 ret.Position = Vector3.Parse(data.Data["Position"]); 119 ret.Position = Vector3.Parse(data.Data["Position"]);
171 if (data.Data.ContainsKey("LookAt")) 120 if (data.Data.ContainsKey("LookAt"))
172 ret.LookAt = Vector3.Parse(data.Data["LookAt"]); 121 ret.LookAt = Vector3.Parse(data.Data["LookAt"]);
173 if (data.Data.ContainsKey("HomeRegionID"))
174 ret.HomeRegionID = new UUID(data.Data["HomeRegionID"]);
175 if (data.Data.ContainsKey("HomePosition"))
176 ret.HomePosition = Vector3.Parse(data.Data["HomePosition"]);
177 if (data.Data.ContainsKey("HomeLookAt"))
178 ret.HomeLookAt = Vector3.Parse(data.Data["HomeLookAt"]);
179 122
180 return ret; 123 return ret;
181 } 124 }
@@ -195,16 +138,8 @@ namespace OpenSim.Services.PresenceService
195 138
196 ret.UserID = d.UserID; 139 ret.UserID = d.UserID;
197 ret.RegionID = d.RegionID; 140 ret.RegionID = d.RegionID;
198 ret.Online = bool.Parse(d.Data["Online"]);
199 ret.Login = Util.ToDateTime(Convert.ToInt32(
200 d.Data["Login"]));
201 ret.Logout = Util.ToDateTime(Convert.ToInt32(
202 d.Data["Logout"]));
203 ret.Position = Vector3.Parse(d.Data["Position"]); 141 ret.Position = Vector3.Parse(d.Data["Position"]);
204 ret.LookAt = Vector3.Parse(d.Data["LookAt"]); 142 ret.LookAt = Vector3.Parse(d.Data["LookAt"]);
205 ret.HomeRegionID = new UUID(d.Data["HomeRegionID"]);
206 ret.HomePosition = Vector3.Parse(d.Data["HomePosition"]);
207 ret.HomeLookAt = Vector3.Parse(d.Data["HomeLookAt"]);
208 143
209 info.Add(ret); 144 info.Add(ret);
210 } 145 }
@@ -214,9 +149,5 @@ namespace OpenSim.Services.PresenceService
214 return info.ToArray(); 149 return info.ToArray();
215 } 150 }
216 151
217 public bool SetHomeLocation(string userID, UUID regionID, Vector3 position, Vector3 lookAt)
218 {
219 return m_Database.SetHomeLocation(userID, regionID, position, lookAt);
220 }
221 } 152 }
222} 153}