aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Scene.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs348
1 files changed, 174 insertions, 174 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 234554e..7b582a9 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;
@@ -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
@@ -2146,7 +2237,10 @@ namespace OpenSim.Region.Framework.Scenes
2146 grp.OffsetForNewRegion(pos); 2237 grp.OffsetForNewRegion(pos);
2147 2238
2148 // If we fail to cross the border, then reset the position of the scene object on that border. 2239 // If we fail to cross the border, then reset the position of the scene object on that border.
2149 if (!CrossPrimGroupIntoNewRegion(newRegionHandle, grp, silent)) 2240 uint x = 0, y = 0;
2241 Utils.LongToUInts(newRegionHandle, out x, out y);
2242 GridRegion destination = GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
2243 if (destination != null && !CrossPrimGroupIntoNewRegion(destination, grp, silent))
2150 { 2244 {
2151 grp.OffsetForNewRegion(oldGroupPosition); 2245 grp.OffsetForNewRegion(oldGroupPosition);
2152 grp.ScheduleGroupForFullUpdate(); 2246 grp.ScheduleGroupForFullUpdate();
@@ -2342,7 +2436,7 @@ namespace OpenSim.Region.Framework.Scenes
2342 /// true if the crossing itself was successful, false on failure 2436 /// true if the crossing itself was successful, false on failure
2343 /// FIMXE: we still return true if the crossing object was not successfully deleted from the originating region 2437 /// FIMXE: we still return true if the crossing object was not successfully deleted from the originating region
2344 /// </returns> 2438 /// </returns>
2345 public bool CrossPrimGroupIntoNewRegion(ulong newRegionHandle, SceneObjectGroup grp, bool silent) 2439 public bool CrossPrimGroupIntoNewRegion(GridRegion destination, SceneObjectGroup grp, bool silent)
2346 { 2440 {
2347 //m_log.Debug(" >>> CrossPrimGroupIntoNewRegion <<<"); 2441 //m_log.Debug(" >>> CrossPrimGroupIntoNewRegion <<<");
2348 2442
@@ -2350,7 +2444,7 @@ namespace OpenSim.Region.Framework.Scenes
2350 grp.RootPart.UpdateFlag = 0; 2444 grp.RootPart.UpdateFlag = 0;
2351 //int primcrossingXMLmethod = 0; 2445 //int primcrossingXMLmethod = 0;
2352 2446
2353 if (newRegionHandle != 0) 2447 if (destination != null)
2354 { 2448 {
2355 //string objectState = grp.GetStateSnapshot(); 2449 //string objectState = grp.GetStateSnapshot();
2356 2450
@@ -2363,9 +2457,11 @@ namespace OpenSim.Region.Framework.Scenes
2363 // newRegionHandle, grp.UUID, objectState, 100); 2457 // newRegionHandle, grp.UUID, objectState, 100);
2364 //} 2458 //}
2365 2459
2366 // And the new channel... 2460 //// And the new channel...
2367 if (m_interregionCommsOut != null) 2461 //if (m_interregionCommsOut != null)
2368 successYN = m_interregionCommsOut.SendCreateObject(newRegionHandle, grp, true); 2462 // successYN = m_interregionCommsOut.SendCreateObject(newRegionHandle, grp, true);
2463 if (m_simulationService != null)
2464 successYN = m_simulationService.CreateObject(destination, grp, true);
2369 2465
2370 if (successYN) 2466 if (successYN)
2371 { 2467 {
@@ -2396,7 +2492,7 @@ namespace OpenSim.Region.Framework.Scenes
2396 } 2492 }
2397 else 2493 else
2398 { 2494 {
2399 m_log.Error("[INTERREGION]: region handle was unexpectedly 0 in Scene.CrossPrimGroupIntoNewRegion()"); 2495 m_log.Error("[INTERREGION]: destination was unexpectedly null in Scene.CrossPrimGroupIntoNewRegion()");
2400 } 2496 }
2401 2497
2402 return successYN; 2498 return successYN;
@@ -2462,6 +2558,9 @@ namespace OpenSim.Region.Framework.Scenes
2462 2558
2463 return false; 2559 return false;
2464 } 2560 }
2561
2562 sceneObject.SetScene(this);
2563
2465 // Force allocation of new LocalId 2564 // Force allocation of new LocalId
2466 // 2565 //
2467 foreach (SceneObjectPart p in sceneObject.Children.Values) 2566 foreach (SceneObjectPart p in sceneObject.Children.Values)
@@ -2589,9 +2688,10 @@ namespace OpenSim.Region.Framework.Scenes
2589 m_log.Debug(logMsg); 2688 m_log.Debug(logMsg);
2590 */ 2689 */
2591 2690
2592 CommsManager.UserProfileCacheService.AddNewUser(client.AgentId); 2691 //CommsManager.UserProfileCacheService.AddNewUser(client.AgentId);
2593 2692
2594 ScenePresence sp = CreateAndAddScenePresence(client); 2693 ScenePresence sp = CreateAndAddScenePresence(client);
2694 sp.Appearance = aCircuit.Appearance;
2595 2695
2596 // HERE!!! Do the initial attachments right here 2696 // HERE!!! Do the initial attachments right here
2597 // first agent upon login is a root agent by design. 2697 // first agent upon login is a root agent by design.
@@ -2605,6 +2705,7 @@ namespace OpenSim.Region.Framework.Scenes
2605 2705
2606 m_LastLogin = Util.EnvironmentTickCount(); 2706 m_LastLogin = Util.EnvironmentTickCount();
2607 EventManager.TriggerOnNewClient(client); 2707 EventManager.TriggerOnNewClient(client);
2708
2608 } 2709 }
2609 2710
2610 2711
@@ -2740,7 +2841,7 @@ namespace OpenSim.Region.Framework.Scenes
2740 2841
2741 public virtual void SubscribeToClientGridEvents(IClientAPI client) 2842 public virtual void SubscribeToClientGridEvents(IClientAPI client)
2742 { 2843 {
2743 client.OnNameFromUUIDRequest += CommsManager.HandleUUIDNameRequest; 2844 client.OnNameFromUUIDRequest += HandleUUIDNameRequest;
2744 client.OnMoneyTransferRequest += ProcessMoneyTransferRequest; 2845 client.OnMoneyTransferRequest += ProcessMoneyTransferRequest;
2745 client.OnAvatarPickerRequest += ProcessAvatarPickerRequest; 2846 client.OnAvatarPickerRequest += ProcessAvatarPickerRequest;
2746 client.OnSetStartLocationRequest += SetHomeRezPoint; 2847 client.OnSetStartLocationRequest += SetHomeRezPoint;
@@ -2895,7 +2996,7 @@ namespace OpenSim.Region.Framework.Scenes
2895 2996
2896 public virtual void UnSubscribeToClientGridEvents(IClientAPI client) 2997 public virtual void UnSubscribeToClientGridEvents(IClientAPI client)
2897 { 2998 {
2898 client.OnNameFromUUIDRequest -= CommsManager.HandleUUIDNameRequest; 2999 client.OnNameFromUUIDRequest -= HandleUUIDNameRequest;
2899 client.OnMoneyTransferRequest -= ProcessMoneyTransferRequest; 3000 client.OnMoneyTransferRequest -= ProcessMoneyTransferRequest;
2900 client.OnAvatarPickerRequest -= ProcessAvatarPickerRequest; 3001 client.OnAvatarPickerRequest -= ProcessAvatarPickerRequest;
2901 client.OnSetStartLocationRequest -= SetHomeRezPoint; 3002 client.OnSetStartLocationRequest -= SetHomeRezPoint;
@@ -2922,21 +3023,11 @@ namespace OpenSim.Region.Framework.Scenes
2922 /// <param name="client">The IClientAPI for the client</param> 3023 /// <param name="client">The IClientAPI for the client</param>
2923 public virtual void TeleportClientHome(UUID agentId, IClientAPI client) 3024 public virtual void TeleportClientHome(UUID agentId, IClientAPI client)
2924 { 3025 {
2925 UserProfileData UserProfile = CommsManager.UserService.GetUserProfile(agentId); 3026 OpenSim.Services.Interfaces.PresenceInfo pinfo = PresenceService.GetAgent(client.SessionId);
2926 if (UserProfile != null) 3027
3028 if (pinfo != null)
2927 { 3029 {
2928 GridRegion regionInfo = GridService.GetRegionByUUID(UUID.Zero, UserProfile.HomeRegionID); 3030 GridRegion regionInfo = GridService.GetRegionByUUID(UUID.Zero, pinfo.HomeRegionID);
2929 if (regionInfo == null)
2930 {
2931 uint x = 0, y = 0;
2932 Utils.LongToUInts(UserProfile.HomeRegion, out x, out y);
2933 regionInfo = GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
2934 if (regionInfo != null) // home region can be away temporarily, too
2935 {
2936 UserProfile.HomeRegionID = regionInfo.RegionID;
2937 CommsManager.UserService.UpdateUserProfile(UserProfile);
2938 }
2939 }
2940 if (regionInfo == null) 3031 if (regionInfo == null)
2941 { 3032 {
2942 // can't find the Home region: Tell viewer and abort 3033 // can't find the Home region: Tell viewer and abort
@@ -2944,7 +3035,7 @@ namespace OpenSim.Region.Framework.Scenes
2944 return; 3035 return;
2945 } 3036 }
2946 RequestTeleportLocation( 3037 RequestTeleportLocation(
2947 client, regionInfo.RegionHandle, UserProfile.HomeLocation, UserProfile.HomeLookAt, 3038 client, regionInfo.RegionHandle, pinfo.HomePosition, pinfo.HomeLookAt,
2948 (uint)(TPFlags.SetLastToTarget | TPFlags.ViaHome)); 3039 (uint)(TPFlags.SetLastToTarget | TPFlags.ViaHome));
2949 } 3040 }
2950 } 3041 }
@@ -3036,7 +3127,7 @@ namespace OpenSim.Region.Framework.Scenes
3036 } 3127 }
3037 3128
3038 /// <summary> 3129 /// <summary>
3039 /// Sets the Home Point. The GridService uses this to know where to put a user when they log-in 3130 /// Sets the Home Point. The LoginService uses this to know where to put a user when they log-in
3040 /// </summary> 3131 /// </summary>
3041 /// <param name="remoteClient"></param> 3132 /// <param name="remoteClient"></param>
3042 /// <param name="regionHandle"></param> 3133 /// <param name="regionHandle"></param>
@@ -3045,27 +3136,11 @@ namespace OpenSim.Region.Framework.Scenes
3045 /// <param name="flags"></param> 3136 /// <param name="flags"></param>
3046 public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags) 3137 public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags)
3047 { 3138 {
3048 UserProfileData UserProfile = CommsManager.UserService.GetUserProfile(remoteClient.AgentId); 3139 if (PresenceService.SetHomeLocation(remoteClient.AgentId.ToString(), RegionInfo.RegionID, position, lookAt))
3049 if (UserProfile != null)
3050 {
3051 // I know I'm ignoring the regionHandle provided by the teleport location request.
3052 // reusing the TeleportLocationRequest delegate, so regionHandle isn't valid
3053 UserProfile.HomeRegionID = RegionInfo.RegionID;
3054 // TODO: The next line can be removed, as soon as only homeRegionID based UserServers are around.
3055 // TODO: The HomeRegion property can be removed then, too
3056 UserProfile.HomeRegion = RegionInfo.RegionHandle;
3057
3058 UserProfile.HomeLocation = position;
3059 UserProfile.HomeLookAt = lookAt;
3060 CommsManager.UserService.UpdateUserProfile(UserProfile);
3061
3062 // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot. 3140 // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot.
3063 m_dialogModule.SendAlertToUser(remoteClient, "Home position set."); 3141 m_dialogModule.SendAlertToUser(remoteClient, "Home position set.");
3064 }
3065 else 3142 else
3066 {
3067 m_dialogModule.SendAlertToUser(remoteClient, "Set Home request Failed."); 3143 m_dialogModule.SendAlertToUser(remoteClient, "Set Home request Failed.");
3068 }
3069 } 3144 }
3070 3145
3071 /// <summary> 3146 /// <summary>
@@ -3139,14 +3214,12 @@ namespace OpenSim.Region.Framework.Scenes
3139 m_sceneGraph.removeUserCount(!childagentYN); 3214 m_sceneGraph.removeUserCount(!childagentYN);
3140 CapsModule.RemoveCapsHandler(agentID); 3215 CapsModule.RemoveCapsHandler(agentID);
3141 3216
3142 if (avatar.Scene.NeedSceneCacheClear(avatar.UUID)) 3217 // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever
3143 { 3218 // this method is doing is HORRIBLE!!!
3144 CommsManager.UserProfileCacheService.RemoveUser(agentID); 3219 avatar.Scene.NeedSceneCacheClear(avatar.UUID);
3145 }
3146 3220
3147 if (!avatar.IsChildAgent) 3221 if (!avatar.IsChildAgent)
3148 { 3222 {
3149 m_sceneGridService.LogOffUser(agentID, RegionInfo.RegionID, RegionInfo.RegionHandle, avatar.AbsolutePosition, avatar.Lookat);
3150 //List<ulong> childknownRegions = new List<ulong>(); 3223 //List<ulong> childknownRegions = new List<ulong>();
3151 //List<ulong> ckn = avatar.KnownChildRegionHandles; 3224 //List<ulong> ckn = avatar.KnownChildRegionHandles;
3152 //for (int i = 0; i < ckn.Count; i++) 3225 //for (int i = 0; i < ckn.Count; i++)
@@ -3201,12 +3274,6 @@ namespace OpenSim.Region.Framework.Scenes
3201 m_log.Error("[SCENE] Scene.cs:RemoveClient exception: " + e.ToString()); 3274 m_log.Error("[SCENE] Scene.cs:RemoveClient exception: " + e.ToString());
3202 } 3275 }
3203 3276
3204 // Remove client agent from profile, so new logins will work
3205 if (!childagentYN)
3206 {
3207 m_sceneGridService.ClearUserAgent(agentID);
3208 }
3209
3210 m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode); 3277 m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode);
3211 3278
3212 //m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false)); 3279 //m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false));
@@ -3280,14 +3347,6 @@ namespace OpenSim.Region.Framework.Scenes
3280 m_sceneGridService.KiPrimitive += SendKillObject; 3347 m_sceneGridService.KiPrimitive += SendKillObject;
3281 m_sceneGridService.OnGetLandData += GetLandData; 3348 m_sceneGridService.OnGetLandData += GetLandData;
3282 3349
3283 if (m_interregionCommsIn != null)
3284 {
3285 m_log.Debug("[SCENE]: Registering with InterregionCommsIn");
3286 m_interregionCommsIn.OnChildAgentUpdate += IncomingChildAgentDataUpdate;
3287 }
3288 else
3289 m_log.Debug("[SCENE]: Unable to register with InterregionCommsIn");
3290
3291 } 3350 }
3292 3351
3293 /// <summary> 3352 /// <summary>
@@ -3305,9 +3364,6 @@ namespace OpenSim.Region.Framework.Scenes
3305 m_sceneGridService.OnCloseAgentConnection -= IncomingCloseAgent; 3364 m_sceneGridService.OnCloseAgentConnection -= IncomingCloseAgent;
3306 m_sceneGridService.OnGetLandData -= GetLandData; 3365 m_sceneGridService.OnGetLandData -= GetLandData;
3307 3366
3308 if (m_interregionCommsIn != null)
3309 m_interregionCommsIn.OnChildAgentUpdate -= IncomingChildAgentDataUpdate;
3310
3311 // this does nothing; should be removed 3367 // this does nothing; should be removed
3312 m_sceneGridService.Close(); 3368 m_sceneGridService.Close();
3313 3369
@@ -3461,18 +3517,6 @@ namespace OpenSim.Region.Framework.Scenes
3461 3517
3462 m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent); 3518 m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent);
3463 3519
3464 // rewrite session_id
3465 CachedUserInfo userinfo = CommsManager.UserProfileCacheService.GetUserDetails(agent.AgentID);
3466 if (userinfo != null)
3467 {
3468 userinfo.SessionID = agent.SessionID;
3469 }
3470 else
3471 {
3472 m_log.WarnFormat(
3473 "[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);
3474 }
3475
3476 return true; 3520 return true;
3477 } 3521 }
3478 3522
@@ -3487,10 +3531,18 @@ namespace OpenSim.Region.Framework.Scenes
3487 { 3531 {
3488 reason = String.Empty; 3532 reason = String.Empty;
3489 3533
3490 bool result = CommsManager.UserService.VerifySession(agent.AgentID, agent.SessionID); 3534 IAuthenticationService auth = RequestModuleInterface<IAuthenticationService>();
3491 m_log.Debug("[CONNECTION BEGIN]: User authentication returned " + result); 3535 if (auth == null)
3536 {
3537 reason = String.Format("Failed to authenticate user {0} {1} in region {2}. Authentication service does not exist.", agent.firstname, agent.lastname, RegionInfo.RegionName);
3538 return false;
3539 }
3540
3541 bool result = auth.Verify(agent.AgentID, agent.SecureSessionID.ToString(), 30);
3542
3543 m_log.Debug("[CONNECTION BEGIN]: Session authentication returned " + result);
3492 if (!result) 3544 if (!result)
3493 reason = String.Format("Failed to authenticate user {0} {1}, access denied.", agent.firstname, agent.lastname); 3545 reason = String.Format("Failed to authenticate user {0} {1}, access denied to region {2}.", agent.firstname, agent.lastname, RegionInfo.RegionName);
3494 3546
3495 return result; 3547 return result;
3496 } 3548 }
@@ -3693,8 +3745,8 @@ namespace OpenSim.Region.Framework.Scenes
3693 /// <returns>true if we handled it.</returns> 3745 /// <returns>true if we handled it.</returns>
3694 public virtual bool IncomingChildAgentDataUpdate(AgentData cAgentData) 3746 public virtual bool IncomingChildAgentDataUpdate(AgentData cAgentData)
3695 { 3747 {
3696// m_log.DebugFormat( 3748 m_log.DebugFormat(
3697// "[SCENE]: Incoming child agent update for {0} in {1}", cAgentData.AgentID, RegionInfo.RegionName); 3749 "[SCENE]: Incoming child agent update for {0} in {1}", cAgentData.AgentID, RegionInfo.RegionName);
3698 3750
3699 // We have to wait until the viewer contacts this region after receiving EAC. 3751 // We have to wait until the viewer contacts this region after receiving EAC.
3700 // That calls AddNewClient, which finally creates the ScenePresence 3752 // That calls AddNewClient, which finally creates the ScenePresence
@@ -3763,16 +3815,6 @@ namespace OpenSim.Region.Framework.Scenes
3763 return false; 3815 return false;
3764 } 3816 }
3765 3817
3766 public virtual bool IncomingReleaseAgent(UUID id)
3767 {
3768 return m_sceneGridService.ReleaseAgent(id);
3769 }
3770
3771 public void SendReleaseAgent(ulong regionHandle, UUID id, string uri)
3772 {
3773 m_interregionCommsOut.SendReleaseAgent(regionHandle, id, uri);
3774 }
3775
3776 /// <summary> 3818 /// <summary>
3777 /// Tell a single agent to disconnect from the region. 3819 /// Tell a single agent to disconnect from the region.
3778 /// </summary> 3820 /// </summary>
@@ -3817,30 +3859,6 @@ namespace OpenSim.Region.Framework.Scenes
3817 } 3859 }
3818 3860
3819 /// <summary> 3861 /// <summary>
3820 /// Tell neighboring regions about this agent
3821 /// When the regions respond with a true value,
3822 /// tell the agents about the region.
3823 ///
3824 /// We have to tell the regions about the agents first otherwise it'll deny them access
3825 ///
3826 /// </summary>
3827 /// <param name="presence"></param>
3828 public void InformClientOfNeighbours(ScenePresence presence)
3829 {
3830 m_sceneGridService.EnableNeighbourChildAgents(presence, m_neighbours);
3831 }
3832
3833 /// <summary>
3834 /// Tell a neighboring region about this agent
3835 /// </summary>
3836 /// <param name="presence"></param>
3837 /// <param name="region"></param>
3838 public void InformClientOfNeighbor(ScenePresence presence, RegionInfo region)
3839 {
3840 m_sceneGridService.EnableNeighbourChildAgents(presence, m_neighbours);
3841 }
3842
3843 /// <summary>
3844 /// Tries to teleport agent to other region. 3862 /// Tries to teleport agent to other region.
3845 /// </summary> 3863 /// </summary>
3846 /// <param name="remoteClient"></param> 3864 /// <param name="remoteClient"></param>
@@ -3915,16 +3933,12 @@ namespace OpenSim.Region.Framework.Scenes
3915 } 3933 }
3916 3934
3917 if (m_teleportModule != null) 3935 if (m_teleportModule != null)
3918 { 3936 m_teleportModule.Teleport(sp, regionHandle, position, lookAt, teleportFlags);
3919 m_teleportModule.RequestTeleportToLocation(sp, regionHandle,
3920 position, lookAt, teleportFlags);
3921 }
3922 else 3937 else
3923 { 3938 {
3924 m_sceneGridService.RequestTeleportToLocation(sp, regionHandle, 3939 m_log.DebugFormat("[SCENE]: Unable to perform teleports: no AgentTransferModule is active");
3925 position, lookAt, teleportFlags); 3940 sp.ControllingClient.SendTeleportFailed("Unable to perform teleports on this simulator.");
3926 } 3941 }
3927
3928 } 3942 }
3929 } 3943 }
3930 3944
@@ -3950,7 +3964,12 @@ namespace OpenSim.Region.Framework.Scenes
3950 3964
3951 public void CrossAgentToNewRegion(ScenePresence agent, bool isFlying) 3965 public void CrossAgentToNewRegion(ScenePresence agent, bool isFlying)
3952 { 3966 {
3953 m_sceneGridService.CrossAgentToNewRegion(this, agent, isFlying); 3967 if (m_teleportModule != null)
3968 m_teleportModule.Cross(agent, isFlying);
3969 else
3970 {
3971 m_log.DebugFormat("[SCENE]: Unable to cross agent to neighbouring region, because there is no AgentTransferModule");
3972 }
3954 } 3973 }
3955 3974
3956 public void SendOutChildAgentUpdates(AgentPosition cadu, ScenePresence presence) 3975 public void SendOutChildAgentUpdates(AgentPosition cadu, ScenePresence presence)
@@ -3976,35 +3995,6 @@ namespace OpenSim.Region.Framework.Scenes
3976 objectCapacity = objects; 3995 objectCapacity = objects;
3977 } 3996 }
3978 3997
3979 public List<FriendListItem> GetFriendList(string id)
3980 {
3981 UUID avatarID;
3982 if (!UUID.TryParse(id, out avatarID))
3983 return new List<FriendListItem>();
3984
3985 return CommsManager.GetUserFriendList(avatarID);
3986 }
3987
3988 public Dictionary<UUID, FriendRegionInfo> GetFriendRegionInfos(List<UUID> uuids)
3989 {
3990 return CommsManager.GetFriendRegionInfos(uuids);
3991 }
3992
3993 public virtual void StoreAddFriendship(UUID ownerID, UUID friendID, uint perms)
3994 {
3995 m_sceneGridService.AddNewUserFriend(ownerID, friendID, perms);
3996 }
3997
3998 public virtual void StoreUpdateFriendship(UUID ownerID, UUID friendID, uint perms)
3999 {
4000 m_sceneGridService.UpdateUserFriendPerms(ownerID, friendID, perms);
4001 }
4002
4003 public virtual void StoreRemoveFriendship(UUID ownerID, UUID ExfriendID)
4004 {
4005 m_sceneGridService.RemoveUserFriend(ownerID, ExfriendID);
4006 }
4007
4008 #endregion 3998 #endregion
4009 3999
4010 public void HandleObjectPermissionsUpdate(IClientAPI controller, UUID agentID, UUID sessionID, byte field, uint localId, uint mask, byte set) 4000 public void HandleObjectPermissionsUpdate(IClientAPI controller, UUID agentID, UUID sessionID, byte field, uint localId, uint mask, byte set)
@@ -4920,5 +4910,15 @@ namespace OpenSim.Region.Framework.Scenes
4920 if (Util.EnvironmentTickCountSubtract(m_lastUpdate) > 2000) 4910 if (Util.EnvironmentTickCountSubtract(m_lastUpdate) > 2000)
4921 StartTimer(); 4911 StartTimer();
4922 } 4912 }
4913
4914 public override ISceneObject DeserializeObject(string representation)
4915 {
4916 return SceneObjectSerializer.FromXml2Format(representation);
4917 }
4918
4919 public override bool AllowScriptCrossings
4920 {
4921 get { return m_allowScriptCrossings; }
4922 }
4923 } 4923 }
4924} 4924}