diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 644 |
1 files changed, 206 insertions, 438 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index c7fb32a..72ece10 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> |
@@ -1993,191 +2085,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1993 | return; | 2085 | return; |
1994 | } | 2086 | } |
1995 | 2087 | ||
1996 | int thisx = (int)RegionInfo.RegionLocX; | 2088 | if (m_teleportModule != null) |
1997 | int thisy = (int)RegionInfo.RegionLocY; | 2089 | m_teleportModule.Cross(grp, attemptedPosition, silent); |
1998 | Vector3 EastCross = new Vector3(0.1f,0,0); | ||
1999 | Vector3 WestCross = new Vector3(-0.1f, 0, 0); | ||
2000 | Vector3 NorthCross = new Vector3(0, 0.1f, 0); | ||
2001 | Vector3 SouthCross = new Vector3(0, -0.1f, 0); | ||
2002 | |||
2003 | |||
2004 | // use this if no borders were crossed! | ||
2005 | ulong newRegionHandle | ||
2006 | = Util.UIntsToLong((uint)((thisx) * Constants.RegionSize), | ||
2007 | (uint)((thisy) * Constants.RegionSize)); | ||
2008 | |||
2009 | Vector3 pos = attemptedPosition; | ||
2010 | |||
2011 | int changeX = 1; | ||
2012 | int changeY = 1; | ||
2013 | |||
2014 | if (TestBorderCross(attemptedPosition + WestCross, Cardinals.W)) | ||
2015 | { | ||
2016 | if (TestBorderCross(attemptedPosition + SouthCross, Cardinals.S)) | ||
2017 | { | ||
2018 | |||
2019 | Border crossedBorderx = GetCrossedBorder(attemptedPosition + WestCross, Cardinals.W); | ||
2020 | |||
2021 | if (crossedBorderx.BorderLine.Z > 0) | ||
2022 | { | ||
2023 | pos.X = ((pos.X + crossedBorderx.BorderLine.Z)); | ||
2024 | changeX = (int)(crossedBorderx.BorderLine.Z /(int) Constants.RegionSize); | ||
2025 | } | ||
2026 | else | ||
2027 | pos.X = ((pos.X + Constants.RegionSize)); | ||
2028 | |||
2029 | Border crossedBordery = GetCrossedBorder(attemptedPosition + SouthCross, Cardinals.S); | ||
2030 | //(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize) | ||
2031 | |||
2032 | if (crossedBordery.BorderLine.Z > 0) | ||
2033 | { | ||
2034 | pos.Y = ((pos.Y + crossedBordery.BorderLine.Z)); | ||
2035 | changeY = (int)(crossedBordery.BorderLine.Z / (int)Constants.RegionSize); | ||
2036 | } | ||
2037 | else | ||
2038 | pos.Y = ((pos.Y + Constants.RegionSize)); | ||
2039 | |||
2040 | |||
2041 | |||
2042 | newRegionHandle | ||
2043 | = Util.UIntsToLong((uint)((thisx - changeX) * Constants.RegionSize), | ||
2044 | (uint)((thisy - changeY) * Constants.RegionSize)); | ||
2045 | // x - 1 | ||
2046 | // y - 1 | ||
2047 | } | ||
2048 | else if (TestBorderCross(attemptedPosition + NorthCross, Cardinals.N)) | ||
2049 | { | ||
2050 | Border crossedBorderx = GetCrossedBorder(attemptedPosition + WestCross, Cardinals.W); | ||
2051 | |||
2052 | if (crossedBorderx.BorderLine.Z > 0) | ||
2053 | { | ||
2054 | pos.X = ((pos.X + crossedBorderx.BorderLine.Z)); | ||
2055 | changeX = (int)(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize); | ||
2056 | } | ||
2057 | else | ||
2058 | pos.X = ((pos.X + Constants.RegionSize)); | ||
2059 | |||
2060 | |||
2061 | Border crossedBordery = GetCrossedBorder(attemptedPosition + SouthCross, Cardinals.S); | ||
2062 | //(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize) | ||
2063 | |||
2064 | try | ||
2065 | { | ||
2066 | if (crossedBordery.BorderLine.Z > 0) | ||
2067 | { | ||
2068 | pos.Y = ((pos.Y + crossedBordery.BorderLine.Z)); | ||
2069 | changeY = (int)(crossedBordery.BorderLine.Z / (int)Constants.RegionSize); | ||
2070 | } | ||
2071 | else | ||
2072 | pos.Y = ((pos.Y + Constants.RegionSize)); | ||
2073 | |||
2074 | newRegionHandle | ||
2075 | = Util.UIntsToLong((uint)((thisx - changeX) * Constants.RegionSize), | ||
2076 | (uint)((thisy + changeY) * Constants.RegionSize)); | ||
2077 | // x - 1 | ||
2078 | // y + 1 | ||
2079 | } | ||
2080 | catch (Exception ex) | ||
2081 | { | ||
2082 | } | ||
2083 | } | ||
2084 | else | ||
2085 | { | ||
2086 | Border crossedBorderx = GetCrossedBorder(attemptedPosition + WestCross, Cardinals.W); | ||
2087 | |||
2088 | if (crossedBorderx.BorderLine.Z > 0) | ||
2089 | { | ||
2090 | pos.X = ((pos.X + crossedBorderx.BorderLine.Z)); | ||
2091 | changeX = (int)(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize); | ||
2092 | } | ||
2093 | else | ||
2094 | pos.X = ((pos.X + Constants.RegionSize)); | ||
2095 | |||
2096 | newRegionHandle | ||
2097 | = Util.UIntsToLong((uint)((thisx - changeX) * Constants.RegionSize), | ||
2098 | (uint) (thisy*Constants.RegionSize)); | ||
2099 | // x - 1 | ||
2100 | } | ||
2101 | } | ||
2102 | else if (TestBorderCross(attemptedPosition + EastCross, Cardinals.E)) | ||
2103 | { | ||
2104 | if (TestBorderCross(attemptedPosition + SouthCross, Cardinals.S)) | ||
2105 | { | ||
2106 | |||
2107 | pos.X = ((pos.X - Constants.RegionSize)); | ||
2108 | Border crossedBordery = GetCrossedBorder(attemptedPosition + SouthCross, Cardinals.S); | ||
2109 | //(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize) | ||
2110 | |||
2111 | if (crossedBordery.BorderLine.Z > 0) | ||
2112 | { | ||
2113 | pos.Y = ((pos.Y + crossedBordery.BorderLine.Z)); | ||
2114 | changeY = (int)(crossedBordery.BorderLine.Z / (int)Constants.RegionSize); | ||
2115 | } | ||
2116 | else | ||
2117 | pos.Y = ((pos.Y + Constants.RegionSize)); | ||
2118 | |||
2119 | |||
2120 | newRegionHandle | ||
2121 | = Util.UIntsToLong((uint)((thisx + changeX) * Constants.RegionSize), | ||
2122 | (uint)((thisy - changeY) * Constants.RegionSize)); | ||
2123 | // x + 1 | ||
2124 | // y - 1 | ||
2125 | } | ||
2126 | else if (TestBorderCross(attemptedPosition + NorthCross, Cardinals.N)) | ||
2127 | { | ||
2128 | pos.X = ((pos.X - Constants.RegionSize)); | ||
2129 | pos.Y = ((pos.Y - Constants.RegionSize)); | ||
2130 | newRegionHandle | ||
2131 | = Util.UIntsToLong((uint)((thisx + changeX) * Constants.RegionSize), | ||
2132 | (uint)((thisy + changeY) * Constants.RegionSize)); | ||
2133 | // x + 1 | ||
2134 | // y + 1 | ||
2135 | } | ||
2136 | else | ||
2137 | { | ||
2138 | pos.X = ((pos.X - Constants.RegionSize)); | ||
2139 | newRegionHandle | ||
2140 | = Util.UIntsToLong((uint)((thisx + changeX) * Constants.RegionSize), | ||
2141 | (uint) (thisy*Constants.RegionSize)); | ||
2142 | // x + 1 | ||
2143 | } | ||
2144 | } | ||
2145 | else if (TestBorderCross(attemptedPosition + SouthCross, Cardinals.S)) | ||
2146 | { | ||
2147 | Border crossedBordery = GetCrossedBorder(attemptedPosition + SouthCross, Cardinals.S); | ||
2148 | //(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize) | ||
2149 | |||
2150 | if (crossedBordery.BorderLine.Z > 0) | ||
2151 | { | ||
2152 | pos.Y = ((pos.Y + crossedBordery.BorderLine.Z)); | ||
2153 | changeY = (int)(crossedBordery.BorderLine.Z / (int)Constants.RegionSize); | ||
2154 | } | ||
2155 | else | ||
2156 | pos.Y = ((pos.Y + Constants.RegionSize)); | ||
2157 | |||
2158 | newRegionHandle | ||
2159 | = Util.UIntsToLong((uint)(thisx * Constants.RegionSize), (uint)((thisy - changeY) * Constants.RegionSize)); | ||
2160 | // y - 1 | ||
2161 | } | ||
2162 | else if (TestBorderCross(attemptedPosition + NorthCross, Cardinals.N)) | ||
2163 | { | ||
2164 | |||
2165 | pos.Y = ((pos.Y - Constants.RegionSize)); | ||
2166 | newRegionHandle | ||
2167 | = Util.UIntsToLong((uint)(thisx * Constants.RegionSize), (uint)((thisy + changeY) * Constants.RegionSize)); | ||
2168 | // y + 1 | ||
2169 | } | ||
2170 | |||
2171 | // Offset the positions for the new region across the border | ||
2172 | Vector3 oldGroupPosition = grp.RootPart.GroupPosition; | ||
2173 | grp.OffsetForNewRegion(pos); | ||
2174 | |||
2175 | // If we fail to cross the border, then reset the position of the scene object on that border. | ||
2176 | if (!CrossPrimGroupIntoNewRegion(newRegionHandle, grp, silent)) | ||
2177 | { | ||
2178 | grp.OffsetForNewRegion(oldGroupPosition); | ||
2179 | grp.ScheduleGroupForFullUpdate(); | ||
2180 | } | ||
2181 | } | 2090 | } |
2182 | 2091 | ||
2183 | public Border GetCrossedBorder(Vector3 position, Cardinals gridline) | 2092 | public Border GetCrossedBorder(Vector3 position, Cardinals gridline) |
@@ -2361,75 +2270,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2361 | 2270 | ||
2362 | 2271 | ||
2363 | /// <summary> | 2272 | /// <summary> |
2364 | /// Move the given scene object into a new region | ||
2365 | /// </summary> | ||
2366 | /// <param name="newRegionHandle"></param> | ||
2367 | /// <param name="grp">Scene Object Group that we're crossing</param> | ||
2368 | /// <returns> | ||
2369 | /// true if the crossing itself was successful, false on failure | ||
2370 | /// FIMXE: we still return true if the crossing object was not successfully deleted from the originating region | ||
2371 | /// </returns> | ||
2372 | public bool CrossPrimGroupIntoNewRegion(ulong newRegionHandle, SceneObjectGroup grp, bool silent) | ||
2373 | { | ||
2374 | //m_log.Debug(" >>> CrossPrimGroupIntoNewRegion <<<"); | ||
2375 | |||
2376 | bool successYN = false; | ||
2377 | grp.RootPart.UpdateFlag = 0; | ||
2378 | //int primcrossingXMLmethod = 0; | ||
2379 | |||
2380 | if (newRegionHandle != 0) | ||
2381 | { | ||
2382 | //string objectState = grp.GetStateSnapshot(); | ||
2383 | |||
2384 | //successYN | ||
2385 | // = m_sceneGridService.PrimCrossToNeighboringRegion( | ||
2386 | // newRegionHandle, grp.UUID, m_serialiser.SaveGroupToXml2(grp), primcrossingXMLmethod); | ||
2387 | //if (successYN && (objectState != "") && m_allowScriptCrossings) | ||
2388 | //{ | ||
2389 | // successYN = m_sceneGridService.PrimCrossToNeighboringRegion( | ||
2390 | // newRegionHandle, grp.UUID, objectState, 100); | ||
2391 | //} | ||
2392 | |||
2393 | // And the new channel... | ||
2394 | if (m_interregionCommsOut != null) | ||
2395 | successYN = m_interregionCommsOut.SendCreateObject(newRegionHandle, grp, true); | ||
2396 | |||
2397 | if (successYN) | ||
2398 | { | ||
2399 | // We remove the object here | ||
2400 | try | ||
2401 | { | ||
2402 | DeleteSceneObject(grp, silent); | ||
2403 | } | ||
2404 | catch (Exception e) | ||
2405 | { | ||
2406 | m_log.ErrorFormat( | ||
2407 | "[INTERREGION]: Exception deleting the old object left behind on a border crossing for {0}, {1}", | ||
2408 | grp, e); | ||
2409 | } | ||
2410 | } | ||
2411 | else | ||
2412 | { | ||
2413 | if (!grp.IsDeleted) | ||
2414 | { | ||
2415 | if (grp.RootPart.PhysActor != null) | ||
2416 | { | ||
2417 | grp.RootPart.PhysActor.CrossingFailure(); | ||
2418 | } | ||
2419 | } | ||
2420 | |||
2421 | m_log.ErrorFormat("[INTERREGION]: Prim crossing failed for {0}", grp); | ||
2422 | } | ||
2423 | } | ||
2424 | else | ||
2425 | { | ||
2426 | m_log.Error("[INTERREGION]: region handle was unexpectedly 0 in Scene.CrossPrimGroupIntoNewRegion()"); | ||
2427 | } | ||
2428 | |||
2429 | return successYN; | ||
2430 | } | ||
2431 | |||
2432 | /// <summary> | ||
2433 | /// Called when objects or attachments cross the border between regions. | 2273 | /// Called when objects or attachments cross the border between regions. |
2434 | /// </summary> | 2274 | /// </summary> |
2435 | /// <param name="sog"></param> | 2275 | /// <param name="sog"></param> |
@@ -2501,6 +2341,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2501 | 2341 | ||
2502 | return false; | 2342 | return false; |
2503 | } | 2343 | } |
2344 | |||
2345 | sceneObject.SetScene(this); | ||
2346 | |||
2504 | // Force allocation of new LocalId | 2347 | // Force allocation of new LocalId |
2505 | // | 2348 | // |
2506 | foreach (SceneObjectPart p in sceneObject.Children.Values) | 2349 | foreach (SceneObjectPart p in sceneObject.Children.Values) |
@@ -2613,6 +2456,37 @@ namespace OpenSim.Region.Framework.Scenes | |||
2613 | { | 2456 | { |
2614 | AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode); | 2457 | AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode); |
2615 | 2458 | ||
2459 | // Do the verification here | ||
2460 | System.Net.EndPoint ep = client.GetClientEP(); | ||
2461 | if (aCircuit != null) | ||
2462 | { | ||
2463 | if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0) | ||
2464 | { | ||
2465 | m_log.DebugFormat("[Scene]: Incoming client {0} {1} in region {2} via Login", aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName); | ||
2466 | IUserAgentVerificationModule userVerification = RequestModuleInterface<IUserAgentVerificationModule>(); | ||
2467 | if (userVerification != null) | ||
2468 | { | ||
2469 | if (!userVerification.VerifyClient(aCircuit, ep.ToString())) | ||
2470 | { | ||
2471 | // uh-oh, this is fishy | ||
2472 | m_log.WarnFormat("[Scene]: Agent {0} with session {1} connecting with unidentified end point {2}. Refusing service.", | ||
2473 | client.AgentId, client.SessionId, ep.ToString()); | ||
2474 | try | ||
2475 | { | ||
2476 | client.Close(); | ||
2477 | } | ||
2478 | catch (Exception e) | ||
2479 | { | ||
2480 | m_log.DebugFormat("[Scene]: Exception while closing aborted client: {0}", e.StackTrace); | ||
2481 | } | ||
2482 | return; | ||
2483 | } | ||
2484 | else | ||
2485 | m_log.DebugFormat("[Scene]: User Client Verification for {0} {1} returned true", aCircuit.firstname, aCircuit.lastname); | ||
2486 | } | ||
2487 | } | ||
2488 | } | ||
2489 | |||
2616 | m_log.Debug("[Scene] Adding new agent " + client.Name + " to scene " + RegionInfo.RegionName); | 2490 | m_log.Debug("[Scene] Adding new agent " + client.Name + " to scene " + RegionInfo.RegionName); |
2617 | /* | 2491 | /* |
2618 | string logMsg = string.Format("[SCENE]: Adding new {0} agent for {1} in {2}", | 2492 | string logMsg = string.Format("[SCENE]: Adding new {0} agent for {1} in {2}", |
@@ -2622,9 +2496,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2622 | m_log.Debug(logMsg); | 2496 | m_log.Debug(logMsg); |
2623 | */ | 2497 | */ |
2624 | 2498 | ||
2625 | CommsManager.UserProfileCacheService.AddNewUser(client.AgentId); | 2499 | //CommsManager.UserProfileCacheService.AddNewUser(client.AgentId); |
2626 | |||
2627 | ScenePresence sp = CreateAndAddScenePresence(client); | 2500 | ScenePresence sp = CreateAndAddScenePresence(client); |
2501 | sp.Appearance = aCircuit.Appearance; | ||
2628 | 2502 | ||
2629 | // HERE!!! Do the initial attachments right here | 2503 | // HERE!!! Do the initial attachments right here |
2630 | // first agent upon login is a root agent by design. | 2504 | // first agent upon login is a root agent by design. |
@@ -2638,6 +2512,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2638 | 2512 | ||
2639 | m_LastLogin = Util.EnvironmentTickCount(); | 2513 | m_LastLogin = Util.EnvironmentTickCount(); |
2640 | EventManager.TriggerOnNewClient(client); | 2514 | EventManager.TriggerOnNewClient(client); |
2515 | |||
2641 | } | 2516 | } |
2642 | 2517 | ||
2643 | 2518 | ||
@@ -2755,7 +2630,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2755 | { | 2630 | { |
2756 | client.OnTeleportLocationRequest += RequestTeleportLocation; | 2631 | client.OnTeleportLocationRequest += RequestTeleportLocation; |
2757 | client.OnTeleportLandmarkRequest += RequestTeleportLandmark; | 2632 | client.OnTeleportLandmarkRequest += RequestTeleportLandmark; |
2758 | client.OnTeleportHomeRequest += TeleportClientHome; | ||
2759 | } | 2633 | } |
2760 | 2634 | ||
2761 | public virtual void SubscribeToClientScriptEvents(IClientAPI client) | 2635 | public virtual void SubscribeToClientScriptEvents(IClientAPI client) |
@@ -2775,7 +2649,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2775 | 2649 | ||
2776 | public virtual void SubscribeToClientGridEvents(IClientAPI client) | 2650 | public virtual void SubscribeToClientGridEvents(IClientAPI client) |
2777 | { | 2651 | { |
2778 | client.OnNameFromUUIDRequest += CommsManager.HandleUUIDNameRequest; | 2652 | client.OnNameFromUUIDRequest += HandleUUIDNameRequest; |
2779 | client.OnMoneyTransferRequest += ProcessMoneyTransferRequest; | 2653 | client.OnMoneyTransferRequest += ProcessMoneyTransferRequest; |
2780 | client.OnAvatarPickerRequest += ProcessAvatarPickerRequest; | 2654 | client.OnAvatarPickerRequest += ProcessAvatarPickerRequest; |
2781 | client.OnSetStartLocationRequest += SetHomeRezPoint; | 2655 | client.OnSetStartLocationRequest += SetHomeRezPoint; |
@@ -2911,7 +2785,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2911 | { | 2785 | { |
2912 | client.OnTeleportLocationRequest -= RequestTeleportLocation; | 2786 | client.OnTeleportLocationRequest -= RequestTeleportLocation; |
2913 | client.OnTeleportLandmarkRequest -= RequestTeleportLandmark; | 2787 | client.OnTeleportLandmarkRequest -= RequestTeleportLandmark; |
2914 | client.OnTeleportHomeRequest -= TeleportClientHome; | 2788 | //client.OnTeleportHomeRequest -= TeleportClientHome; |
2915 | } | 2789 | } |
2916 | 2790 | ||
2917 | public virtual void UnSubscribeToClientScriptEvents(IClientAPI client) | 2791 | public virtual void UnSubscribeToClientScriptEvents(IClientAPI client) |
@@ -2931,7 +2805,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2931 | 2805 | ||
2932 | public virtual void UnSubscribeToClientGridEvents(IClientAPI client) | 2806 | public virtual void UnSubscribeToClientGridEvents(IClientAPI client) |
2933 | { | 2807 | { |
2934 | client.OnNameFromUUIDRequest -= CommsManager.HandleUUIDNameRequest; | 2808 | client.OnNameFromUUIDRequest -= HandleUUIDNameRequest; |
2935 | client.OnMoneyTransferRequest -= ProcessMoneyTransferRequest; | 2809 | client.OnMoneyTransferRequest -= ProcessMoneyTransferRequest; |
2936 | client.OnAvatarPickerRequest -= ProcessAvatarPickerRequest; | 2810 | client.OnAvatarPickerRequest -= ProcessAvatarPickerRequest; |
2937 | client.OnSetStartLocationRequest -= SetHomeRezPoint; | 2811 | client.OnSetStartLocationRequest -= SetHomeRezPoint; |
@@ -2958,30 +2832,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2958 | /// <param name="client">The IClientAPI for the client</param> | 2832 | /// <param name="client">The IClientAPI for the client</param> |
2959 | public virtual void TeleportClientHome(UUID agentId, IClientAPI client) | 2833 | public virtual void TeleportClientHome(UUID agentId, IClientAPI client) |
2960 | { | 2834 | { |
2961 | UserProfileData UserProfile = CommsManager.UserService.GetUserProfile(agentId); | 2835 | if (m_teleportModule != null) |
2962 | if (UserProfile != null) | 2836 | m_teleportModule.TeleportHome(agentId, client); |
2837 | else | ||
2963 | { | 2838 | { |
2964 | GridRegion regionInfo = GridService.GetRegionByUUID(UUID.Zero, UserProfile.HomeRegionID); | 2839 | m_log.DebugFormat("[SCENE]: Unable to teleport user home: no AgentTransferModule is active"); |
2965 | if (regionInfo == null) | 2840 | client.SendTeleportFailed("Unable to perform teleports on this simulator."); |
2966 | { | ||
2967 | uint x = 0, y = 0; | ||
2968 | Utils.LongToUInts(UserProfile.HomeRegion, out x, out y); | ||
2969 | regionInfo = GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y); | ||
2970 | if (regionInfo != null) // home region can be away temporarily, too | ||
2971 | { | ||
2972 | UserProfile.HomeRegionID = regionInfo.RegionID; | ||
2973 | CommsManager.UserService.UpdateUserProfile(UserProfile); | ||
2974 | } | ||
2975 | } | ||
2976 | if (regionInfo == null) | ||
2977 | { | ||
2978 | // can't find the Home region: Tell viewer and abort | ||
2979 | client.SendTeleportFailed("Your home-region could not be found."); | ||
2980 | return; | ||
2981 | } | ||
2982 | RequestTeleportLocation( | ||
2983 | client, regionInfo.RegionHandle, UserProfile.HomeLocation, UserProfile.HomeLookAt, | ||
2984 | (uint)(TPFlags.SetLastToTarget | TPFlags.ViaHome)); | ||
2985 | } | 2841 | } |
2986 | } | 2842 | } |
2987 | 2843 | ||
@@ -3072,7 +2928,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3072 | } | 2928 | } |
3073 | 2929 | ||
3074 | /// <summary> | 2930 | /// <summary> |
3075 | /// Sets the Home Point. The GridService uses this to know where to put a user when they log-in | 2931 | /// Sets the Home Point. The LoginService uses this to know where to put a user when they log-in |
3076 | /// </summary> | 2932 | /// </summary> |
3077 | /// <param name="remoteClient"></param> | 2933 | /// <param name="remoteClient"></param> |
3078 | /// <param name="regionHandle"></param> | 2934 | /// <param name="regionHandle"></param> |
@@ -3081,27 +2937,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
3081 | /// <param name="flags"></param> | 2937 | /// <param name="flags"></param> |
3082 | public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags) | 2938 | public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags) |
3083 | { | 2939 | { |
3084 | UserProfileData UserProfile = CommsManager.UserService.GetUserProfile(remoteClient.AgentId); | 2940 | if (PresenceService.SetHomeLocation(remoteClient.AgentId.ToString(), RegionInfo.RegionID, position, lookAt)) |
3085 | if (UserProfile != null) | ||
3086 | { | ||
3087 | // I know I'm ignoring the regionHandle provided by the teleport location request. | ||
3088 | // reusing the TeleportLocationRequest delegate, so regionHandle isn't valid | ||
3089 | UserProfile.HomeRegionID = RegionInfo.RegionID; | ||
3090 | // TODO: The next line can be removed, as soon as only homeRegionID based UserServers are around. | ||
3091 | // TODO: The HomeRegion property can be removed then, too | ||
3092 | UserProfile.HomeRegion = RegionInfo.RegionHandle; | ||
3093 | |||
3094 | UserProfile.HomeLocation = position; | ||
3095 | UserProfile.HomeLookAt = lookAt; | ||
3096 | CommsManager.UserService.UpdateUserProfile(UserProfile); | ||
3097 | |||
3098 | // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot. | 2941 | // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot. |
3099 | m_dialogModule.SendAlertToUser(remoteClient, "Home position set."); | 2942 | m_dialogModule.SendAlertToUser(remoteClient, "Home position set."); |
3100 | } | ||
3101 | else | 2943 | else |
3102 | { | ||
3103 | m_dialogModule.SendAlertToUser(remoteClient, "Set Home request Failed."); | 2944 | m_dialogModule.SendAlertToUser(remoteClient, "Set Home request Failed."); |
3104 | } | ||
3105 | } | 2945 | } |
3106 | 2946 | ||
3107 | /// <summary> | 2947 | /// <summary> |
@@ -3174,14 +3014,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
3174 | m_sceneGraph.removeUserCount(!childagentYN); | 3014 | m_sceneGraph.removeUserCount(!childagentYN); |
3175 | CapsModule.RemoveCapsHandler(agentID); | 3015 | CapsModule.RemoveCapsHandler(agentID); |
3176 | 3016 | ||
3177 | if (avatar.Scene.NeedSceneCacheClear(avatar.UUID)) | 3017 | // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever |
3178 | { | 3018 | // this method is doing is HORRIBLE!!! |
3179 | CommsManager.UserProfileCacheService.RemoveUser(agentID); | 3019 | avatar.Scene.NeedSceneCacheClear(avatar.UUID); |
3180 | } | ||
3181 | 3020 | ||
3182 | if (!avatar.IsChildAgent) | 3021 | if (!avatar.IsChildAgent) |
3183 | { | 3022 | { |
3184 | m_sceneGridService.LogOffUser(agentID, RegionInfo.RegionID, RegionInfo.RegionHandle, avatar.AbsolutePosition, avatar.Lookat); | ||
3185 | //List<ulong> childknownRegions = new List<ulong>(); | 3023 | //List<ulong> childknownRegions = new List<ulong>(); |
3186 | //List<ulong> ckn = avatar.KnownChildRegionHandles; | 3024 | //List<ulong> ckn = avatar.KnownChildRegionHandles; |
3187 | //for (int i = 0; i < ckn.Count; i++) | 3025 | //for (int i = 0; i < ckn.Count; i++) |
@@ -3236,12 +3074,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3236 | m_log.Error("[SCENE] Scene.cs:RemoveClient exception: " + e.ToString()); | 3074 | m_log.Error("[SCENE] Scene.cs:RemoveClient exception: " + e.ToString()); |
3237 | } | 3075 | } |
3238 | 3076 | ||
3239 | // Remove client agent from profile, so new logins will work | ||
3240 | if (!childagentYN) | ||
3241 | { | ||
3242 | m_sceneGridService.ClearUserAgent(agentID); | ||
3243 | } | ||
3244 | |||
3245 | m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode); | 3077 | m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode); |
3246 | 3078 | ||
3247 | //m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false)); | 3079 | //m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false)); |
@@ -3315,14 +3147,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3315 | m_sceneGridService.KiPrimitive += SendKillObject; | 3147 | m_sceneGridService.KiPrimitive += SendKillObject; |
3316 | m_sceneGridService.OnGetLandData += GetLandData; | 3148 | m_sceneGridService.OnGetLandData += GetLandData; |
3317 | 3149 | ||
3318 | if (m_interregionCommsIn != null) | ||
3319 | { | ||
3320 | m_log.Debug("[SCENE]: Registering with InterregionCommsIn"); | ||
3321 | m_interregionCommsIn.OnChildAgentUpdate += IncomingChildAgentDataUpdate; | ||
3322 | } | ||
3323 | else | ||
3324 | m_log.Debug("[SCENE]: Unable to register with InterregionCommsIn"); | ||
3325 | |||
3326 | } | 3150 | } |
3327 | 3151 | ||
3328 | /// <summary> | 3152 | /// <summary> |
@@ -3340,9 +3164,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3340 | m_sceneGridService.OnCloseAgentConnection -= IncomingCloseAgent; | 3164 | m_sceneGridService.OnCloseAgentConnection -= IncomingCloseAgent; |
3341 | m_sceneGridService.OnGetLandData -= GetLandData; | 3165 | m_sceneGridService.OnGetLandData -= GetLandData; |
3342 | 3166 | ||
3343 | if (m_interregionCommsIn != null) | ||
3344 | m_interregionCommsIn.OnChildAgentUpdate -= IncomingChildAgentDataUpdate; | ||
3345 | |||
3346 | // this does nothing; should be removed | 3167 | // this does nothing; should be removed |
3347 | m_sceneGridService.Close(); | 3168 | m_sceneGridService.Close(); |
3348 | 3169 | ||
@@ -3399,7 +3220,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3399 | agent.AgentID, agent.circuitcode, teleportFlags); | 3220 | agent.AgentID, agent.circuitcode, teleportFlags); |
3400 | 3221 | ||
3401 | reason = String.Empty; | 3222 | reason = String.Empty; |
3402 | if (!AuthenticateUser(agent, out reason)) | 3223 | if (!VerifyUserPresence(agent, out reason)) |
3403 | return false; | 3224 | return false; |
3404 | 3225 | ||
3405 | if (!AuthorizeUser(agent, out reason)) | 3226 | if (!AuthorizeUser(agent, out reason)) |
@@ -3494,40 +3315,39 @@ namespace OpenSim.Region.Framework.Scenes | |||
3494 | } | 3315 | } |
3495 | } | 3316 | } |
3496 | 3317 | ||
3318 | agent.teleportFlags = teleportFlags; | ||
3497 | m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent); | 3319 | m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent); |
3498 | 3320 | ||
3499 | // rewrite session_id | ||
3500 | CachedUserInfo userinfo = CommsManager.UserProfileCacheService.GetUserDetails(agent.AgentID); | ||
3501 | if (userinfo != null) | ||
3502 | { | ||
3503 | userinfo.SessionID = agent.SessionID; | ||
3504 | } | ||
3505 | else | ||
3506 | { | ||
3507 | m_log.WarnFormat( | ||
3508 | "[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); | ||
3509 | } | ||
3510 | |||
3511 | return true; | 3321 | return true; |
3512 | } | 3322 | } |
3513 | 3323 | ||
3514 | /// <summary> | 3324 | /// <summary> |
3515 | /// Verifies that the user has a session on the Grid | 3325 | /// Verifies that the user has a presence on the Grid |
3516 | /// </summary> | 3326 | /// </summary> |
3517 | /// <param name="agent">Circuit Data of the Agent we're verifying</param> | 3327 | /// <param name="agent">Circuit Data of the Agent we're verifying</param> |
3518 | /// <param name="reason">Outputs the reason for the false response on this string</param> | 3328 | /// <param name="reason">Outputs the reason for the false response on this string</param> |
3519 | /// <returns>True if the user has a session on the grid. False if it does not. False will | 3329 | /// <returns>True if the user has a session on the grid. False if it does not. False will |
3520 | /// also return a reason.</returns> | 3330 | /// also return a reason.</returns> |
3521 | public virtual bool AuthenticateUser(AgentCircuitData agent, out string reason) | 3331 | public virtual bool VerifyUserPresence(AgentCircuitData agent, out string reason) |
3522 | { | 3332 | { |
3523 | reason = String.Empty; | 3333 | reason = String.Empty; |
3524 | 3334 | ||
3525 | bool result = CommsManager.UserService.VerifySession(agent.AgentID, agent.SessionID); | 3335 | IPresenceService presence = RequestModuleInterface<IPresenceService>(); |
3526 | m_log.Debug("[CONNECTION BEGIN]: User authentication returned " + result); | 3336 | if (presence == null) |
3527 | if (!result) | 3337 | { |
3528 | reason = String.Format("Failed to authenticate user {0} {1}, access denied.", agent.firstname, agent.lastname); | 3338 | reason = String.Format("Failed to verify user {0} {1} in region {2}. Presence service does not exist.", agent.firstname, agent.lastname, RegionInfo.RegionName); |
3339 | return false; | ||
3340 | } | ||
3341 | |||
3342 | OpenSim.Services.Interfaces.PresenceInfo pinfo = presence.GetAgent(agent.SessionID); | ||
3529 | 3343 | ||
3530 | return result; | 3344 | if (pinfo == null || (pinfo != null && pinfo.Online == false)) |
3345 | { | ||
3346 | reason = String.Format("Failed to verify user {0} {1}, access denied to region {2}.", agent.firstname, agent.lastname, RegionInfo.RegionName); | ||
3347 | return false; | ||
3348 | } | ||
3349 | |||
3350 | return true; | ||
3531 | } | 3351 | } |
3532 | 3352 | ||
3533 | /// <summary> | 3353 | /// <summary> |
@@ -3728,8 +3548,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3728 | /// <returns>true if we handled it.</returns> | 3548 | /// <returns>true if we handled it.</returns> |
3729 | public virtual bool IncomingChildAgentDataUpdate(AgentData cAgentData) | 3549 | public virtual bool IncomingChildAgentDataUpdate(AgentData cAgentData) |
3730 | { | 3550 | { |
3731 | // m_log.DebugFormat( | 3551 | m_log.DebugFormat( |
3732 | // "[SCENE]: Incoming child agent update for {0} in {1}", cAgentData.AgentID, RegionInfo.RegionName); | 3552 | "[SCENE]: Incoming child agent update for {0} in {1}", cAgentData.AgentID, RegionInfo.RegionName); |
3733 | 3553 | ||
3734 | // We have to wait until the viewer contacts this region after receiving EAC. | 3554 | // We have to wait until the viewer contacts this region after receiving EAC. |
3735 | // That calls AddNewClient, which finally creates the ScenePresence | 3555 | // That calls AddNewClient, which finally creates the ScenePresence |
@@ -3798,16 +3618,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3798 | return false; | 3618 | return false; |
3799 | } | 3619 | } |
3800 | 3620 | ||
3801 | public virtual bool IncomingReleaseAgent(UUID id) | ||
3802 | { | ||
3803 | return m_sceneGridService.ReleaseAgent(id); | ||
3804 | } | ||
3805 | |||
3806 | public void SendReleaseAgent(ulong regionHandle, UUID id, string uri) | ||
3807 | { | ||
3808 | m_interregionCommsOut.SendReleaseAgent(regionHandle, id, uri); | ||
3809 | } | ||
3810 | |||
3811 | /// <summary> | 3621 | /// <summary> |
3812 | /// Tell a single agent to disconnect from the region. | 3622 | /// Tell a single agent to disconnect from the region. |
3813 | /// </summary> | 3623 | /// </summary> |
@@ -3852,30 +3662,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3852 | } | 3662 | } |
3853 | 3663 | ||
3854 | /// <summary> | 3664 | /// <summary> |
3855 | /// Tell neighboring regions about this agent | ||
3856 | /// When the regions respond with a true value, | ||
3857 | /// tell the agents about the region. | ||
3858 | /// | ||
3859 | /// We have to tell the regions about the agents first otherwise it'll deny them access | ||
3860 | /// | ||
3861 | /// </summary> | ||
3862 | /// <param name="presence"></param> | ||
3863 | public void InformClientOfNeighbours(ScenePresence presence) | ||
3864 | { | ||
3865 | m_sceneGridService.EnableNeighbourChildAgents(presence, m_neighbours); | ||
3866 | } | ||
3867 | |||
3868 | /// <summary> | ||
3869 | /// Tell a neighboring region about this agent | ||
3870 | /// </summary> | ||
3871 | /// <param name="presence"></param> | ||
3872 | /// <param name="region"></param> | ||
3873 | public void InformClientOfNeighbor(ScenePresence presence, RegionInfo region) | ||
3874 | { | ||
3875 | m_sceneGridService.EnableNeighbourChildAgents(presence, m_neighbours); | ||
3876 | } | ||
3877 | |||
3878 | /// <summary> | ||
3879 | /// Tries to teleport agent to other region. | 3665 | /// Tries to teleport agent to other region. |
3880 | /// </summary> | 3666 | /// </summary> |
3881 | /// <param name="remoteClient"></param> | 3667 | /// <param name="remoteClient"></param> |
@@ -3950,16 +3736,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
3950 | } | 3736 | } |
3951 | 3737 | ||
3952 | if (m_teleportModule != null) | 3738 | if (m_teleportModule != null) |
3953 | { | 3739 | m_teleportModule.Teleport(sp, regionHandle, position, lookAt, teleportFlags); |
3954 | m_teleportModule.RequestTeleportToLocation(sp, regionHandle, | ||
3955 | position, lookAt, teleportFlags); | ||
3956 | } | ||
3957 | else | 3740 | else |
3958 | { | 3741 | { |
3959 | m_sceneGridService.RequestTeleportToLocation(sp, regionHandle, | 3742 | m_log.DebugFormat("[SCENE]: Unable to perform teleports: no AgentTransferModule is active"); |
3960 | position, lookAt, teleportFlags); | 3743 | sp.ControllingClient.SendTeleportFailed("Unable to perform teleports on this simulator."); |
3961 | } | 3744 | } |
3962 | |||
3963 | } | 3745 | } |
3964 | } | 3746 | } |
3965 | 3747 | ||
@@ -3985,7 +3767,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
3985 | 3767 | ||
3986 | public void CrossAgentToNewRegion(ScenePresence agent, bool isFlying) | 3768 | public void CrossAgentToNewRegion(ScenePresence agent, bool isFlying) |
3987 | { | 3769 | { |
3988 | m_sceneGridService.CrossAgentToNewRegion(this, agent, isFlying); | 3770 | if (m_teleportModule != null) |
3771 | m_teleportModule.Cross(agent, isFlying); | ||
3772 | else | ||
3773 | { | ||
3774 | m_log.DebugFormat("[SCENE]: Unable to cross agent to neighbouring region, because there is no AgentTransferModule"); | ||
3775 | } | ||
3989 | } | 3776 | } |
3990 | 3777 | ||
3991 | public void SendOutChildAgentUpdates(AgentPosition cadu, ScenePresence presence) | 3778 | public void SendOutChildAgentUpdates(AgentPosition cadu, ScenePresence presence) |
@@ -4011,35 +3798,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
4011 | objectCapacity = objects; | 3798 | objectCapacity = objects; |
4012 | } | 3799 | } |
4013 | 3800 | ||
4014 | public List<FriendListItem> GetFriendList(string id) | ||
4015 | { | ||
4016 | UUID avatarID; | ||
4017 | if (!UUID.TryParse(id, out avatarID)) | ||
4018 | return new List<FriendListItem>(); | ||
4019 | |||
4020 | return CommsManager.GetUserFriendList(avatarID); | ||
4021 | } | ||
4022 | |||
4023 | public Dictionary<UUID, FriendRegionInfo> GetFriendRegionInfos(List<UUID> uuids) | ||
4024 | { | ||
4025 | return CommsManager.GetFriendRegionInfos(uuids); | ||
4026 | } | ||
4027 | |||
4028 | public virtual void StoreAddFriendship(UUID ownerID, UUID friendID, uint perms) | ||
4029 | { | ||
4030 | m_sceneGridService.AddNewUserFriend(ownerID, friendID, perms); | ||
4031 | } | ||
4032 | |||
4033 | public virtual void StoreUpdateFriendship(UUID ownerID, UUID friendID, uint perms) | ||
4034 | { | ||
4035 | m_sceneGridService.UpdateUserFriendPerms(ownerID, friendID, perms); | ||
4036 | } | ||
4037 | |||
4038 | public virtual void StoreRemoveFriendship(UUID ownerID, UUID ExfriendID) | ||
4039 | { | ||
4040 | m_sceneGridService.RemoveUserFriend(ownerID, ExfriendID); | ||
4041 | } | ||
4042 | |||
4043 | #endregion | 3801 | #endregion |
4044 | 3802 | ||
4045 | public void HandleObjectPermissionsUpdate(IClientAPI controller, UUID agentID, UUID sessionID, byte field, uint localId, uint mask, byte set) | 3803 | public void HandleObjectPermissionsUpdate(IClientAPI controller, UUID agentID, UUID sessionID, byte field, uint localId, uint mask, byte set) |
@@ -4955,5 +4713,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
4955 | if (Util.EnvironmentTickCountSubtract(m_lastUpdate) > 2000) | 4713 | if (Util.EnvironmentTickCountSubtract(m_lastUpdate) > 2000) |
4956 | StartTimer(); | 4714 | StartTimer(); |
4957 | } | 4715 | } |
4716 | |||
4717 | public override ISceneObject DeserializeObject(string representation) | ||
4718 | { | ||
4719 | return SceneObjectSerializer.FromXml2Format(representation); | ||
4720 | } | ||
4721 | |||
4722 | public override bool AllowScriptCrossings | ||
4723 | { | ||
4724 | get { return m_allowScriptCrossings; } | ||
4725 | } | ||
4958 | } | 4726 | } |
4959 | } | 4727 | } |