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