aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Client/Linden
diff options
context:
space:
mode:
authorlbsa712009-03-11 19:19:48 +0000
committerlbsa712009-03-11 19:19:48 +0000
commit2133d358317f28fe54020207ed8fa59562e1d6eb (patch)
treedf648eee35bf347a7ba66a15bdec6a1b4082840b /OpenSim/Client/Linden
parentThanks rtomita for a patch to fix inventory listings for clients using libomv... (diff)
downloadopensim-SC_OLD-2133d358317f28fe54020207ed8fa59562e1d6eb.zip
opensim-SC_OLD-2133d358317f28fe54020207ed8fa59562e1d6eb.tar.gz
opensim-SC_OLD-2133d358317f28fe54020207ed8fa59562e1d6eb.tar.bz2
opensim-SC_OLD-2133d358317f28fe54020207ed8fa59562e1d6eb.tar.xz
* Reverted r8750 to do another round of debugging on mantis #3287
Diffstat (limited to 'OpenSim/Client/Linden')
-rw-r--r--OpenSim/Client/Linden/LLStandaloneLoginService.cs143
1 files changed, 138 insertions, 5 deletions
diff --git a/OpenSim/Client/Linden/LLStandaloneLoginService.cs b/OpenSim/Client/Linden/LLStandaloneLoginService.cs
index b596e14..8fe7172 100644
--- a/OpenSim/Client/Linden/LLStandaloneLoginService.cs
+++ b/OpenSim/Client/Linden/LLStandaloneLoginService.cs
@@ -126,17 +126,150 @@ namespace OpenSim.Client.Linden
126 } 126 }
127 } 127 }
128 128
129 protected override RegionInfo RequestClosestRegion(string region) 129 /// <summary>
130 /// Customises the login response and fills in missing values.
131 /// </summary>
132 /// <param name="response">The existing response</param>
133 /// <param name="theUser">The user profile</param>
134 /// <param name="startLocationRequest">The requested start location</param>
135 public override bool CustomiseResponse(LoginResponse response, UserProfileData theUser, string startLocationRequest)
136 {
137 // add active gestures to login-response
138 AddActiveGestures(response, theUser);
139
140 // HomeLocation
141 RegionInfo homeInfo = null;
142
143 // use the homeRegionID if it is stored already. If not, use the regionHandle as before
144 UUID homeRegionId = theUser.HomeRegionID;
145 ulong homeRegionHandle = theUser.HomeRegion;
146 if (homeRegionId != UUID.Zero)
147 {
148 homeInfo = GetRegionInfo(homeRegionId);
149 }
150 else
151 {
152 homeInfo = GetRegionInfo(homeRegionHandle);
153 }
154
155 if (homeInfo != null)
156 {
157 response.Home =
158 string.Format(
159 "{{'region_handle':[r{0},r{1}], 'position':[r{2},r{3},r{4}], 'look_at':[r{5},r{6},r{7}]}}",
160 (homeInfo.RegionLocX * Constants.RegionSize),
161 (homeInfo.RegionLocY * Constants.RegionSize),
162 theUser.HomeLocation.X, theUser.HomeLocation.Y, theUser.HomeLocation.Z,
163 theUser.HomeLookAt.X, theUser.HomeLookAt.Y, theUser.HomeLookAt.Z);
164 }
165 else
166 {
167 m_log.InfoFormat("not found the region at {0} {1}", theUser.HomeRegionX, theUser.HomeRegionY);
168 // Emergency mode: Home-region isn't available, so we can't request the region info.
169 // Use the stored home regionHandle instead.
170 // NOTE: If the home-region moves, this will be wrong until the users update their user-profile again
171 ulong regionX = homeRegionHandle >> 32;
172 ulong regionY = homeRegionHandle & 0xffffffff;
173 response.Home =
174 string.Format(
175 "{{'region_handle':[r{0},r{1}], 'position':[r{2},r{3},r{4}], 'look_at':[r{5},r{6},r{7}]}}",
176 regionX, regionY,
177 theUser.HomeLocation.X, theUser.HomeLocation.Y, theUser.HomeLocation.Z,
178 theUser.HomeLookAt.X, theUser.HomeLookAt.Y, theUser.HomeLookAt.Z);
179
180 m_log.InfoFormat("[LOGIN] Home region of user {0} {1} is not available; using computed region position {2} {3}",
181 theUser.FirstName, theUser.SurName,
182 regionX, regionY);
183 }
184
185 // StartLocation
186 RegionInfo regionInfo = null;
187 if (startLocationRequest == "home")
188 {
189 regionInfo = homeInfo;
190 theUser.CurrentAgent.Position = theUser.HomeLocation;
191 response.LookAt = "[r" + theUser.HomeLookAt.X.ToString() + ",r" + theUser.HomeLookAt.Y.ToString() + ",r" + theUser.HomeLookAt.Z.ToString() + "]";
192 }
193 else if (startLocationRequest == "last")
194 {
195 UUID lastRegion = theUser.CurrentAgent.Region;
196 regionInfo = GetRegionInfo(lastRegion);
197 response.LookAt = "[r" + theUser.CurrentAgent.LookAt.X.ToString() + ",r" + theUser.CurrentAgent.LookAt.Y.ToString() + ",r" + theUser.CurrentAgent.LookAt.Z.ToString() + "]";
198 }
199 else
200 {
201 Regex reURI = new Regex(@"^uri:(?<region>[^&]+)&(?<x>\d+)&(?<y>\d+)&(?<z>\d+)$");
202 Match uriMatch = reURI.Match(startLocationRequest);
203 if (uriMatch == null)
204 {
205 m_log.InfoFormat("[LOGIN]: Got Custom Login URL {0}, but can't process it", startLocationRequest);
206 }
207 else
208 {
209 string region = uriMatch.Groups["region"].ToString();
210 regionInfo = RequestClosestRegion(region);
211 if (regionInfo == null)
212 {
213 m_log.InfoFormat("[LOGIN]: Got Custom Login URL {0}, can't locate region {1}", startLocationRequest, region);
214 }
215 else
216 {
217 theUser.CurrentAgent.Position = new Vector3(float.Parse(uriMatch.Groups["x"].Value),
218 float.Parse(uriMatch.Groups["y"].Value), float.Parse(uriMatch.Groups["z"].Value));
219 }
220 }
221 response.LookAt = "[r0,r1,r0]";
222 // can be: last, home, safe, url
223 response.StartLocation = "url";
224 }
225
226 if ((regionInfo != null) && (PrepareLoginToRegion(regionInfo, theUser, response)))
227 {
228 return true;
229 }
230
231 // StartLocation not available, send him to a nearby region instead
232 // regionInfo = m_gridService.RequestClosestRegion("");
233 //m_log.InfoFormat("[LOGIN]: StartLocation not available sending to region {0}", regionInfo.regionName);
234
235 // Send him to default region instead
236 ulong defaultHandle = (((ulong)m_defaultHomeX * Constants.RegionSize) << 32) |
237 ((ulong)m_defaultHomeY * Constants.RegionSize);
238
239 if ((regionInfo != null) && (defaultHandle == regionInfo.RegionHandle))
240 {
241 m_log.ErrorFormat("[LOGIN]: Not trying the default region since this is the same as the selected region");
242 return false;
243 }
244
245 m_log.Error("[LOGIN]: Sending user to default region " + defaultHandle + " instead");
246 regionInfo = GetRegionInfo(defaultHandle);
247
248 // Customise the response
249 //response.Home =
250 // string.Format(
251 // "{{'region_handle':[r{0},r{1}], 'position':[r{2},r{3},r{4}], 'look_at':[r{5},r{6},r{7}]}}",
252 // (SimInfo.regionLocX * Constants.RegionSize),
253 // (SimInfo.regionLocY*Constants.RegionSize),
254 // theUser.HomeLocation.X, theUser.HomeLocation.Y, theUser.HomeLocation.Z,
255 // theUser.HomeLookAt.X, theUser.HomeLookAt.Y, theUser.HomeLookAt.Z);
256 theUser.CurrentAgent.Position = new Vector3(128, 128, 0);
257 response.StartLocation = "safe";
258
259 return PrepareLoginToRegion(regionInfo, theUser, response);
260 }
261
262 protected RegionInfo RequestClosestRegion(string region)
130 { 263 {
131 return m_regionsConnector.RequestClosestRegion(region); 264 return m_regionsConnector.RequestClosestRegion(region);
132 } 265 }
133 266
134 protected override RegionInfo GetRegionInfo(ulong homeRegionHandle) 267 protected RegionInfo GetRegionInfo(ulong homeRegionHandle)
135 { 268 {
136 return m_regionsConnector.RequestNeighbourInfo(homeRegionHandle); 269 return m_regionsConnector.RequestNeighbourInfo(homeRegionHandle);
137 } 270 }
138 271
139 protected override RegionInfo GetRegionInfo(UUID homeRegionId) 272 protected RegionInfo GetRegionInfo(UUID homeRegionId)
140 { 273 {
141 return m_regionsConnector.RequestNeighbourInfo(homeRegionId); 274 return m_regionsConnector.RequestNeighbourInfo(homeRegionId);
142 } 275 }
@@ -150,7 +283,7 @@ namespace OpenSim.Client.Linden
150 /// <param name="theUser"> 283 /// <param name="theUser">
151 /// A <see cref="UserProfileData"/> 284 /// A <see cref="UserProfileData"/>
152 /// </param> 285 /// </param>
153 protected override void AddActiveGestures(LoginResponse response, UserProfileData theUser) 286 private void AddActiveGestures(LoginResponse response, UserProfileData theUser)
154 { 287 {
155 List<InventoryItemBase> gestures = m_interServiceInventoryService.GetActiveGestures(theUser.ID); 288 List<InventoryItemBase> gestures = m_interServiceInventoryService.GetActiveGestures(theUser.ID);
156 //m_log.DebugFormat("[LOGIN]: AddActiveGestures, found {0}", gestures == null ? 0 : gestures.Count); 289 //m_log.DebugFormat("[LOGIN]: AddActiveGestures, found {0}", gestures == null ? 0 : gestures.Count);
@@ -176,7 +309,7 @@ namespace OpenSim.Client.Linden
176 /// <param name="user"></param> 309 /// <param name="user"></param>
177 /// <param name="response"></param> 310 /// <param name="response"></param>
178 /// <returns>true if the region was successfully contacted, false otherwise</returns> 311 /// <returns>true if the region was successfully contacted, false otherwise</returns>
179 protected override bool PrepareLoginToRegion(RegionInfo regionInfo, UserProfileData user, LoginResponse response) 312 protected bool PrepareLoginToRegion(RegionInfo regionInfo, UserProfileData user, LoginResponse response)
180 { 313 {
181 IPEndPoint endPoint = regionInfo.ExternalEndPoint; 314 IPEndPoint endPoint = regionInfo.ExternalEndPoint;
182 response.SimAddress = endPoint.Address.ToString(); 315 response.SimAddress = endPoint.Address.ToString();