aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorlbsa712009-02-07 20:16:58 +0000
committerlbsa712009-02-07 20:16:58 +0000
commit262acf61c469cfd746958630c8842ab688118f09 (patch)
tree4b8fa7abe7e447cff89282cb494b58dd779339c2
parentThank you kindly, TLaukkan (Tommil) for a patch that: (diff)
downloadopensim-SC_OLD-262acf61c469cfd746958630c8842ab688118f09.zip
opensim-SC_OLD-262acf61c469cfd746958630c8842ab688118f09.tar.gz
opensim-SC_OLD-262acf61c469cfd746958630c8842ab688118f09.tar.bz2
opensim-SC_OLD-262acf61c469cfd746958630c8842ab688118f09.tar.xz
* Refactored UserLoginService.CustomiseResponse to be (almost) text-wide identical to LocalLoginService.CustomiseResponse in order to be able to pull them up.
-rw-r--r--OpenSim/Grid/UserServer/UserLoginService.cs48
-rw-r--r--OpenSim/Region/Communications/Local/LocalLoginService.cs39
2 files changed, 67 insertions, 20 deletions
diff --git a/OpenSim/Grid/UserServer/UserLoginService.cs b/OpenSim/Grid/UserServer/UserLoginService.cs
index dfc44ef..0caefb1 100644
--- a/OpenSim/Grid/UserServer/UserLoginService.cs
+++ b/OpenSim/Grid/UserServer/UserLoginService.cs
@@ -183,12 +183,17 @@ namespace OpenSim.Grid.UserServer
183 // HomeLocation 183 // HomeLocation
184 RegionProfileData homeInfo = null; 184 RegionProfileData homeInfo = null;
185 // use the homeRegionID if it is stored already. If not, use the regionHandle as before 185 // use the homeRegionID if it is stored already. If not, use the regionHandle as before
186 if (theUser.HomeRegionID != UUID.Zero) 186 UUID homeRegionId = theUser.HomeRegionID;
187 homeInfo = RegionProfileData.RequestSimProfileData(theUser.HomeRegionID, 187 ulong homeRegionHandle = theUser.HomeRegion;
188 m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey); 188 if (homeRegionId != UUID.Zero)
189 {
190 homeInfo = GetRegionInfo(homeRegionId);
191 }
189 else 192 else
190 homeInfo = RegionProfileData.RequestSimProfileData(theUser.HomeRegion, 193 {
191 m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey); 194 homeInfo = GetRegionInfo(homeRegionHandle);
195 }
196
192 if (homeInfo != null) 197 if (homeInfo != null)
193 { 198 {
194 response.Home = 199 response.Home =
@@ -204,8 +209,8 @@ namespace OpenSim.Grid.UserServer
204 // Emergency mode: Home-region isn't available, so we can't request the region info. 209 // Emergency mode: Home-region isn't available, so we can't request the region info.
205 // Use the stored home regionHandle instead. 210 // Use the stored home regionHandle instead.
206 // NOTE: If the home-region moves, this will be wrong until the users update their user-profile again 211 // NOTE: If the home-region moves, this will be wrong until the users update their user-profile again
207 ulong regionX = theUser.HomeRegion >> 32; 212 ulong regionX = homeRegionHandle >> 32;
208 ulong regionY = theUser.HomeRegion & 0xffffffff; 213 ulong regionY = homeRegionHandle & 0xffffffff;
209 response.Home = 214 response.Home =
210 string.Format( 215 string.Format(
211 "{{'region_handle':[r{0},r{1}], 'position':[r{2},r{3},r{4}], 'look_at':[r{5},r{6},r{7}]}}", 216 "{{'region_handle':[r{0},r{1}], 'position':[r{2},r{3},r{4}], 'look_at':[r{5},r{6},r{7}]}}",
@@ -227,8 +232,8 @@ namespace OpenSim.Grid.UserServer
227 } 232 }
228 else if (startLocationRequest == "last") 233 else if (startLocationRequest == "last")
229 { 234 {
230 regionInfo = RegionProfileData.RequestSimProfileData(theUser.CurrentAgent.Region, 235 UUID lastRegion = theUser.CurrentAgent.Region;
231 m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey); 236 regionInfo = GetRegionInfo(lastRegion);
232 response.LookAt = "[r" + theUser.CurrentAgent.LookAt.X.ToString() + ",r" + theUser.CurrentAgent.LookAt.Y.ToString() + ",r" + theUser.CurrentAgent.LookAt.Z.ToString() + "]"; 237 response.LookAt = "[r" + theUser.CurrentAgent.LookAt.X.ToString() + ",r" + theUser.CurrentAgent.LookAt.Y.ToString() + ",r" + theUser.CurrentAgent.LookAt.Z.ToString() + "]";
233 } 238 }
234 else 239 else
@@ -242,8 +247,7 @@ namespace OpenSim.Grid.UserServer
242 else 247 else
243 { 248 {
244 string region = uriMatch.Groups["region"].ToString(); 249 string region = uriMatch.Groups["region"].ToString();
245 regionInfo = RegionProfileData.RequestSimProfileData(region, 250 regionInfo = RequestClosestRegion(region);
246 m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey);
247 if (regionInfo == null) 251 if (regionInfo == null)
248 { 252 {
249 m_log.InfoFormat("[LOGIN]: Got Custom Login URL {0}, can't locate region {1}", startLocationRequest, region); 253 m_log.InfoFormat("[LOGIN]: Got Custom Login URL {0}, can't locate region {1}", startLocationRequest, region);
@@ -280,7 +284,7 @@ namespace OpenSim.Grid.UserServer
280 } 284 }
281 285
282 m_log.Error("[LOGIN]: Sending user to default region " + defaultHandle + " instead"); 286 m_log.Error("[LOGIN]: Sending user to default region " + defaultHandle + " instead");
283 regionInfo = RegionProfileData.RequestSimProfileData(defaultHandle, m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey); 287 regionInfo = GetRegionInfo(defaultHandle);
284 288
285 // Customise the response 289 // Customise the response
286 //response.Home = 290 //response.Home =
@@ -296,6 +300,26 @@ namespace OpenSim.Grid.UserServer
296 return PrepareLoginToRegion(regionInfo, theUser, response); 300 return PrepareLoginToRegion(regionInfo, theUser, response);
297 } 301 }
298 302
303 protected RegionProfileData RequestClosestRegion(string region)
304 {
305 return RegionProfileData.RequestSimProfileData(region,
306 m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey);
307 }
308
309 protected RegionProfileData GetRegionInfo(ulong homeRegionHandle)
310 {
311 return RegionProfileData.RequestSimProfileData(homeRegionHandle,
312 m_config.GridServerURL, m_config.GridSendKey,
313 m_config.GridRecvKey);
314 }
315
316 protected RegionProfileData GetRegionInfo(UUID homeRegionId)
317 {
318 return RegionProfileData.RequestSimProfileData(homeRegionId,
319 m_config.GridServerURL, m_config.GridSendKey,
320 m_config.GridRecvKey);
321 }
322
299 /// <summary> 323 /// <summary>
300 /// Add active gestures of the user to the login response. 324 /// Add active gestures of the user to the login response.
301 /// </summary> 325 /// </summary>
diff --git a/OpenSim/Region/Communications/Local/LocalLoginService.cs b/OpenSim/Region/Communications/Local/LocalLoginService.cs
index 159773b..5cd587d 100644
--- a/OpenSim/Region/Communications/Local/LocalLoginService.cs
+++ b/OpenSim/Region/Communications/Local/LocalLoginService.cs
@@ -145,10 +145,17 @@ namespace OpenSim.Region.Communications.Local
145 RegionInfo homeInfo = null; 145 RegionInfo homeInfo = null;
146 146
147 // use the homeRegionID if it is stored already. If not, use the regionHandle as before 147 // use the homeRegionID if it is stored already. If not, use the regionHandle as before
148 if (theUser.HomeRegionID != UUID.Zero) 148 UUID homeRegionId = theUser.HomeRegionID;
149 homeInfo = m_gridService.RequestNeighbourInfo(theUser.HomeRegionID); 149 ulong homeRegionHandle = theUser.HomeRegion;
150 if (homeRegionId != UUID.Zero)
151 {
152 homeInfo = GetRegionInfo(homeRegionId);
153 }
150 else 154 else
151 homeInfo = m_gridService.RequestNeighbourInfo(theUser.HomeRegion); 155 {
156 homeInfo = GetRegionInfo(homeRegionHandle);
157 }
158
152 if (homeInfo != null) 159 if (homeInfo != null)
153 { 160 {
154 response.Home = 161 response.Home =
@@ -164,8 +171,8 @@ namespace OpenSim.Region.Communications.Local
164 // Emergency mode: Home-region isn't available, so we can't request the region info. 171 // Emergency mode: Home-region isn't available, so we can't request the region info.
165 // Use the stored home regionHandle instead. 172 // Use the stored home regionHandle instead.
166 // NOTE: If the home-region moves, this will be wrong until the users update their user-profile again 173 // NOTE: If the home-region moves, this will be wrong until the users update their user-profile again
167 ulong regionX = theUser.HomeRegion >> 32; 174 ulong regionX = homeRegionHandle >> 32;
168 ulong regionY = theUser.HomeRegion & 0xffffffff; 175 ulong regionY = homeRegionHandle & 0xffffffff;
169 response.Home = 176 response.Home =
170 string.Format( 177 string.Format(
171 "{{'region_handle':[r{0},r{1}], 'position':[r{2},r{3},r{4}], 'look_at':[r{5},r{6},r{7}]}}", 178 "{{'region_handle':[r{0},r{1}], 'position':[r{2},r{3},r{4}], 'look_at':[r{5},r{6},r{7}]}}",
@@ -188,7 +195,8 @@ namespace OpenSim.Region.Communications.Local
188 } 195 }
189 else if (startLocationRequest == "last") 196 else if (startLocationRequest == "last")
190 { 197 {
191 regionInfo = m_gridService.RequestNeighbourInfo(theUser.CurrentAgent.Region); 198 UUID lastRegion = theUser.CurrentAgent.Region;
199 regionInfo = GetRegionInfo(lastRegion);
192 response.LookAt = "[r" + theUser.CurrentAgent.LookAt.X.ToString() + ",r" + theUser.CurrentAgent.LookAt.Y.ToString() + ",r" + theUser.CurrentAgent.LookAt.Z.ToString() + "]"; 200 response.LookAt = "[r" + theUser.CurrentAgent.LookAt.X.ToString() + ",r" + theUser.CurrentAgent.LookAt.Y.ToString() + ",r" + theUser.CurrentAgent.LookAt.Z.ToString() + "]";
193 } 201 }
194 else 202 else
@@ -202,7 +210,7 @@ namespace OpenSim.Region.Communications.Local
202 else 210 else
203 { 211 {
204 string region = uriMatch.Groups["region"].ToString(); 212 string region = uriMatch.Groups["region"].ToString();
205 regionInfo = m_gridService.RequestClosestRegion(region); 213 regionInfo = RequestClosestRegion(region);
206 if (regionInfo == null) 214 if (regionInfo == null)
207 { 215 {
208 m_log.InfoFormat("[LOGIN]: Got Custom Login URL {0}, can't locate region {1}", startLocationRequest, region); 216 m_log.InfoFormat("[LOGIN]: Got Custom Login URL {0}, can't locate region {1}", startLocationRequest, region);
@@ -238,7 +246,7 @@ namespace OpenSim.Region.Communications.Local
238 } 246 }
239 247
240 m_log.Error("[LOGIN]: Sending user to default region " + defaultHandle + " instead"); 248 m_log.Error("[LOGIN]: Sending user to default region " + defaultHandle + " instead");
241 regionInfo = m_gridService.RequestNeighbourInfo(defaultHandle); 249 regionInfo = GetRegionInfo(defaultHandle);
242 250
243 // Customise the response 251 // Customise the response
244 //response.Home = 252 //response.Home =
@@ -254,6 +262,21 @@ namespace OpenSim.Region.Communications.Local
254 return PrepareLoginToRegion(regionInfo, theUser, response); 262 return PrepareLoginToRegion(regionInfo, theUser, response);
255 } 263 }
256 264
265 protected RegionInfo RequestClosestRegion(string region)
266 {
267 return m_gridService.RequestClosestRegion(region);
268 }
269
270 protected RegionInfo GetRegionInfo(ulong homeRegionHandle)
271 {
272 return m_gridService.RequestNeighbourInfo(homeRegionHandle);
273 }
274
275 protected RegionInfo GetRegionInfo(UUID homeRegionId)
276 {
277 return m_gridService.RequestNeighbourInfo(homeRegionId);
278 }
279
257 /// <summary> 280 /// <summary>
258 /// Add active gestures of the user to the login response. 281 /// Add active gestures of the user to the login response.
259 /// </summary> 282 /// </summary>