aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Framework/General/Util.cs25
-rw-r--r--OpenSim/Framework/Servers/BaseHttpServer.cs5
-rw-r--r--OpenSim/Framework/UserManager/UserManagerBase.cs120
-rw-r--r--OpenSim/Grid/UserServer/UserManager.cs119
-rw-r--r--OpenSim/Region/Communications/Local/LocalLoginService.cs1
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs6
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs3
7 files changed, 154 insertions, 125 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}
diff --git a/OpenSim/Grid/UserServer/UserManager.cs b/OpenSim/Grid/UserServer/UserManager.cs
index 4203ba6..c68b260 100644
--- a/OpenSim/Grid/UserServer/UserManager.cs
+++ b/OpenSim/Grid/UserServer/UserManager.cs
@@ -32,6 +32,7 @@ using Nwc.XmlRpc;
32using OpenSim.Framework.Data; 32using OpenSim.Framework.Data;
33using OpenSim.Framework.UserManagement; 33using OpenSim.Framework.UserManagement;
34using OpenSim.Framework.Utilities; 34using OpenSim.Framework.Utilities;
35using libsecondlife;
35 36
36namespace OpenSim.Grid.UserServer 37namespace OpenSim.Grid.UserServer
37{ 38{
@@ -41,6 +42,122 @@ namespace OpenSim.Grid.UserServer
41 { 42 {
42 } 43 }
43 44
44 45
46 /// <summary>
47 /// Deletes an active agent session
48 /// </summary>
49 /// <param name="request">The request</param>
50 /// <param name="path">The path (eg /bork/narf/test)</param>
51 /// <param name="param">Parameters sent</param>
52 /// <returns>Success "OK" else error</returns>
53 public string RestDeleteUserSessionMethod(string request, string path, string param)
54 {
55 // TODO! Important!
56
57 return "OK";
58 }
59
60 /// <summary>
61 /// Returns an error message that the user could not be found in the database
62 /// </summary>
63 /// <returns>XML string consisting of a error element containing individual error(s)</returns>
64 public XmlRpcResponse CreateUnknownUserErrorResponse()
65 {
66 XmlRpcResponse response = new XmlRpcResponse();
67 Hashtable responseData = new Hashtable();
68 responseData["error_type"] = "unknown_user";
69 responseData["error_desc"] = "The user requested is not in the database";
70
71 response.Value = responseData;
72 return response;
73 }
74
75 /// <summary>
76 /// Converts a user profile to an XML element which can be returned
77 /// </summary>
78 /// <param name="profile">The user profile</param>
79 /// <returns>A string containing an XML Document of the user profile</returns>
80 public XmlRpcResponse ProfileToXmlRPCResponse(UserProfileData profile)
81 {
82 XmlRpcResponse response = new XmlRpcResponse();
83 Hashtable responseData = new Hashtable();
84
85 // Account information
86 responseData["firstname"] = profile.username;
87 responseData["lastname"] = profile.surname;
88 responseData["uuid"] = profile.UUID.ToStringHyphenated();
89 // Server Information
90 responseData["server_inventory"] = profile.userInventoryURI;
91 responseData["server_asset"] = profile.userAssetURI;
92 // Profile Information
93 responseData["profile_about"] = profile.profileAboutText;
94 responseData["profile_firstlife_about"] = profile.profileFirstText;
95 responseData["profile_firstlife_image"] = profile.profileFirstImage.ToStringHyphenated();
96 responseData["profile_can_do"] = profile.profileCanDoMask.ToString();
97 responseData["profile_want_do"] = profile.profileWantDoMask.ToString();
98 responseData["profile_image"] = profile.profileImage.ToStringHyphenated();
99 responseData["profile_created"] = profile.created.ToString();
100 responseData["profile_lastlogin"] = profile.lastLogin.ToString();
101 // Home region information
102 responseData["home_coordinates_x"] = profile.homeLocation.X.ToString();
103 responseData["home_coordinates_y"] = profile.homeLocation.Y.ToString();
104 responseData["home_coordinates_z"] = profile.homeLocation.Z.ToString();
105
106 responseData["home_region"] = profile.homeRegion.ToString();
107
108 responseData["home_look_x"] = profile.homeLookAt.X.ToString();
109 responseData["home_look_y"] = profile.homeLookAt.Y.ToString();
110 responseData["home_look_z"] = profile.homeLookAt.Z.ToString();
111 response.Value = responseData;
112
113 return response;
114 }
115
116 #region XMLRPC User Methods
117 //should most likely move out of here and into the grid's userserver sub class
118 public XmlRpcResponse XmlRPCGetUserMethodName(XmlRpcRequest request)
119 {
120 XmlRpcResponse response = new XmlRpcResponse();
121 Hashtable requestData = (Hashtable)request.Params[0];
122 UserProfileData userProfile;
123 if (requestData.Contains("avatar_name"))
124 {
125 userProfile = getUserProfile((string)requestData["avatar_name"]);
126 if (userProfile == null)
127 {
128 return CreateUnknownUserErrorResponse();
129 }
130 }
131 else
132 {
133 return CreateUnknownUserErrorResponse();
134 }
135
136 return ProfileToXmlRPCResponse(userProfile);
137 }
138
139 public XmlRpcResponse XmlRPCGetUserMethodUUID(XmlRpcRequest request)
140 {
141 XmlRpcResponse response = new XmlRpcResponse();
142 Hashtable requestData = (Hashtable)request.Params[0];
143 UserProfileData userProfile;
144 System.Console.WriteLine("METHOD BY UUID CALLED");
145 if (requestData.Contains("avatar_uuid"))
146 {
147 userProfile = getUserProfile((LLUUID)(string)requestData["avatar_uuid"]);
148 if (userProfile == null)
149 {
150 return CreateUnknownUserErrorResponse();
151 }
152 }
153 else
154 {
155 return CreateUnknownUserErrorResponse();
156 }
157
158
159 return ProfileToXmlRPCResponse(userProfile);
160 }
161 #endregion
45 } 162 }
46} 163}
diff --git a/OpenSim/Region/Communications/Local/LocalLoginService.cs b/OpenSim/Region/Communications/Local/LocalLoginService.cs
index 661fbbe..88377bc 100644
--- a/OpenSim/Region/Communications/Local/LocalLoginService.cs
+++ b/OpenSim/Region/Communications/Local/LocalLoginService.cs
@@ -89,7 +89,6 @@ namespace OpenSim.Region.Communications.Local
89 response.RegionX = reg.RegionLocX; 89 response.RegionX = reg.RegionLocX;
90 response.RegionY = reg.RegionLocY; 90 response.RegionY = reg.RegionLocY;
91 91
92 //following port needs changing as we don't want a http listener for every region (or do we?)
93 response.SeedCapability = "http://" + reg.ExternalHostName + ":" + this.serversInfo.HttpListenerPort.ToString() + "/CAPS/" + capsPath + "0000/"; 92 response.SeedCapability = "http://" + reg.ExternalHostName + ":" + this.serversInfo.HttpListenerPort.ToString() + "/CAPS/" + capsPath + "0000/";
94 theUser.currentAgent.currentRegion = reg.SimUUID; 93 theUser.currentAgent.currentRegion = reg.SimUUID;
95 theUser.currentAgent.currentHandle = reg.RegionHandle; 94 theUser.currentAgent.currentHandle = reg.RegionHandle;
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 0fa3ab7..3ee1f19 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -36,6 +36,7 @@ using OpenSim.Framework.Console;
36using OpenSim.Framework.Interfaces; 36using OpenSim.Framework.Interfaces;
37using OpenSim.Framework.Servers; 37using OpenSim.Framework.Servers;
38using OpenSim.Framework.Types; 38using OpenSim.Framework.Types;
39using OpenSim.Framework.Utilities;
39using OpenSim.Physics.Manager; 40using OpenSim.Physics.Manager;
40using OpenSim.Framework.Communications.Caches; 41using OpenSim.Framework.Communications.Caches;
41using OpenSim.Region.Environment.LandManagement; 42using OpenSim.Region.Environment.LandManagement;
@@ -836,6 +837,7 @@ namespace OpenSim.Region.Environment.Scenes
836 Caps cap = 837 Caps cap =
837 new Caps(assetCache, httpListener, m_regInfo.ExternalHostName, m_regInfo.ExternalEndPoint.Port, 838 new Caps(assetCache, httpListener, m_regInfo.ExternalHostName, m_regInfo.ExternalEndPoint.Port,
838 agent.CapsPath, agent.AgentID); 839 agent.CapsPath, agent.AgentID);
840 Util.SetCapsURL(agent.AgentID, "http://" + m_regInfo.ExternalHostName + ":" + httpListener.Port.ToString() + "/CAPS/" + agent.CapsPath + "0000/");
839 cap.RegisterHandlers(); 841 cap.RegisterHandlers();
840 cap.AddNewInventoryItem = this.AddInventoryItem; 842 cap.AddNewInventoryItem = this.AddInventoryItem;
841 cap.ItemUpdatedCall = this.UpdateInventoryItemAsset; 843 cap.ItemUpdatedCall = this.UpdateInventoryItemAsset;
@@ -948,7 +950,7 @@ namespace OpenSim.Region.Environment.Scenes
948 950
949 //TODO: following line is hard coded to port 9000, really need to change this as soon as possible 951 //TODO: following line is hard coded to port 9000, really need to change this as soon as possible
950 AgentCircuitData circuitdata = remoteClient.RequestClientInfo(); 952 AgentCircuitData circuitdata = remoteClient.RequestClientInfo();
951 string capsPath = "http://" + reg.ExternalEndPoint.Address.ToString() + ":9000/CAPS/" + this.AuthenticateHandler.AgentCircuits[circuitdata.circuitcode].CapsPath + "0000/"; 953 string capsPath = Util.GetCapsURL(remoteClient.AgentId);
952 remoteClient.SendRegionTeleport(regionHandle, 13, reg.ExternalEndPoint, 4, (1 << 4), capsPath); 954 remoteClient.SendRegionTeleport(regionHandle, 13, reg.ExternalEndPoint, 4, (1 << 4), capsPath);
953 } 955 }
954 } 956 }
@@ -1111,7 +1113,7 @@ namespace OpenSim.Region.Environment.Scenes
1111 item.assetID = asset.FullID; 1113 item.assetID = asset.FullID;
1112 userInfo.updateItem(remoteClient.AgentId, item); 1114 userInfo.updateItem(remoteClient.AgentId, item);
1113 1115
1114 remoteClient.SendInventoryItemUpdate(item); 1116 // remoteClient.SendInventoryItemUpdate(item);
1115 1117
1116 return (asset.FullID); 1118 return (asset.FullID);
1117 } 1119 }
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index 1be1e7a..6e4fcda 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -34,6 +34,7 @@ using libsecondlife.Packets;
34using OpenSim.Framework.Console; 34using OpenSim.Framework.Console;
35using OpenSim.Framework.Interfaces; 35using OpenSim.Framework.Interfaces;
36using OpenSim.Framework.Types; 36using OpenSim.Framework.Types;
37using OpenSim.Framework.Utilities;
37using OpenSim.Physics.Manager; 38using OpenSim.Physics.Manager;
38 39
39namespace OpenSim.Region.Environment.Scenes 40namespace OpenSim.Region.Environment.Scenes
@@ -623,7 +624,7 @@ namespace OpenSim.Region.Environment.Scenes
623 { 624 {
624 //TODO: following line is hard coded to port 9000, really need to change this as soon as possible 625 //TODO: following line is hard coded to port 9000, really need to change this as soon as possible
625 AgentCircuitData circuitdata = this.ControllingClient.RequestClientInfo(); 626 AgentCircuitData circuitdata = this.ControllingClient.RequestClientInfo();
626 string capsPath = "http://" + neighbourRegion.ExternalEndPoint.Address.ToString() + ":9000/CAPS/" +this.m_scene.AuthenticateHandler.AgentCircuits[circuitdata.circuitcode].CapsPath + "0000/"; 627 string capsPath = Util.GetCapsURL(this.ControllingClient.AgentId);
627 this.ControllingClient.CrossRegion(neighbourHandle, newpos, vel, neighbourRegion.ExternalEndPoint, capsPath); 628 this.ControllingClient.CrossRegion(neighbourHandle, newpos, vel, neighbourRegion.ExternalEndPoint, capsPath);
628 this.MakeChildAgent(); 629 this.MakeChildAgent();
629 } 630 }