aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/OpenSim.LocalCommunications
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/OpenSim.LocalCommunications')
-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}