diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 651 |
1 files changed, 206 insertions, 445 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 73b0b3e..f109589 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -41,8 +41,7 @@ using OpenMetaverse.Imaging; | |||
41 | using OpenSim.Framework; | 41 | using OpenSim.Framework; |
42 | using OpenSim.Services.Interfaces; | 42 | using OpenSim.Services.Interfaces; |
43 | using OpenSim.Framework.Communications; | 43 | using OpenSim.Framework.Communications; |
44 | using OpenSim.Framework.Communications.Cache; | 44 | |
45 | using OpenSim.Framework.Communications.Clients; | ||
46 | using OpenSim.Framework.Console; | 45 | using OpenSim.Framework.Console; |
47 | using OpenSim.Region.Framework.Interfaces; | 46 | using OpenSim.Region.Framework.Interfaces; |
48 | using OpenSim.Region.Framework.Scenes.Scripting; | 47 | using OpenSim.Region.Framework.Scenes.Scripting; |
@@ -141,7 +140,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
141 | protected ModuleLoader m_moduleLoader; | 140 | protected ModuleLoader m_moduleLoader; |
142 | protected StorageManager m_storageManager; | 141 | protected StorageManager m_storageManager; |
143 | protected AgentCircuitManager m_authenticateHandler; | 142 | protected AgentCircuitManager m_authenticateHandler; |
144 | public CommunicationsManager CommsManager; | ||
145 | 143 | ||
146 | protected SceneCommunicationService m_sceneGridService; | 144 | protected SceneCommunicationService m_sceneGridService; |
147 | public bool LoginsDisabled = true; | 145 | public bool LoginsDisabled = true; |
@@ -189,11 +187,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
189 | { | 187 | { |
190 | m_AuthorizationService = RequestModuleInterface<IAuthorizationService>(); | 188 | m_AuthorizationService = RequestModuleInterface<IAuthorizationService>(); |
191 | 189 | ||
192 | if (m_AuthorizationService == null) | 190 | //if (m_AuthorizationService == null) |
193 | { | 191 | //{ |
194 | // don't throw an exception if no authorization service is set for the time being | 192 | // // don't throw an exception if no authorization service is set for the time being |
195 | m_log.InfoFormat("[SCENE]: No Authorization service is configured"); | 193 | // m_log.InfoFormat("[SCENE]: No Authorization service is configured"); |
196 | } | 194 | //} |
197 | } | 195 | } |
198 | 196 | ||
199 | return m_AuthorizationService; | 197 | return m_AuthorizationService; |
@@ -240,6 +238,73 @@ namespace OpenSim.Region.Framework.Scenes | |||
240 | } | 238 | } |
241 | } | 239 | } |
242 | 240 | ||
241 | protected ILibraryService m_LibraryService; | ||
242 | |||
243 | public ILibraryService LibraryService | ||
244 | { | ||
245 | get | ||
246 | { | ||
247 | if (m_LibraryService == null) | ||
248 | m_LibraryService = RequestModuleInterface<ILibraryService>(); | ||
249 | |||
250 | return m_LibraryService; | ||
251 | } | ||
252 | } | ||
253 | |||
254 | protected ISimulationService m_simulationService; | ||
255 | public ISimulationService SimulationService | ||
256 | { | ||
257 | get | ||
258 | { | ||
259 | if (m_simulationService == null) | ||
260 | m_simulationService = RequestModuleInterface<ISimulationService>(); | ||
261 | return m_simulationService; | ||
262 | } | ||
263 | } | ||
264 | |||
265 | protected IAuthenticationService m_AuthenticationService; | ||
266 | public IAuthenticationService AuthenticationService | ||
267 | { | ||
268 | get | ||
269 | { | ||
270 | if (m_AuthenticationService == null) | ||
271 | m_AuthenticationService = RequestModuleInterface<IAuthenticationService>(); | ||
272 | return m_AuthenticationService; | ||
273 | } | ||
274 | } | ||
275 | |||
276 | protected IPresenceService m_PresenceService; | ||
277 | public IPresenceService PresenceService | ||
278 | { | ||
279 | get | ||
280 | { | ||
281 | if (m_PresenceService == null) | ||
282 | m_PresenceService = RequestModuleInterface<IPresenceService>(); | ||
283 | return m_PresenceService; | ||
284 | } | ||
285 | } | ||
286 | protected IUserAccountService m_UserAccountService; | ||
287 | public IUserAccountService UserAccountService | ||
288 | { | ||
289 | get | ||
290 | { | ||
291 | if (m_UserAccountService == null) | ||
292 | m_UserAccountService = RequestModuleInterface<IUserAccountService>(); | ||
293 | return m_UserAccountService; | ||
294 | } | ||
295 | } | ||
296 | |||
297 | protected OpenSim.Services.Interfaces.IAvatarService m_AvatarService; | ||
298 | public OpenSim.Services.Interfaces.IAvatarService AvatarService | ||
299 | { | ||
300 | get | ||
301 | { | ||
302 | if (m_AvatarService == null) | ||
303 | m_AvatarService = RequestModuleInterface<IAvatarService>(); | ||
304 | return m_AvatarService; | ||
305 | } | ||
306 | } | ||
307 | |||
243 | protected IXMLRPC m_xmlrpcModule; | 308 | protected IXMLRPC m_xmlrpcModule; |
244 | protected IWorldComm m_worldCommModule; | 309 | protected IWorldComm m_worldCommModule; |
245 | protected IAvatarFactory m_AvatarFactory; | 310 | protected IAvatarFactory m_AvatarFactory; |
@@ -249,10 +314,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
249 | } | 314 | } |
250 | protected IConfigSource m_config; | 315 | protected IConfigSource m_config; |
251 | protected IRegionSerialiserModule m_serialiser; | 316 | protected IRegionSerialiserModule m_serialiser; |
252 | protected IInterregionCommsOut m_interregionCommsOut; | ||
253 | protected IInterregionCommsIn m_interregionCommsIn; | ||
254 | protected IDialogModule m_dialogModule; | 317 | protected IDialogModule m_dialogModule; |
255 | protected ITeleportModule m_teleportModule; | 318 | protected IEntityTransferModule m_teleportModule; |
256 | 319 | ||
257 | protected ICapabilitiesModule m_capsModule; | 320 | protected ICapabilitiesModule m_capsModule; |
258 | public ICapabilitiesModule CapsModule | 321 | public ICapabilitiesModule CapsModule |
@@ -483,7 +546,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
483 | #region Constructors | 546 | #region Constructors |
484 | 547 | ||
485 | public Scene(RegionInfo regInfo, AgentCircuitManager authen, | 548 | public Scene(RegionInfo regInfo, AgentCircuitManager authen, |
486 | CommunicationsManager commsMan, SceneCommunicationService sceneGridService, | 549 | SceneCommunicationService sceneGridService, |
487 | StorageManager storeManager, | 550 | StorageManager storeManager, |
488 | ModuleLoader moduleLoader, bool dumpAssetsToFile, bool physicalPrim, | 551 | ModuleLoader moduleLoader, bool dumpAssetsToFile, bool physicalPrim, |
489 | bool SeeIntoRegionFromNeighbor, IConfigSource config, string simulatorVersion) | 552 | bool SeeIntoRegionFromNeighbor, IConfigSource config, string simulatorVersion) |
@@ -519,7 +582,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
519 | m_lastAllocatedLocalId = (uint)(random.NextDouble() * (double)(uint.MaxValue/2))+(uint)(uint.MaxValue/4); | 582 | m_lastAllocatedLocalId = (uint)(random.NextDouble() * (double)(uint.MaxValue/2))+(uint)(uint.MaxValue/4); |
520 | m_moduleLoader = moduleLoader; | 583 | m_moduleLoader = moduleLoader; |
521 | m_authenticateHandler = authen; | 584 | m_authenticateHandler = authen; |
522 | CommsManager = commsMan; | ||
523 | m_sceneGridService = sceneGridService; | 585 | m_sceneGridService = sceneGridService; |
524 | m_storageManager = storeManager; | 586 | m_storageManager = storeManager; |
525 | m_regInfo = regInfo; | 587 | m_regInfo = regInfo; |
@@ -776,6 +838,36 @@ namespace OpenSim.Region.Framework.Scenes | |||
776 | return m_simulatorVersion; | 838 | return m_simulatorVersion; |
777 | } | 839 | } |
778 | 840 | ||
841 | public string[] GetUserNames(UUID uuid) | ||
842 | { | ||
843 | string[] returnstring = new string[0]; | ||
844 | |||
845 | UserAccount account = UserAccountService.GetUserAccount(RegionInfo.ScopeID, uuid); | ||
846 | |||
847 | if (account != null) | ||
848 | { | ||
849 | returnstring = new string[2]; | ||
850 | returnstring[0] = account.FirstName; | ||
851 | returnstring[1] = account.LastName; | ||
852 | } | ||
853 | |||
854 | return returnstring; | ||
855 | } | ||
856 | |||
857 | public string GetUserName(UUID uuid) | ||
858 | { | ||
859 | string[] names = GetUserNames(uuid); | ||
860 | if (names.Length == 2) | ||
861 | { | ||
862 | string firstname = names[0]; | ||
863 | string lastname = names[1]; | ||
864 | |||
865 | return firstname + " " + lastname; | ||
866 | |||
867 | } | ||
868 | return "(hippos)"; | ||
869 | } | ||
870 | |||
779 | /// <summary> | 871 | /// <summary> |
780 | /// Another region is up. | 872 | /// Another region is up. |
781 | /// | 873 | /// |
@@ -809,7 +901,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
809 | regInfo.RegionName = otherRegion.RegionName; | 901 | regInfo.RegionName = otherRegion.RegionName; |
810 | regInfo.ScopeID = otherRegion.ScopeID; | 902 | regInfo.ScopeID = otherRegion.ScopeID; |
811 | regInfo.ExternalHostName = otherRegion.ExternalHostName; | 903 | regInfo.ExternalHostName = otherRegion.ExternalHostName; |
812 | 904 | GridRegion r = new GridRegion(regInfo); | |
813 | try | 905 | try |
814 | { | 906 | { |
815 | ForEachScenePresence(delegate(ScenePresence agent) | 907 | ForEachScenePresence(delegate(ScenePresence agent) |
@@ -823,7 +915,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
823 | List<ulong> old = new List<ulong>(); | 915 | List<ulong> old = new List<ulong>(); |
824 | old.Add(otherRegion.RegionHandle); | 916 | old.Add(otherRegion.RegionHandle); |
825 | agent.DropOldNeighbours(old); | 917 | agent.DropOldNeighbours(old); |
826 | InformClientOfNeighbor(agent, regInfo); | 918 | if (m_teleportModule != null) |
919 | m_teleportModule.EnableChildAgent(agent, r); | ||
827 | } | 920 | } |
828 | } | 921 | } |
829 | ); | 922 | ); |
@@ -971,6 +1064,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
971 | { | 1064 | { |
972 | foreach (RegionInfo region in m_regionRestartNotifyList) | 1065 | foreach (RegionInfo region in m_regionRestartNotifyList) |
973 | { | 1066 | { |
1067 | GridRegion r = new GridRegion(region); | ||
974 | try | 1068 | try |
975 | { | 1069 | { |
976 | ForEachScenePresence(delegate(ScenePresence agent) | 1070 | ForEachScenePresence(delegate(ScenePresence agent) |
@@ -978,9 +1072,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
978 | // If agent is a root agent. | 1072 | // If agent is a root agent. |
979 | if (!agent.IsChildAgent) | 1073 | if (!agent.IsChildAgent) |
980 | { | 1074 | { |
981 | //agent.ControllingClient.new | 1075 | if (m_teleportModule != null) |
982 | //this.CommsManager.InterRegion.InformRegionOfChildAgent(otherRegion.RegionHandle, agent.ControllingClient.RequestClientInfo()); | 1076 | m_teleportModule.EnableChildAgent(agent, r); |
983 | InformClientOfNeighbor(agent, region); | ||
984 | } | 1077 | } |
985 | } | 1078 | } |
986 | ); | 1079 | ); |
@@ -1123,11 +1216,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1123 | XferManager = RequestModuleInterface<IXfer>(); | 1216 | XferManager = RequestModuleInterface<IXfer>(); |
1124 | m_AvatarFactory = RequestModuleInterface<IAvatarFactory>(); | 1217 | m_AvatarFactory = RequestModuleInterface<IAvatarFactory>(); |
1125 | m_serialiser = RequestModuleInterface<IRegionSerialiserModule>(); | 1218 | m_serialiser = RequestModuleInterface<IRegionSerialiserModule>(); |
1126 | m_interregionCommsOut = RequestModuleInterface<IInterregionCommsOut>(); | ||
1127 | m_interregionCommsIn = RequestModuleInterface<IInterregionCommsIn>(); | ||
1128 | m_dialogModule = RequestModuleInterface<IDialogModule>(); | 1219 | m_dialogModule = RequestModuleInterface<IDialogModule>(); |
1129 | m_capsModule = RequestModuleInterface<ICapabilitiesModule>(); | 1220 | m_capsModule = RequestModuleInterface<ICapabilitiesModule>(); |
1130 | m_teleportModule = RequestModuleInterface<ITeleportModule>(); | 1221 | m_teleportModule = RequestModuleInterface<IEntityTransferModule>(); |
1131 | } | 1222 | } |
1132 | 1223 | ||
1133 | #endregion | 1224 | #endregion |
@@ -1564,7 +1655,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1564 | GridRegion region = new GridRegion(RegionInfo); | 1655 | GridRegion region = new GridRegion(RegionInfo); |
1565 | string error = GridService.RegisterRegion(RegionInfo.ScopeID, region); | 1656 | string error = GridService.RegisterRegion(RegionInfo.ScopeID, region); |
1566 | if (error != String.Empty) | 1657 | if (error != String.Empty) |
1658 | { | ||
1567 | throw new Exception(error); | 1659 | throw new Exception(error); |
1660 | } | ||
1568 | 1661 | ||
1569 | m_sceneGridService.SetScene(this); | 1662 | m_sceneGridService.SetScene(this); |
1570 | m_sceneGridService.InformNeighborsThatRegionisUp(RequestModuleInterface<INeighbourService>(), RegionInfo); | 1663 | m_sceneGridService.InformNeighborsThatRegionisUp(RequestModuleInterface<INeighbourService>(), RegionInfo); |
@@ -1951,7 +2044,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1951 | /// Move the given scene object into a new region depending on which region its absolute position has moved | 2044 | /// Move the given scene object into a new region depending on which region its absolute position has moved |
1952 | /// into. | 2045 | /// into. |
1953 | /// | 2046 | /// |
1954 | /// This method locates the new region handle and offsets the prim position for the new region | ||
1955 | /// </summary> | 2047 | /// </summary> |
1956 | /// <param name="attemptedPosition">the attempted out of region position of the scene object</param> | 2048 | /// <param name="attemptedPosition">the attempted out of region position of the scene object</param> |
1957 | /// <param name="grp">the scene object that we're crossing</param> | 2049 | /// <param name="grp">the scene object that we're crossing</param> |
@@ -1962,199 +2054,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1962 | if (grp.IsDeleted) | 2054 | if (grp.IsDeleted) |
1963 | return; | 2055 | return; |
1964 | 2056 | ||
1965 | if (grp.RootPart.DIE_AT_EDGE) | 2057 | if (m_teleportModule != null) |
1966 | { | 2058 | m_teleportModule.Cross(grp, attemptedPosition, silent); |
1967 | // We remove the object here | ||
1968 | try | ||
1969 | { | ||
1970 | DeleteSceneObject(grp, false); | ||
1971 | } | ||
1972 | catch (Exception) | ||
1973 | { | ||
1974 | m_log.Warn("[DATABASE]: exception when trying to remove the prim that crossed the border."); | ||
1975 | } | ||
1976 | return; | ||
1977 | } | ||
1978 | 2059 | ||
1979 | int thisx = (int)RegionInfo.RegionLocX; | ||
1980 | int thisy = (int)RegionInfo.RegionLocY; | ||
1981 | Vector3 EastCross = new Vector3(0.1f,0,0); | ||
1982 | Vector3 WestCross = new Vector3(-0.1f, 0, 0); | ||
1983 | Vector3 NorthCross = new Vector3(0, 0.1f, 0); | ||
1984 | Vector3 SouthCross = new Vector3(0, -0.1f, 0); | ||
1985 | |||
1986 | |||
1987 | // use this if no borders were crossed! | ||
1988 | ulong newRegionHandle | ||
1989 | = Util.UIntsToLong((uint)((thisx) * Constants.RegionSize), | ||
1990 | (uint)((thisy) * Constants.RegionSize)); | ||
1991 | |||
1992 | Vector3 pos = attemptedPosition; | ||
1993 | |||
1994 | int changeX = 1; | ||
1995 | int changeY = 1; | ||
1996 | |||
1997 | if (TestBorderCross(attemptedPosition + WestCross, Cardinals.W)) | ||
1998 | { | ||
1999 | if (TestBorderCross(attemptedPosition + SouthCross, Cardinals.S)) | ||
2000 | { | ||
2001 | |||
2002 | Border crossedBorderx = GetCrossedBorder(attemptedPosition + WestCross, Cardinals.W); | ||
2003 | |||
2004 | if (crossedBorderx.BorderLine.Z > 0) | ||
2005 | { | ||
2006 | pos.X = ((pos.X + crossedBorderx.BorderLine.Z)); | ||
2007 | changeX = (int)(crossedBorderx.BorderLine.Z /(int) Constants.RegionSize); | ||
2008 | } | ||
2009 | else | ||
2010 | pos.X = ((pos.X + Constants.RegionSize)); | ||
2011 | |||
2012 | Border crossedBordery = GetCrossedBorder(attemptedPosition + SouthCross, Cardinals.S); | ||
2013 | //(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize) | ||
2014 | |||
2015 | if (crossedBordery.BorderLine.Z > 0) | ||
2016 | { | ||
2017 | pos.Y = ((pos.Y + crossedBordery.BorderLine.Z)); | ||
2018 | changeY = (int)(crossedBordery.BorderLine.Z / (int)Constants.RegionSize); | ||
2019 | } | ||
2020 | else | ||
2021 | pos.Y = ((pos.Y + Constants.RegionSize)); | ||
2022 | |||
2023 | |||
2024 | |||
2025 | newRegionHandle | ||
2026 | = Util.UIntsToLong((uint)((thisx - changeX) * Constants.RegionSize), | ||
2027 | (uint)((thisy - changeY) * Constants.RegionSize)); | ||
2028 | // x - 1 | ||
2029 | // y - 1 | ||
2030 | } | ||
2031 | else if (TestBorderCross(attemptedPosition + NorthCross, Cardinals.N)) | ||
2032 | { | ||
2033 | Border crossedBorderx = GetCrossedBorder(attemptedPosition + WestCross, Cardinals.W); | ||
2034 | |||
2035 | if (crossedBorderx.BorderLine.Z > 0) | ||
2036 | { | ||
2037 | pos.X = ((pos.X + crossedBorderx.BorderLine.Z)); | ||
2038 | changeX = (int)(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize); | ||
2039 | } | ||
2040 | else | ||
2041 | pos.X = ((pos.X + Constants.RegionSize)); | ||
2042 | |||
2043 | |||
2044 | Border crossedBordery = GetCrossedBorder(attemptedPosition + SouthCross, Cardinals.S); | ||
2045 | //(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize) | ||
2046 | |||
2047 | if (crossedBordery.BorderLine.Z > 0) | ||
2048 | { | ||
2049 | pos.Y = ((pos.Y + crossedBordery.BorderLine.Z)); | ||
2050 | changeY = (int)(crossedBordery.BorderLine.Z / (int)Constants.RegionSize); | ||
2051 | } | ||
2052 | else | ||
2053 | pos.Y = ((pos.Y + Constants.RegionSize)); | ||
2054 | |||
2055 | newRegionHandle | ||
2056 | = Util.UIntsToLong((uint)((thisx - changeX) * Constants.RegionSize), | ||
2057 | (uint)((thisy + changeY) * Constants.RegionSize)); | ||
2058 | // x - 1 | ||
2059 | // y + 1 | ||
2060 | } | ||
2061 | else | ||
2062 | { | ||
2063 | Border crossedBorderx = GetCrossedBorder(attemptedPosition + WestCross, Cardinals.W); | ||
2064 | |||
2065 | if (crossedBorderx.BorderLine.Z > 0) | ||
2066 | { | ||
2067 | pos.X = ((pos.X + crossedBorderx.BorderLine.Z)); | ||
2068 | changeX = (int)(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize); | ||
2069 | } | ||
2070 | else | ||
2071 | pos.X = ((pos.X + Constants.RegionSize)); | ||
2072 | |||
2073 | newRegionHandle | ||
2074 | = Util.UIntsToLong((uint)((thisx - changeX) * Constants.RegionSize), | ||
2075 | (uint) (thisy*Constants.RegionSize)); | ||
2076 | // x - 1 | ||
2077 | } | ||
2078 | } | ||
2079 | else if (TestBorderCross(attemptedPosition + EastCross, Cardinals.E)) | ||
2080 | { | ||
2081 | if (TestBorderCross(attemptedPosition + SouthCross, Cardinals.S)) | ||
2082 | { | ||
2083 | |||
2084 | pos.X = ((pos.X - Constants.RegionSize)); | ||
2085 | Border crossedBordery = GetCrossedBorder(attemptedPosition + SouthCross, Cardinals.S); | ||
2086 | //(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize) | ||
2087 | |||
2088 | if (crossedBordery.BorderLine.Z > 0) | ||
2089 | { | ||
2090 | pos.Y = ((pos.Y + crossedBordery.BorderLine.Z)); | ||
2091 | changeY = (int)(crossedBordery.BorderLine.Z / (int)Constants.RegionSize); | ||
2092 | } | ||
2093 | else | ||
2094 | pos.Y = ((pos.Y + Constants.RegionSize)); | ||
2095 | |||
2096 | |||
2097 | newRegionHandle | ||
2098 | = Util.UIntsToLong((uint)((thisx + changeX) * Constants.RegionSize), | ||
2099 | (uint)((thisy - changeY) * Constants.RegionSize)); | ||
2100 | // x + 1 | ||
2101 | // y - 1 | ||
2102 | } | ||
2103 | else if (TestBorderCross(attemptedPosition + NorthCross, Cardinals.N)) | ||
2104 | { | ||
2105 | pos.X = ((pos.X - Constants.RegionSize)); | ||
2106 | pos.Y = ((pos.Y - Constants.RegionSize)); | ||
2107 | newRegionHandle | ||
2108 | = Util.UIntsToLong((uint)((thisx + changeX) * Constants.RegionSize), | ||
2109 | (uint)((thisy + changeY) * Constants.RegionSize)); | ||
2110 | // x + 1 | ||
2111 | // y + 1 | ||
2112 | } | ||
2113 | else | ||
2114 | { | ||
2115 | pos.X = ((pos.X - Constants.RegionSize)); | ||
2116 | newRegionHandle | ||
2117 | = Util.UIntsToLong((uint)((thisx + changeX) * Constants.RegionSize), | ||
2118 | (uint) (thisy*Constants.RegionSize)); | ||
2119 | // x + 1 | ||
2120 | } | ||
2121 | } | ||
2122 | else if (TestBorderCross(attemptedPosition + SouthCross, Cardinals.S)) | ||
2123 | { | ||
2124 | Border crossedBordery = GetCrossedBorder(attemptedPosition + SouthCross, Cardinals.S); | ||
2125 | //(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize) | ||
2126 | |||
2127 | if (crossedBordery.BorderLine.Z > 0) | ||
2128 | { | ||
2129 | pos.Y = ((pos.Y + crossedBordery.BorderLine.Z)); | ||
2130 | changeY = (int)(crossedBordery.BorderLine.Z / (int)Constants.RegionSize); | ||
2131 | } | ||
2132 | else | ||
2133 | pos.Y = ((pos.Y + Constants.RegionSize)); | ||
2134 | |||
2135 | newRegionHandle | ||
2136 | = Util.UIntsToLong((uint)(thisx * Constants.RegionSize), (uint)((thisy - changeY) * Constants.RegionSize)); | ||
2137 | // y - 1 | ||
2138 | } | ||
2139 | else if (TestBorderCross(attemptedPosition + NorthCross, Cardinals.N)) | ||
2140 | { | ||
2141 | |||
2142 | pos.Y = ((pos.Y - Constants.RegionSize)); | ||
2143 | newRegionHandle | ||
2144 | = Util.UIntsToLong((uint)(thisx * Constants.RegionSize), (uint)((thisy + changeY) * Constants.RegionSize)); | ||
2145 | // y + 1 | ||
2146 | } | ||
2147 | |||
2148 | // Offset the positions for the new region across the border | ||
2149 | Vector3 oldGroupPosition = grp.RootPart.GroupPosition; | ||
2150 | grp.OffsetForNewRegion(pos); | ||
2151 | |||
2152 | // If we fail to cross the border, then reset the position of the scene object on that border. | ||
2153 | if (!CrossPrimGroupIntoNewRegion(newRegionHandle, grp, silent)) | ||
2154 | { | ||
2155 | grp.OffsetForNewRegion(oldGroupPosition); | ||
2156 | grp.ScheduleGroupForFullUpdate(); | ||
2157 | } | ||
2158 | } | 2060 | } |
2159 | 2061 | ||
2160 | public Border GetCrossedBorder(Vector3 position, Cardinals gridline) | 2062 | public Border GetCrossedBorder(Vector3 position, Cardinals gridline) |
@@ -2337,75 +2239,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2337 | } | 2239 | } |
2338 | 2240 | ||
2339 | 2241 | ||
2340 | /// <summary> | ||
2341 | /// Move the given scene object into a new region | ||
2342 | /// </summary> | ||
2343 | /// <param name="newRegionHandle"></param> | ||
2344 | /// <param name="grp">Scene Object Group that we're crossing</param> | ||
2345 | /// <returns> | ||
2346 | /// true if the crossing itself was successful, false on failure | ||
2347 | /// FIMXE: we still return true if the crossing object was not successfully deleted from the originating region | ||
2348 | /// </returns> | ||
2349 | public bool CrossPrimGroupIntoNewRegion(ulong newRegionHandle, SceneObjectGroup grp, bool silent) | ||
2350 | { | ||
2351 | //m_log.Debug(" >>> CrossPrimGroupIntoNewRegion <<<"); | ||
2352 | |||
2353 | bool successYN = false; | ||
2354 | grp.RootPart.UpdateFlag = 0; | ||
2355 | //int primcrossingXMLmethod = 0; | ||
2356 | |||
2357 | if (newRegionHandle != 0) | ||
2358 | { | ||
2359 | //string objectState = grp.GetStateSnapshot(); | ||
2360 | |||
2361 | //successYN | ||
2362 | // = m_sceneGridService.PrimCrossToNeighboringRegion( | ||
2363 | // newRegionHandle, grp.UUID, m_serialiser.SaveGroupToXml2(grp), primcrossingXMLmethod); | ||
2364 | //if (successYN && (objectState != "") && m_allowScriptCrossings) | ||
2365 | //{ | ||
2366 | // successYN = m_sceneGridService.PrimCrossToNeighboringRegion( | ||
2367 | // newRegionHandle, grp.UUID, objectState, 100); | ||
2368 | //} | ||
2369 | |||
2370 | // And the new channel... | ||
2371 | if (m_interregionCommsOut != null) | ||
2372 | successYN = m_interregionCommsOut.SendCreateObject(newRegionHandle, grp, true); | ||
2373 | |||
2374 | if (successYN) | ||
2375 | { | ||
2376 | // We remove the object here | ||
2377 | try | ||
2378 | { | ||
2379 | DeleteSceneObject(grp, silent); | ||
2380 | } | ||
2381 | catch (Exception e) | ||
2382 | { | ||
2383 | m_log.ErrorFormat( | ||
2384 | "[INTERREGION]: Exception deleting the old object left behind on a border crossing for {0}, {1}", | ||
2385 | grp, e); | ||
2386 | } | ||
2387 | } | ||
2388 | else | ||
2389 | { | ||
2390 | if (!grp.IsDeleted) | ||
2391 | { | ||
2392 | if (grp.RootPart.PhysActor != null) | ||
2393 | { | ||
2394 | grp.RootPart.PhysActor.CrossingFailure(); | ||
2395 | } | ||
2396 | } | ||
2397 | |||
2398 | m_log.ErrorFormat("[INTERREGION]: Prim crossing failed for {0}", grp); | ||
2399 | } | ||
2400 | } | ||
2401 | else | ||
2402 | { | ||
2403 | m_log.Error("[INTERREGION]: region handle was unexpectedly 0 in Scene.CrossPrimGroupIntoNewRegion()"); | ||
2404 | } | ||
2405 | |||
2406 | return successYN; | ||
2407 | } | ||
2408 | |||
2409 | public bool IncomingCreateObject(ISceneObject sog) | 2242 | public bool IncomingCreateObject(ISceneObject sog) |
2410 | { | 2243 | { |
2411 | //m_log.Debug(" >>> IncomingCreateObject <<< " + ((SceneObjectGroup)sog).AbsolutePosition + " deleted? " + ((SceneObjectGroup)sog).IsDeleted); | 2244 | //m_log.Debug(" >>> IncomingCreateObject <<< " + ((SceneObjectGroup)sog).AbsolutePosition + " deleted? " + ((SceneObjectGroup)sog).IsDeleted); |
@@ -2466,6 +2299,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2466 | 2299 | ||
2467 | return false; | 2300 | return false; |
2468 | } | 2301 | } |
2302 | |||
2303 | sceneObject.SetScene(this); | ||
2304 | |||
2469 | // Force allocation of new LocalId | 2305 | // Force allocation of new LocalId |
2470 | // | 2306 | // |
2471 | foreach (SceneObjectPart p in sceneObject.Children.Values) | 2307 | foreach (SceneObjectPart p in sceneObject.Children.Values) |
@@ -2584,6 +2420,37 @@ namespace OpenSim.Region.Framework.Scenes | |||
2584 | { | 2420 | { |
2585 | AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode); | 2421 | AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode); |
2586 | 2422 | ||
2423 | // Do the verification here | ||
2424 | System.Net.EndPoint ep = client.GetClientEP(); | ||
2425 | if (aCircuit != null) | ||
2426 | { | ||
2427 | if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0) | ||
2428 | { | ||
2429 | m_log.DebugFormat("[Scene]: Incoming client {0} {1} in region {2} via Login", aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName); | ||
2430 | IUserAgentVerificationModule userVerification = RequestModuleInterface<IUserAgentVerificationModule>(); | ||
2431 | if (userVerification != null) | ||
2432 | { | ||
2433 | if (!userVerification.VerifyClient(aCircuit, ep.ToString())) | ||
2434 | { | ||
2435 | // uh-oh, this is fishy | ||
2436 | m_log.WarnFormat("[Scene]: Agent {0} with session {1} connecting with unidentified end point {2}. Refusing service.", | ||
2437 | client.AgentId, client.SessionId, ep.ToString()); | ||
2438 | try | ||
2439 | { | ||
2440 | client.Close(); | ||
2441 | } | ||
2442 | catch (Exception e) | ||
2443 | { | ||
2444 | m_log.DebugFormat("[Scene]: Exception while closing aborted client: {0}", e.StackTrace); | ||
2445 | } | ||
2446 | return; | ||
2447 | } | ||
2448 | else | ||
2449 | m_log.DebugFormat("[Scene]: User Client Verification for {0} {1} returned true", aCircuit.firstname, aCircuit.lastname); | ||
2450 | } | ||
2451 | } | ||
2452 | } | ||
2453 | |||
2587 | m_log.Debug("[Scene] Adding new agent " + client.Name + " to scene " + RegionInfo.RegionName); | 2454 | m_log.Debug("[Scene] Adding new agent " + client.Name + " to scene " + RegionInfo.RegionName); |
2588 | /* | 2455 | /* |
2589 | string logMsg = string.Format("[SCENE]: Adding new {0} agent for {1} in {2}", | 2456 | string logMsg = string.Format("[SCENE]: Adding new {0} agent for {1} in {2}", |
@@ -2593,9 +2460,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2593 | m_log.Debug(logMsg); | 2460 | m_log.Debug(logMsg); |
2594 | */ | 2461 | */ |
2595 | 2462 | ||
2596 | CommsManager.UserProfileCacheService.AddNewUser(client.AgentId); | 2463 | //CommsManager.UserProfileCacheService.AddNewUser(client.AgentId); |
2597 | |||
2598 | ScenePresence sp = CreateAndAddScenePresence(client); | 2464 | ScenePresence sp = CreateAndAddScenePresence(client); |
2465 | sp.Appearance = aCircuit.Appearance; | ||
2599 | 2466 | ||
2600 | // HERE!!! Do the initial attachments right here | 2467 | // HERE!!! Do the initial attachments right here |
2601 | // first agent upon login is a root agent by design. | 2468 | // first agent upon login is a root agent by design. |
@@ -2609,6 +2476,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2609 | 2476 | ||
2610 | m_LastLogin = Util.EnvironmentTickCount(); | 2477 | m_LastLogin = Util.EnvironmentTickCount(); |
2611 | EventManager.TriggerOnNewClient(client); | 2478 | EventManager.TriggerOnNewClient(client); |
2479 | |||
2612 | } | 2480 | } |
2613 | 2481 | ||
2614 | 2482 | ||
@@ -2725,7 +2593,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2725 | { | 2593 | { |
2726 | client.OnTeleportLocationRequest += RequestTeleportLocation; | 2594 | client.OnTeleportLocationRequest += RequestTeleportLocation; |
2727 | client.OnTeleportLandmarkRequest += RequestTeleportLandmark; | 2595 | client.OnTeleportLandmarkRequest += RequestTeleportLandmark; |
2728 | client.OnTeleportHomeRequest += TeleportClientHome; | ||
2729 | } | 2596 | } |
2730 | 2597 | ||
2731 | public virtual void SubscribeToClientScriptEvents(IClientAPI client) | 2598 | public virtual void SubscribeToClientScriptEvents(IClientAPI client) |
@@ -2745,7 +2612,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2745 | 2612 | ||
2746 | public virtual void SubscribeToClientGridEvents(IClientAPI client) | 2613 | public virtual void SubscribeToClientGridEvents(IClientAPI client) |
2747 | { | 2614 | { |
2748 | client.OnNameFromUUIDRequest += CommsManager.HandleUUIDNameRequest; | 2615 | client.OnNameFromUUIDRequest += HandleUUIDNameRequest; |
2749 | client.OnMoneyTransferRequest += ProcessMoneyTransferRequest; | 2616 | client.OnMoneyTransferRequest += ProcessMoneyTransferRequest; |
2750 | client.OnAvatarPickerRequest += ProcessAvatarPickerRequest; | 2617 | client.OnAvatarPickerRequest += ProcessAvatarPickerRequest; |
2751 | client.OnSetStartLocationRequest += SetHomeRezPoint; | 2618 | client.OnSetStartLocationRequest += SetHomeRezPoint; |
@@ -2880,7 +2747,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2880 | { | 2747 | { |
2881 | client.OnTeleportLocationRequest -= RequestTeleportLocation; | 2748 | client.OnTeleportLocationRequest -= RequestTeleportLocation; |
2882 | client.OnTeleportLandmarkRequest -= RequestTeleportLandmark; | 2749 | client.OnTeleportLandmarkRequest -= RequestTeleportLandmark; |
2883 | client.OnTeleportHomeRequest -= TeleportClientHome; | 2750 | //client.OnTeleportHomeRequest -= TeleportClientHome; |
2884 | } | 2751 | } |
2885 | 2752 | ||
2886 | public virtual void UnSubscribeToClientScriptEvents(IClientAPI client) | 2753 | public virtual void UnSubscribeToClientScriptEvents(IClientAPI client) |
@@ -2900,7 +2767,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2900 | 2767 | ||
2901 | public virtual void UnSubscribeToClientGridEvents(IClientAPI client) | 2768 | public virtual void UnSubscribeToClientGridEvents(IClientAPI client) |
2902 | { | 2769 | { |
2903 | client.OnNameFromUUIDRequest -= CommsManager.HandleUUIDNameRequest; | 2770 | client.OnNameFromUUIDRequest -= HandleUUIDNameRequest; |
2904 | client.OnMoneyTransferRequest -= ProcessMoneyTransferRequest; | 2771 | client.OnMoneyTransferRequest -= ProcessMoneyTransferRequest; |
2905 | client.OnAvatarPickerRequest -= ProcessAvatarPickerRequest; | 2772 | client.OnAvatarPickerRequest -= ProcessAvatarPickerRequest; |
2906 | client.OnSetStartLocationRequest -= SetHomeRezPoint; | 2773 | client.OnSetStartLocationRequest -= SetHomeRezPoint; |
@@ -2927,30 +2794,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2927 | /// <param name="client">The IClientAPI for the client</param> | 2794 | /// <param name="client">The IClientAPI for the client</param> |
2928 | public virtual void TeleportClientHome(UUID agentId, IClientAPI client) | 2795 | public virtual void TeleportClientHome(UUID agentId, IClientAPI client) |
2929 | { | 2796 | { |
2930 | UserProfileData UserProfile = CommsManager.UserService.GetUserProfile(agentId); | 2797 | if (m_teleportModule != null) |
2931 | if (UserProfile != null) | 2798 | m_teleportModule.TeleportHome(agentId, client); |
2799 | else | ||
2932 | { | 2800 | { |
2933 | GridRegion regionInfo = GridService.GetRegionByUUID(UUID.Zero, UserProfile.HomeRegionID); | 2801 | m_log.DebugFormat("[SCENE]: Unable to teleport user home: no AgentTransferModule is active"); |
2934 | if (regionInfo == null) | 2802 | client.SendTeleportFailed("Unable to perform teleports on this simulator."); |
2935 | { | ||
2936 | uint x = 0, y = 0; | ||
2937 | Utils.LongToUInts(UserProfile.HomeRegion, out x, out y); | ||
2938 | regionInfo = GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y); | ||
2939 | if (regionInfo != null) // home region can be away temporarily, too | ||
2940 | { | ||
2941 | UserProfile.HomeRegionID = regionInfo.RegionID; | ||
2942 | CommsManager.UserService.UpdateUserProfile(UserProfile); | ||
2943 | } | ||
2944 | } | ||
2945 | if (regionInfo == null) | ||
2946 | { | ||
2947 | // can't find the Home region: Tell viewer and abort | ||
2948 | client.SendTeleportFailed("Your home-region could not be found."); | ||
2949 | return; | ||
2950 | } | ||
2951 | RequestTeleportLocation( | ||
2952 | client, regionInfo.RegionHandle, UserProfile.HomeLocation, UserProfile.HomeLookAt, | ||
2953 | (uint)(TPFlags.SetLastToTarget | TPFlags.ViaHome)); | ||
2954 | } | 2803 | } |
2955 | } | 2804 | } |
2956 | 2805 | ||
@@ -3041,7 +2890,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3041 | } | 2890 | } |
3042 | 2891 | ||
3043 | /// <summary> | 2892 | /// <summary> |
3044 | /// Sets the Home Point. The GridService uses this to know where to put a user when they log-in | 2893 | /// Sets the Home Point. The LoginService uses this to know where to put a user when they log-in |
3045 | /// </summary> | 2894 | /// </summary> |
3046 | /// <param name="remoteClient"></param> | 2895 | /// <param name="remoteClient"></param> |
3047 | /// <param name="regionHandle"></param> | 2896 | /// <param name="regionHandle"></param> |
@@ -3050,27 +2899,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
3050 | /// <param name="flags"></param> | 2899 | /// <param name="flags"></param> |
3051 | public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags) | 2900 | public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags) |
3052 | { | 2901 | { |
3053 | UserProfileData UserProfile = CommsManager.UserService.GetUserProfile(remoteClient.AgentId); | 2902 | if (PresenceService.SetHomeLocation(remoteClient.AgentId.ToString(), RegionInfo.RegionID, position, lookAt)) |
3054 | if (UserProfile != null) | ||
3055 | { | ||
3056 | // I know I'm ignoring the regionHandle provided by the teleport location request. | ||
3057 | // reusing the TeleportLocationRequest delegate, so regionHandle isn't valid | ||
3058 | UserProfile.HomeRegionID = RegionInfo.RegionID; | ||
3059 | // TODO: The next line can be removed, as soon as only homeRegionID based UserServers are around. | ||
3060 | // TODO: The HomeRegion property can be removed then, too | ||
3061 | UserProfile.HomeRegion = RegionInfo.RegionHandle; | ||
3062 | |||
3063 | UserProfile.HomeLocation = position; | ||
3064 | UserProfile.HomeLookAt = lookAt; | ||
3065 | CommsManager.UserService.UpdateUserProfile(UserProfile); | ||
3066 | |||
3067 | // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot. | 2903 | // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot. |
3068 | m_dialogModule.SendAlertToUser(remoteClient, "Home position set."); | 2904 | m_dialogModule.SendAlertToUser(remoteClient, "Home position set."); |
3069 | } | ||
3070 | else | 2905 | else |
3071 | { | ||
3072 | m_dialogModule.SendAlertToUser(remoteClient, "Set Home request Failed."); | 2906 | m_dialogModule.SendAlertToUser(remoteClient, "Set Home request Failed."); |
3073 | } | ||
3074 | } | 2907 | } |
3075 | 2908 | ||
3076 | /// <summary> | 2909 | /// <summary> |
@@ -3144,14 +2977,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
3144 | m_sceneGraph.removeUserCount(!childagentYN); | 2977 | m_sceneGraph.removeUserCount(!childagentYN); |
3145 | CapsModule.RemoveCapsHandler(agentID); | 2978 | CapsModule.RemoveCapsHandler(agentID); |
3146 | 2979 | ||
3147 | if (avatar.Scene.NeedSceneCacheClear(avatar.UUID)) | 2980 | // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever |
3148 | { | 2981 | // this method is doing is HORRIBLE!!! |
3149 | CommsManager.UserProfileCacheService.RemoveUser(agentID); | 2982 | avatar.Scene.NeedSceneCacheClear(avatar.UUID); |
3150 | } | ||
3151 | 2983 | ||
3152 | if (!avatar.IsChildAgent) | 2984 | if (!avatar.IsChildAgent) |
3153 | { | 2985 | { |
3154 | m_sceneGridService.LogOffUser(agentID, RegionInfo.RegionID, RegionInfo.RegionHandle, avatar.AbsolutePosition, avatar.Lookat); | ||
3155 | //List<ulong> childknownRegions = new List<ulong>(); | 2986 | //List<ulong> childknownRegions = new List<ulong>(); |
3156 | //List<ulong> ckn = avatar.KnownChildRegionHandles; | 2987 | //List<ulong> ckn = avatar.KnownChildRegionHandles; |
3157 | //for (int i = 0; i < ckn.Count; i++) | 2988 | //for (int i = 0; i < ckn.Count; i++) |
@@ -3206,12 +3037,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3206 | m_log.Error("[SCENE] Scene.cs:RemoveClient exception: " + e.ToString()); | 3037 | m_log.Error("[SCENE] Scene.cs:RemoveClient exception: " + e.ToString()); |
3207 | } | 3038 | } |
3208 | 3039 | ||
3209 | // Remove client agent from profile, so new logins will work | ||
3210 | if (!childagentYN) | ||
3211 | { | ||
3212 | m_sceneGridService.ClearUserAgent(agentID); | ||
3213 | } | ||
3214 | |||
3215 | m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode); | 3040 | m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode); |
3216 | 3041 | ||
3217 | //m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false)); | 3042 | //m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false)); |
@@ -3285,14 +3110,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3285 | m_sceneGridService.KiPrimitive += SendKillObject; | 3110 | m_sceneGridService.KiPrimitive += SendKillObject; |
3286 | m_sceneGridService.OnGetLandData += GetLandData; | 3111 | m_sceneGridService.OnGetLandData += GetLandData; |
3287 | 3112 | ||
3288 | if (m_interregionCommsIn != null) | ||
3289 | { | ||
3290 | m_log.Debug("[SCENE]: Registering with InterregionCommsIn"); | ||
3291 | m_interregionCommsIn.OnChildAgentUpdate += IncomingChildAgentDataUpdate; | ||
3292 | } | ||
3293 | else | ||
3294 | m_log.Debug("[SCENE]: Unable to register with InterregionCommsIn"); | ||
3295 | |||
3296 | } | 3113 | } |
3297 | 3114 | ||
3298 | /// <summary> | 3115 | /// <summary> |
@@ -3310,9 +3127,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3310 | m_sceneGridService.OnCloseAgentConnection -= IncomingCloseAgent; | 3127 | m_sceneGridService.OnCloseAgentConnection -= IncomingCloseAgent; |
3311 | m_sceneGridService.OnGetLandData -= GetLandData; | 3128 | m_sceneGridService.OnGetLandData -= GetLandData; |
3312 | 3129 | ||
3313 | if (m_interregionCommsIn != null) | ||
3314 | m_interregionCommsIn.OnChildAgentUpdate -= IncomingChildAgentDataUpdate; | ||
3315 | |||
3316 | // this does nothing; should be removed | 3130 | // this does nothing; should be removed |
3317 | m_sceneGridService.Close(); | 3131 | m_sceneGridService.Close(); |
3318 | 3132 | ||
@@ -3369,7 +3183,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3369 | agent.AgentID, agent.circuitcode, teleportFlags); | 3183 | agent.AgentID, agent.circuitcode, teleportFlags); |
3370 | 3184 | ||
3371 | reason = String.Empty; | 3185 | reason = String.Empty; |
3372 | if (!AuthenticateUser(agent, out reason)) | 3186 | if (!VerifyUserPresence(agent, out reason)) |
3373 | return false; | 3187 | return false; |
3374 | 3188 | ||
3375 | if (!AuthorizeUser(agent, out reason)) | 3189 | if (!AuthorizeUser(agent, out reason)) |
@@ -3464,40 +3278,39 @@ namespace OpenSim.Region.Framework.Scenes | |||
3464 | } | 3278 | } |
3465 | } | 3279 | } |
3466 | 3280 | ||
3281 | agent.teleportFlags = teleportFlags; | ||
3467 | m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent); | 3282 | m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent); |
3468 | 3283 | ||
3469 | // rewrite session_id | ||
3470 | CachedUserInfo userinfo = CommsManager.UserProfileCacheService.GetUserDetails(agent.AgentID); | ||
3471 | if (userinfo != null) | ||
3472 | { | ||
3473 | userinfo.SessionID = agent.SessionID; | ||
3474 | } | ||
3475 | else | ||
3476 | { | ||
3477 | m_log.WarnFormat( | ||
3478 | "[CONNECTION BEGIN]: We couldn't find a User Info record for {0}. This is usually an indication that the UUID we're looking up is invalid", agent.AgentID); | ||
3479 | } | ||
3480 | |||
3481 | return true; | 3284 | return true; |
3482 | } | 3285 | } |
3483 | 3286 | ||
3484 | /// <summary> | 3287 | /// <summary> |
3485 | /// Verifies that the user has a session on the Grid | 3288 | /// Verifies that the user has a presence on the Grid |
3486 | /// </summary> | 3289 | /// </summary> |
3487 | /// <param name="agent">Circuit Data of the Agent we're verifying</param> | 3290 | /// <param name="agent">Circuit Data of the Agent we're verifying</param> |
3488 | /// <param name="reason">Outputs the reason for the false response on this string</param> | 3291 | /// <param name="reason">Outputs the reason for the false response on this string</param> |
3489 | /// <returns>True if the user has a session on the grid. False if it does not. False will | 3292 | /// <returns>True if the user has a session on the grid. False if it does not. False will |
3490 | /// also return a reason.</returns> | 3293 | /// also return a reason.</returns> |
3491 | public virtual bool AuthenticateUser(AgentCircuitData agent, out string reason) | 3294 | public virtual bool VerifyUserPresence(AgentCircuitData agent, out string reason) |
3492 | { | 3295 | { |
3493 | reason = String.Empty; | 3296 | reason = String.Empty; |
3494 | 3297 | ||
3495 | bool result = CommsManager.UserService.VerifySession(agent.AgentID, agent.SessionID); | 3298 | IPresenceService presence = RequestModuleInterface<IPresenceService>(); |
3496 | m_log.Debug("[CONNECTION BEGIN]: User authentication returned " + result); | 3299 | if (presence == null) |
3497 | if (!result) | 3300 | { |
3498 | reason = String.Format("Failed to authenticate user {0} {1}, access denied.", agent.firstname, agent.lastname); | 3301 | reason = String.Format("Failed to verify user {0} {1} in region {2}. Presence service does not exist.", agent.firstname, agent.lastname, RegionInfo.RegionName); |
3302 | return false; | ||
3303 | } | ||
3304 | |||
3305 | OpenSim.Services.Interfaces.PresenceInfo pinfo = presence.GetAgent(agent.SessionID); | ||
3499 | 3306 | ||
3500 | return result; | 3307 | if (pinfo == null || (pinfo != null && pinfo.Online == false)) |
3308 | { | ||
3309 | reason = String.Format("Failed to verify user {0} {1}, access denied to region {2}.", agent.firstname, agent.lastname, RegionInfo.RegionName); | ||
3310 | return false; | ||
3311 | } | ||
3312 | |||
3313 | return true; | ||
3501 | } | 3314 | } |
3502 | 3315 | ||
3503 | /// <summary> | 3316 | /// <summary> |
@@ -3698,8 +3511,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3698 | /// <returns>true if we handled it.</returns> | 3511 | /// <returns>true if we handled it.</returns> |
3699 | public virtual bool IncomingChildAgentDataUpdate(AgentData cAgentData) | 3512 | public virtual bool IncomingChildAgentDataUpdate(AgentData cAgentData) |
3700 | { | 3513 | { |
3701 | // m_log.DebugFormat( | 3514 | m_log.DebugFormat( |
3702 | // "[SCENE]: Incoming child agent update for {0} in {1}", cAgentData.AgentID, RegionInfo.RegionName); | 3515 | "[SCENE]: Incoming child agent update for {0} in {1}", cAgentData.AgentID, RegionInfo.RegionName); |
3703 | 3516 | ||
3704 | // We have to wait until the viewer contacts this region after receiving EAC. | 3517 | // We have to wait until the viewer contacts this region after receiving EAC. |
3705 | // That calls AddNewClient, which finally creates the ScenePresence | 3518 | // That calls AddNewClient, which finally creates the ScenePresence |
@@ -3768,16 +3581,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3768 | return false; | 3581 | return false; |
3769 | } | 3582 | } |
3770 | 3583 | ||
3771 | public virtual bool IncomingReleaseAgent(UUID id) | ||
3772 | { | ||
3773 | return m_sceneGridService.ReleaseAgent(id); | ||
3774 | } | ||
3775 | |||
3776 | public void SendReleaseAgent(ulong regionHandle, UUID id, string uri) | ||
3777 | { | ||
3778 | m_interregionCommsOut.SendReleaseAgent(regionHandle, id, uri); | ||
3779 | } | ||
3780 | |||
3781 | /// <summary> | 3584 | /// <summary> |
3782 | /// Tell a single agent to disconnect from the region. | 3585 | /// Tell a single agent to disconnect from the region. |
3783 | /// </summary> | 3586 | /// </summary> |
@@ -3822,30 +3625,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3822 | } | 3625 | } |
3823 | 3626 | ||
3824 | /// <summary> | 3627 | /// <summary> |
3825 | /// Tell neighboring regions about this agent | ||
3826 | /// When the regions respond with a true value, | ||
3827 | /// tell the agents about the region. | ||
3828 | /// | ||
3829 | /// We have to tell the regions about the agents first otherwise it'll deny them access | ||
3830 | /// | ||
3831 | /// </summary> | ||
3832 | /// <param name="presence"></param> | ||
3833 | public void InformClientOfNeighbours(ScenePresence presence) | ||
3834 | { | ||
3835 | m_sceneGridService.EnableNeighbourChildAgents(presence, m_neighbours); | ||
3836 | } | ||
3837 | |||
3838 | /// <summary> | ||
3839 | /// Tell a neighboring region about this agent | ||
3840 | /// </summary> | ||
3841 | /// <param name="presence"></param> | ||
3842 | /// <param name="region"></param> | ||
3843 | public void InformClientOfNeighbor(ScenePresence presence, RegionInfo region) | ||
3844 | { | ||
3845 | m_sceneGridService.EnableNeighbourChildAgents(presence, m_neighbours); | ||
3846 | } | ||
3847 | |||
3848 | /// <summary> | ||
3849 | /// Tries to teleport agent to other region. | 3628 | /// Tries to teleport agent to other region. |
3850 | /// </summary> | 3629 | /// </summary> |
3851 | /// <param name="remoteClient"></param> | 3630 | /// <param name="remoteClient"></param> |
@@ -3920,16 +3699,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
3920 | } | 3699 | } |
3921 | 3700 | ||
3922 | if (m_teleportModule != null) | 3701 | if (m_teleportModule != null) |
3923 | { | 3702 | m_teleportModule.Teleport(sp, regionHandle, position, lookAt, teleportFlags); |
3924 | m_teleportModule.RequestTeleportToLocation(sp, regionHandle, | ||
3925 | position, lookAt, teleportFlags); | ||
3926 | } | ||
3927 | else | 3703 | else |
3928 | { | 3704 | { |
3929 | m_sceneGridService.RequestTeleportToLocation(sp, regionHandle, | 3705 | m_log.DebugFormat("[SCENE]: Unable to perform teleports: no AgentTransferModule is active"); |
3930 | position, lookAt, teleportFlags); | 3706 | sp.ControllingClient.SendTeleportFailed("Unable to perform teleports on this simulator."); |
3931 | } | 3707 | } |
3932 | |||
3933 | } | 3708 | } |
3934 | } | 3709 | } |
3935 | 3710 | ||
@@ -3955,7 +3730,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
3955 | 3730 | ||
3956 | public void CrossAgentToNewRegion(ScenePresence agent, bool isFlying) | 3731 | public void CrossAgentToNewRegion(ScenePresence agent, bool isFlying) |
3957 | { | 3732 | { |
3958 | m_sceneGridService.CrossAgentToNewRegion(this, agent, isFlying); | 3733 | if (m_teleportModule != null) |
3734 | m_teleportModule.Cross(agent, isFlying); | ||
3735 | else | ||
3736 | { | ||
3737 | m_log.DebugFormat("[SCENE]: Unable to cross agent to neighbouring region, because there is no AgentTransferModule"); | ||
3738 | } | ||
3959 | } | 3739 | } |
3960 | 3740 | ||
3961 | public void SendOutChildAgentUpdates(AgentPosition cadu, ScenePresence presence) | 3741 | public void SendOutChildAgentUpdates(AgentPosition cadu, ScenePresence presence) |
@@ -3981,35 +3761,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3981 | objectCapacity = objects; | 3761 | objectCapacity = objects; |
3982 | } | 3762 | } |
3983 | 3763 | ||
3984 | public List<FriendListItem> GetFriendList(string id) | ||
3985 | { | ||
3986 | UUID avatarID; | ||
3987 | if (!UUID.TryParse(id, out avatarID)) | ||
3988 | return new List<FriendListItem>(); | ||
3989 | |||
3990 | return CommsManager.GetUserFriendList(avatarID); | ||
3991 | } | ||
3992 | |||
3993 | public Dictionary<UUID, FriendRegionInfo> GetFriendRegionInfos(List<UUID> uuids) | ||
3994 | { | ||
3995 | return CommsManager.GetFriendRegionInfos(uuids); | ||
3996 | } | ||
3997 | |||
3998 | public virtual void StoreAddFriendship(UUID ownerID, UUID friendID, uint perms) | ||
3999 | { | ||
4000 | m_sceneGridService.AddNewUserFriend(ownerID, friendID, perms); | ||
4001 | } | ||
4002 | |||
4003 | public virtual void StoreUpdateFriendship(UUID ownerID, UUID friendID, uint perms) | ||
4004 | { | ||
4005 | m_sceneGridService.UpdateUserFriendPerms(ownerID, friendID, perms); | ||
4006 | } | ||
4007 | |||
4008 | public virtual void StoreRemoveFriendship(UUID ownerID, UUID ExfriendID) | ||
4009 | { | ||
4010 | m_sceneGridService.RemoveUserFriend(ownerID, ExfriendID); | ||
4011 | } | ||
4012 | |||
4013 | #endregion | 3764 | #endregion |
4014 | 3765 | ||
4015 | public void HandleObjectPermissionsUpdate(IClientAPI controller, UUID agentID, UUID sessionID, byte field, uint localId, uint mask, byte set) | 3766 | public void HandleObjectPermissionsUpdate(IClientAPI controller, UUID agentID, UUID sessionID, byte field, uint localId, uint mask, byte set) |
@@ -4925,5 +4676,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
4925 | if (Util.EnvironmentTickCountSubtract(m_lastUpdate) > 2000) | 4676 | if (Util.EnvironmentTickCountSubtract(m_lastUpdate) > 2000) |
4926 | StartTimer(); | 4677 | StartTimer(); |
4927 | } | 4678 | } |
4679 | |||
4680 | public override ISceneObject DeserializeObject(string representation) | ||
4681 | { | ||
4682 | return SceneObjectSerializer.FromXml2Format(representation); | ||
4683 | } | ||
4684 | |||
4685 | public override bool AllowScriptCrossings | ||
4686 | { | ||
4687 | get { return m_allowScriptCrossings; } | ||
4688 | } | ||
4928 | } | 4689 | } |
4929 | } | 4690 | } |