diff options
author | Melanie | 2009-12-31 23:30:09 +0000 |
---|---|---|
committer | Melanie | 2009-12-31 23:30:09 +0000 |
commit | a876cfad012b11440adb7fd21222edc06450fada (patch) | |
tree | 5a9a8ab836205953b5c883bfa1a84fe91e2ad7be /OpenSim | |
parent | Readds llCollisionFilter and adds llPassCollision. (diff) | |
parent | * Added the Login server handlers that were lost in yesterday's commit grief (diff) | |
download | opensim-SC_OLD-a876cfad012b11440adb7fd21222edc06450fada.zip opensim-SC_OLD-a876cfad012b11440adb7fd21222edc06450fada.tar.gz opensim-SC_OLD-a876cfad012b11440adb7fd21222edc06450fada.tar.bz2 opensim-SC_OLD-a876cfad012b11440adb7fd21222edc06450fada.tar.xz |
Merge branch 'presence-refactor' of melanie@opensimulator.org:/var/git/opensim into presence-refactor
Diffstat (limited to 'OpenSim')
6 files changed, 295 insertions, 22 deletions
diff --git a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs new file mode 100644 index 0000000..b973c11 --- /dev/null +++ b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs | |||
@@ -0,0 +1,139 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.IO; | ||
31 | using System.Reflection; | ||
32 | using System.Net; | ||
33 | using System.Text; | ||
34 | |||
35 | using OpenSim.Server.Base; | ||
36 | using OpenSim.Server.Handlers.Base; | ||
37 | using OpenSim.Services.Interfaces; | ||
38 | using OpenSim.Framework; | ||
39 | using OpenSim.Framework.Servers.HttpServer; | ||
40 | |||
41 | using OpenMetaverse; | ||
42 | using OpenMetaverse.StructuredData; | ||
43 | using Nwc.XmlRpc; | ||
44 | using Nini.Config; | ||
45 | using log4net; | ||
46 | |||
47 | |||
48 | namespace OpenSim.Server.Handlers.Login | ||
49 | { | ||
50 | public class LLLoginHandlers | ||
51 | { | ||
52 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
53 | |||
54 | private ILoginService m_LocalService; | ||
55 | |||
56 | public LLLoginHandlers(ILoginService service) | ||
57 | { | ||
58 | m_LocalService = service; | ||
59 | } | ||
60 | |||
61 | public XmlRpcResponse HandleXMLRPCLogin(XmlRpcRequest request, IPEndPoint remoteClient) | ||
62 | { | ||
63 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
64 | |||
65 | if (requestData != null) | ||
66 | { | ||
67 | if (requestData.ContainsKey("first") && requestData["first"] != null && | ||
68 | requestData.ContainsKey("last") && requestData["last"] != null && | ||
69 | requestData.ContainsKey("passwd") && requestData["passwd"] != null) | ||
70 | { | ||
71 | string startLocation = string.Empty; | ||
72 | if (requestData.ContainsKey("start")) | ||
73 | startLocation = requestData["start"].ToString(); | ||
74 | |||
75 | LoginResponse reply = null; | ||
76 | reply = m_LocalService.Login(requestData["first"].ToString(), requestData["last"].ToString(), requestData["passwd"].ToString(), startLocation); | ||
77 | |||
78 | XmlRpcResponse response = new XmlRpcResponse(); | ||
79 | response.Value = reply.ToHashtable(); | ||
80 | return response; | ||
81 | |||
82 | } | ||
83 | } | ||
84 | |||
85 | return FailedXMLRPCResponse(); | ||
86 | |||
87 | } | ||
88 | |||
89 | public OSD HandleLLSDLogin(OSD request, IPEndPoint remoteClient) | ||
90 | { | ||
91 | if (request.Type == OSDType.Map) | ||
92 | { | ||
93 | OSDMap map = (OSDMap)request; | ||
94 | |||
95 | if (map.ContainsKey("first") && map.ContainsKey("last") && map.ContainsKey("passwd")) | ||
96 | { | ||
97 | string startLocation = string.Empty; | ||
98 | |||
99 | if (map.ContainsKey("start")) | ||
100 | startLocation = map["start"].AsString(); | ||
101 | |||
102 | m_log.Info("[LOGIN]: LLSD Login Requested for: '" + map["first"].AsString() + "' '" + map["last"].AsString() + "' / " + startLocation); | ||
103 | |||
104 | LoginResponse reply = null; | ||
105 | reply = m_LocalService.Login(map["first"].AsString(), map["last"].AsString(), map["passwd"].AsString(), startLocation); | ||
106 | return reply.ToOSDMap(); | ||
107 | |||
108 | } | ||
109 | } | ||
110 | |||
111 | return FailedOSDResponse(); | ||
112 | } | ||
113 | |||
114 | private XmlRpcResponse FailedXMLRPCResponse() | ||
115 | { | ||
116 | Hashtable hash = new Hashtable(); | ||
117 | hash["reason"] = "key"; | ||
118 | hash["message"] = "Incomplete login credentials. Check your username and password."; | ||
119 | hash["login"] = "false"; | ||
120 | |||
121 | XmlRpcResponse response = new XmlRpcResponse(); | ||
122 | response.Value = hash; | ||
123 | |||
124 | return response; | ||
125 | } | ||
126 | |||
127 | private OSD FailedOSDResponse() | ||
128 | { | ||
129 | OSDMap map = new OSDMap(); | ||
130 | |||
131 | map["reason"] = OSD.FromString("key"); | ||
132 | map["message"] = OSD.FromString("Invalid login credentials. Check your username and passwd."); | ||
133 | map["login"] = OSD.FromString("false"); | ||
134 | |||
135 | return map; | ||
136 | } | ||
137 | } | ||
138 | |||
139 | } | ||
diff --git a/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs b/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs new file mode 100644 index 0000000..42ecd4d --- /dev/null +++ b/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs | |||
@@ -0,0 +1,93 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Reflection; | ||
31 | using log4net; | ||
32 | using Nini.Config; | ||
33 | using OpenSim.Server.Base; | ||
34 | using OpenSim.Services.Interfaces; | ||
35 | using OpenSim.Framework; | ||
36 | using OpenSim.Framework.Servers.HttpServer; | ||
37 | using OpenSim.Server.Handlers.Base; | ||
38 | |||
39 | namespace OpenSim.Server.Handlers.Login | ||
40 | { | ||
41 | public class LLLoginServiceInConnector : ServiceConnector | ||
42 | { | ||
43 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
44 | |||
45 | private ILoginService m_LoginService; | ||
46 | |||
47 | public LLLoginServiceInConnector(IConfigSource config, IHttpServer server, IScene scene) : | ||
48 | base(config, server, String.Empty) | ||
49 | { | ||
50 | string loginService = ReadLocalServiceFromConfig(config); | ||
51 | |||
52 | ISimulationService simService = scene.RequestModuleInterface<ISimulationService>(); | ||
53 | |||
54 | Object[] args = new Object[] { config, simService }; | ||
55 | m_LoginService = ServerUtils.LoadPlugin<ILoginService>(loginService, args); | ||
56 | |||
57 | InitializeHandlers(server); | ||
58 | } | ||
59 | |||
60 | public LLLoginServiceInConnector(IConfigSource config, IHttpServer server) : | ||
61 | base(config, server, String.Empty) | ||
62 | { | ||
63 | string loginService = ReadLocalServiceFromConfig(config); | ||
64 | |||
65 | Object[] args = new Object[] { config }; | ||
66 | |||
67 | m_LoginService = ServerUtils.LoadPlugin<ILoginService>(loginService, args); | ||
68 | |||
69 | InitializeHandlers(server); | ||
70 | } | ||
71 | |||
72 | private string ReadLocalServiceFromConfig(IConfigSource config) | ||
73 | { | ||
74 | IConfig serverConfig = config.Configs["LoginService"]; | ||
75 | if (serverConfig == null) | ||
76 | throw new Exception(String.Format("No section LoginService in config file")); | ||
77 | |||
78 | string loginService = serverConfig.GetString("LocalServiceModule", String.Empty); | ||
79 | if (loginService == string.Empty) | ||
80 | throw new Exception(String.Format("No LocalServiceModule for LoginService in config file")); | ||
81 | |||
82 | return loginService; | ||
83 | } | ||
84 | |||
85 | private void InitializeHandlers(IHttpServer server) | ||
86 | { | ||
87 | LLLoginHandlers loginHandlers = new LLLoginHandlers(m_LoginService); | ||
88 | server.AddXmlRPCHandler("Login_to_simulator", loginHandlers.HandleXMLRPCLogin, false); | ||
89 | server.SetDefaultLLSDHandler(loginHandlers.HandleLLSDLogin); | ||
90 | } | ||
91 | |||
92 | } | ||
93 | } | ||
diff --git a/OpenSim/Server/Handlers/Simulation/SimulationServiceInConnector.cs b/OpenSim/Server/Handlers/Simulation/SimulationServiceInConnector.cs index b2aa52f..8611228 100644 --- a/OpenSim/Server/Handlers/Simulation/SimulationServiceInConnector.cs +++ b/OpenSim/Server/Handlers/Simulation/SimulationServiceInConnector.cs | |||
@@ -37,7 +37,7 @@ namespace OpenSim.Server.Handlers.Simulation | |||
37 | { | 37 | { |
38 | public class SimulationServiceInConnector : ServiceConnector | 38 | public class SimulationServiceInConnector : ServiceConnector |
39 | { | 39 | { |
40 | private ISimulationService m_SimulationService; | 40 | private ISimulationService m_LocalSimulationService; |
41 | private IAuthenticationService m_AuthenticationService; | 41 | private IAuthenticationService m_AuthenticationService; |
42 | 42 | ||
43 | public SimulationServiceInConnector(IConfigSource config, IHttpServer server, IScene scene) : | 43 | public SimulationServiceInConnector(IConfigSource config, IHttpServer server, IScene scene) : |
@@ -54,20 +54,16 @@ namespace OpenSim.Server.Handlers.Simulation | |||
54 | // throw new Exception("No SimulationService in config file"); | 54 | // throw new Exception("No SimulationService in config file"); |
55 | 55 | ||
56 | //Object[] args = new Object[] { config }; | 56 | //Object[] args = new Object[] { config }; |
57 | m_SimulationService = scene.RequestModuleInterface<ISimulationService>(); | 57 | m_LocalSimulationService = scene.RequestModuleInterface<ISimulationService>(); |
58 | //ServerUtils.LoadPlugin<ISimulationService>(simService, args); | 58 | //ServerUtils.LoadPlugin<ISimulationService>(simService, args); |
59 | if (m_SimulationService == null) | ||
60 | throw new Exception("No Local ISimulationService Module"); | ||
61 | |||
62 | |||
63 | 59 | ||
64 | //System.Console.WriteLine("XXXXXXXXXXXXXXXXXXX m_AssetSetvice == null? " + ((m_AssetService == null) ? "yes" : "no")); | 60 | //System.Console.WriteLine("XXXXXXXXXXXXXXXXXXX m_AssetSetvice == null? " + ((m_AssetService == null) ? "yes" : "no")); |
65 | //server.AddStreamHandler(new AgentGetHandler(m_SimulationService, m_AuthenticationService)); | 61 | //server.AddStreamHandler(new AgentGetHandler(m_SimulationService, m_AuthenticationService)); |
66 | //server.AddStreamHandler(new AgentPostHandler(m_SimulationService, m_AuthenticationService)); | 62 | //server.AddStreamHandler(new AgentPostHandler(m_SimulationService, m_AuthenticationService)); |
67 | //server.AddStreamHandler(new AgentPutHandler(m_SimulationService, m_AuthenticationService)); | 63 | //server.AddStreamHandler(new AgentPutHandler(m_SimulationService, m_AuthenticationService)); |
68 | //server.AddStreamHandler(new AgentDeleteHandler(m_SimulationService, m_AuthenticationService)); | 64 | //server.AddStreamHandler(new AgentDeleteHandler(m_SimulationService, m_AuthenticationService)); |
69 | server.AddHTTPHandler("/agent/", new AgentHandler(m_SimulationService).Handler); | 65 | server.AddHTTPHandler("/agent/", new AgentHandler(m_LocalSimulationService).Handler); |
70 | server.AddHTTPHandler("/object/", new ObjectHandler(m_SimulationService).Handler); | 66 | server.AddHTTPHandler("/object/", new ObjectHandler(m_LocalSimulationService).Handler); |
71 | 67 | ||
72 | //server.AddStreamHandler(new ObjectPostHandler(m_SimulationService, authentication)); | 68 | //server.AddStreamHandler(new ObjectPostHandler(m_SimulationService, authentication)); |
73 | } | 69 | } |
diff --git a/OpenSim/Services/Interfaces/ILoginService.cs b/OpenSim/Services/Interfaces/ILoginService.cs index 5397b10..0f82de5 100644 --- a/OpenSim/Services/Interfaces/ILoginService.cs +++ b/OpenSim/Services/Interfaces/ILoginService.cs | |||
@@ -29,11 +29,14 @@ using System; | |||
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | 31 | ||
32 | using OpenMetaverse.StructuredData; | ||
33 | |||
32 | namespace OpenSim.Services.Interfaces | 34 | namespace OpenSim.Services.Interfaces |
33 | { | 35 | { |
34 | public abstract class LoginResponse | 36 | public abstract class LoginResponse |
35 | { | 37 | { |
36 | public abstract Hashtable ToHashtable(); | 38 | public abstract Hashtable ToHashtable(); |
39 | public abstract OSD ToOSDMap(); | ||
37 | } | 40 | } |
38 | 41 | ||
39 | public abstract class FailedLoginResponse : LoginResponse | 42 | public abstract class FailedLoginResponse : LoginResponse |
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 | } |