aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Scene.cs
diff options
context:
space:
mode:
authorMelanie2010-03-03 02:07:03 +0000
committerMelanie2010-03-03 02:07:03 +0000
commit028a87fe37002e7a0611f66babf1deee46c83804 (patch)
tree387aec499fd60c2012bed8148e6a2ddc847c3d95 /OpenSim/Region/Framework/Scenes/Scene.cs
parentRevert "test" (diff)
parentFixes Region.Framework tests. Although these tests don't fail, they need to b... (diff)
downloadopensim-SC_OLD-028a87fe37002e7a0611f66babf1deee46c83804.zip
opensim-SC_OLD-028a87fe37002e7a0611f66babf1deee46c83804.tar.gz
opensim-SC_OLD-028a87fe37002e7a0611f66babf1deee46c83804.tar.bz2
opensim-SC_OLD-028a87fe37002e7a0611f66babf1deee46c83804.tar.xz
Merge branch 'master' into careminster-presence-refactor
This brings careminster on the level of master. To be tested
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs661
1 files changed, 226 insertions, 435 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 4d357fd..181b7c5 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -41,8 +41,7 @@ using OpenMetaverse.Imaging;
41using OpenSim.Framework; 41using OpenSim.Framework;
42using OpenSim.Services.Interfaces; 42using OpenSim.Services.Interfaces;
43using OpenSim.Framework.Communications; 43using OpenSim.Framework.Communications;
44using OpenSim.Framework.Communications.Cache; 44
45using OpenSim.Framework.Communications.Clients;
46using OpenSim.Framework.Console; 45using OpenSim.Framework.Console;
47using OpenSim.Region.Framework.Interfaces; 46using OpenSim.Region.Framework.Interfaces;
48using OpenSim.Region.Framework.Scenes.Scripting; 47using 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;
@@ -778,6 +840,36 @@ namespace OpenSim.Region.Framework.Scenes
778 return m_simulatorVersion; 840 return m_simulatorVersion;
779 } 841 }
780 842
843 public string[] GetUserNames(UUID uuid)
844 {
845 string[] returnstring = new string[0];
846
847 UserAccount account = UserAccountService.GetUserAccount(RegionInfo.ScopeID, uuid);
848
849 if (account != null)
850 {
851 returnstring = new string[2];
852 returnstring[0] = account.FirstName;
853 returnstring[1] = account.LastName;
854 }
855
856 return returnstring;
857 }
858
859 public string GetUserName(UUID uuid)
860 {
861 string[] names = GetUserNames(uuid);
862 if (names.Length == 2)
863 {
864 string firstname = names[0];
865 string lastname = names[1];
866
867 return firstname + " " + lastname;
868
869 }
870 return "(hippos)";
871 }
872
781 /// <summary> 873 /// <summary>
782 /// Another region is up. 874 /// Another region is up.
783 /// 875 ///
@@ -811,7 +903,7 @@ namespace OpenSim.Region.Framework.Scenes
811 regInfo.RegionName = otherRegion.RegionName; 903 regInfo.RegionName = otherRegion.RegionName;
812 regInfo.ScopeID = otherRegion.ScopeID; 904 regInfo.ScopeID = otherRegion.ScopeID;
813 regInfo.ExternalHostName = otherRegion.ExternalHostName; 905 regInfo.ExternalHostName = otherRegion.ExternalHostName;
814 906 GridRegion r = new GridRegion(regInfo);
815 try 907 try
816 { 908 {
817 ForEachScenePresence(delegate(ScenePresence agent) 909 ForEachScenePresence(delegate(ScenePresence agent)
@@ -825,7 +917,8 @@ namespace OpenSim.Region.Framework.Scenes
825 List<ulong> old = new List<ulong>(); 917 List<ulong> old = new List<ulong>();
826 old.Add(otherRegion.RegionHandle); 918 old.Add(otherRegion.RegionHandle);
827 agent.DropOldNeighbours(old); 919 agent.DropOldNeighbours(old);
828 InformClientOfNeighbor(agent, regInfo); 920 if (m_teleportModule != null)
921 m_teleportModule.EnableChildAgent(agent, r);
829 } 922 }
830 } 923 }
831 ); 924 );
@@ -985,6 +1078,7 @@ namespace OpenSim.Region.Framework.Scenes
985 { 1078 {
986 foreach (RegionInfo region in m_regionRestartNotifyList) 1079 foreach (RegionInfo region in m_regionRestartNotifyList)
987 { 1080 {
1081 GridRegion r = new GridRegion(region);
988 try 1082 try
989 { 1083 {
990 ForEachScenePresence(delegate(ScenePresence agent) 1084 ForEachScenePresence(delegate(ScenePresence agent)
@@ -992,9 +1086,8 @@ namespace OpenSim.Region.Framework.Scenes
992 // If agent is a root agent. 1086 // If agent is a root agent.
993 if (!agent.IsChildAgent) 1087 if (!agent.IsChildAgent)
994 { 1088 {
995 //agent.ControllingClient.new 1089 if (m_teleportModule != null)
996 //this.CommsManager.InterRegion.InformRegionOfChildAgent(otherRegion.RegionHandle, agent.ControllingClient.RequestClientInfo()); 1090 m_teleportModule.EnableChildAgent(agent, r);
997 InformClientOfNeighbor(agent, region);
998 } 1091 }
999 } 1092 }
1000 ); 1093 );
@@ -1137,11 +1230,9 @@ namespace OpenSim.Region.Framework.Scenes
1137 XferManager = RequestModuleInterface<IXfer>(); 1230 XferManager = RequestModuleInterface<IXfer>();
1138 m_AvatarFactory = RequestModuleInterface<IAvatarFactory>(); 1231 m_AvatarFactory = RequestModuleInterface<IAvatarFactory>();
1139 m_serialiser = RequestModuleInterface<IRegionSerialiserModule>(); 1232 m_serialiser = RequestModuleInterface<IRegionSerialiserModule>();
1140 m_interregionCommsOut = RequestModuleInterface<IInterregionCommsOut>();
1141 m_interregionCommsIn = RequestModuleInterface<IInterregionCommsIn>();
1142 m_dialogModule = RequestModuleInterface<IDialogModule>(); 1233 m_dialogModule = RequestModuleInterface<IDialogModule>();
1143 m_capsModule = RequestModuleInterface<ICapabilitiesModule>(); 1234 m_capsModule = RequestModuleInterface<ICapabilitiesModule>();
1144 m_teleportModule = RequestModuleInterface<ITeleportModule>(); 1235 m_teleportModule = RequestModuleInterface<IEntityTransferModule>();
1145 } 1236 }
1146 1237
1147 #endregion 1238 #endregion
@@ -1591,7 +1682,9 @@ namespace OpenSim.Region.Framework.Scenes
1591 GridRegion region = new GridRegion(RegionInfo); 1682 GridRegion region = new GridRegion(RegionInfo);
1592 string error = GridService.RegisterRegion(RegionInfo.ScopeID, region); 1683 string error = GridService.RegisterRegion(RegionInfo.ScopeID, region);
1593 if (error != String.Empty) 1684 if (error != String.Empty)
1685 {
1594 throw new Exception(error); 1686 throw new Exception(error);
1687 }
1595 1688
1596 m_sceneGridService.SetScene(this); 1689 m_sceneGridService.SetScene(this);
1597 m_sceneGridService.InformNeighborsThatRegionisUp(RequestModuleInterface<INeighbourService>(), RegionInfo); 1690 m_sceneGridService.InformNeighborsThatRegionisUp(RequestModuleInterface<INeighbourService>(), RegionInfo);
@@ -1978,7 +2071,6 @@ namespace OpenSim.Region.Framework.Scenes
1978 /// Move the given scene object into a new region depending on which region its absolute position has moved 2071 /// Move the given scene object into a new region depending on which region its absolute position has moved
1979 /// into. 2072 /// into.
1980 /// 2073 ///
1981 /// This method locates the new region handle and offsets the prim position for the new region
1982 /// </summary> 2074 /// </summary>
1983 /// <param name="attemptedPosition">the attempted out of region position of the scene object</param> 2075 /// <param name="attemptedPosition">the attempted out of region position of the scene object</param>
1984 /// <param name="grp">the scene object that we're crossing</param> 2076 /// <param name="grp">the scene object that we're crossing</param>
@@ -2003,185 +2095,25 @@ namespace OpenSim.Region.Framework.Scenes
2003 return; 2095 return;
2004 } 2096 }
2005 2097
2006 int thisx = (int)RegionInfo.RegionLocX; 2098 if (grp.RootPart.RETURN_AT_EDGE)
2007 int thisy = (int)RegionInfo.RegionLocY;
2008 Vector3 EastCross = new Vector3(0.1f,0,0);
2009 Vector3 WestCross = new Vector3(-0.1f, 0, 0);
2010 Vector3 NorthCross = new Vector3(0, 0.1f, 0);
2011 Vector3 SouthCross = new Vector3(0, -0.1f, 0);
2012
2013
2014 // use this if no borders were crossed!
2015 ulong newRegionHandle
2016 = Util.UIntsToLong((uint)((thisx) * Constants.RegionSize),
2017 (uint)((thisy) * Constants.RegionSize));
2018
2019 Vector3 pos = attemptedPosition;
2020
2021 int changeX = 1;
2022 int changeY = 1;
2023
2024 if (TestBorderCross(attemptedPosition + WestCross, Cardinals.W))
2025 {
2026 if (TestBorderCross(attemptedPosition + SouthCross, Cardinals.S))
2027 {
2028
2029 Border crossedBorderx = GetCrossedBorder(attemptedPosition + WestCross, Cardinals.W);
2030
2031 if (crossedBorderx.BorderLine.Z > 0)
2032 {
2033 pos.X = ((pos.X + crossedBorderx.BorderLine.Z));
2034 changeX = (int)(crossedBorderx.BorderLine.Z /(int) Constants.RegionSize);
2035 }
2036 else
2037 pos.X = ((pos.X + Constants.RegionSize));
2038
2039 Border crossedBordery = GetCrossedBorder(attemptedPosition + SouthCross, Cardinals.S);
2040 //(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize)
2041
2042 if (crossedBordery.BorderLine.Z > 0)
2043 {
2044 pos.Y = ((pos.Y + crossedBordery.BorderLine.Z));
2045 changeY = (int)(crossedBordery.BorderLine.Z / (int)Constants.RegionSize);
2046 }
2047 else
2048 pos.Y = ((pos.Y + Constants.RegionSize));
2049
2050
2051
2052 newRegionHandle
2053 = Util.UIntsToLong((uint)((thisx - changeX) * Constants.RegionSize),
2054 (uint)((thisy - changeY) * Constants.RegionSize));
2055 // x - 1
2056 // y - 1
2057 }
2058 else if (TestBorderCross(attemptedPosition + NorthCross, Cardinals.N))
2059 {
2060 Border crossedBorderx = GetCrossedBorder(attemptedPosition + WestCross, Cardinals.W);
2061
2062 if (crossedBorderx.BorderLine.Z > 0)
2063 {
2064 pos.X = ((pos.X + crossedBorderx.BorderLine.Z));
2065 changeX = (int)(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize);
2066 }
2067 else
2068 pos.X = ((pos.X + Constants.RegionSize));
2069
2070
2071 Border crossedBordery = GetCrossedBorder(attemptedPosition + SouthCross, Cardinals.S);
2072 //(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize)
2073
2074 if (crossedBordery.BorderLine.Z > 0)
2075 {
2076 pos.Y = ((pos.Y + crossedBordery.BorderLine.Z));
2077 changeY = (int)(crossedBordery.BorderLine.Z / (int)Constants.RegionSize);
2078 }
2079 else
2080 pos.Y = ((pos.Y + Constants.RegionSize));
2081
2082 newRegionHandle
2083 = Util.UIntsToLong((uint)((thisx - changeX) * Constants.RegionSize),
2084 (uint)((thisy + changeY) * Constants.RegionSize));
2085 // x - 1
2086 // y + 1
2087 }
2088 else
2089 {
2090 Border crossedBorderx = GetCrossedBorder(attemptedPosition + WestCross, Cardinals.W);
2091
2092 if (crossedBorderx.BorderLine.Z > 0)
2093 {
2094 pos.X = ((pos.X + crossedBorderx.BorderLine.Z));
2095 changeX = (int)(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize);
2096 }
2097 else
2098 pos.X = ((pos.X + Constants.RegionSize));
2099
2100 newRegionHandle
2101 = Util.UIntsToLong((uint)((thisx - changeX) * Constants.RegionSize),
2102 (uint) (thisy*Constants.RegionSize));
2103 // x - 1
2104 }
2105 }
2106 else if (TestBorderCross(attemptedPosition + EastCross, Cardinals.E))
2107 { 2099 {
2108 if (TestBorderCross(attemptedPosition + SouthCross, Cardinals.S)) 2100 // We remove the object here
2109 { 2101 try
2110
2111 pos.X = ((pos.X - Constants.RegionSize));
2112 Border crossedBordery = GetCrossedBorder(attemptedPosition + SouthCross, Cardinals.S);
2113 //(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize)
2114
2115 if (crossedBordery.BorderLine.Z > 0)
2116 {
2117 pos.Y = ((pos.Y + crossedBordery.BorderLine.Z));
2118 changeY = (int)(crossedBordery.BorderLine.Z / (int)Constants.RegionSize);
2119 }
2120 else
2121 pos.Y = ((pos.Y + Constants.RegionSize));
2122
2123
2124 newRegionHandle
2125 = Util.UIntsToLong((uint)((thisx + changeX) * Constants.RegionSize),
2126 (uint)((thisy - changeY) * Constants.RegionSize));
2127 // x + 1
2128 // y - 1
2129 }
2130 else if (TestBorderCross(attemptedPosition + NorthCross, Cardinals.N))
2131 {
2132 pos.X = ((pos.X - Constants.RegionSize));
2133 pos.Y = ((pos.Y - Constants.RegionSize));
2134 newRegionHandle
2135 = Util.UIntsToLong((uint)((thisx + changeX) * Constants.RegionSize),
2136 (uint)((thisy + changeY) * Constants.RegionSize));
2137 // x + 1
2138 // y + 1
2139 }
2140 else
2141 { 2102 {
2142 pos.X = ((pos.X - Constants.RegionSize)); 2103 List<SceneObjectGroup> objects = new List<SceneObjectGroup>();
2143 newRegionHandle 2104 objects.Add(grp);
2144 = Util.UIntsToLong((uint)((thisx + changeX) * Constants.RegionSize), 2105 SceneObjectGroup[] objectsArray = objects.ToArray();
2145 (uint) (thisy*Constants.RegionSize)); 2106 returnObjects(objectsArray, UUID.Zero);
2146 // x + 1
2147 } 2107 }
2148 } 2108 catch (Exception)
2149 else if (TestBorderCross(attemptedPosition + SouthCross, Cardinals.S))
2150 {
2151 Border crossedBordery = GetCrossedBorder(attemptedPosition + SouthCross, Cardinals.S);
2152 //(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize)
2153
2154 if (crossedBordery.BorderLine.Z > 0)
2155 { 2109 {
2156 pos.Y = ((pos.Y + crossedBordery.BorderLine.Z)); 2110 m_log.Warn("[DATABASE]: exception when trying to return the prim that crossed the border.");
2157 changeY = (int)(crossedBordery.BorderLine.Z / (int)Constants.RegionSize);
2158 } 2111 }
2159 else 2112 return;
2160 pos.Y = ((pos.Y + Constants.RegionSize));
2161
2162 newRegionHandle
2163 = Util.UIntsToLong((uint)(thisx * Constants.RegionSize), (uint)((thisy - changeY) * Constants.RegionSize));
2164 // y - 1
2165 }
2166 else if (TestBorderCross(attemptedPosition + NorthCross, Cardinals.N))
2167 {
2168
2169 pos.Y = ((pos.Y - Constants.RegionSize));
2170 newRegionHandle
2171 = Util.UIntsToLong((uint)(thisx * Constants.RegionSize), (uint)((thisy + changeY) * Constants.RegionSize));
2172 // y + 1
2173 } 2113 }
2174 2114
2175 // Offset the positions for the new region across the border 2115 if (m_teleportModule != null)
2176 Vector3 oldGroupPosition = grp.RootPart.GroupPosition; 2116 m_teleportModule.Cross(grp, attemptedPosition, silent);
2177 grp.OffsetForNewRegion(pos);
2178
2179 // If we fail to cross the border, then reset the position of the scene object on that border.
2180 if (!CrossPrimGroupIntoNewRegion(newRegionHandle, grp, silent))
2181 {
2182 grp.OffsetForNewRegion(oldGroupPosition);
2183 grp.ScheduleGroupForFullUpdate();
2184 }
2185 } 2117 }
2186 2118
2187 public Border GetCrossedBorder(Vector3 position, Cardinals gridline) 2119 public Border GetCrossedBorder(Vector3 position, Cardinals gridline)
@@ -2365,75 +2297,6 @@ namespace OpenSim.Region.Framework.Scenes
2365 2297
2366 2298
2367 /// <summary> 2299 /// <summary>
2368 /// Move the given scene object into a new region
2369 /// </summary>
2370 /// <param name="newRegionHandle"></param>
2371 /// <param name="grp">Scene Object Group that we're crossing</param>
2372 /// <returns>
2373 /// true if the crossing itself was successful, false on failure
2374 /// FIMXE: we still return true if the crossing object was not successfully deleted from the originating region
2375 /// </returns>
2376 public bool CrossPrimGroupIntoNewRegion(ulong newRegionHandle, SceneObjectGroup grp, bool silent)
2377 {
2378 //m_log.Debug(" >>> CrossPrimGroupIntoNewRegion <<<");
2379
2380 bool successYN = false;
2381 grp.RootPart.UpdateFlag = 0;
2382 //int primcrossingXMLmethod = 0;
2383
2384 if (newRegionHandle != 0)
2385 {
2386 //string objectState = grp.GetStateSnapshot();
2387
2388 //successYN
2389 // = m_sceneGridService.PrimCrossToNeighboringRegion(
2390 // newRegionHandle, grp.UUID, m_serialiser.SaveGroupToXml2(grp), primcrossingXMLmethod);
2391 //if (successYN && (objectState != "") && m_allowScriptCrossings)
2392 //{
2393 // successYN = m_sceneGridService.PrimCrossToNeighboringRegion(
2394 // newRegionHandle, grp.UUID, objectState, 100);
2395 //}
2396
2397 // And the new channel...
2398 if (m_interregionCommsOut != null)
2399 successYN = m_interregionCommsOut.SendCreateObject(newRegionHandle, grp, true);
2400
2401 if (successYN)
2402 {
2403 // We remove the object here
2404 try
2405 {
2406 DeleteSceneObject(grp, silent);
2407 }
2408 catch (Exception e)
2409 {
2410 m_log.ErrorFormat(
2411 "[INTERREGION]: Exception deleting the old object left behind on a border crossing for {0}, {1}",
2412 grp, e);
2413 }
2414 }
2415 else
2416 {
2417 if (!grp.IsDeleted)
2418 {
2419 if (grp.RootPart.PhysActor != null)
2420 {
2421 grp.RootPart.PhysActor.CrossingFailure();
2422 }
2423 }
2424
2425 m_log.ErrorFormat("[INTERREGION]: Prim crossing failed for {0}", grp);
2426 }
2427 }
2428 else
2429 {
2430 m_log.Error("[INTERREGION]: region handle was unexpectedly 0 in Scene.CrossPrimGroupIntoNewRegion()");
2431 }
2432
2433 return successYN;
2434 }
2435
2436 /// <summary>
2437 /// Called when objects or attachments cross the border between regions. 2300 /// Called when objects or attachments cross the border between regions.
2438 /// </summary> 2301 /// </summary>
2439 /// <param name="sog"></param> 2302 /// <param name="sog"></param>
@@ -2505,6 +2368,9 @@ namespace OpenSim.Region.Framework.Scenes
2505 2368
2506 return false; 2369 return false;
2507 } 2370 }
2371
2372 sceneObject.SetScene(this);
2373
2508 // Force allocation of new LocalId 2374 // Force allocation of new LocalId
2509 // 2375 //
2510 foreach (SceneObjectPart p in sceneObject.Children.Values) 2376 foreach (SceneObjectPart p in sceneObject.Children.Values)
@@ -2545,7 +2411,7 @@ namespace OpenSim.Region.Framework.Scenes
2545 AttachObject( 2411 AttachObject(
2546 sp.ControllingClient, grp.LocalId, (uint)0, grp.GroupRotation, grp.AbsolutePosition, false); 2412 sp.ControllingClient, grp.LocalId, (uint)0, grp.GroupRotation, grp.AbsolutePosition, false);
2547 RootPrim.RemFlag(PrimFlags.TemporaryOnRez); 2413 RootPrim.RemFlag(PrimFlags.TemporaryOnRez);
2548 grp.SendGroupFullUpdate(); 2414 grp.SendGroupFullUpdate();
2549 } 2415 }
2550 else 2416 else
2551 { 2417 {
@@ -2583,6 +2449,8 @@ namespace OpenSim.Region.Framework.Scenes
2583 /// <param name="client"></param> 2449 /// <param name="client"></param>
2584 public override void AddNewClient(IClientAPI client) 2450 public override void AddNewClient(IClientAPI client)
2585 { 2451 {
2452 bool vialogin = false;
2453
2586 m_clientManager.Add(client); 2454 m_clientManager.Add(client);
2587 2455
2588 CheckHeartbeat(); 2456 CheckHeartbeat();
@@ -2617,23 +2485,48 @@ namespace OpenSim.Region.Framework.Scenes
2617 { 2485 {
2618 AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode); 2486 AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode);
2619 2487
2620 m_log.Debug("[Scene] Adding new agent " + client.Name + " to scene " + RegionInfo.RegionName); 2488 // Do the verification here
2621 /* 2489 System.Net.EndPoint ep = client.GetClientEP();
2622 string logMsg = string.Format("[SCENE]: Adding new {0} agent for {1} in {2}", 2490 if (aCircuit != null)
2623 ((aCircuit.child == true) ? "child" : "root"), client.Name, 2491 {
2624 RegionInfo.RegionName); 2492 if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0)
2625 2493 {
2626 m_log.Debug(logMsg); 2494 m_log.DebugFormat("[Scene]: Incoming client {0} {1} in region {2} via Login", aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName);
2627 */ 2495 vialogin = true;
2496 IUserAgentVerificationModule userVerification = RequestModuleInterface<IUserAgentVerificationModule>();
2497 if (userVerification != null && ep != null)
2498 {
2499 if (!userVerification.VerifyClient(aCircuit, ep.ToString()))
2500 {
2501 // uh-oh, this is fishy
2502 m_log.WarnFormat("[Scene]: Agent {0} with session {1} connecting with unidentified end point {2}. Refusing service.",
2503 client.AgentId, client.SessionId, ep.ToString());
2504 try
2505 {
2506 client.Close();
2507 }
2508 catch (Exception e)
2509 {
2510 m_log.DebugFormat("[Scene]: Exception while closing aborted client: {0}", e.StackTrace);
2511 }
2512 return;
2513 }
2514 else
2515 m_log.DebugFormat("[Scene]: User Client Verification for {0} {1} returned true", aCircuit.firstname, aCircuit.lastname);
2516 }
2517 }
2518 }
2628 2519
2629 CommsManager.UserProfileCacheService.AddNewUser(client.AgentId); 2520 m_log.Debug("[Scene] Adding new agent " + client.Name + " to scene " + RegionInfo.RegionName);
2630 2521
2631 ScenePresence sp = CreateAndAddScenePresence(client); 2522 ScenePresence sp = CreateAndAddScenePresence(client);
2523 if (aCircuit != null)
2524 sp.Appearance = aCircuit.Appearance;
2632 2525
2633 // HERE!!! Do the initial attachments right here 2526 // HERE!!! Do the initial attachments right here
2634 // first agent upon login is a root agent by design. 2527 // first agent upon login is a root agent by design.
2635 // All other AddNewClient calls find aCircuit.child to be true 2528 // All other AddNewClient calls find aCircuit.child to be true
2636 if (aCircuit == null || aCircuit.child == false) 2529 if (aCircuit == null || (aCircuit != null && aCircuit.child == false))
2637 { 2530 {
2638 sp.IsChildAgent = false; 2531 sp.IsChildAgent = false;
2639 Util.FireAndForget(delegate(object o) { sp.RezAttachments(); }); 2532 Util.FireAndForget(delegate(object o) { sp.RezAttachments(); });
@@ -2642,6 +2535,8 @@ namespace OpenSim.Region.Framework.Scenes
2642 2535
2643 m_LastLogin = Util.EnvironmentTickCount(); 2536 m_LastLogin = Util.EnvironmentTickCount();
2644 EventManager.TriggerOnNewClient(client); 2537 EventManager.TriggerOnNewClient(client);
2538 if (vialogin)
2539 EventManager.TriggerOnClientLogin(client);
2645 } 2540 }
2646 2541
2647 2542
@@ -2711,6 +2606,7 @@ namespace OpenSim.Region.Framework.Scenes
2711 client.OnGrabUpdate += ProcessObjectGrabUpdate; 2606 client.OnGrabUpdate += ProcessObjectGrabUpdate;
2712 client.OnDeGrabObject += ProcessObjectDeGrab; 2607 client.OnDeGrabObject += ProcessObjectDeGrab;
2713 client.OnUndo += m_sceneGraph.HandleUndo; 2608 client.OnUndo += m_sceneGraph.HandleUndo;
2609 client.OnRedo += m_sceneGraph.HandleRedo;
2714 client.OnObjectDescription += m_sceneGraph.PrimDescription; 2610 client.OnObjectDescription += m_sceneGraph.PrimDescription;
2715 client.OnObjectDrop += m_sceneGraph.DropObject; 2611 client.OnObjectDrop += m_sceneGraph.DropObject;
2716 client.OnObjectSaleInfo += ObjectSaleInfo; 2612 client.OnObjectSaleInfo += ObjectSaleInfo;
@@ -2758,7 +2654,6 @@ namespace OpenSim.Region.Framework.Scenes
2758 { 2654 {
2759 client.OnTeleportLocationRequest += RequestTeleportLocation; 2655 client.OnTeleportLocationRequest += RequestTeleportLocation;
2760 client.OnTeleportLandmarkRequest += RequestTeleportLandmark; 2656 client.OnTeleportLandmarkRequest += RequestTeleportLandmark;
2761 client.OnTeleportHomeRequest += TeleportClientHome;
2762 } 2657 }
2763 2658
2764 public virtual void SubscribeToClientScriptEvents(IClientAPI client) 2659 public virtual void SubscribeToClientScriptEvents(IClientAPI client)
@@ -2778,7 +2673,7 @@ namespace OpenSim.Region.Framework.Scenes
2778 2673
2779 public virtual void SubscribeToClientGridEvents(IClientAPI client) 2674 public virtual void SubscribeToClientGridEvents(IClientAPI client)
2780 { 2675 {
2781 client.OnNameFromUUIDRequest += CommsManager.HandleUUIDNameRequest; 2676 client.OnNameFromUUIDRequest += HandleUUIDNameRequest;
2782 client.OnMoneyTransferRequest += ProcessMoneyTransferRequest; 2677 client.OnMoneyTransferRequest += ProcessMoneyTransferRequest;
2783 client.OnAvatarPickerRequest += ProcessAvatarPickerRequest; 2678 client.OnAvatarPickerRequest += ProcessAvatarPickerRequest;
2784 client.OnSetStartLocationRequest += SetHomeRezPoint; 2679 client.OnSetStartLocationRequest += SetHomeRezPoint;
@@ -2865,6 +2760,7 @@ namespace OpenSim.Region.Framework.Scenes
2865 client.OnGrabObject -= ProcessObjectGrab; 2760 client.OnGrabObject -= ProcessObjectGrab;
2866 client.OnDeGrabObject -= ProcessObjectDeGrab; 2761 client.OnDeGrabObject -= ProcessObjectDeGrab;
2867 client.OnUndo -= m_sceneGraph.HandleUndo; 2762 client.OnUndo -= m_sceneGraph.HandleUndo;
2763 client.OnRedo -= m_sceneGraph.HandleRedo;
2868 client.OnObjectDescription -= m_sceneGraph.PrimDescription; 2764 client.OnObjectDescription -= m_sceneGraph.PrimDescription;
2869 client.OnObjectDrop -= m_sceneGraph.DropObject; 2765 client.OnObjectDrop -= m_sceneGraph.DropObject;
2870 client.OnObjectSaleInfo -= ObjectSaleInfo; 2766 client.OnObjectSaleInfo -= ObjectSaleInfo;
@@ -2913,7 +2809,7 @@ namespace OpenSim.Region.Framework.Scenes
2913 { 2809 {
2914 client.OnTeleportLocationRequest -= RequestTeleportLocation; 2810 client.OnTeleportLocationRequest -= RequestTeleportLocation;
2915 client.OnTeleportLandmarkRequest -= RequestTeleportLandmark; 2811 client.OnTeleportLandmarkRequest -= RequestTeleportLandmark;
2916 client.OnTeleportHomeRequest -= TeleportClientHome; 2812 //client.OnTeleportHomeRequest -= TeleportClientHome;
2917 } 2813 }
2918 2814
2919 public virtual void UnSubscribeToClientScriptEvents(IClientAPI client) 2815 public virtual void UnSubscribeToClientScriptEvents(IClientAPI client)
@@ -2933,7 +2829,7 @@ namespace OpenSim.Region.Framework.Scenes
2933 2829
2934 public virtual void UnSubscribeToClientGridEvents(IClientAPI client) 2830 public virtual void UnSubscribeToClientGridEvents(IClientAPI client)
2935 { 2831 {
2936 client.OnNameFromUUIDRequest -= CommsManager.HandleUUIDNameRequest; 2832 client.OnNameFromUUIDRequest -= HandleUUIDNameRequest;
2937 client.OnMoneyTransferRequest -= ProcessMoneyTransferRequest; 2833 client.OnMoneyTransferRequest -= ProcessMoneyTransferRequest;
2938 client.OnAvatarPickerRequest -= ProcessAvatarPickerRequest; 2834 client.OnAvatarPickerRequest -= ProcessAvatarPickerRequest;
2939 client.OnSetStartLocationRequest -= SetHomeRezPoint; 2835 client.OnSetStartLocationRequest -= SetHomeRezPoint;
@@ -2960,30 +2856,12 @@ namespace OpenSim.Region.Framework.Scenes
2960 /// <param name="client">The IClientAPI for the client</param> 2856 /// <param name="client">The IClientAPI for the client</param>
2961 public virtual void TeleportClientHome(UUID agentId, IClientAPI client) 2857 public virtual void TeleportClientHome(UUID agentId, IClientAPI client)
2962 { 2858 {
2963 UserProfileData UserProfile = CommsManager.UserService.GetUserProfile(agentId); 2859 if (m_teleportModule != null)
2964 if (UserProfile != null) 2860 m_teleportModule.TeleportHome(agentId, client);
2861 else
2965 { 2862 {
2966 GridRegion regionInfo = GridService.GetRegionByUUID(UUID.Zero, UserProfile.HomeRegionID); 2863 m_log.DebugFormat("[SCENE]: Unable to teleport user home: no AgentTransferModule is active");
2967 if (regionInfo == null) 2864 client.SendTeleportFailed("Unable to perform teleports on this simulator.");
2968 {
2969 uint x = 0, y = 0;
2970 Utils.LongToUInts(UserProfile.HomeRegion, out x, out y);
2971 regionInfo = GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
2972 if (regionInfo != null) // home region can be away temporarily, too
2973 {
2974 UserProfile.HomeRegionID = regionInfo.RegionID;
2975 CommsManager.UserService.UpdateUserProfile(UserProfile);
2976 }
2977 }
2978 if (regionInfo == null)
2979 {
2980 // can't find the Home region: Tell viewer and abort
2981 client.SendTeleportFailed("Your home-region could not be found.");
2982 return;
2983 }
2984 RequestTeleportLocation(
2985 client, regionInfo.RegionHandle, UserProfile.HomeLocation, UserProfile.HomeLookAt,
2986 (uint)(TPFlags.SetLastToTarget | TPFlags.ViaHome));
2987 } 2865 }
2988 } 2866 }
2989 2867
@@ -3074,7 +2952,7 @@ namespace OpenSim.Region.Framework.Scenes
3074 } 2952 }
3075 2953
3076 /// <summary> 2954 /// <summary>
3077 /// Sets the Home Point. The GridService uses this to know where to put a user when they log-in 2955 /// Sets the Home Point. The LoginService uses this to know where to put a user when they log-in
3078 /// </summary> 2956 /// </summary>
3079 /// <param name="remoteClient"></param> 2957 /// <param name="remoteClient"></param>
3080 /// <param name="regionHandle"></param> 2958 /// <param name="regionHandle"></param>
@@ -3083,27 +2961,11 @@ namespace OpenSim.Region.Framework.Scenes
3083 /// <param name="flags"></param> 2961 /// <param name="flags"></param>
3084 public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags) 2962 public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags)
3085 { 2963 {
3086 UserProfileData UserProfile = CommsManager.UserService.GetUserProfile(remoteClient.AgentId); 2964 if (PresenceService.SetHomeLocation(remoteClient.AgentId.ToString(), RegionInfo.RegionID, position, lookAt))
3087 if (UserProfile != null)
3088 {
3089 // I know I'm ignoring the regionHandle provided by the teleport location request.
3090 // reusing the TeleportLocationRequest delegate, so regionHandle isn't valid
3091 UserProfile.HomeRegionID = RegionInfo.RegionID;
3092 // TODO: The next line can be removed, as soon as only homeRegionID based UserServers are around.
3093 // TODO: The HomeRegion property can be removed then, too
3094 UserProfile.HomeRegion = RegionInfo.RegionHandle;
3095
3096 UserProfile.HomeLocation = position;
3097 UserProfile.HomeLookAt = lookAt;
3098 CommsManager.UserService.UpdateUserProfile(UserProfile);
3099
3100 // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot. 2965 // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot.
3101 m_dialogModule.SendAlertToUser(remoteClient, "Home position set."); 2966 m_dialogModule.SendAlertToUser(remoteClient, "Home position set.");
3102 }
3103 else 2967 else
3104 {
3105 m_dialogModule.SendAlertToUser(remoteClient, "Set Home request Failed."); 2968 m_dialogModule.SendAlertToUser(remoteClient, "Set Home request Failed.");
3106 }
3107 } 2969 }
3108 2970
3109 /// <summary> 2971 /// <summary>
@@ -3176,14 +3038,12 @@ namespace OpenSim.Region.Framework.Scenes
3176 m_sceneGraph.removeUserCount(!childagentYN); 3038 m_sceneGraph.removeUserCount(!childagentYN);
3177 CapsModule.RemoveCapsHandler(agentID); 3039 CapsModule.RemoveCapsHandler(agentID);
3178 3040
3179 if (avatar.Scene.NeedSceneCacheClear(avatar.UUID)) 3041 // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever
3180 { 3042 // this method is doing is HORRIBLE!!!
3181 CommsManager.UserProfileCacheService.RemoveUser(agentID); 3043 avatar.Scene.NeedSceneCacheClear(avatar.UUID);
3182 }
3183 3044
3184 if (!avatar.IsChildAgent) 3045 if (!avatar.IsChildAgent)
3185 { 3046 {
3186 m_sceneGridService.LogOffUser(agentID, RegionInfo.RegionID, RegionInfo.RegionHandle, avatar.AbsolutePosition, avatar.Lookat);
3187 //List<ulong> childknownRegions = new List<ulong>(); 3047 //List<ulong> childknownRegions = new List<ulong>();
3188 //List<ulong> ckn = avatar.KnownChildRegionHandles; 3048 //List<ulong> ckn = avatar.KnownChildRegionHandles;
3189 //for (int i = 0; i < ckn.Count; i++) 3049 //for (int i = 0; i < ckn.Count; i++)
@@ -3238,12 +3098,6 @@ namespace OpenSim.Region.Framework.Scenes
3238 m_log.Error("[SCENE] Scene.cs:RemoveClient exception: " + e.ToString()); 3098 m_log.Error("[SCENE] Scene.cs:RemoveClient exception: " + e.ToString());
3239 } 3099 }
3240 3100
3241 // Remove client agent from profile, so new logins will work
3242 if (!childagentYN)
3243 {
3244 m_sceneGridService.ClearUserAgent(agentID);
3245 }
3246
3247 m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode); 3101 m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode);
3248 3102
3249 //m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false)); 3103 //m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false));
@@ -3317,14 +3171,6 @@ namespace OpenSim.Region.Framework.Scenes
3317 m_sceneGridService.KiPrimitive += SendKillObject; 3171 m_sceneGridService.KiPrimitive += SendKillObject;
3318 m_sceneGridService.OnGetLandData += GetLandData; 3172 m_sceneGridService.OnGetLandData += GetLandData;
3319 3173
3320 if (m_interregionCommsIn != null)
3321 {
3322 m_log.Debug("[SCENE]: Registering with InterregionCommsIn");
3323 m_interregionCommsIn.OnChildAgentUpdate += IncomingChildAgentDataUpdate;
3324 }
3325 else
3326 m_log.Debug("[SCENE]: Unable to register with InterregionCommsIn");
3327
3328 } 3174 }
3329 3175
3330 /// <summary> 3176 /// <summary>
@@ -3342,9 +3188,6 @@ namespace OpenSim.Region.Framework.Scenes
3342 m_sceneGridService.OnCloseAgentConnection -= IncomingCloseAgent; 3188 m_sceneGridService.OnCloseAgentConnection -= IncomingCloseAgent;
3343 m_sceneGridService.OnGetLandData -= GetLandData; 3189 m_sceneGridService.OnGetLandData -= GetLandData;
3344 3190
3345 if (m_interregionCommsIn != null)
3346 m_interregionCommsIn.OnChildAgentUpdate -= IncomingChildAgentDataUpdate;
3347
3348 // this does nothing; should be removed 3191 // this does nothing; should be removed
3349 m_sceneGridService.Close(); 3192 m_sceneGridService.Close();
3350 3193
@@ -3401,7 +3244,7 @@ namespace OpenSim.Region.Framework.Scenes
3401 agent.AgentID, agent.circuitcode, teleportFlags); 3244 agent.AgentID, agent.circuitcode, teleportFlags);
3402 3245
3403 reason = String.Empty; 3246 reason = String.Empty;
3404 if (!AuthenticateUser(agent, out reason)) 3247 if (!VerifyUserPresence(agent, out reason))
3405 return false; 3248 return false;
3406 3249
3407 if (!AuthorizeUser(agent, out reason)) 3250 if (!AuthorizeUser(agent, out reason))
@@ -3501,40 +3344,39 @@ namespace OpenSim.Region.Framework.Scenes
3501 */// This is now handled properly in ScenePresence.MakeRootAgent 3344 */// This is now handled properly in ScenePresence.MakeRootAgent
3502 } 3345 }
3503 3346
3347 agent.teleportFlags = teleportFlags;
3504 m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent); 3348 m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent);
3505 3349
3506 // rewrite session_id
3507 CachedUserInfo userinfo = CommsManager.UserProfileCacheService.GetUserDetails(agent.AgentID);
3508 if (userinfo != null)
3509 {
3510 userinfo.SessionID = agent.SessionID;
3511 }
3512 else
3513 {
3514 m_log.WarnFormat(
3515 "[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);
3516 }
3517
3518 return true; 3350 return true;
3519 } 3351 }
3520 3352
3521 /// <summary> 3353 /// <summary>
3522 /// Verifies that the user has a session on the Grid 3354 /// Verifies that the user has a presence on the Grid
3523 /// </summary> 3355 /// </summary>
3524 /// <param name="agent">Circuit Data of the Agent we're verifying</param> 3356 /// <param name="agent">Circuit Data of the Agent we're verifying</param>
3525 /// <param name="reason">Outputs the reason for the false response on this string</param> 3357 /// <param name="reason">Outputs the reason for the false response on this string</param>
3526 /// <returns>True if the user has a session on the grid. False if it does not. False will 3358 /// <returns>True if the user has a session on the grid. False if it does not. False will
3527 /// also return a reason.</returns> 3359 /// also return a reason.</returns>
3528 public virtual bool AuthenticateUser(AgentCircuitData agent, out string reason) 3360 public virtual bool VerifyUserPresence(AgentCircuitData agent, out string reason)
3529 { 3361 {
3530 reason = String.Empty; 3362 reason = String.Empty;
3531 3363
3532 bool result = CommsManager.UserService.VerifySession(agent.AgentID, agent.SessionID); 3364 IPresenceService presence = RequestModuleInterface<IPresenceService>();
3533 m_log.Debug("[CONNECTION BEGIN]: User authentication returned " + result); 3365 if (presence == null)
3534 if (!result) 3366 {
3535 reason = String.Format("Failed to authenticate user {0} {1}, access denied.", agent.firstname, agent.lastname); 3367 reason = String.Format("Failed to verify user {0} {1} in region {2}. Presence service does not exist.", agent.firstname, agent.lastname, RegionInfo.RegionName);
3368 return false;
3369 }
3370
3371 OpenSim.Services.Interfaces.PresenceInfo pinfo = presence.GetAgent(agent.SessionID);
3536 3372
3537 return result; 3373 if (pinfo == null || (pinfo != null && pinfo.Online == false))
3374 {
3375 reason = String.Format("Failed to verify user {0} {1}, access denied to region {2}.", agent.firstname, agent.lastname, RegionInfo.RegionName);
3376 return false;
3377 }
3378
3379 return true;
3538 } 3380 }
3539 3381
3540 /// <summary> 3382 /// <summary>
@@ -3735,8 +3577,8 @@ namespace OpenSim.Region.Framework.Scenes
3735 /// <returns>true if we handled it.</returns> 3577 /// <returns>true if we handled it.</returns>
3736 public virtual bool IncomingChildAgentDataUpdate(AgentData cAgentData) 3578 public virtual bool IncomingChildAgentDataUpdate(AgentData cAgentData)
3737 { 3579 {
3738// m_log.DebugFormat( 3580 m_log.DebugFormat(
3739// "[SCENE]: Incoming child agent update for {0} in {1}", cAgentData.AgentID, RegionInfo.RegionName); 3581 "[SCENE]: Incoming child agent update for {0} in {1}", cAgentData.AgentID, RegionInfo.RegionName);
3740 3582
3741 // We have to wait until the viewer contacts this region after receiving EAC. 3583 // We have to wait until the viewer contacts this region after receiving EAC.
3742 // That calls AddNewClient, which finally creates the ScenePresence 3584 // That calls AddNewClient, which finally creates the ScenePresence
@@ -3805,16 +3647,6 @@ namespace OpenSim.Region.Framework.Scenes
3805 return false; 3647 return false;
3806 } 3648 }
3807 3649
3808 public virtual bool IncomingReleaseAgent(UUID id)
3809 {
3810 return m_sceneGridService.ReleaseAgent(id);
3811 }
3812
3813 public void SendReleaseAgent(ulong regionHandle, UUID id, string uri)
3814 {
3815 m_interregionCommsOut.SendReleaseAgent(regionHandle, id, uri);
3816 }
3817
3818 /// <summary> 3650 /// <summary>
3819 /// Tell a single agent to disconnect from the region. 3651 /// Tell a single agent to disconnect from the region.
3820 /// </summary> 3652 /// </summary>
@@ -3859,30 +3691,6 @@ namespace OpenSim.Region.Framework.Scenes
3859 } 3691 }
3860 3692
3861 /// <summary> 3693 /// <summary>
3862 /// Tell neighboring regions about this agent
3863 /// When the regions respond with a true value,
3864 /// tell the agents about the region.
3865 ///
3866 /// We have to tell the regions about the agents first otherwise it'll deny them access
3867 ///
3868 /// </summary>
3869 /// <param name="presence"></param>
3870 public void InformClientOfNeighbours(ScenePresence presence)
3871 {
3872 m_sceneGridService.EnableNeighbourChildAgents(presence, m_neighbours);
3873 }
3874
3875 /// <summary>
3876 /// Tell a neighboring region about this agent
3877 /// </summary>
3878 /// <param name="presence"></param>
3879 /// <param name="region"></param>
3880 public void InformClientOfNeighbor(ScenePresence presence, RegionInfo region)
3881 {
3882 m_sceneGridService.EnableNeighbourChildAgents(presence, m_neighbours);
3883 }
3884
3885 /// <summary>
3886 /// Tries to teleport agent to other region. 3694 /// Tries to teleport agent to other region.
3887 /// </summary> 3695 /// </summary>
3888 /// <param name="remoteClient"></param> 3696 /// <param name="remoteClient"></param>
@@ -3957,16 +3765,12 @@ namespace OpenSim.Region.Framework.Scenes
3957 } 3765 }
3958 3766
3959 if (m_teleportModule != null) 3767 if (m_teleportModule != null)
3960 { 3768 m_teleportModule.Teleport(sp, regionHandle, position, lookAt, teleportFlags);
3961 m_teleportModule.RequestTeleportToLocation(sp, regionHandle,
3962 position, lookAt, teleportFlags);
3963 }
3964 else 3769 else
3965 { 3770 {
3966 m_sceneGridService.RequestTeleportToLocation(sp, regionHandle, 3771 m_log.DebugFormat("[SCENE]: Unable to perform teleports: no AgentTransferModule is active");
3967 position, lookAt, teleportFlags); 3772 sp.ControllingClient.SendTeleportFailed("Unable to perform teleports on this simulator.");
3968 } 3773 }
3969
3970 } 3774 }
3971 } 3775 }
3972 3776
@@ -3992,7 +3796,12 @@ namespace OpenSim.Region.Framework.Scenes
3992 3796
3993 public void CrossAgentToNewRegion(ScenePresence agent, bool isFlying) 3797 public void CrossAgentToNewRegion(ScenePresence agent, bool isFlying)
3994 { 3798 {
3995 m_sceneGridService.CrossAgentToNewRegion(this, agent, isFlying); 3799 if (m_teleportModule != null)
3800 m_teleportModule.Cross(agent, isFlying);
3801 else
3802 {
3803 m_log.DebugFormat("[SCENE]: Unable to cross agent to neighbouring region, because there is no AgentTransferModule");
3804 }
3996 } 3805 }
3997 3806
3998 public void SendOutChildAgentUpdates(AgentPosition cadu, ScenePresence presence) 3807 public void SendOutChildAgentUpdates(AgentPosition cadu, ScenePresence presence)
@@ -4018,35 +3827,6 @@ namespace OpenSim.Region.Framework.Scenes
4018 objectCapacity = objects; 3827 objectCapacity = objects;
4019 } 3828 }
4020 3829
4021 public List<FriendListItem> GetFriendList(string id)
4022 {
4023 UUID avatarID;
4024 if (!UUID.TryParse(id, out avatarID))
4025 return new List<FriendListItem>();
4026
4027 return CommsManager.GetUserFriendList(avatarID);
4028 }
4029
4030 public Dictionary<UUID, FriendRegionInfo> GetFriendRegionInfos(List<UUID> uuids)
4031 {
4032 return CommsManager.GetFriendRegionInfos(uuids);
4033 }
4034
4035 public virtual void StoreAddFriendship(UUID ownerID, UUID friendID, uint perms)
4036 {
4037 m_sceneGridService.AddNewUserFriend(ownerID, friendID, perms);
4038 }
4039
4040 public virtual void StoreUpdateFriendship(UUID ownerID, UUID friendID, uint perms)
4041 {
4042 m_sceneGridService.UpdateUserFriendPerms(ownerID, friendID, perms);
4043 }
4044
4045 public virtual void StoreRemoveFriendship(UUID ownerID, UUID ExfriendID)
4046 {
4047 m_sceneGridService.RemoveUserFriend(ownerID, ExfriendID);
4048 }
4049
4050 #endregion 3830 #endregion
4051 3831
4052 public void HandleObjectPermissionsUpdate(IClientAPI controller, UUID agentID, UUID sessionID, byte field, uint localId, uint mask, byte set) 3832 public void HandleObjectPermissionsUpdate(IClientAPI controller, UUID agentID, UUID sessionID, byte field, uint localId, uint mask, byte set)
@@ -4638,7 +4418,8 @@ namespace OpenSim.Region.Framework.Scenes
4638 group.GetPartName(localID), 4418 group.GetPartName(localID),
4639 group.GetPartDescription(localID), 4419 group.GetPartDescription(localID),
4640 (sbyte)AssetType.Object, 4420 (sbyte)AssetType.Object,
4641 Utils.StringToBytes(sceneObjectXml)); 4421 Utils.StringToBytes(sceneObjectXml),
4422 group.OwnerID);
4642 AssetService.Store(asset); 4423 AssetService.Store(asset);
4643 4424
4644 InventoryItemBase item = new InventoryItemBase(); 4425 InventoryItemBase item = new InventoryItemBase();
@@ -4962,5 +4743,15 @@ namespace OpenSim.Region.Framework.Scenes
4962 if (Util.EnvironmentTickCountSubtract(m_lastUpdate) > 2000) 4743 if (Util.EnvironmentTickCountSubtract(m_lastUpdate) > 2000)
4963 StartTimer(); 4744 StartTimer();
4964 } 4745 }
4746
4747 public override ISceneObject DeserializeObject(string representation)
4748 {
4749 return SceneObjectSerializer.FromXml2Format(representation);
4750 }
4751
4752 public override bool AllowScriptCrossings
4753 {
4754 get { return m_allowScriptCrossings; }
4755 }
4965 } 4756 }
4966} 4757}