diff options
Diffstat (limited to 'OpenSim/Region/Communications/Local/LocalUserServices.cs')
-rw-r--r-- | OpenSim/Region/Communications/Local/LocalUserServices.cs | 284 |
1 files changed, 142 insertions, 142 deletions
diff --git a/OpenSim/Region/Communications/Local/LocalUserServices.cs b/OpenSim/Region/Communications/Local/LocalUserServices.cs index 592b36c..a4cefc4 100644 --- a/OpenSim/Region/Communications/Local/LocalUserServices.cs +++ b/OpenSim/Region/Communications/Local/LocalUserServices.cs | |||
@@ -1,142 +1,142 @@ | |||
1 | using System; | 1 | using System; |
2 | using libsecondlife; | 2 | using libsecondlife; |
3 | using OpenSim.Framework.Communications; | 3 | using OpenSim.Framework.Communications; |
4 | using OpenSim.Framework.Data; | 4 | using OpenSim.Framework.Data; |
5 | using OpenSim.Framework.Types; | 5 | using OpenSim.Framework.Types; |
6 | using OpenSim.Framework.UserManagement; | 6 | using OpenSim.Framework.UserManagement; |
7 | using OpenSim.Framework.Utilities; | 7 | using OpenSim.Framework.Utilities; |
8 | 8 | ||
9 | namespace OpenSim.Region.Communications.Local | 9 | namespace OpenSim.Region.Communications.Local |
10 | { | 10 | { |
11 | public class LocalUserServices : UserManagerBase, IUserServices | 11 | public class LocalUserServices : UserManagerBase, IUserServices |
12 | { | 12 | { |
13 | private CommunicationsLocal m_Parent; | 13 | private CommunicationsLocal m_Parent; |
14 | 14 | ||
15 | private NetworkServersInfo serversInfo; | 15 | private NetworkServersInfo serversInfo; |
16 | private uint defaultHomeX ; | 16 | private uint defaultHomeX ; |
17 | private uint defaultHomeY; | 17 | private uint defaultHomeY; |
18 | public LocalUserServices(CommunicationsLocal parent, NetworkServersInfo serversData) | 18 | public LocalUserServices(CommunicationsLocal parent, NetworkServersInfo serversData) |
19 | { | 19 | { |
20 | m_Parent = parent; | 20 | m_Parent = parent; |
21 | this.serversInfo = serversData; | 21 | this.serversInfo = serversData; |
22 | defaultHomeX = this.serversInfo.DefaultHomeLocX; | 22 | defaultHomeX = this.serversInfo.DefaultHomeLocX; |
23 | defaultHomeY = this.serversInfo.DefaultHomeLocY; | 23 | defaultHomeY = this.serversInfo.DefaultHomeLocY; |
24 | } | 24 | } |
25 | 25 | ||
26 | public UserProfileData GetUserProfile(string firstName, string lastName) | 26 | public UserProfileData GetUserProfile(string firstName, string lastName) |
27 | { | 27 | { |
28 | return GetUserProfile(firstName + " " + lastName); | 28 | return GetUserProfile(firstName + " " + lastName); |
29 | } | 29 | } |
30 | 30 | ||
31 | public UserProfileData GetUserProfile(string name) | 31 | public UserProfileData GetUserProfile(string name) |
32 | { | 32 | { |
33 | return this.getUserProfile(name); | 33 | return this.getUserProfile(name); |
34 | } | 34 | } |
35 | 35 | ||
36 | public UserProfileData GetUserProfile(LLUUID avatarID) | 36 | public UserProfileData GetUserProfile(LLUUID avatarID) |
37 | { | 37 | { |
38 | return this.getUserProfile(avatarID); | 38 | return this.getUserProfile(avatarID); |
39 | } | 39 | } |
40 | 40 | ||
41 | /// <summary> | 41 | /// <summary> |
42 | /// | 42 | /// |
43 | /// </summary> | 43 | /// </summary> |
44 | /// <returns></returns> | 44 | /// <returns></returns> |
45 | public override string GetMessage() | 45 | public override string GetMessage() |
46 | { | 46 | { |
47 | return "Welcome to OpenSim"; | 47 | return "Welcome to OpenSim"; |
48 | } | 48 | } |
49 | 49 | ||
50 | public override UserProfileData GetTheUser(string firstname, string lastname) | 50 | public override UserProfileData GetTheUser(string firstname, string lastname) |
51 | { | 51 | { |
52 | UserProfileData profile = getUserProfile(firstname, lastname); | 52 | UserProfileData profile = getUserProfile(firstname, lastname); |
53 | if (profile != null) | 53 | if (profile != null) |
54 | { | 54 | { |
55 | 55 | ||
56 | return profile; | 56 | return profile; |
57 | } | 57 | } |
58 | 58 | ||
59 | //no current user account so make one | 59 | //no current user account so make one |
60 | Console.WriteLine("No User account found so creating a new one "); | 60 | Console.WriteLine("No User account found so creating a new one "); |
61 | this.AddUserProfile(firstname, lastname, "test", defaultHomeX, defaultHomeY); | 61 | this.AddUserProfile(firstname, lastname, "test", defaultHomeX, defaultHomeY); |
62 | 62 | ||
63 | profile = getUserProfile(firstname, lastname); | 63 | profile = getUserProfile(firstname, lastname); |
64 | 64 | ||
65 | return profile; | 65 | return profile; |
66 | } | 66 | } |
67 | 67 | ||
68 | public override bool AuthenticateUser(UserProfileData profile, string password) | 68 | public override bool AuthenticateUser(UserProfileData profile, string password) |
69 | { | 69 | { |
70 | //for now we will accept any password in sandbox mode | 70 | //for now we will accept any password in sandbox mode |
71 | Console.WriteLine("authorising user"); | 71 | Console.WriteLine("authorising user"); |
72 | return true; | 72 | return true; |
73 | } | 73 | } |
74 | 74 | ||
75 | public override void CustomiseResponse(LoginResponse response, UserProfileData theUser) | 75 | public override void CustomiseResponse(LoginResponse response, UserProfileData theUser) |
76 | { | 76 | { |
77 | ulong currentRegion = theUser.currentAgent.currentHandle; | 77 | ulong currentRegion = theUser.currentAgent.currentHandle; |
78 | RegionInfo reg = m_Parent.GridServer.RequestNeighbourInfo(currentRegion); | 78 | RegionInfo reg = m_Parent.GridServer.RequestNeighbourInfo(currentRegion); |
79 | 79 | ||
80 | if (reg != null) | 80 | if (reg != null) |
81 | { | 81 | { |
82 | response.Home = "{'region_handle':[r" + (reg.RegionLocX * 256).ToString() + ",r" + (reg.RegionLocY * 256).ToString() + "], " + | 82 | response.Home = "{'region_handle':[r" + (reg.RegionLocX * 256).ToString() + ",r" + (reg.RegionLocY * 256).ToString() + "], " + |
83 | "'position':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " + | 83 | "'position':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " + |
84 | "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}"; | 84 | "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}"; |
85 | string capsPath = Util.GetRandomCapsPath(); | 85 | string capsPath = Util.GetRandomCapsPath(); |
86 | response.SimAddress = reg.ExternalEndPoint.Address.ToString(); | 86 | response.SimAddress = reg.ExternalEndPoint.Address.ToString(); |
87 | response.SimPort = (Int32)reg.ExternalEndPoint.Port; | 87 | response.SimPort = (Int32)reg.ExternalEndPoint.Port; |
88 | response.RegionX = reg.RegionLocX ; | 88 | response.RegionX = reg.RegionLocX ; |
89 | response.RegionY = reg.RegionLocY ; | 89 | response.RegionY = reg.RegionLocY ; |
90 | 90 | ||
91 | //following port needs changing as we don't want a http listener for every region (or do we?) | 91 | //following port needs changing as we don't want a http listener for every region (or do we?) |
92 | response.SeedCapability = "http://" + reg.ExternalHostName + ":" + this.serversInfo.HttpListenerPort.ToString() + "/CAPS/" + capsPath + "0000/"; | 92 | response.SeedCapability = "http://" + reg.ExternalHostName + ":" + this.serversInfo.HttpListenerPort.ToString() + "/CAPS/" + capsPath + "0000/"; |
93 | theUser.currentAgent.currentRegion = reg.SimUUID; | 93 | theUser.currentAgent.currentRegion = reg.SimUUID; |
94 | theUser.currentAgent.currentHandle = reg.RegionHandle; | 94 | theUser.currentAgent.currentHandle = reg.RegionHandle; |
95 | 95 | ||
96 | Login _login = new Login(); | 96 | Login _login = new Login(); |
97 | //copy data to login object | 97 | //copy data to login object |
98 | _login.First = response.Firstname; | 98 | _login.First = response.Firstname; |
99 | _login.Last = response.Lastname; | 99 | _login.Last = response.Lastname; |
100 | _login.Agent = response.AgentID; | 100 | _login.Agent = response.AgentID; |
101 | _login.Session = response.SessionID; | 101 | _login.Session = response.SessionID; |
102 | _login.SecureSession = response.SecureSessionID; | 102 | _login.SecureSession = response.SecureSessionID; |
103 | _login.CircuitCode = (uint)response.CircuitCode; | 103 | _login.CircuitCode = (uint)response.CircuitCode; |
104 | _login.CapsPath = capsPath; | 104 | _login.CapsPath = capsPath; |
105 | 105 | ||
106 | m_Parent.InformRegionOfLogin(currentRegion, _login); | 106 | m_Parent.InformRegionOfLogin(currentRegion, _login); |
107 | } | 107 | } |
108 | else | 108 | else |
109 | { | 109 | { |
110 | Console.WriteLine("not found region " + currentRegion); | 110 | Console.WriteLine("not found region " + currentRegion); |
111 | } | 111 | } |
112 | 112 | ||
113 | } | 113 | } |
114 | 114 | ||
115 | public UserProfileData SetupMasterUser(string firstName, string lastName) | 115 | public UserProfileData SetupMasterUser(string firstName, string lastName) |
116 | { | 116 | { |
117 | return SetupMasterUser(firstName, lastName, ""); | 117 | return SetupMasterUser(firstName, lastName, ""); |
118 | } | 118 | } |
119 | 119 | ||
120 | public UserProfileData SetupMasterUser(string firstName, string lastName, string password) | 120 | public UserProfileData SetupMasterUser(string firstName, string lastName, string password) |
121 | { | 121 | { |
122 | UserProfileData profile = getUserProfile(firstName, lastName); | 122 | UserProfileData profile = getUserProfile(firstName, lastName); |
123 | if (profile != null) | 123 | if (profile != null) |
124 | { | 124 | { |
125 | 125 | ||
126 | return profile; | 126 | return profile; |
127 | } | 127 | } |
128 | 128 | ||
129 | Console.WriteLine("Unknown Master User. Sandbox Mode: Creating Account"); | 129 | Console.WriteLine("Unknown Master User. Sandbox Mode: Creating Account"); |
130 | this.AddUserProfile(firstName, lastName, password, defaultHomeX, defaultHomeY); | 130 | this.AddUserProfile(firstName, lastName, password, defaultHomeX, defaultHomeY); |
131 | 131 | ||
132 | profile = getUserProfile(firstName, lastName); | 132 | profile = getUserProfile(firstName, lastName); |
133 | 133 | ||
134 | if (profile == null) | 134 | if (profile == null) |
135 | { | 135 | { |
136 | Console.WriteLine("Unknown Master User after creation attempt. No clue what to do here."); | 136 | Console.WriteLine("Unknown Master User after creation attempt. No clue what to do here."); |
137 | } | 137 | } |
138 | 138 | ||
139 | return profile; | 139 | return profile; |
140 | } | 140 | } |
141 | } | 141 | } |
142 | } | 142 | } |