aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/OpenSim.LocalCommunications
diff options
context:
space:
mode:
authorMW2007-06-22 18:28:49 +0000
committerMW2007-06-22 18:28:49 +0000
commita9dde515ba7d35b6069a3b2cd8b66bb72b007801 (patch)
tree5c219b4f52c2a58d0ac507b90556afc2a6848f94 /OpenSim/OpenSim.LocalCommunications
parent* Porting console fix from Trunk to Sugilite (diff)
downloadopensim-SC_OLD-a9dde515ba7d35b6069a3b2cd8b66bb72b007801.zip
opensim-SC_OLD-a9dde515ba7d35b6069a3b2cd8b66bb72b007801.tar.gz
opensim-SC_OLD-a9dde515ba7d35b6069a3b2cd8b66bb72b007801.tar.bz2
opensim-SC_OLD-a9dde515ba7d35b6069a3b2cd8b66bb72b007801.tar.xz
SandBox mode login now shares a base class with the grid mode user server.
To allow people to login without creating accounts first in sandbox mode anytime a login request is received without a matching account already being in the database, a new account will be made. (also in sandbox mode, passwords aren't currently used).
Diffstat (limited to '')
-rw-r--r--OpenSim/OpenSim.LocalCommunications/CommunicationsLocal.cs11
-rw-r--r--OpenSim/OpenSim.LocalCommunications/LocalUserServices.cs96
2 files changed, 94 insertions, 13 deletions
diff --git a/OpenSim/OpenSim.LocalCommunications/CommunicationsLocal.cs b/OpenSim/OpenSim.LocalCommunications/CommunicationsLocal.cs
index 795f99d..008d47e 100644
--- a/OpenSim/OpenSim.LocalCommunications/CommunicationsLocal.cs
+++ b/OpenSim/OpenSim.LocalCommunications/CommunicationsLocal.cs
@@ -41,13 +41,20 @@ namespace OpenSim.LocalCommunications
41 public class CommunicationsLocal : CommunicationsManager 41 public class CommunicationsLocal : CommunicationsManager
42 { 42 {
43 public LocalBackEndServices SandBoxServices = new LocalBackEndServices(); 43 public LocalBackEndServices SandBoxServices = new LocalBackEndServices();
44 protected LocalUserServices UserServices = new LocalUserServices(); 44 public LocalUserServices UserServices;
45 45
46 public CommunicationsLocal() 46 public CommunicationsLocal(uint defaultHomeX , uint defaultHomeY)
47 { 47 {
48 UserServices = new LocalUserServices(this , defaultHomeX, defaultHomeY);
49 UserServices.AddPlugin("OpenGrid.Framework.Data.DB4o.dll");
48 UserServer = UserServices; 50 UserServer = UserServices;
49 GridServer = SandBoxServices; 51 GridServer = SandBoxServices;
50 InterRegion = SandBoxServices; 52 InterRegion = SandBoxServices;
51 } 53 }
54
55 internal void InformRegionOfLogin(ulong regionHandle, Login login)
56 {
57 this.SandBoxServices.AddNewSession(regionHandle, login);
58 }
52 } 59 }
53} 60}
diff --git a/OpenSim/OpenSim.LocalCommunications/LocalUserServices.cs b/OpenSim/OpenSim.LocalCommunications/LocalUserServices.cs
index fdfdd16..7a7f2bf 100644
--- a/OpenSim/OpenSim.LocalCommunications/LocalUserServices.cs
+++ b/OpenSim/OpenSim.LocalCommunications/LocalUserServices.cs
@@ -4,9 +4,11 @@ using System.Collections.Generic;
4using System.Text; 4using System.Text;
5 5
6using OpenGrid.Framework.Communications; 6using OpenGrid.Framework.Communications;
7using OpenSim.Framework.User; 7//using OpenSim.Framework.User;
8using OpenGrid.Framework.UserManagement; 8using OpenGrid.Framework.UserManagement;
9using OpenGrid.Framework.Data; 9using OpenGrid.Framework.Data;
10using OpenSim.Framework.Types;
11using OpenSim.Framework.Utilities;
10 12
11using libsecondlife; 13using libsecondlife;
12 14
@@ -14,30 +16,102 @@ namespace OpenSim.LocalCommunications
14{ 16{
15 public class LocalUserServices : UserManagerBase, IUserServices 17 public class LocalUserServices : UserManagerBase, IUserServices
16 { 18 {
17 19 private CommunicationsLocal m_Parent;
18 public LocalUserServices()
19 {
20 20
21 private uint defaultHomeX ;
22 private uint defaultHomeY;
23 public LocalUserServices(CommunicationsLocal parent, uint defHomeX, uint defHomeY)
24 {
25 m_Parent = parent;
26 defaultHomeX = defHomeX;
27 defaultHomeY = defHomeY;
21 } 28 }
22 29
23 public UserProfileData GetUserProfile(string first_name, string last_name) 30 public UserProfileData GetUserProfile(string firstName, string lastName)
24 { 31 {
25 return GetUserProfile(first_name + " " + last_name); 32 return GetUserProfile(firstName + " " + lastName);
26 } 33 }
27 34
28 public UserProfileData GetUserProfile(string name) 35 public UserProfileData GetUserProfile(string name)
29 { 36 {
30 return null; 37 return this.getUserProfile(name);
38 }
39 public UserProfileData GetUserProfile(LLUUID avatarID)
40 {
41 return this.getUserProfile(avatarID);
42 }
43
44 /// <summary>
45 ///
46 /// </summary>
47 /// <returns></returns>
48 public override string GetMessage()
49 {
50 return "Welcome to OpenSim";
51 }
52
53 public override UserProfileData GetTheUser(string firstname, string lastname)
54 {
55 UserProfileData profile = getUserProfile(firstname, lastname);
56 if (profile != null)
57 {
58
59 return profile;
60 }
61
62 //no current user account so make one
63 Console.WriteLine("No User account found so creating a new one ");
64 this.AddUserProfile(firstname, lastname, "test", defaultHomeX, defaultHomeY);
65
66 profile = getUserProfile(firstname, lastname);
67
68 return profile;
31 } 69 }
32 public UserProfileData GetUserProfile(LLUUID avatar_id) 70
71 public override bool AuthenticateUser(ref UserProfileData profile, string password)
33 { 72 {
34 return null; 73 //for now we will accept any password in sandbox mode
74 Console.WriteLine("authorising user");
75 return true;
35 } 76 }
36 77
37 public override void CustomiseResponse(ref Hashtable response, ref UserProfileData theUser) 78 public override void CustomiseResponse(ref LoginResponse response, ref UserProfileData theUser)
38 { 79 {
80 ulong currentRegion = theUser.currentAgent.currentHandle;
81 RegionInfo reg = m_Parent.GridServer.RequestNeighbourInfo(currentRegion);
82
83
84 if (reg != null)
85 {
86 response.Home = "{'region_handle':[r" + (reg.RegionLocX * 256).ToString() + ",r" + (reg.RegionLocY * 256).ToString() + "], " +
87 "'position':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " +
88 "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}";
89
90 response.SimAddress = reg.IPListenAddr;
91 response.SimPort = (Int32)reg.IPListenPort;
92 response.RegionX = reg.RegionLocX ;
93 response.RegionY = reg.RegionLocY ;
94
95 theUser.currentAgent.currentRegion = reg.SimUUID;
96 theUser.currentAgent.currentHandle = reg.RegionHandle;
97
98 Login _login = new Login();
99 //copy data to login object
100 _login.First = response.Firstname;
101 _login.Last = response.Lastname;
102 _login.Agent = response.AgentID;
103 _login.Session = response.SessionID;
104 _login.SecureSession = response.SecureSessionID;
105 _login.CircuitCode = (uint)response.CircuitCode;
106
107 m_Parent.InformRegionOfLogin(currentRegion, _login);
108 }
109 else
110 {
111 Console.WriteLine("not found region " + currentRegion);
112 }
39 113
40 } 114 }
41 115
42 } 116 }
43} 117}