diff options
Diffstat (limited to 'OpenSim/Services/LLLoginService')
-rw-r--r-- | OpenSim/Services/LLLoginService/LLLoginResponse.cs | 4 | ||||
-rw-r--r-- | OpenSim/Services/LLLoginService/LLLoginService.cs | 66 |
2 files changed, 56 insertions, 14 deletions
diff --git a/OpenSim/Services/LLLoginService/LLLoginResponse.cs b/OpenSim/Services/LLLoginService/LLLoginResponse.cs index e3935a8..fbce63f 100644 --- a/OpenSim/Services/LLLoginService/LLLoginResponse.cs +++ b/OpenSim/Services/LLLoginService/LLLoginResponse.cs | |||
@@ -92,7 +92,7 @@ namespace OpenSim.Services.LLLoginService | |||
92 | return loginError; | 92 | return loginError; |
93 | } | 93 | } |
94 | 94 | ||
95 | public OSD ToOSDMap() | 95 | public override OSD ToOSDMap() |
96 | { | 96 | { |
97 | OSDMap map = new OSDMap(); | 97 | OSDMap map = new OSDMap(); |
98 | 98 | ||
@@ -327,7 +327,7 @@ namespace OpenSim.Services.LLLoginService | |||
327 | } | 327 | } |
328 | } | 328 | } |
329 | 329 | ||
330 | public OSD ToLLSDResponse() | 330 | public override OSD ToOSDMap() |
331 | { | 331 | { |
332 | try | 332 | try |
333 | { | 333 | { |
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index 4501da2..25a65b5 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs | |||
@@ -23,12 +23,12 @@ namespace OpenSim.Services.LLLoginService | |||
23 | private IInventoryService m_InventoryService; | 23 | private IInventoryService m_InventoryService; |
24 | private IGridService m_GridService; | 24 | private IGridService m_GridService; |
25 | private IPresenceService m_PresenceService; | 25 | private IPresenceService m_PresenceService; |
26 | private ISimulationService m_LocalSimulationService; | ||
26 | 27 | ||
27 | private string m_DefaultRegionName; | 28 | private string m_DefaultRegionName; |
28 | private string m_LocalSimulationDll; | ||
29 | private string m_RemoteSimulationDll; | 29 | private string m_RemoteSimulationDll; |
30 | 30 | ||
31 | public LLLoginService(IConfigSource config) | 31 | public LLLoginService(IConfigSource config, ISimulationService simService) |
32 | { | 32 | { |
33 | IConfig serverConfig = config.Configs["LoginService"]; | 33 | IConfig serverConfig = config.Configs["LoginService"]; |
34 | if (serverConfig == null) | 34 | if (serverConfig == null) |
@@ -41,7 +41,6 @@ namespace OpenSim.Services.LLLoginService | |||
41 | string presenceService = serverConfig.GetString("PresenceService", String.Empty); | 41 | string presenceService = serverConfig.GetString("PresenceService", String.Empty); |
42 | 42 | ||
43 | m_DefaultRegionName = serverConfig.GetString("DefaultRegion", String.Empty); | 43 | m_DefaultRegionName = serverConfig.GetString("DefaultRegion", String.Empty); |
44 | m_LocalSimulationDll = serverConfig.GetString("LocalSimulationService", String.Empty); | ||
45 | m_RemoteSimulationDll = serverConfig.GetString("RemoteSimulationService", String.Empty); | 44 | m_RemoteSimulationDll = serverConfig.GetString("RemoteSimulationService", String.Empty); |
46 | 45 | ||
47 | // These 3 are required; the other 2 aren't | 46 | // These 3 are required; the other 2 aren't |
@@ -57,11 +56,18 @@ namespace OpenSim.Services.LLLoginService | |||
57 | m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args); | 56 | m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args); |
58 | if (presenceService != string.Empty) | 57 | if (presenceService != string.Empty) |
59 | m_PresenceService = ServerUtils.LoadPlugin<IPresenceService>(presenceService, args); | 58 | m_PresenceService = ServerUtils.LoadPlugin<IPresenceService>(presenceService, args); |
59 | m_LocalSimulationService = simService; | ||
60 | 60 | ||
61 | } | 61 | } |
62 | 62 | ||
63 | public LLLoginService(IConfigSource config) : this(config, null) | ||
64 | { | ||
65 | } | ||
66 | |||
63 | public LoginResponse Login(string firstName, string lastName, string passwd, string startLocation) | 67 | public LoginResponse Login(string firstName, string lastName, string passwd, string startLocation) |
64 | { | 68 | { |
69 | bool success = false; | ||
70 | |||
65 | // Get the account and check that it exists | 71 | // Get the account and check that it exists |
66 | UserAccount account = m_UserAccountService.GetUserAccount(UUID.Zero, firstName, lastName); | 72 | UserAccount account = m_UserAccountService.GetUserAccount(UUID.Zero, firstName, lastName); |
67 | if (account == null) | 73 | if (account == null) |
@@ -82,31 +88,46 @@ namespace OpenSim.Services.LLLoginService | |||
82 | UUID session = UUID.Random(); | 88 | UUID session = UUID.Random(); |
83 | if (m_PresenceService != null) | 89 | if (m_PresenceService != null) |
84 | { | 90 | { |
85 | bool success = m_PresenceService.LoginAgent(account.PrincipalID.ToString(), session, secureSession); | 91 | success = m_PresenceService.LoginAgent(account.PrincipalID.ToString(), session, secureSession); |
86 | if (!success) | 92 | if (!success) |
87 | return LLFailedLoginResponse.GridProblem; | 93 | return LLFailedLoginResponse.GridProblem; |
88 | } | 94 | } |
89 | 95 | ||
90 | // lots of things missing... need to do the simulation service | 96 | // Find the destination region/grid |
91 | string where = string.Empty; | 97 | string where = string.Empty; |
92 | Vector3 position = Vector3.Zero; | 98 | Vector3 position = Vector3.Zero; |
93 | Vector3 lookAt = Vector3.Zero; | 99 | Vector3 lookAt = Vector3.Zero; |
94 | GridRegion destination = FindDestination(account, session, startLocation, out where, out position, out lookAt); | 100 | GridRegion destination = FindDestination(account, session, startLocation, out where, out position, out lookAt); |
95 | if (destination == null) | 101 | if (destination == null) |
102 | { | ||
103 | m_PresenceService.LogoutAgent(session); | ||
96 | return LLFailedLoginResponse.GridProblem; | 104 | return LLFailedLoginResponse.GridProblem; |
105 | } | ||
97 | 106 | ||
98 | ISimulationService sim = null; | 107 | // Instantiate/get the simulation interface and launch an agent at the destination |
108 | ISimulationService simConnector = null; | ||
109 | success = false; | ||
110 | string reason = string.Empty; | ||
99 | Object[] args = new Object[] { destination }; | 111 | Object[] args = new Object[] { destination }; |
100 | // HG standalones have both a localSimulatonDll and a remoteSimulationDll | 112 | // HG standalones have both a localSimulatonDll and a remoteSimulationDll |
101 | // non-HG standalones have just a localSimulationDll | 113 | // non-HG standalones have just a localSimulationDll |
102 | // independent login servers have just a remoteSimulationDll | 114 | // independent login servers have just a remoteSimulationDll |
103 | if (!startLocation.Contains("@") && (m_LocalSimulationDll != string.Empty)) | 115 | if (!startLocation.Contains("@") && (m_LocalSimulationService != null)) |
104 | sim = ServerUtils.LoadPlugin<ISimulationService>(m_LocalSimulationDll, args); | 116 | simConnector = m_LocalSimulationService; |
105 | else | 117 | else if (m_RemoteSimulationDll != string.Empty) |
106 | sim = ServerUtils.LoadPlugin<ISimulationService>(m_RemoteSimulationDll, args); | 118 | simConnector = ServerUtils.LoadPlugin<ISimulationService>(m_RemoteSimulationDll, args); |
107 | 119 | if (simConnector != null) | |
120 | success = LaunchAgent(simConnector, destination, account, session, out reason); | ||
121 | if (!success) | ||
122 | { | ||
123 | m_PresenceService.LogoutAgent(session); | ||
124 | return LLFailedLoginResponse.GridProblem; | ||
125 | } | ||
108 | 126 | ||
109 | return null; | 127 | // Finally, fill out the response and return it |
128 | LLLoginResponse response = new LLLoginResponse(); | ||
129 | //.... | ||
130 | return response; | ||
110 | } | 131 | } |
111 | 132 | ||
112 | private GridRegion FindDestination(UserAccount account, UUID sessionID, string startLocation, out string where, out Vector3 position, out Vector3 lookAt) | 133 | private GridRegion FindDestination(UserAccount account, UUID sessionID, string startLocation, out string where, out Vector3 position, out Vector3 lookAt) |
@@ -228,5 +249,26 @@ namespace OpenSim.Services.LLLoginService | |||
228 | } | 249 | } |
229 | 250 | ||
230 | } | 251 | } |
252 | |||
253 | private bool LaunchAgent(ISimulationService simConnector, GridRegion region, UserAccount account, UUID session, out string reason) | ||
254 | { | ||
255 | reason = string.Empty; | ||
256 | AgentCircuitData aCircuit = new AgentCircuitData(); | ||
257 | aCircuit.AgentID = account.PrincipalID; | ||
258 | //aCircuit.Appearance = optional | ||
259 | //aCircuit.BaseFolder = irrelevant | ||
260 | //aCircuit.CapsPath = required | ||
261 | aCircuit.child = false; | ||
262 | //aCircuit.circuitcode = required | ||
263 | aCircuit.firstname = account.FirstName; | ||
264 | //aCircuit.InventoryFolder = irrelevant | ||
265 | aCircuit.lastname = account.LastName; | ||
266 | //aCircuit.SecureSessionID = required | ||
267 | aCircuit.SessionID = session; | ||
268 | //aCircuit.startpos = required | ||
269 | |||
270 | return simConnector.CreateAgent(region.RegionHandle, aCircuit, 0, out reason); | ||
271 | |||
272 | } | ||
231 | } | 273 | } |
232 | } | 274 | } |