diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Grid/UserServer/UserLoginService.cs | 160 |
1 files changed, 80 insertions, 80 deletions
diff --git a/OpenSim/Grid/UserServer/UserLoginService.cs b/OpenSim/Grid/UserServer/UserLoginService.cs index 57652b0..3820575 100644 --- a/OpenSim/Grid/UserServer/UserLoginService.cs +++ b/OpenSim/Grid/UserServer/UserLoginService.cs | |||
@@ -1,80 +1,80 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections; | 2 | using System.Collections; |
3 | using System.Net; | 3 | using System.Net; |
4 | using Nwc.XmlRpc; | 4 | using Nwc.XmlRpc; |
5 | using OpenSim.Framework.Data; | 5 | using OpenSim.Framework.Data; |
6 | using OpenSim.Framework.UserManagement; | 6 | using OpenSim.Framework.UserManagement; |
7 | using OpenSim.Framework.Utilities; | 7 | using OpenSim.Framework.Utilities; |
8 | using OpenSim.Framework.Configuration; | 8 | using OpenSim.Framework.Configuration; |
9 | 9 | ||
10 | namespace OpenSim.Grid.UserServer | 10 | namespace OpenSim.Grid.UserServer |
11 | { | 11 | { |
12 | public class UserLoginService : LoginService | 12 | public class UserLoginService : LoginService |
13 | { | 13 | { |
14 | public UserConfig m_config; | 14 | public UserConfig m_config; |
15 | 15 | ||
16 | public UserLoginService(UserManagerBase userManager, UserConfig config, string welcomeMess) | 16 | public UserLoginService(UserManagerBase userManager, UserConfig config, string welcomeMess) |
17 | : base(userManager, welcomeMess) | 17 | : base(userManager, welcomeMess) |
18 | { | 18 | { |
19 | m_config = config; | 19 | m_config = config; |
20 | } | 20 | } |
21 | 21 | ||
22 | /// <summary> | 22 | /// <summary> |
23 | /// Customises the login response and fills in missing values. | 23 | /// Customises the login response and fills in missing values. |
24 | /// </summary> | 24 | /// </summary> |
25 | /// <param name="response">The existing response</param> | 25 | /// <param name="response">The existing response</param> |
26 | /// <param name="theUser">The user profile</param> | 26 | /// <param name="theUser">The user profile</param> |
27 | public override void CustomiseResponse(LoginResponse response, UserProfileData theUser) | 27 | public override void CustomiseResponse(LoginResponse response, UserProfileData theUser) |
28 | { | 28 | { |
29 | // Load information from the gridserver | 29 | // Load information from the gridserver |
30 | SimProfileData SimInfo = new SimProfileData(); | 30 | SimProfileData SimInfo = new SimProfileData(); |
31 | SimInfo = SimInfo.RequestSimProfileData(theUser.currentAgent.currentHandle, m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey); | 31 | SimInfo = SimInfo.RequestSimProfileData(theUser.currentAgent.currentHandle, m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey); |
32 | 32 | ||
33 | // Customise the response | 33 | // Customise the response |
34 | // Home Location | 34 | // Home Location |
35 | response.Home = "{'region_handle':[r" + (SimInfo.regionLocX * 256).ToString() + ",r" + (SimInfo.regionLocY * 256).ToString() + "], " + | 35 | response.Home = "{'region_handle':[r" + (SimInfo.regionLocX * 256).ToString() + ",r" + (SimInfo.regionLocY * 256).ToString() + "], " + |
36 | "'position':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " + | 36 | "'position':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " + |
37 | "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}"; | 37 | "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}"; |
38 | 38 | ||
39 | // Destination | 39 | // Destination |
40 | Console.WriteLine("CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + "; Region Y: " + SimInfo.regionLocY); | 40 | Console.WriteLine("CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + "; Region Y: " + SimInfo.regionLocY); |
41 | response.SimAddress = Util.GetHostFromDNS(SimInfo.serverIP).ToString(); | 41 | response.SimAddress = Util.GetHostFromDNS(SimInfo.serverIP).ToString(); |
42 | response.SimPort = (Int32)SimInfo.serverPort; | 42 | response.SimPort = (Int32)SimInfo.serverPort; |
43 | response.RegionX = SimInfo.regionLocX; | 43 | response.RegionX = SimInfo.regionLocX; |
44 | response.RegionY = SimInfo.regionLocY; | 44 | response.RegionY = SimInfo.regionLocY; |
45 | 45 | ||
46 | //Not sure if the + "/CAPS/" should in fact be +"CAPS/" depending if there is already a / as part of httpServerURI | 46 | //Not sure if the + "/CAPS/" should in fact be +"CAPS/" depending if there is already a / as part of httpServerURI |
47 | string capsPath = Util.GetRandomCapsPath(); | 47 | string capsPath = Util.GetRandomCapsPath(); |
48 | response.SeedCapability = SimInfo.httpServerURI + "CAPS/" + capsPath + "0000/"; | 48 | response.SeedCapability = SimInfo.httpServerURI + "CAPS/" + capsPath + "0000/"; |
49 | 49 | ||
50 | // Notify the target of an incoming user | 50 | // Notify the target of an incoming user |
51 | Console.WriteLine("Notifying " + SimInfo.regionName + " (" + SimInfo.serverURI + ")"); | 51 | Console.WriteLine("Notifying " + SimInfo.regionName + " (" + SimInfo.serverURI + ")"); |
52 | 52 | ||
53 | // Prepare notification | 53 | // Prepare notification |
54 | Hashtable SimParams = new Hashtable(); | 54 | Hashtable SimParams = new Hashtable(); |
55 | SimParams["session_id"] = theUser.currentAgent.sessionID.ToString(); | 55 | SimParams["session_id"] = theUser.currentAgent.sessionID.ToString(); |
56 | SimParams["secure_session_id"] = theUser.currentAgent.secureSessionID.ToString(); | 56 | SimParams["secure_session_id"] = theUser.currentAgent.secureSessionID.ToString(); |
57 | SimParams["firstname"] = theUser.username; | 57 | SimParams["firstname"] = theUser.username; |
58 | SimParams["lastname"] = theUser.surname; | 58 | SimParams["lastname"] = theUser.surname; |
59 | SimParams["agent_id"] = theUser.UUID.ToString(); | 59 | SimParams["agent_id"] = theUser.UUID.ToString(); |
60 | SimParams["circuit_code"] = (Int32)Convert.ToUInt32(response.CircuitCode); | 60 | SimParams["circuit_code"] = (Int32)Convert.ToUInt32(response.CircuitCode); |
61 | SimParams["startpos_x"] = theUser.currentAgent.currentPos.X.ToString(); | 61 | SimParams["startpos_x"] = theUser.currentAgent.currentPos.X.ToString(); |
62 | SimParams["startpos_y"] = theUser.currentAgent.currentPos.Y.ToString(); | 62 | SimParams["startpos_y"] = theUser.currentAgent.currentPos.Y.ToString(); |
63 | SimParams["startpos_z"] = theUser.currentAgent.currentPos.Z.ToString(); | 63 | SimParams["startpos_z"] = theUser.currentAgent.currentPos.Z.ToString(); |
64 | SimParams["regionhandle"] = theUser.currentAgent.currentHandle.ToString(); | 64 | SimParams["regionhandle"] = theUser.currentAgent.currentHandle.ToString(); |
65 | SimParams["caps_path"] = capsPath; | 65 | SimParams["caps_path"] = capsPath; |
66 | ArrayList SendParams = new ArrayList(); | 66 | ArrayList SendParams = new ArrayList(); |
67 | SendParams.Add(SimParams); | 67 | SendParams.Add(SimParams); |
68 | 68 | ||
69 | // Update agent with target sim | 69 | // Update agent with target sim |
70 | theUser.currentAgent.currentRegion = SimInfo.UUID; | 70 | theUser.currentAgent.currentRegion = SimInfo.UUID; |
71 | theUser.currentAgent.currentHandle = SimInfo.regionHandle; | 71 | theUser.currentAgent.currentHandle = SimInfo.regionHandle; |
72 | 72 | ||
73 | System.Console.WriteLine("Informing region --> " + SimInfo.httpServerURI); | 73 | System.Console.WriteLine("Informing region --> " + SimInfo.httpServerURI); |
74 | // Send | 74 | // Send |
75 | XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams); | 75 | XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams); |
76 | XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 3000); | 76 | XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 3000); |
77 | } | 77 | } |
78 | } | 78 | } |
79 | } | 79 | } |
80 | 80 | ||