diff options
author | MW | 2007-06-27 15:28:52 +0000 |
---|---|---|
committer | MW | 2007-06-27 15:28:52 +0000 |
commit | 646bbbc84b8010e0dacbeed5342cdb045f46cc49 (patch) | |
tree | 770b34d19855363c3c113ab9a0af9a56d821d887 /OpenSim/Grid/UserServer/UserManager.cs | |
download | opensim-SC-646bbbc84b8010e0dacbeed5342cdb045f46cc49.zip opensim-SC-646bbbc84b8010e0dacbeed5342cdb045f46cc49.tar.gz opensim-SC-646bbbc84b8010e0dacbeed5342cdb045f46cc49.tar.bz2 opensim-SC-646bbbc84b8010e0dacbeed5342cdb045f46cc49.tar.xz |
Some work on restructuring the namespaces / project names. Note this doesn't compile yet as not all the code has been changed to use the new namespaces. Am committing it now for feedback on the namespaces.
Diffstat (limited to 'OpenSim/Grid/UserServer/UserManager.cs')
-rw-r--r-- | OpenSim/Grid/UserServer/UserManager.cs | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/OpenSim/Grid/UserServer/UserManager.cs b/OpenSim/Grid/UserServer/UserManager.cs new file mode 100644 index 0000000..0704de1 --- /dev/null +++ b/OpenSim/Grid/UserServer/UserManager.cs | |||
@@ -0,0 +1,103 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | using OpenGrid.Framework.Data; | ||
33 | using libsecondlife; | ||
34 | using System.Reflection; | ||
35 | |||
36 | using System.Xml; | ||
37 | using Nwc.XmlRpc; | ||
38 | using OpenSim.Framework.Sims; | ||
39 | using OpenSim.Framework.Inventory; | ||
40 | using OpenSim.Framework.Utilities; | ||
41 | using OpenGrid.Framework.UserManagement; | ||
42 | |||
43 | using System.Security.Cryptography; | ||
44 | |||
45 | namespace OpenGridServices.UserServer | ||
46 | { | ||
47 | public class UserManager : UserManagerBase | ||
48 | { | ||
49 | public UserManager() | ||
50 | { | ||
51 | } | ||
52 | |||
53 | /// <summary> | ||
54 | /// Customises the login response and fills in missing values. | ||
55 | /// </summary> | ||
56 | /// <param name="response">The existing response</param> | ||
57 | /// <param name="theUser">The user profile</param> | ||
58 | public override void CustomiseResponse(ref LoginResponse response, ref UserProfileData theUser) | ||
59 | { | ||
60 | // Load information from the gridserver | ||
61 | SimProfile SimInfo = new SimProfile(); | ||
62 | SimInfo = SimInfo.LoadFromGrid(theUser.currentAgent.currentHandle, _config.GridServerURL, _config.GridSendKey, _config.GridRecvKey); | ||
63 | |||
64 | // Customise the response | ||
65 | // Home Location | ||
66 | response.Home = "{'region_handle':[r" + (SimInfo.RegionLocX * 256).ToString() + ",r" + (SimInfo.RegionLocY * 256).ToString() + "], " + | ||
67 | "'position':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " + | ||
68 | "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}"; | ||
69 | |||
70 | // Destination | ||
71 | response.SimAddress = SimInfo.sim_ip; | ||
72 | response.SimPort = (Int32)SimInfo.sim_port; | ||
73 | response.RegionX = SimInfo.RegionLocY ; | ||
74 | response.RegionY = SimInfo.RegionLocX ; | ||
75 | |||
76 | // Notify the target of an incoming user | ||
77 | Console.WriteLine("Notifying " + SimInfo.regionname + " (" + SimInfo.caps_url + ")"); | ||
78 | |||
79 | // Prepare notification | ||
80 | Hashtable SimParams = new Hashtable(); | ||
81 | SimParams["session_id"] = theUser.currentAgent.sessionID.ToString(); | ||
82 | SimParams["secure_session_id"] = theUser.currentAgent.secureSessionID.ToString(); | ||
83 | SimParams["firstname"] = theUser.username; | ||
84 | SimParams["lastname"] = theUser.surname; | ||
85 | SimParams["agent_id"] = theUser.UUID.ToString(); | ||
86 | SimParams["circuit_code"] = (Int32)Convert.ToUInt32(response.CircuitCode); | ||
87 | SimParams["startpos_x"] = theUser.currentAgent.currentPos.X.ToString(); | ||
88 | SimParams["startpos_y"] = theUser.currentAgent.currentPos.Y.ToString(); | ||
89 | SimParams["startpos_z"] = theUser.currentAgent.currentPos.Z.ToString(); | ||
90 | SimParams["regionhandle"] = theUser.currentAgent.currentHandle.ToString(); | ||
91 | ArrayList SendParams = new ArrayList(); | ||
92 | SendParams.Add(SimParams); | ||
93 | |||
94 | // Update agent with target sim | ||
95 | theUser.currentAgent.currentRegion = SimInfo.UUID; | ||
96 | theUser.currentAgent.currentHandle = SimInfo.regionhandle; | ||
97 | |||
98 | // Send | ||
99 | XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams); | ||
100 | XmlRpcResponse GridResp = GridReq.Send(SimInfo.caps_url, 3000); | ||
101 | } | ||
102 | } | ||
103 | } | ||