aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid/UserServer/UserLoginService.cs
diff options
context:
space:
mode:
authorlbsa712007-10-05 10:14:42 +0000
committerlbsa712007-10-05 10:14:42 +0000
commit5a6552120395611e66a88821ce848a06c9ea4720 (patch)
treed23780998986524b160ba97292022809efcff0bc /OpenSim/Grid/UserServer/UserLoginService.cs
parent* ignored ScriptServer/bin (diff)
downloadopensim-SC_OLD-5a6552120395611e66a88821ce848a06c9ea4720.zip
opensim-SC_OLD-5a6552120395611e66a88821ce848a06c9ea4720.tar.gz
opensim-SC_OLD-5a6552120395611e66a88821ce848a06c9ea4720.tar.bz2
opensim-SC_OLD-5a6552120395611e66a88821ce848a06c9ea4720.tar.xz
== The "right name and place" commit ==
* Moved InventoryData to Framework.Types/InventoryItemBase.cs * Moved UserData to Framework.Interfaces/IUserData.cs * Moved UserProfileData to Framework/Types/UserProfileData.cs * Deleted ass-backwards Framework dependency on Framework.Data (now it's the other way round) * Changed some namespaces to reflect file structure
Diffstat (limited to 'OpenSim/Grid/UserServer/UserLoginService.cs')
-rw-r--r--OpenSim/Grid/UserServer/UserLoginService.cs161
1 files changed, 81 insertions, 80 deletions
diff --git a/OpenSim/Grid/UserServer/UserLoginService.cs b/OpenSim/Grid/UserServer/UserLoginService.cs
index 95192e3..b42427b 100644
--- a/OpenSim/Grid/UserServer/UserLoginService.cs
+++ b/OpenSim/Grid/UserServer/UserLoginService.cs
@@ -1,83 +1,84 @@
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;
9 9using OpenSim.Framework.Types;
10namespace OpenSim.Grid.UserServer 10
11{ 11namespace OpenSim.Grid.UserServer
12 public class UserLoginService : LoginService 12{
13 { 13 public class UserLoginService : LoginService
14 public UserConfig m_config; 14 {
15 15 public UserConfig m_config;
16 public UserLoginService(UserManagerBase userManager, UserConfig config, string welcomeMess) 16
17 : base(userManager, welcomeMess) 17 public UserLoginService(UserManagerBase userManager, UserConfig config, string welcomeMess)
18 { 18 : base(userManager, welcomeMess)
19 m_config = config; 19 {
20 } 20 m_config = config;
21 21 }
22 /// <summary> 22
23 /// Customises the login response and fills in missing values. 23 /// <summary>
24 /// </summary> 24 /// Customises the login response and fills in missing values.
25 /// <param name="response">The existing response</param> 25 /// </summary>
26 /// <param name="theUser">The user profile</param> 26 /// <param name="response">The existing response</param>
27 public override void CustomiseResponse(LoginResponse response, UserProfileData theUser) 27 /// <param name="theUser">The user profile</param>
28 { 28 public override void CustomiseResponse(LoginResponse response, UserProfileData theUser)
29 // Load information from the gridserver 29 {
30 SimProfileData SimInfo = new SimProfileData(); 30 // Load information from the gridserver
31 SimInfo = SimInfo.RequestSimProfileData(theUser.currentAgent.currentHandle, m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey); 31 SimProfileData SimInfo = new SimProfileData();
32 32 SimInfo = SimInfo.RequestSimProfileData(theUser.currentAgent.currentHandle, m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey);
33 // Customise the response 33
34 // Home Location 34 // Customise the response
35 response.Home = "{'region_handle':[r" + (SimInfo.regionLocX * 256).ToString() + ",r" + (SimInfo.regionLocY * 256).ToString() + "], " + 35 // Home Location
36 "'position':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " + 36 response.Home = "{'region_handle':[r" + (SimInfo.regionLocX * 256).ToString() + ",r" + (SimInfo.regionLocY * 256).ToString() + "], " +
37 "'look_at':[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 38 "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}";
39 // Destination 39
40 Console.WriteLine("CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + "; Region Y: " + SimInfo.regionLocY); 40 // Destination
41 response.SimAddress = Util.GetHostFromDNS(SimInfo.serverIP).ToString(); 41 Console.WriteLine("CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + "; Region Y: " + SimInfo.regionLocY);
42 response.SimPort = (Int32)SimInfo.serverPort; 42 response.SimAddress = Util.GetHostFromDNS(SimInfo.serverIP).ToString();
43 response.RegionX = SimInfo.regionLocX; 43 response.SimPort = (Int32)SimInfo.serverPort;
44 response.RegionY = SimInfo.regionLocY; 44 response.RegionX = SimInfo.regionLocX;
45 45 response.RegionY = SimInfo.regionLocY;
46 //Not sure if the + "/CAPS/" should in fact be +"CAPS/" depending if there is already a / as part of httpServerURI 46
47 string capsPath = Util.GetRandomCapsPath(); 47 //Not sure if the + "/CAPS/" should in fact be +"CAPS/" depending if there is already a / as part of httpServerURI
48 response.SeedCapability = SimInfo.httpServerURI + "CAPS/" + capsPath + "0000/"; 48 string capsPath = Util.GetRandomCapsPath();
49 49 response.SeedCapability = SimInfo.httpServerURI + "CAPS/" + capsPath + "0000/";
50 // Notify the target of an incoming user 50
51 Console.WriteLine("Notifying " + SimInfo.regionName + " (" + SimInfo.serverURI + ")"); 51 // Notify the target of an incoming user
52 52 Console.WriteLine("Notifying " + SimInfo.regionName + " (" + SimInfo.serverURI + ")");
53 // Prepare notification 53
54 Hashtable SimParams = new Hashtable(); 54 // Prepare notification
55 SimParams["session_id"] = theUser.currentAgent.sessionID.ToString(); 55 Hashtable SimParams = new Hashtable();
56 SimParams["secure_session_id"] = theUser.currentAgent.secureSessionID.ToString(); 56 SimParams["session_id"] = theUser.currentAgent.sessionID.ToString();
57 SimParams["firstname"] = theUser.username; 57 SimParams["secure_session_id"] = theUser.currentAgent.secureSessionID.ToString();
58 SimParams["lastname"] = theUser.surname; 58 SimParams["firstname"] = theUser.username;
59 SimParams["agent_id"] = theUser.UUID.ToString(); 59 SimParams["lastname"] = theUser.surname;
60 SimParams["circuit_code"] = (Int32)Convert.ToUInt32(response.CircuitCode); 60 SimParams["agent_id"] = theUser.UUID.ToString();
61 SimParams["startpos_x"] = theUser.currentAgent.currentPos.X.ToString(); 61 SimParams["circuit_code"] = (Int32)Convert.ToUInt32(response.CircuitCode);
62 SimParams["startpos_y"] = theUser.currentAgent.currentPos.Y.ToString(); 62 SimParams["startpos_x"] = theUser.currentAgent.currentPos.X.ToString();
63 SimParams["startpos_z"] = theUser.currentAgent.currentPos.Z.ToString(); 63 SimParams["startpos_y"] = theUser.currentAgent.currentPos.Y.ToString();
64 SimParams["regionhandle"] = theUser.currentAgent.currentHandle.ToString(); 64 SimParams["startpos_z"] = theUser.currentAgent.currentPos.Z.ToString();
65 SimParams["caps_path"] = capsPath; 65 SimParams["regionhandle"] = theUser.currentAgent.currentHandle.ToString();
66 ArrayList SendParams = new ArrayList(); 66 SimParams["caps_path"] = capsPath;
67 SendParams.Add(SimParams); 67 ArrayList SendParams = new ArrayList();
68 68 SendParams.Add(SimParams);
69 // Update agent with target sim 69
70 theUser.currentAgent.currentRegion = SimInfo.UUID; 70 // Update agent with target sim
71 theUser.currentAgent.currentHandle = SimInfo.regionHandle; 71 theUser.currentAgent.currentRegion = SimInfo.UUID;
72 72 theUser.currentAgent.currentHandle = SimInfo.regionHandle;
73 System.Console.WriteLine("Informing region --> " + SimInfo.httpServerURI); 73
74 System.Console.WriteLine("Informing region --> " + SimInfo.httpServerURI);
74 // Send 75 // Send
75 try 76 try
76 { 77 {
77 XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams); 78 XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams);
78 XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000); 79 XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000);
79 } 80 }
80 catch( WebException e ) 81 catch( WebException e )
81 { 82 {
82 switch( e.Status ) 83 switch( e.Status )
83 { 84 {
@@ -88,8 +89,8 @@ namespace OpenSim.Grid.UserServer
88 default: 89 default:
89 throw; 90 throw;
90 } 91 }
91 } 92 }
92 } 93 }
93 } 94 }
94} 95}
95 96