aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid
diff options
context:
space:
mode:
authorMW2007-08-13 16:24:12 +0000
committerMW2007-08-13 16:24:12 +0000
commit9cd64931d6067155c0214c62673f4196e251e7f7 (patch)
tree8f911ad80ffe2ad3aa356a5f8f285d99e899786d /OpenSim/Grid
parentSeparated Login Service from usermanager, which helps to clean up the code a ... (diff)
downloadopensim-SC_OLD-9cd64931d6067155c0214c62673f4196e251e7f7.zip
opensim-SC_OLD-9cd64931d6067155c0214c62673f4196e251e7f7.tar.gz
opensim-SC_OLD-9cd64931d6067155c0214c62673f4196e251e7f7.tar.bz2
opensim-SC_OLD-9cd64931d6067155c0214c62673f4196e251e7f7.tar.xz
oops , guess I should include the new files next time
Diffstat (limited to 'OpenSim/Grid')
-rw-r--r--OpenSim/Grid/UserServer/UserLoginService.cs80
1 files changed, 80 insertions, 0 deletions
diff --git a/OpenSim/Grid/UserServer/UserLoginService.cs b/OpenSim/Grid/UserServer/UserLoginService.cs
new file mode 100644
index 0000000..57652b0
--- /dev/null
+++ b/OpenSim/Grid/UserServer/UserLoginService.cs
@@ -0,0 +1,80 @@
1using System;
2using System.Collections;
3using System.Net;
4using Nwc.XmlRpc;
5using OpenSim.Framework.Data;
6using OpenSim.Framework.UserManagement;
7using OpenSim.Framework.Utilities;
8using OpenSim.Framework.Configuration;
9
10namespace OpenSim.Grid.UserServer
11{
12 public class UserLoginService : LoginService
13 {
14 public UserConfig m_config;
15
16 public UserLoginService(UserManagerBase userManager, UserConfig config, string welcomeMess)
17 : base(userManager, welcomeMess)
18 {
19 m_config = config;
20 }
21
22 /// <summary>
23 /// Customises the login response and fills in missing values.
24 /// </summary>
25 /// <param name="response">The existing response</param>
26 /// <param name="theUser">The user profile</param>
27 public override void CustomiseResponse(LoginResponse response, UserProfileData theUser)
28 {
29 // Load information from the gridserver
30 SimProfileData SimInfo = new SimProfileData();
31 SimInfo = SimInfo.RequestSimProfileData(theUser.currentAgent.currentHandle, m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey);
32
33 // Customise the response
34 // Home Location
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() + "], " +
37 "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}";
38
39 // Destination
40 Console.WriteLine("CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + "; Region Y: " + SimInfo.regionLocY);
41 response.SimAddress = Util.GetHostFromDNS(SimInfo.serverIP).ToString();
42 response.SimPort = (Int32)SimInfo.serverPort;
43 response.RegionX = SimInfo.regionLocX;
44 response.RegionY = SimInfo.regionLocY;
45
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();
48 response.SeedCapability = SimInfo.httpServerURI + "CAPS/" + capsPath + "0000/";
49
50 // Notify the target of an incoming user
51 Console.WriteLine("Notifying " + SimInfo.regionName + " (" + SimInfo.serverURI + ")");
52
53 // Prepare notification
54 Hashtable SimParams = new Hashtable();
55 SimParams["session_id"] = theUser.currentAgent.sessionID.ToString();
56 SimParams["secure_session_id"] = theUser.currentAgent.secureSessionID.ToString();
57 SimParams["firstname"] = theUser.username;
58 SimParams["lastname"] = theUser.surname;
59 SimParams["agent_id"] = theUser.UUID.ToString();
60 SimParams["circuit_code"] = (Int32)Convert.ToUInt32(response.CircuitCode);
61 SimParams["startpos_x"] = theUser.currentAgent.currentPos.X.ToString();
62 SimParams["startpos_y"] = theUser.currentAgent.currentPos.Y.ToString();
63 SimParams["startpos_z"] = theUser.currentAgent.currentPos.Z.ToString();
64 SimParams["regionhandle"] = theUser.currentAgent.currentHandle.ToString();
65 SimParams["caps_path"] = capsPath;
66 ArrayList SendParams = new ArrayList();
67 SendParams.Add(SimParams);
68
69 // Update agent with target sim
70 theUser.currentAgent.currentRegion = SimInfo.UUID;
71 theUser.currentAgent.currentHandle = SimInfo.regionHandle;
72
73 System.Console.WriteLine("Informing region --> " + SimInfo.httpServerURI);
74 // Send
75 XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams);
76 XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 3000);
77 }
78 }
79}
80