diff options
author | Teravus Ovares | 2008-01-05 06:05:25 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-01-05 06:05:25 +0000 |
commit | db3edff5d5f1c9a31f377db77d1ac4e1fa685623 (patch) | |
tree | 5b2066a5556b3eff8f0152bdb3ce109b428081fe /OpenSim/Framework/Communications/LoginResponse.cs | |
parent | * Added shell Messaging Server. Don't run the MessagingServer yet or you mig... (diff) | |
download | opensim-SC_OLD-db3edff5d5f1c9a31f377db77d1ac4e1fa685623.zip opensim-SC_OLD-db3edff5d5f1c9a31f377db77d1ac4e1fa685623.tar.gz opensim-SC_OLD-db3edff5d5f1c9a31f377db77d1ac4e1fa685623.tar.bz2 opensim-SC_OLD-db3edff5d5f1c9a31f377db77d1ac4e1fa685623.tar.xz |
* Applying jhurliman's LLSD login enablement patch.
* I'm keeping it deactivated until some issues are resolved.
* I'm patching it in deactivated so the patch doesn't get outdated
* I've deactivated it by commenting out the handler for the application/xml+llsd content type.
* While I've tested this as much as possible on my setup and found the deactivated code doesn't cause any problems, consider this update experimental (event though it's deactivated)
Diffstat (limited to 'OpenSim/Framework/Communications/LoginResponse.cs')
-rw-r--r-- | OpenSim/Framework/Communications/LoginResponse.cs | 161 |
1 files changed, 160 insertions, 1 deletions
diff --git a/OpenSim/Framework/Communications/LoginResponse.cs b/OpenSim/Framework/Communications/LoginResponse.cs index 954aecb..2239a9c 100644 --- a/OpenSim/Framework/Communications/LoginResponse.cs +++ b/OpenSim/Framework/Communications/LoginResponse.cs | |||
@@ -30,6 +30,7 @@ using System; | |||
30 | using System.Collections; | 30 | using System.Collections; |
31 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
32 | using libsecondlife; | 32 | using libsecondlife; |
33 | using libsecondlife.StructuredData; | ||
33 | using Nwc.XmlRpc; | 34 | using Nwc.XmlRpc; |
34 | using OpenSim.Framework.Console; | 35 | using OpenSim.Framework.Console; |
35 | 36 | ||
@@ -197,11 +198,31 @@ namespace OpenSim.Framework.UserManagement | |||
197 | return (xmlRpcResponse); | 198 | return (xmlRpcResponse); |
198 | } // GenerateResponse | 199 | } // GenerateResponse |
199 | 200 | ||
201 | public LLSD GenerateFailureResponseLLSD(string reason, string message, string login) | ||
202 | { | ||
203 | LLSDMap map = new LLSDMap(); | ||
204 | |||
205 | // Ensure Login Failed message/reason; | ||
206 | ErrorMessage = message; | ||
207 | ErrorReason = reason; | ||
208 | |||
209 | map["reason"] = LLSD.FromString(ErrorReason); | ||
210 | map["message"] = LLSD.FromString(ErrorMessage); | ||
211 | map["login"] = LLSD.FromString(login); | ||
212 | |||
213 | return map; | ||
214 | } | ||
215 | |||
200 | public XmlRpcResponse CreateFailedResponse() | 216 | public XmlRpcResponse CreateFailedResponse() |
201 | { | 217 | { |
202 | return (CreateLoginFailedResponse()); | 218 | return (CreateLoginFailedResponse()); |
203 | } // CreateErrorConnectingToGridResponse() | 219 | } // CreateErrorConnectingToGridResponse() |
204 | 220 | ||
221 | public LLSD CreateFailedResponseLLSD() | ||
222 | { | ||
223 | return CreateLoginFailedResponseLLSD(); | ||
224 | } | ||
225 | |||
205 | public XmlRpcResponse CreateLoginFailedResponse() | 226 | public XmlRpcResponse CreateLoginFailedResponse() |
206 | { | 227 | { |
207 | return | 228 | return |
@@ -210,6 +231,14 @@ namespace OpenSim.Framework.UserManagement | |||
210 | "false")); | 231 | "false")); |
211 | } // LoginFailedResponse | 232 | } // LoginFailedResponse |
212 | 233 | ||
234 | public LLSD CreateLoginFailedResponseLLSD() | ||
235 | { | ||
236 | return GenerateFailureResponseLLSD( | ||
237 | "key", | ||
238 | "Could not authenticate your avatar. Please check your username and password, and check the grid if problems persist.", | ||
239 | "false"); | ||
240 | } | ||
241 | |||
213 | public XmlRpcResponse CreateAlreadyLoggedInResponse() | 242 | public XmlRpcResponse CreateAlreadyLoggedInResponse() |
214 | { | 243 | { |
215 | return | 244 | return |
@@ -218,6 +247,14 @@ namespace OpenSim.Framework.UserManagement | |||
218 | "false")); | 247 | "false")); |
219 | } // CreateAlreadyLoggedInResponse() | 248 | } // CreateAlreadyLoggedInResponse() |
220 | 249 | ||
250 | public LLSD CreateAlreadyLoggedInResponseLLSD() | ||
251 | { | ||
252 | return GenerateFailureResponseLLSD( | ||
253 | "presence", | ||
254 | "You appear to be already logged in, if this is not the case please wait for your session to timeout, if this takes longer than a few minutes please contact the grid owner", | ||
255 | "false"); | ||
256 | } | ||
257 | |||
221 | public XmlRpcResponse CreateDeadRegionResponse() | 258 | public XmlRpcResponse CreateDeadRegionResponse() |
222 | { | 259 | { |
223 | return | 260 | return |
@@ -226,6 +263,14 @@ namespace OpenSim.Framework.UserManagement | |||
226 | "false")); | 263 | "false")); |
227 | } | 264 | } |
228 | 265 | ||
266 | public LLSD CreateDeadRegionResponseLLSD() | ||
267 | { | ||
268 | return GenerateFailureResponseLLSD( | ||
269 | "key", | ||
270 | "The region you are attempting to log into is not responding. Please select another region and try again.", | ||
271 | "false"); | ||
272 | } | ||
273 | |||
229 | public XmlRpcResponse CreateGridErrorResponse() | 274 | public XmlRpcResponse CreateGridErrorResponse() |
230 | { | 275 | { |
231 | return | 276 | return |
@@ -234,6 +279,14 @@ namespace OpenSim.Framework.UserManagement | |||
234 | "false")); | 279 | "false")); |
235 | } | 280 | } |
236 | 281 | ||
282 | public LLSD CreateGridErrorResponseLLSD() | ||
283 | { | ||
284 | return GenerateFailureResponseLLSD( | ||
285 | "key", | ||
286 | "Error connecting to grid. Could not percieve credentials from login XML.", | ||
287 | "false"); | ||
288 | } | ||
289 | |||
237 | #endregion | 290 | #endregion |
238 | 291 | ||
239 | public XmlRpcResponse ToXmlRpcResponse() | 292 | public XmlRpcResponse ToXmlRpcResponse() |
@@ -317,6 +370,112 @@ namespace OpenSim.Framework.UserManagement | |||
317 | } | 370 | } |
318 | } // ToXmlRpcResponse | 371 | } // ToXmlRpcResponse |
319 | 372 | ||
373 | public LLSD ToLLSDResponse() | ||
374 | { | ||
375 | try | ||
376 | { | ||
377 | LLSDMap map = new LLSDMap(); | ||
378 | |||
379 | map["first_name"] = LLSD.FromString(Firstname); | ||
380 | map["last_name"] = LLSD.FromString(Lastname); | ||
381 | map["agent_access"] = LLSD.FromString(agentAccess); | ||
382 | |||
383 | map["sim_port"] = LLSD.FromInteger(SimPort); | ||
384 | map["sim_ip"] = LLSD.FromString(SimAddress); | ||
385 | |||
386 | map["agent_id"] = LLSD.FromUUID(AgentID); | ||
387 | map["session_id"] = LLSD.FromUUID(SessionID); | ||
388 | map["secure_session_id"] = LLSD.FromUUID(SecureSessionID); | ||
389 | map["circuit_code"] = LLSD.FromInteger(CircuitCode); | ||
390 | map["seconds_since_epoch"] = LLSD.FromInteger((int)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds); | ||
391 | |||
392 | #region Login Flags | ||
393 | |||
394 | LLSDMap loginFlagsLLSD = new LLSDMap(); | ||
395 | loginFlagsLLSD["daylight_savings"] = LLSD.FromString(DST); | ||
396 | loginFlagsLLSD["stipend_since_login"] = LLSD.FromString(StipendSinceLogin); | ||
397 | loginFlagsLLSD["gendered"] = LLSD.FromString(Gendered); | ||
398 | loginFlagsLLSD["ever_logged_in"] = LLSD.FromString(EverLoggedIn); | ||
399 | map["login-flags"] = WrapLLSDMap(loginFlagsLLSD); | ||
400 | |||
401 | #endregion Login Flags | ||
402 | |||
403 | #region Global Textures | ||
404 | |||
405 | LLSDMap globalTexturesLLSD = new LLSDMap(); | ||
406 | globalTexturesLLSD["sun_texture_id"] = LLSD.FromString(SunTexture); | ||
407 | globalTexturesLLSD["cloud_texture_id"] = LLSD.FromString(CloudTexture); | ||
408 | globalTexturesLLSD["moon_texture_id"] = LLSD.FromString(MoonTexture); | ||
409 | |||
410 | map["global-textures"] = WrapLLSDMap(globalTexturesLLSD); | ||
411 | |||
412 | #endregion Global Textures | ||
413 | |||
414 | map["seed_capability"] = LLSD.FromString(seedCapability); | ||
415 | |||
416 | // FIXME: Need a function that will convert these ArrayLists in to LLSDArrays, | ||
417 | // and convert the data inside them to LLSD objects as well | ||
418 | |||
419 | //map["event_categories"] = eventCategories; | ||
420 | //map["event_notifications"] = new LLSDArray(); // todo | ||
421 | //map["classified_categories"] = classifiedCategories; | ||
422 | |||
423 | #region UI Config | ||
424 | |||
425 | LLSDMap uiConfigLLSD = new LLSDMap(); | ||
426 | uiConfigLLSD["allow_first_life"] = LLSD.FromString(allowFirstLife); | ||
427 | map["ui-config"] = WrapLLSDMap(uiConfigLLSD); | ||
428 | |||
429 | #endregion UI Config | ||
430 | |||
431 | #region Inventory | ||
432 | |||
433 | //map["inventory-skeleton"] = agentInventory; | ||
434 | //map["inventory-skel-lib"] = inventoryLibrary; | ||
435 | //map["inventory-root"] = inventoryRoot; | ||
436 | //map["inventory-lib-root"] = inventoryLibRoot; | ||
437 | //map["inventory-lib-owner"] = inventoryLibraryOwner; | ||
438 | |||
439 | #endregion Inventory | ||
440 | |||
441 | map["gestures"] = new LLSDArray(); // todo | ||
442 | |||
443 | //responseData["initial-outfit"] = initialOutfit; | ||
444 | //responseData["start_location"] = startLocation; | ||
445 | |||
446 | map["seed_capability"] = LLSD.FromString(seedCapability); | ||
447 | map["home"] = LLSD.FromString(home); | ||
448 | map["look_at"] = LLSD.FromString(lookAt); | ||
449 | map["message"] = LLSD.FromString(welcomeMessage); | ||
450 | map["region_x"] = LLSD.FromInteger(RegionX * 256); | ||
451 | map["region_y"] = LLSD.FromInteger(RegionY * 256); | ||
452 | |||
453 | if (m_buddyList != null) | ||
454 | { | ||
455 | //map["buddy-list"] = m_buddyList.ToArray(); | ||
456 | } | ||
457 | |||
458 | map["login"] = LLSD.FromString("true"); | ||
459 | |||
460 | return map; | ||
461 | } | ||
462 | catch (Exception e) | ||
463 | { | ||
464 | MainLog.Instance.Warn( | ||
465 | "CLIENT", | ||
466 | "LoginResponse: Error creating XML-RPC Response: " + e.Message | ||
467 | ); | ||
468 | return GenerateFailureResponseLLSD("Internal Error", "Error generating Login Response", "false"); | ||
469 | } | ||
470 | } | ||
471 | |||
472 | private LLSDArray WrapLLSDMap(LLSDMap wrapMe) | ||
473 | { | ||
474 | LLSDArray array = new LLSDArray(); | ||
475 | array.Add(wrapMe); | ||
476 | return array; | ||
477 | } | ||
478 | |||
320 | public void SetEventCategories(string category, string value) | 479 | public void SetEventCategories(string category, string value) |
321 | { | 480 | { |
322 | // this.eventCategoriesHash[category] = value; | 481 | // this.eventCategoriesHash[category] = value; |
@@ -591,4 +750,4 @@ namespace OpenSim.Framework.UserManagement | |||
591 | } | 750 | } |
592 | } | 751 | } |
593 | } | 752 | } |
594 | } \ No newline at end of file | 753 | } |