aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim.Servers/LocalUserProfileManager.cs
diff options
context:
space:
mode:
authorMW2007-04-11 13:40:29 +0000
committerMW2007-04-11 13:40:29 +0000
commitbea8e2b82654b558f7131fa262a613de62df9124 (patch)
treeec59130668dee7cff27fcc49925ae64bf7997bb7 /OpenSim.Servers/LocalUserProfileManager.cs
parentThought OpenSim.Config had been deleted a long time ago. (diff)
downloadopensim-SC-bea8e2b82654b558f7131fa262a613de62df9124.zip
opensim-SC-bea8e2b82654b558f7131fa262a613de62df9124.tar.gz
opensim-SC-bea8e2b82654b558f7131fa262a613de62df9124.tar.bz2
opensim-SC-bea8e2b82654b558f7131fa262a613de62df9124.tar.xz
Renamed the Servers directory to OpenSim.Servers
Diffstat (limited to 'OpenSim.Servers/LocalUserProfileManager.cs')
-rw-r--r--OpenSim.Servers/LocalUserProfileManager.cs109
1 files changed, 109 insertions, 0 deletions
diff --git a/OpenSim.Servers/LocalUserProfileManager.cs b/OpenSim.Servers/LocalUserProfileManager.cs
new file mode 100644
index 0000000..6166e02
--- /dev/null
+++ b/OpenSim.Servers/LocalUserProfileManager.cs
@@ -0,0 +1,109 @@
1/*
2* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
3*
4* Redistribution and use in source and binary forms, with or without
5* modification, are permitted provided that the following conditions are met:
6* * Redistributions of source code must retain the above copyright
7* notice, this list of conditions and the following disclaimer.
8* * Redistributions in binary form must reproduce the above copyright
9* notice, this list of conditions and the following disclaimer in the
10* documentation and/or other materials provided with the distribution.
11* * Neither the name of the <organization> nor the
12* names of its contributors may be used to endorse or promote products
13* derived from this software without specific prior written permission.
14*
15* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
16* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
19* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25*
26*/
27
28using System;
29using System.Collections.Generic;
30using System.Collections;
31using System.Text;
32using OpenSim.Framework.User;
33using OpenSim.Framework.Grid;
34using OpenSim.Framework.Inventory;
35using OpenSim.Framework.Interfaces;
36using libsecondlife;
37
38namespace OpenSim.UserServer
39{
40 public class LocalUserProfileManager : UserProfileManager
41 {
42 private IGridServer m_gridServer;
43 private int m_port;
44 private string m_ipAddr;
45
46 public LocalUserProfileManager(IGridServer gridServer, int simPort, string ipAddr)
47 {
48 m_gridServer = gridServer;
49 m_port = simPort;
50 m_ipAddr = ipAddr;
51 }
52
53 public override void InitUserProfiles()
54 {
55 // TODO: need to load from database
56 }
57
58 public override void CustomiseResponse(ref System.Collections.Hashtable response, UserProfile theUser)
59 {
60 Int32 circode = (Int32)response["circuit_code"];
61 theUser.AddSimCircuit((uint)circode, LLUUID.Random());
62 response["home"] = "{'region_handle':[r" + (997 * 256).ToString() + ",r" + (996 * 256).ToString() + "], 'position':[r" + theUser.homepos.X.ToString() + ",r" + theUser.homepos.Y.ToString() + ",r" + theUser.homepos.Z.ToString() + "], 'look_at':[r" + theUser.homelookat.X.ToString() + ",r" + theUser.homelookat.Y.ToString() + ",r" + theUser.homelookat.Z.ToString() + "]}";
63 response["sim_port"] = m_port;
64 response["sim_ip"] = m_ipAddr;
65 response["region_y"] = (Int32)996 * 256;
66 response["region_x"] = (Int32)997* 256;
67
68 string first;
69 string last;
70 if (response.Contains("first_name"))
71 {
72 first = (string)response["first_name"];
73 }
74 else
75 {
76 first = "test";
77 }
78
79 if (response.Contains("last_name"))
80 {
81 last = (string)response["last_name"];
82 }
83 else
84 {
85 last = "User";
86 }
87
88 ArrayList InventoryList = (ArrayList)response["inventory-skeleton"];
89 Hashtable Inventory1 = (Hashtable)InventoryList[0];
90
91 Login _login = new Login();
92 //copy data to login object
93 _login.First = first;
94 _login.Last = last;
95 _login.Agent = new LLUUID((string)response["agent_id"]) ;
96 _login.Session = new LLUUID((string)response["session_id"]);
97 _login.SecureSession = new LLUUID((string)response["secure_session_id"]);
98 _login.BaseFolder = null;
99 _login.InventoryFolder = new LLUUID((string)Inventory1["folder_id"]);
100
101 //working on local computer if so lets add to the gridserver's list of sessions?
102 if (m_gridServer.GetName() == "Local")
103 {
104 Console.WriteLine("adding login data to gridserver");
105 ((LocalGridBase)this.m_gridServer).AddNewSession(_login);
106 }
107 }
108 }
109}