diff options
author | Melanie | 2010-05-08 13:31:36 +0100 |
---|---|---|
committer | Melanie | 2010-05-08 13:31:36 +0100 |
commit | 14fcc2510ef9f1effc06d7e99b57f7f74de08eac (patch) | |
tree | e52f145ef2aac9a9cc7fb32a6a40e62f67991743 /OpenSim/Region/CoreModules | |
parent | Merge branch 'master' into careminster-presence-refactor (diff) | |
parent | test commit for panda (diff) | |
download | opensim-SC_OLD-14fcc2510ef9f1effc06d7e99b57f7f74de08eac.zip opensim-SC_OLD-14fcc2510ef9f1effc06d7e99b57f7f74de08eac.tar.gz opensim-SC_OLD-14fcc2510ef9f1effc06d7e99b57f7f74de08eac.tar.bz2 opensim-SC_OLD-14fcc2510ef9f1effc06d7e99b57f7f74de08eac.tar.xz |
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Region/CoreModules')
10 files changed, 357 insertions, 53 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index f2b03e4..ef37f63 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -526,11 +526,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
526 | { | 526 | { |
527 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.FirstName, client.LastName); | 527 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.FirstName, client.LastName); |
528 | 528 | ||
529 | OpenSim.Services.Interfaces.PresenceInfo pinfo = m_aScene.PresenceService.GetAgent(client.SessionId); | 529 | //OpenSim.Services.Interfaces.PresenceInfo pinfo = m_aScene.PresenceService.GetAgent(client.SessionId); |
530 | GridUserInfo uinfo = m_aScene.GridUserService.GetGridUserInfo(client.AgentId.ToString()); | ||
530 | 531 | ||
531 | if (pinfo != null) | 532 | if (uinfo != null) |
532 | { | 533 | { |
533 | GridRegion regionInfo = m_aScene.GridService.GetRegionByUUID(UUID.Zero, pinfo.HomeRegionID); | 534 | GridRegion regionInfo = m_aScene.GridService.GetRegionByUUID(UUID.Zero, uinfo.HomeRegionID); |
534 | if (regionInfo == null) | 535 | if (regionInfo == null) |
535 | { | 536 | { |
536 | // can't find the Home region: Tell viewer and abort | 537 | // can't find the Home region: Tell viewer and abort |
@@ -539,7 +540,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
539 | } | 540 | } |
540 | // a little eekie that this goes back to Scene and with a forced cast, will fix that at some point... | 541 | // a little eekie that this goes back to Scene and with a forced cast, will fix that at some point... |
541 | ((Scene)(client.Scene)).RequestTeleportLocation( | 542 | ((Scene)(client.Scene)).RequestTeleportLocation( |
542 | client, regionInfo.RegionHandle, pinfo.HomePosition, pinfo.HomeLookAt, | 543 | client, regionInfo.RegionHandle, uinfo.HomePosition, uinfo.HomeLookAt, |
543 | (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome)); | 544 | (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome)); |
544 | } | 545 | } |
545 | } | 546 | } |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index 28593fc..137dfec 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | |||
@@ -154,7 +154,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
154 | bool success = connector.LoginAgentToGrid(agentCircuit, reg, finalDestination, out reason); | 154 | bool success = connector.LoginAgentToGrid(agentCircuit, reg, finalDestination, out reason); |
155 | if (success) | 155 | if (success) |
156 | // Log them out of this grid | 156 | // Log them out of this grid |
157 | m_aScene.PresenceService.LogoutAgent(agentCircuit.SessionID, sp.AbsolutePosition, sp.Lookat); | 157 | m_aScene.PresenceService.LogoutAgent(agentCircuit.SessionID); |
158 | 158 | ||
159 | return success; | 159 | return success; |
160 | } | 160 | } |
@@ -238,6 +238,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
238 | { | 238 | { |
239 | if (obj.IsLoggingOut) | 239 | if (obj.IsLoggingOut) |
240 | { | 240 | { |
241 | object sp = null; | ||
242 | if (obj.Scene.TryGetScenePresence(obj.AgentId, out sp)) | ||
243 | { | ||
244 | if (((ScenePresence)sp).IsChildAgent) | ||
245 | return; | ||
246 | } | ||
247 | |||
241 | AgentCircuitData aCircuit = ((Scene)(obj.Scene)).AuthenticateHandler.GetAgentCircuitData(obj.CircuitCode); | 248 | AgentCircuitData aCircuit = ((Scene)(obj.Scene)).AuthenticateHandler.GetAgentCircuitData(obj.CircuitCode); |
242 | 249 | ||
243 | if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) | 250 | if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) |
diff --git a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml index 0a5ff3f..ee07075 100644 --- a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml +++ b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml | |||
@@ -59,9 +59,11 @@ | |||
59 | <RegionModule id="RemoteUserAccountServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts.RemoteUserAccountServicesConnector" /> | 59 | <RegionModule id="RemoteUserAccountServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts.RemoteUserAccountServicesConnector" /> |
60 | 60 | ||
61 | <RegionModule id="LocalGridUserServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser.LocalGridUserServicesConnector" /> | 61 | <RegionModule id="LocalGridUserServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser.LocalGridUserServicesConnector" /> |
62 | 62 | <RegionModule id="RemoteGridUserServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser.RemoteGridUserServicesConnector" /> | |
63 | |||
63 | <RegionModule id="LocalSimulationConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation.LocalSimulationConnectorModule" /> | 64 | <RegionModule id="LocalSimulationConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation.LocalSimulationConnectorModule" /> |
64 | <RegionModule id="RemoteSimulationConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation.RemoteSimulationConnectorModule" /> | 65 | <RegionModule id="RemoteSimulationConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation.RemoteSimulationConnectorModule" /> |
66 | |||
65 | <!-- Service connectors IN modules --> | 67 | <!-- Service connectors IN modules --> |
66 | <RegionModule id="AssetServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Asset.AssetServiceInConnectorModule" /> | 68 | <RegionModule id="AssetServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Asset.AssetServiceInConnectorModule" /> |
67 | <RegionModule id="InventoryServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Inventory.InventoryServiceInConnectorModule" /> | 69 | <RegionModule id="InventoryServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Inventory.InventoryServiceInConnectorModule" /> |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/ActivityDetector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/ActivityDetector.cs new file mode 100644 index 0000000..6c01927 --- /dev/null +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/ActivityDetector.cs | |||
@@ -0,0 +1,116 @@ | |||
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 | using System; | ||
28 | using System.Collections.Generic; | ||
29 | using System.Reflection; | ||
30 | |||
31 | using OpenSim.Framework; | ||
32 | using OpenSim.Region.Framework.Scenes; | ||
33 | using OpenSim.Services.Interfaces; | ||
34 | |||
35 | using OpenMetaverse; | ||
36 | using log4net; | ||
37 | |||
38 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser | ||
39 | { | ||
40 | public class ActivityDetector | ||
41 | { | ||
42 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
43 | |||
44 | private IGridUserService m_GridUserService; | ||
45 | private Scene m_aScene; | ||
46 | |||
47 | public ActivityDetector(IGridUserService guservice) | ||
48 | { | ||
49 | m_GridUserService = guservice; | ||
50 | m_log.DebugFormat("[ACTIVITY DETECTOR]: starting "); | ||
51 | } | ||
52 | |||
53 | public void AddRegion(Scene scene) | ||
54 | { | ||
55 | // For now the only events we listen to are these | ||
56 | // But we could trigger the position update more often | ||
57 | scene.EventManager.OnMakeRootAgent += OnMakeRootAgent; | ||
58 | scene.EventManager.OnNewClient += OnNewClient; | ||
59 | scene.EventManager.OnAvatarEnteringNewParcel += OnEnteringNewParcel; | ||
60 | |||
61 | if (m_aScene == null) | ||
62 | m_aScene = scene; | ||
63 | } | ||
64 | |||
65 | public void RemoveRegion(Scene scene) | ||
66 | { | ||
67 | scene.EventManager.OnMakeRootAgent -= OnMakeRootAgent; | ||
68 | scene.EventManager.OnNewClient -= OnNewClient; | ||
69 | } | ||
70 | |||
71 | public void OnMakeRootAgent(ScenePresence sp) | ||
72 | { | ||
73 | m_log.DebugFormat("[ACTIVITY DETECTOR]: Detected root presence {0} in {1}", sp.UUID, sp.Scene.RegionInfo.RegionName); | ||
74 | |||
75 | m_GridUserService.SetLastPosition(sp.UUID.ToString(), sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat); | ||
76 | } | ||
77 | |||
78 | public void OnNewClient(IClientAPI client) | ||
79 | { | ||
80 | client.OnConnectionClosed += OnConnectionClose; | ||
81 | } | ||
82 | |||
83 | public void OnConnectionClose(IClientAPI client) | ||
84 | { | ||
85 | if (client.IsLoggingOut) | ||
86 | { | ||
87 | object sp = null; | ||
88 | Vector3 position = new Vector3(128, 128, 0); | ||
89 | Vector3 lookat = new Vector3(0, 1, 0); | ||
90 | |||
91 | if (client.Scene.TryGetScenePresence(client.AgentId, out sp)) | ||
92 | { | ||
93 | if (sp is ScenePresence) | ||
94 | { | ||
95 | if (((ScenePresence)sp).IsChildAgent) | ||
96 | return; | ||
97 | |||
98 | position = ((ScenePresence)sp).AbsolutePosition; | ||
99 | lookat = ((ScenePresence)sp).Lookat; | ||
100 | } | ||
101 | } | ||
102 | m_log.DebugFormat("[ACTIVITY DETECTOR]: Detected client logout {0} in {1}", client.AgentId, client.Scene.RegionInfo.RegionName); | ||
103 | m_GridUserService.LoggedOut(client.AgentId.ToString(), client.Scene.RegionInfo.RegionID, position, lookat); | ||
104 | } | ||
105 | |||
106 | } | ||
107 | |||
108 | void OnEnteringNewParcel(ScenePresence sp, int localLandID, UUID regionID) | ||
109 | { | ||
110 | // TODO: grab the parcel ID from ILandModule | ||
111 | // and send that along | ||
112 | m_GridUserService.SetLastPosition(sp.UUID.ToString(), sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat); | ||
113 | } | ||
114 | |||
115 | } | ||
116 | } | ||
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/LocalGridUserServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/LocalGridUserServiceConnector.cs index d5fae23..d914a57 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/LocalGridUserServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/LocalGridUserServiceConnector.cs | |||
@@ -41,13 +41,19 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser | |||
41 | { | 41 | { |
42 | public class LocalGridUserServicesConnector : ISharedRegionModule, IGridUserService | 42 | public class LocalGridUserServicesConnector : ISharedRegionModule, IGridUserService |
43 | { | 43 | { |
44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 44 | private static readonly ILog m_log = |
45 | LogManager.GetLogger( | ||
46 | MethodBase.GetCurrentMethod().DeclaringType); | ||
45 | 47 | ||
46 | private IGridUserService m_service; | 48 | private IGridUserService m_GridUserService; |
49 | |||
50 | private ActivityDetector m_ActivityDetector; | ||
47 | 51 | ||
48 | private bool m_Enabled = false; | 52 | private bool m_Enabled = false; |
49 | 53 | ||
50 | public Type ReplaceableInterface | 54 | #region ISharedRegionModule |
55 | |||
56 | public Type ReplaceableInterface | ||
51 | { | 57 | { |
52 | get { return null; } | 58 | get { return null; } |
53 | } | 59 | } |
@@ -68,7 +74,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser | |||
68 | IConfig userConfig = source.Configs["GridUserService"]; | 74 | IConfig userConfig = source.Configs["GridUserService"]; |
69 | if (userConfig == null) | 75 | if (userConfig == null) |
70 | { | 76 | { |
71 | m_log.Error("[LOCAL GRID USER SERVICE CONNECTOR]: GridUserService missing from ini files"); | 77 | m_log.Error("[LOCAL GRID USER SERVICE CONNECTOR]: GridUserService missing from OpenSim.ini"); |
72 | return; | 78 | return; |
73 | } | 79 | } |
74 | 80 | ||
@@ -81,15 +87,20 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser | |||
81 | } | 87 | } |
82 | 88 | ||
83 | Object[] args = new Object[] { source }; | 89 | Object[] args = new Object[] { source }; |
84 | m_service = ServerUtils.LoadPlugin<IGridUserService>(serviceDll, args); | 90 | m_GridUserService = ServerUtils.LoadPlugin<IGridUserService>(serviceDll, args); |
85 | 91 | ||
86 | if (m_service == null) | 92 | if (m_GridUserService == null) |
87 | { | 93 | { |
88 | m_log.Error("[LOCAL GRID USER SERVICE CONNECTOR]: Can't load GridUser service"); | 94 | m_log.ErrorFormat( |
95 | "[LOCAL GRID USER SERVICE CONNECTOR]: Cannot load user account service specified as {0}", serviceDll); | ||
89 | return; | 96 | return; |
90 | } | 97 | } |
98 | |||
99 | m_ActivityDetector = new ActivityDetector(this); | ||
100 | |||
91 | m_Enabled = true; | 101 | m_Enabled = true; |
92 | m_log.Info("[LOCAL GRID USER SERVICE CONNECTOR]: Local GridUser connector enabled"); | 102 | |
103 | m_log.Info("[LOCAL GRID USER SERVICE CONNECTOR]: Local grid user connector enabled"); | ||
93 | } | 104 | } |
94 | } | 105 | } |
95 | } | 106 | } |
@@ -111,29 +122,57 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser | |||
111 | if (!m_Enabled) | 122 | if (!m_Enabled) |
112 | return; | 123 | return; |
113 | 124 | ||
114 | scene.RegisterModuleInterface<IGridUserService>(m_service); | 125 | scene.RegisterModuleInterface<IGridUserService>(m_GridUserService); |
126 | m_ActivityDetector.AddRegion(scene); | ||
115 | } | 127 | } |
116 | 128 | ||
117 | public void RemoveRegion(Scene scene) | 129 | public void RemoveRegion(Scene scene) |
118 | { | 130 | { |
119 | if (!m_Enabled) | 131 | if (!m_Enabled) |
120 | return; | 132 | return; |
133 | |||
134 | scene.UnregisterModuleInterface<IGridUserService>(this); | ||
135 | m_ActivityDetector.RemoveRegion(scene); | ||
121 | } | 136 | } |
122 | 137 | ||
123 | public void RegionLoaded(Scene scene) | 138 | public void RegionLoaded(Scene scene) |
124 | { | 139 | { |
125 | if (!m_Enabled) | 140 | if (!m_Enabled) |
126 | return; | 141 | return; |
142 | |||
143 | m_log.InfoFormat("[LOCAL GRID USER SERVICE CONNECTOR]: Enabled local grid user for region {0}", scene.RegionInfo.RegionName); | ||
127 | } | 144 | } |
128 | 145 | ||
129 | public GridUserInfo GetGridUserInfo(string userID) | 146 | #endregion |
147 | |||
148 | #region IGridUserService | ||
149 | |||
150 | public GridUserInfo LoggedIn(string userID) | ||
130 | { | 151 | { |
131 | return m_service.GetGridUserInfo(userID); | 152 | return m_GridUserService.LoggedIn(userID); |
132 | } | 153 | } |
133 | 154 | ||
134 | public bool StoreGridUserInfo(GridUserInfo info) | 155 | public bool LoggedOut(string userID, UUID regionID, Vector3 lastPosition, Vector3 lastLookAt) |
135 | { | 156 | { |
136 | return m_service.StoreGridUserInfo(info); | 157 | return m_GridUserService.LoggedOut(userID, regionID, lastPosition, lastLookAt); |
137 | } | 158 | } |
159 | |||
160 | public bool SetHome(string userID, UUID homeID, Vector3 homePosition, Vector3 homeLookAt) | ||
161 | { | ||
162 | return m_GridUserService.SetHome(userID, homeID, homePosition, homeLookAt); | ||
163 | } | ||
164 | |||
165 | public bool SetLastPosition(string userID, UUID regionID, Vector3 lastPosition, Vector3 lastLookAt) | ||
166 | { | ||
167 | return m_GridUserService.SetLastPosition(userID, regionID, lastPosition, lastLookAt); | ||
168 | } | ||
169 | |||
170 | public GridUserInfo GetGridUserInfo(string userID) | ||
171 | { | ||
172 | return m_GridUserService.GetGridUserInfo(userID); | ||
173 | } | ||
174 | |||
175 | #endregion | ||
176 | |||
138 | } | 177 | } |
139 | } \ No newline at end of file | 178 | } |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/RemoteGridUserServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/RemoteGridUserServiceConnector.cs new file mode 100644 index 0000000..e3e2e61 --- /dev/null +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/RemoteGridUserServiceConnector.cs | |||
@@ -0,0 +1,153 @@ | |||
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 | using System; | ||
28 | using System.Collections.Generic; | ||
29 | using System.Reflection; | ||
30 | |||
31 | using OpenSim.Region.Framework.Interfaces; | ||
32 | using OpenSim.Region.Framework.Scenes; | ||
33 | using OpenSim.Server.Base; | ||
34 | using OpenSim.Services.Interfaces; | ||
35 | using OpenSim.Services.Connectors; | ||
36 | |||
37 | using OpenMetaverse; | ||
38 | using log4net; | ||
39 | using Nini.Config; | ||
40 | |||
41 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser | ||
42 | { | ||
43 | public class RemoteGridUserServicesConnector : ISharedRegionModule, IGridUserService | ||
44 | { | ||
45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
46 | |||
47 | #region ISharedRegionModule | ||
48 | |||
49 | private bool m_Enabled = false; | ||
50 | |||
51 | private ActivityDetector m_ActivityDetector; | ||
52 | private IGridUserService m_RemoteConnector; | ||
53 | |||
54 | public Type ReplaceableInterface | ||
55 | { | ||
56 | get { return null; } | ||
57 | } | ||
58 | |||
59 | public string Name | ||
60 | { | ||
61 | get { return "RemoteGridUserServicesConnector"; } | ||
62 | } | ||
63 | |||
64 | public void Initialise(IConfigSource source) | ||
65 | { | ||
66 | IConfig moduleConfig = source.Configs["Modules"]; | ||
67 | if (moduleConfig != null) | ||
68 | { | ||
69 | string name = moduleConfig.GetString("GridUserServices", ""); | ||
70 | if (name == Name) | ||
71 | { | ||
72 | m_RemoteConnector = new GridUserServicesConnector(source); | ||
73 | |||
74 | m_Enabled = true; | ||
75 | |||
76 | m_ActivityDetector = new ActivityDetector(this); | ||
77 | |||
78 | m_log.Info("[REMOTE GRID USER CONNECTOR]: Remote grid user enabled"); | ||
79 | } | ||
80 | } | ||
81 | |||
82 | } | ||
83 | |||
84 | public void PostInitialise() | ||
85 | { | ||
86 | } | ||
87 | |||
88 | public void Close() | ||
89 | { | ||
90 | } | ||
91 | |||
92 | public void AddRegion(Scene scene) | ||
93 | { | ||
94 | if (!m_Enabled) | ||
95 | return; | ||
96 | |||
97 | scene.RegisterModuleInterface<IGridUserService>(this); | ||
98 | m_ActivityDetector.AddRegion(scene); | ||
99 | |||
100 | m_log.InfoFormat("[REMOTE GRID USER CONNECTOR]: Enabled remote grid user for region {0}", scene.RegionInfo.RegionName); | ||
101 | |||
102 | } | ||
103 | |||
104 | public void RemoveRegion(Scene scene) | ||
105 | { | ||
106 | if (!m_Enabled) | ||
107 | return; | ||
108 | |||
109 | m_ActivityDetector.RemoveRegion(scene); | ||
110 | } | ||
111 | |||
112 | public void RegionLoaded(Scene scene) | ||
113 | { | ||
114 | if (!m_Enabled) | ||
115 | return; | ||
116 | |||
117 | } | ||
118 | |||
119 | #endregion | ||
120 | |||
121 | #region IGridUserService | ||
122 | |||
123 | public GridUserInfo LoggedIn(string userID) | ||
124 | { | ||
125 | m_log.Warn("[REMOTE GRID USER CONNECTOR]: LoggedIn not implemented at the simulators"); | ||
126 | return null; | ||
127 | } | ||
128 | |||
129 | public bool LoggedOut(string userID, UUID region, Vector3 position, Vector3 lookat) | ||
130 | { | ||
131 | return m_RemoteConnector.LoggedOut(userID, region, position, lookat); | ||
132 | } | ||
133 | |||
134 | |||
135 | public bool SetHome(string userID, UUID regionID, Vector3 position, Vector3 lookAt) | ||
136 | { | ||
137 | return m_RemoteConnector.SetHome(userID, regionID, position, lookAt); | ||
138 | } | ||
139 | |||
140 | public bool SetLastPosition(string userID, UUID regionID, Vector3 position, Vector3 lookAt) | ||
141 | { | ||
142 | return m_RemoteConnector.SetLastPosition(userID, regionID, position, lookAt); | ||
143 | } | ||
144 | |||
145 | public GridUserInfo GetGridUserInfo(string userID) | ||
146 | { | ||
147 | return m_RemoteConnector.GetGridUserInfo(userID); | ||
148 | } | ||
149 | |||
150 | #endregion | ||
151 | |||
152 | } | ||
153 | } | ||
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/LocalPresenceServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/LocalPresenceServiceConnector.cs index c402a3f..49dd633 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/LocalPresenceServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/LocalPresenceServiceConnector.cs | |||
@@ -167,9 +167,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence | |||
167 | return false; | 167 | return false; |
168 | } | 168 | } |
169 | 169 | ||
170 | public bool LogoutAgent(UUID sessionID, Vector3 position, Vector3 lookat) | 170 | public bool LogoutAgent(UUID sessionID) |
171 | { | 171 | { |
172 | return m_PresenceService.LogoutAgent(sessionID, position, lookat); | 172 | return m_PresenceService.LogoutAgent(sessionID); |
173 | } | 173 | } |
174 | 174 | ||
175 | 175 | ||
@@ -178,9 +178,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence | |||
178 | return m_PresenceService.LogoutRegionAgents(regionID); | 178 | return m_PresenceService.LogoutRegionAgents(regionID); |
179 | } | 179 | } |
180 | 180 | ||
181 | public bool ReportAgent(UUID sessionID, UUID regionID, Vector3 position, Vector3 lookAt) | 181 | public bool ReportAgent(UUID sessionID, UUID regionID) |
182 | { | 182 | { |
183 | return m_PresenceService.ReportAgent(sessionID, regionID, position, lookAt); | 183 | return m_PresenceService.ReportAgent(sessionID, regionID); |
184 | } | 184 | } |
185 | 185 | ||
186 | public PresenceInfo GetAgent(UUID sessionID) | 186 | public PresenceInfo GetAgent(UUID sessionID) |
@@ -193,11 +193,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence | |||
193 | return m_PresenceService.GetAgents(userIDs); | 193 | return m_PresenceService.GetAgents(userIDs); |
194 | } | 194 | } |
195 | 195 | ||
196 | public bool SetHomeLocation(string userID, UUID regionID, Vector3 position, Vector3 lookAt) | ||
197 | { | ||
198 | return m_PresenceService.SetHomeLocation(userID, regionID, position, lookAt); | ||
199 | } | ||
200 | |||
201 | #endregion | 196 | #endregion |
202 | 197 | ||
203 | } | 198 | } |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs index 7a75a89..62b8278 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs | |||
@@ -72,7 +72,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence | |||
72 | public void OnMakeRootAgent(ScenePresence sp) | 72 | public void OnMakeRootAgent(ScenePresence sp) |
73 | { | 73 | { |
74 | m_log.DebugFormat("[PRESENCE DETECTOR]: Detected root presence {0} in {1}", sp.UUID, sp.Scene.RegionInfo.RegionName); | 74 | m_log.DebugFormat("[PRESENCE DETECTOR]: Detected root presence {0} in {1}", sp.UUID, sp.Scene.RegionInfo.RegionName); |
75 | m_PresenceService.ReportAgent(sp.ControllingClient.SessionId, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat); | 75 | m_PresenceService.ReportAgent(sp.ControllingClient.SessionId, sp.Scene.RegionInfo.RegionID); |
76 | } | 76 | } |
77 | 77 | ||
78 | public void OnNewClient(IClientAPI client) | 78 | public void OnNewClient(IClientAPI client) |
@@ -85,19 +85,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence | |||
85 | if (client.IsLoggingOut) | 85 | if (client.IsLoggingOut) |
86 | { | 86 | { |
87 | object sp = null; | 87 | object sp = null; |
88 | Vector3 position = new Vector3(128, 128, 0); | ||
89 | Vector3 lookat = new Vector3(0, 1, 0); | ||
90 | |||
91 | if (client.Scene.TryGetScenePresence(client.AgentId, out sp)) | 88 | if (client.Scene.TryGetScenePresence(client.AgentId, out sp)) |
92 | { | 89 | { |
93 | if (sp is ScenePresence) | 90 | if (sp is ScenePresence) |
94 | { | 91 | { |
95 | position = ((ScenePresence)sp).AbsolutePosition; | 92 | if (((ScenePresence)sp).IsChildAgent) |
96 | lookat = ((ScenePresence)sp).Lookat; | 93 | return; |
97 | } | 94 | } |
98 | } | 95 | } |
99 | 96 | ||
100 | m_PresenceService.LogoutAgent(client.SessionId, position, lookat); | 97 | m_log.DebugFormat("[PRESENCE DETECTOR]: Detected client logout {0} in {1}", client.AgentId, client.Scene.RegionInfo.RegionName); |
98 | m_PresenceService.LogoutAgent(client.SessionId); | ||
101 | } | 99 | } |
102 | 100 | ||
103 | } | 101 | } |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/RemotePresenceServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/RemotePresenceServiceConnector.cs index 5f3666e..bf4e9ab 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/RemotePresenceServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/RemotePresenceServiceConnector.cs | |||
@@ -127,9 +127,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence | |||
127 | return false; | 127 | return false; |
128 | } | 128 | } |
129 | 129 | ||
130 | public bool LogoutAgent(UUID sessionID, Vector3 position, Vector3 lookat) | 130 | public bool LogoutAgent(UUID sessionID) |
131 | { | 131 | { |
132 | return m_RemoteConnector.LogoutAgent(sessionID, position, lookat); | 132 | return m_RemoteConnector.LogoutAgent(sessionID); |
133 | } | 133 | } |
134 | 134 | ||
135 | 135 | ||
@@ -138,9 +138,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence | |||
138 | return m_RemoteConnector.LogoutRegionAgents(regionID); | 138 | return m_RemoteConnector.LogoutRegionAgents(regionID); |
139 | } | 139 | } |
140 | 140 | ||
141 | public bool ReportAgent(UUID sessionID, UUID regionID, Vector3 position, Vector3 lookAt) | 141 | public bool ReportAgent(UUID sessionID, UUID regionID) |
142 | { | 142 | { |
143 | return m_RemoteConnector.ReportAgent(sessionID, regionID, position, lookAt); | 143 | return m_RemoteConnector.ReportAgent(sessionID, regionID); |
144 | } | 144 | } |
145 | 145 | ||
146 | public PresenceInfo GetAgent(UUID sessionID) | 146 | public PresenceInfo GetAgent(UUID sessionID) |
@@ -153,11 +153,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence | |||
153 | return m_RemoteConnector.GetAgents(userIDs); | 153 | return m_RemoteConnector.GetAgents(userIDs); |
154 | } | 154 | } |
155 | 155 | ||
156 | public bool SetHomeLocation(string userID, UUID regionID, Vector3 position, Vector3 lookAt) | ||
157 | { | ||
158 | return m_RemoteConnector.SetHomeLocation(userID, regionID, position, lookAt); | ||
159 | } | ||
160 | |||
161 | #endregion | 156 | #endregion |
162 | 157 | ||
163 | } | 158 | } |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/Tests/PresenceConnectorsTests.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/Tests/PresenceConnectorsTests.cs index 63a28fc..ef910f4 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/Tests/PresenceConnectorsTests.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/Tests/PresenceConnectorsTests.cs | |||
@@ -90,27 +90,25 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence.Tests | |||
90 | PresenceInfo result = m_LocalConnector.GetAgent(session1); | 90 | PresenceInfo result = m_LocalConnector.GetAgent(session1); |
91 | Assert.IsNotNull(result, "Retrieved GetAgent is null"); | 91 | Assert.IsNotNull(result, "Retrieved GetAgent is null"); |
92 | Assert.That(result.UserID, Is.EqualTo(user1), "Retrieved userID does not match"); | 92 | Assert.That(result.UserID, Is.EqualTo(user1), "Retrieved userID does not match"); |
93 | Assert.IsTrue(result.Online, "Agent just logged in but is offline"); | ||
94 | 93 | ||
95 | UUID region1 = UUID.Random(); | 94 | UUID region1 = UUID.Random(); |
96 | bool r = m_LocalConnector.ReportAgent(session1, region1, Vector3.Zero, Vector3.Zero); | 95 | bool r = m_LocalConnector.ReportAgent(session1, region1); |
97 | Assert.IsTrue(r, "First ReportAgent returned false"); | 96 | Assert.IsTrue(r, "First ReportAgent returned false"); |
98 | result = m_LocalConnector.GetAgent(session1); | 97 | result = m_LocalConnector.GetAgent(session1); |
99 | Assert.That(result.RegionID, Is.EqualTo(region1), "Agent is not in the right region (region1)"); | 98 | Assert.That(result.RegionID, Is.EqualTo(region1), "Agent is not in the right region (region1)"); |
100 | 99 | ||
101 | UUID region2 = UUID.Random(); | 100 | UUID region2 = UUID.Random(); |
102 | r = m_LocalConnector.ReportAgent(session1, region2, Vector3.Zero, Vector3.Zero); | 101 | r = m_LocalConnector.ReportAgent(session1, region2); |
103 | Assert.IsTrue(r, "Second ReportAgent returned false"); | 102 | Assert.IsTrue(r, "Second ReportAgent returned false"); |
104 | result = m_LocalConnector.GetAgent(session1); | 103 | result = m_LocalConnector.GetAgent(session1); |
105 | Assert.That(result.RegionID, Is.EqualTo(region2), "Agent is not in the right region (region2)"); | 104 | Assert.That(result.RegionID, Is.EqualTo(region2), "Agent is not in the right region (region2)"); |
106 | 105 | ||
107 | r = m_LocalConnector.LogoutAgent(session1, Vector3.Zero, Vector3.UnitY); | 106 | r = m_LocalConnector.LogoutAgent(session1); |
108 | Assert.IsTrue(r, "LogoutAgent returned false"); | 107 | Assert.IsTrue(r, "LogoutAgent returned false"); |
109 | result = m_LocalConnector.GetAgent(session1); | 108 | result = m_LocalConnector.GetAgent(session1); |
110 | Assert.IsNotNull(result, "Agent session disappeared from storage after logout"); | 109 | Assert.IsNull(result, "Agent session is still stored after logout"); |
111 | Assert.IsFalse(result.Online, "Agent is reported to be Online after logout"); | ||
112 | 110 | ||
113 | r = m_LocalConnector.ReportAgent(session1, region1, Vector3.Zero, Vector3.Zero); | 111 | r = m_LocalConnector.ReportAgent(session1, region1); |
114 | Assert.IsFalse(r, "ReportAgent of non-logged in user returned true"); | 112 | Assert.IsFalse(r, "ReportAgent of non-logged in user returned true"); |
115 | } | 113 | } |
116 | } | 114 | } |