aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/General/Util.cs25
-rw-r--r--OpenSim/Framework/Servers/BaseHttpServer.cs5
-rw-r--r--OpenSim/Framework/UserManager/UserManagerBase.cs120
3 files changed, 30 insertions, 120 deletions
diff --git a/OpenSim/Framework/General/Util.cs b/OpenSim/Framework/General/Util.cs
index f3a8c73..5eae206 100644
--- a/OpenSim/Framework/General/Util.cs
+++ b/OpenSim/Framework/General/Util.cs
@@ -26,6 +26,7 @@
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic;
29using System.IO; 30using System.IO;
30using System.Security.Cryptography; 31using System.Security.Cryptography;
31using System.Net; 32using System.Net;
@@ -41,6 +42,7 @@ namespace OpenSim.Framework.Utilities
41 private static Random randomClass = new Random(); 42 private static Random randomClass = new Random();
42 private static uint nextXferID = 5000; 43 private static uint nextXferID = 5000;
43 private static object XferLock = new object(); 44 private static object XferLock = new object();
45 private static Dictionary<LLUUID, string> capsURLS = new Dictionary<LLUUID, string>();
44 46
45 public static ulong UIntsToLong(uint X, uint Y) 47 public static ulong UIntsToLong(uint X, uint Y)
46 { 48 {
@@ -66,6 +68,11 @@ namespace OpenSim.Framework.Utilities
66 return id; 68 return id;
67 } 69 }
68 70
71 public Util()
72 {
73
74 }
75
69 public static string GetFileName(string file) 76 public static string GetFileName(string file)
70 { 77 {
71 // Return just the filename on UNIX platforms 78 // Return just the filename on UNIX platforms
@@ -311,9 +318,25 @@ namespace OpenSim.Framework.Utilities
311 return temp; 318 return temp;
312 } 319 }
313 320
314 public Util() 321 public static string GetCapsURL(LLUUID userID)
315 { 322 {
323 if (capsURLS.ContainsKey(userID))
324 {
325 return capsURLS[userID];
326 }
327 return "";
328 }
316 329
330 public static void SetCapsURL(LLUUID userID, string url)
331 {
332 if (capsURLS.ContainsKey(userID))
333 {
334 capsURLS[userID] = url;
335 }
336 else
337 {
338 capsURLS.Add(userID, url);
339 }
317 } 340 }
318 341
319 // Nini (config) related Methods 342 // Nini (config) related Methods
diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs
index c514b96..4eb776e 100644
--- a/OpenSim/Framework/Servers/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/BaseHttpServer.cs
@@ -47,6 +47,11 @@ namespace OpenSim.Framework.Servers
47 protected int m_port; 47 protected int m_port;
48 protected bool m_firstcaps = true; 48 protected bool m_firstcaps = true;
49 49
50 public int Port
51 {
52 get { return m_port; }
53 }
54
50 public BaseHttpServer(int port) 55 public BaseHttpServer(int port)
51 { 56 {
52 m_port = port; 57 m_port = port;
diff --git a/OpenSim/Framework/UserManager/UserManagerBase.cs b/OpenSim/Framework/UserManager/UserManagerBase.cs
index c1084e9..39681d5 100644
--- a/OpenSim/Framework/UserManager/UserManagerBase.cs
+++ b/OpenSim/Framework/UserManager/UserManagerBase.cs
@@ -369,124 +369,6 @@ namespace OpenSim.Framework.UserManagement
369 } 369 }
370 } 370 }
371 371
372 // Rest and XML-RPC methods. (could move them to a sub class in the user server?) 372 // Rest and XML-RPC methods. (have moved them to a sub class in the user server)
373
374 /// <summary>
375 /// Deletes an active agent session
376 /// </summary>
377 /// <param name="request">The request</param>
378 /// <param name="path">The path (eg /bork/narf/test)</param>
379 /// <param name="param">Parameters sent</param>
380 /// <returns>Success "OK" else error</returns>
381 public string RestDeleteUserSessionMethod(string request, string path, string param)
382 {
383 // TODO! Important!
384
385 return "OK";
386 }
387
388 /// <summary>
389 /// Returns an error message that the user could not be found in the database
390 /// </summary>
391 /// <returns>XML string consisting of a error element containing individual error(s)</returns>
392 public XmlRpcResponse CreateUnknownUserErrorResponse()
393 {
394 XmlRpcResponse response = new XmlRpcResponse();
395 Hashtable responseData = new Hashtable();
396 responseData["error_type"] = "unknown_user";
397 responseData["error_desc"] = "The user requested is not in the database";
398
399 response.Value = responseData;
400 return response;
401 }
402
403 /// <summary>
404 /// Converts a user profile to an XML element which can be returned
405 /// </summary>
406 /// <param name="profile">The user profile</param>
407 /// <returns>A string containing an XML Document of the user profile</returns>
408 public XmlRpcResponse ProfileToXmlRPCResponse(UserProfileData profile)
409 {
410 XmlRpcResponse response = new XmlRpcResponse();
411 Hashtable responseData = new Hashtable();
412
413 // Account information
414 responseData["firstname"] = profile.username;
415 responseData["lastname"] = profile.surname;
416 responseData["uuid"] = profile.UUID.ToStringHyphenated();
417 // Server Information
418 responseData["server_inventory"] = profile.userInventoryURI;
419 responseData["server_asset"] = profile.userAssetURI;
420 // Profile Information
421 responseData["profile_about"] = profile.profileAboutText;
422 responseData["profile_firstlife_about"] = profile.profileFirstText;
423 responseData["profile_firstlife_image"] = profile.profileFirstImage.ToStringHyphenated();
424 responseData["profile_can_do"] = profile.profileCanDoMask.ToString();
425 responseData["profile_want_do"] = profile.profileWantDoMask.ToString();
426 responseData["profile_image"] = profile.profileImage.ToStringHyphenated();
427 responseData["profile_created"] = profile.created.ToString();
428 responseData["profile_lastlogin"] = profile.lastLogin.ToString();
429 // Home region information
430 responseData["home_coordinates_x"] = profile.homeLocation.X.ToString();
431 responseData["home_coordinates_y"] = profile.homeLocation.Y.ToString();
432 responseData["home_coordinates_z"] = profile.homeLocation.Z.ToString();
433
434 responseData["home_region"] = profile.homeRegion.ToString();
435
436 responseData["home_look_x"] = profile.homeLookAt.X.ToString();
437 responseData["home_look_y"] = profile.homeLookAt.Y.ToString();
438 responseData["home_look_z"] = profile.homeLookAt.Z.ToString();
439 response.Value = responseData;
440
441 return response;
442 }
443
444 #region XMLRPC User Methods
445 //should most likely move out of here and into the grid's userserver sub class
446 public XmlRpcResponse XmlRPCGetUserMethodName(XmlRpcRequest request)
447 {
448 XmlRpcResponse response = new XmlRpcResponse();
449 Hashtable requestData = (Hashtable)request.Params[0];
450 UserProfileData userProfile;
451 if (requestData.Contains("avatar_name"))
452 {
453 userProfile = getUserProfile((string)requestData["avatar_name"]);
454 if (userProfile == null)
455 {
456 return CreateUnknownUserErrorResponse();
457 }
458 }
459 else
460 {
461 return CreateUnknownUserErrorResponse();
462 }
463
464 return ProfileToXmlRPCResponse(userProfile);
465 }
466
467 public XmlRpcResponse XmlRPCGetUserMethodUUID(XmlRpcRequest request)
468 {
469 XmlRpcResponse response = new XmlRpcResponse();
470 Hashtable requestData = (Hashtable)request.Params[0];
471 UserProfileData userProfile;
472 System.Console.WriteLine("METHOD BY UUID CALLED");
473 if (requestData.Contains("avatar_uuid"))
474 {
475 userProfile = getUserProfile((LLUUID)(string)requestData["avatar_uuid"]);
476 if (userProfile == null)
477 {
478 return CreateUnknownUserErrorResponse();
479 }
480 }
481 else
482 {
483 return CreateUnknownUserErrorResponse();
484 }
485
486
487 return ProfileToXmlRPCResponse(userProfile);
488 }
489 #endregion
490
491 } 373 }
492} 374}