diff options
author | Justin Clarke Casey | 2009-03-30 18:20:41 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2009-03-30 18:20:41 +0000 |
commit | ac8fc02afc695cfefdcc668cdd4ef0c9e1788b82 (patch) | |
tree | 1512ad29316f73d6bf88a830ffbfac9cb61ad100 /OpenSim/Region/Framework/Scenes | |
parent | Sigh. Manual data typing grief. (diff) | |
download | opensim-SC_OLD-ac8fc02afc695cfefdcc668cdd4ef0c9e1788b82.zip opensim-SC_OLD-ac8fc02afc695cfefdcc668cdd4ef0c9e1788b82.tar.gz opensim-SC_OLD-ac8fc02afc695cfefdcc668cdd4ef0c9e1788b82.tar.bz2 opensim-SC_OLD-ac8fc02afc695cfefdcc668cdd4ef0c9e1788b82.tar.xz |
* refactor: Move god related methods in Scene out to a module
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 127 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneGraph.cs | 2 |
2 files changed, 10 insertions, 119 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 2687422..c9e13ac 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -1931,9 +1931,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1931 | client.OnObjectDuplicate += m_sceneGraph.DuplicateObject; | 1931 | client.OnObjectDuplicate += m_sceneGraph.DuplicateObject; |
1932 | client.OnObjectDuplicateOnRay += doObjectDuplicateOnRay; | 1932 | client.OnObjectDuplicateOnRay += doObjectDuplicateOnRay; |
1933 | client.OnUpdatePrimFlags += m_sceneGraph.UpdatePrimFlags; | 1933 | client.OnUpdatePrimFlags += m_sceneGraph.UpdatePrimFlags; |
1934 | client.OnRequestObjectPropertiesFamily += m_sceneGraph.RequestObjectPropertiesFamily; | 1934 | client.OnRequestObjectPropertiesFamily += m_sceneGraph.RequestObjectPropertiesFamily; |
1935 | client.OnRequestGodlikePowers += handleRequestGodlikePowers; | ||
1936 | client.OnGodKickUser += HandleGodlikeKickUser; | ||
1937 | client.OnObjectPermissions += HandleObjectPermissionsUpdate; | 1935 | client.OnObjectPermissions += HandleObjectPermissionsUpdate; |
1938 | client.OnCreateNewInventoryItem += CreateNewInventoryItem; | 1936 | client.OnCreateNewInventoryItem += CreateNewInventoryItem; |
1939 | client.OnCreateNewInventoryFolder += HandleCreateInventoryFolder; | 1937 | client.OnCreateNewInventoryFolder += HandleCreateInventoryFolder; |
@@ -1970,9 +1968,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1970 | client.OnSetScriptRunning += SetScriptRunning; | 1968 | client.OnSetScriptRunning += SetScriptRunning; |
1971 | client.OnRegionHandleRequest += RegionHandleRequest; | 1969 | client.OnRegionHandleRequest += RegionHandleRequest; |
1972 | client.OnUnackedTerrain += TerrainUnAcked; | 1970 | client.OnUnackedTerrain += TerrainUnAcked; |
1973 | |||
1974 | client.OnObjectOwner += ObjectOwner; | 1971 | client.OnObjectOwner += ObjectOwner; |
1975 | 1972 | ||
1973 | IGodsModule godsModule = RequestModuleInterface<IGodsModule>(); | ||
1974 | client.OnGodKickUser += godsModule.KickUser; | ||
1975 | client.OnRequestGodlikePowers += godsModule.RequestGodlikePowers; | ||
1976 | |||
1976 | if (StatsReporter != null) | 1977 | if (StatsReporter != null) |
1977 | client.OnNetworkStatsUpdate += StatsReporter.AddPacketsFromClientStats; | 1978 | client.OnNetworkStatsUpdate += StatsReporter.AddPacketsFromClientStats; |
1978 | 1979 | ||
@@ -2658,7 +2659,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2658 | /// <param name="maxY"></param> | 2659 | /// <param name="maxY"></param> |
2659 | public void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY) | 2660 | public void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY) |
2660 | { | 2661 | { |
2661 | m_log.InfoFormat("[MAPBLOCK]: {0}-{1}, {2}-{3}", minX, minY, maxX, maxY); | 2662 | m_log.DebugFormat("[MAPBLOCK]: {0}-{1}, {2}-{3}", minX, minY, maxX, maxY); |
2662 | m_sceneGridService.RequestMapBlocks(remoteClient, minX, minY, maxX, maxY); | 2663 | m_sceneGridService.RequestMapBlocks(remoteClient, minX, minY, maxX, maxY); |
2663 | } | 2664 | } |
2664 | 2665 | ||
@@ -2817,116 +2818,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2817 | 2818 | ||
2818 | #endregion | 2819 | #endregion |
2819 | 2820 | ||
2820 | #region Alert Methods | ||
2821 | |||
2822 | /// <summary> | ||
2823 | /// Handle a request for admin rights | ||
2824 | /// </summary> | ||
2825 | /// <param name="agentID"></param> | ||
2826 | /// <param name="sessionID"></param> | ||
2827 | /// <param name="token"></param> | ||
2828 | /// <param name="controllingClient"></param> | ||
2829 | public void handleRequestGodlikePowers(UUID agentID, UUID sessionID, UUID token, bool godLike, | ||
2830 | IClientAPI controllingClient) | ||
2831 | { | ||
2832 | ScenePresence sp = null; | ||
2833 | |||
2834 | lock (m_scenePresences) | ||
2835 | { | ||
2836 | // User needs to be logged into this sim | ||
2837 | m_scenePresences.TryGetValue(agentID, out sp); | ||
2838 | } | ||
2839 | |||
2840 | if (sp != null) | ||
2841 | { | ||
2842 | if (godLike == false) | ||
2843 | { | ||
2844 | sp.GrantGodlikePowers(agentID, sessionID, token, godLike); | ||
2845 | return; | ||
2846 | } | ||
2847 | |||
2848 | // First check that this is the sim owner | ||
2849 | if (Permissions.IsGod(agentID)) | ||
2850 | { | ||
2851 | // Next we check for spoofing..... | ||
2852 | UUID testSessionID = sp.ControllingClient.SessionId; | ||
2853 | if (sessionID == testSessionID) | ||
2854 | { | ||
2855 | if (sessionID == controllingClient.SessionId) | ||
2856 | { | ||
2857 | //m_log.Info("godlike: " + godLike.ToString()); | ||
2858 | sp.GrantGodlikePowers(agentID, testSessionID, token, godLike); | ||
2859 | } | ||
2860 | } | ||
2861 | } | ||
2862 | else | ||
2863 | { | ||
2864 | m_dialogModule.SendAlertToUser(agentID, "Request for god powers denied"); | ||
2865 | } | ||
2866 | } | ||
2867 | } | ||
2868 | |||
2869 | /// <summary> | ||
2870 | /// Kicks User specified from the simulator. This logs them off of the grid | ||
2871 | /// If the client gets the UUID: 44e87126e7944ded05b37c42da3d5cdb it assumes | ||
2872 | /// that you're kicking it even if the avatar's UUID isn't the UUID that the | ||
2873 | /// agent is assigned | ||
2874 | /// </summary> | ||
2875 | /// <param name="godID">The person doing the kicking</param> | ||
2876 | /// <param name="sessionID">The session of the person doing the kicking</param> | ||
2877 | /// <param name="agentID">the person that is being kicked</param> | ||
2878 | /// <param name="kickflags">This isn't used apparently</param> | ||
2879 | /// <param name="reason">The message to send to the user after it's been turned into a field</param> | ||
2880 | public void HandleGodlikeKickUser(UUID godID, UUID sessionID, UUID agentID, uint kickflags, byte[] reason) | ||
2881 | { | ||
2882 | // For some reason the client sends this seemingly hard coded UUID for kicking everyone. Dun-know. | ||
2883 | UUID kickUserID = new UUID("44e87126e7944ded05b37c42da3d5cdb"); | ||
2884 | lock (m_scenePresences) | ||
2885 | { | ||
2886 | if (m_scenePresences.ContainsKey(agentID) || agentID == kickUserID) | ||
2887 | { | ||
2888 | if (Permissions.IsGod(godID)) | ||
2889 | { | ||
2890 | if (agentID == kickUserID) | ||
2891 | { | ||
2892 | ClientManager.ForEachClient(delegate(IClientAPI controller) | ||
2893 | { | ||
2894 | if (controller.AgentId != godID) | ||
2895 | controller.Kick(Utils.BytesToString(reason)); | ||
2896 | } | ||
2897 | ); | ||
2898 | |||
2899 | // This is a bit crude. It seems the client will be null before it actually stops the thread | ||
2900 | // The thread will kill itself eventually :/ | ||
2901 | // Is there another way to make sure *all* clients get this 'inter region' message? | ||
2902 | ClientManager.ForEachClient(delegate(IClientAPI controller) | ||
2903 | { | ||
2904 | ScenePresence p = GetScenePresence(controller.AgentId); | ||
2905 | bool childagent = p != null && p.IsChildAgent; | ||
2906 | if (controller.AgentId != godID && !childagent) | ||
2907 | // Do we really want to kick the initiator of this madness? | ||
2908 | { | ||
2909 | controller.Close(true); | ||
2910 | } | ||
2911 | } | ||
2912 | ); | ||
2913 | } | ||
2914 | else | ||
2915 | { | ||
2916 | m_sceneGraph.removeUserCount(!m_scenePresences[agentID].IsChildAgent); | ||
2917 | |||
2918 | m_scenePresences[agentID].ControllingClient.Kick(Utils.BytesToString(reason)); | ||
2919 | m_scenePresences[agentID].ControllingClient.Close(true); | ||
2920 | } | ||
2921 | } | ||
2922 | else | ||
2923 | { | ||
2924 | m_dialogModule.SendAlertToUser(godID, "Kick request denied"); | ||
2925 | } | ||
2926 | } | ||
2927 | } | ||
2928 | } | ||
2929 | |||
2930 | public void HandleObjectPermissionsUpdate(IClientAPI controller, UUID agentID, UUID sessionID, byte field, uint localId, uint mask, byte set) | 2821 | public void HandleObjectPermissionsUpdate(IClientAPI controller, UUID agentID, UUID sessionID, byte field, uint localId, uint mask, byte set) |
2931 | { | 2822 | { |
2932 | // Check for spoofing.. since this is permissions we're talking about here! | 2823 | // Check for spoofing.. since this is permissions we're talking about here! |
@@ -2944,8 +2835,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2944 | } | 2835 | } |
2945 | } | 2836 | } |
2946 | 2837 | ||
2947 | #endregion | ||
2948 | |||
2949 | /// <summary> | 2838 | /// <summary> |
2950 | /// Causes all clients to get a full object update on all of the objects in the scene. | 2839 | /// Causes all clients to get a full object update on all of the objects in the scene. |
2951 | /// </summary> | 2840 | /// </summary> |
@@ -3077,7 +2966,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3077 | } | 2966 | } |
3078 | else if ((parcel.landData.Flags & (uint)Parcel.ParcelFlags.AllowGroupScripts) != 0) | 2967 | else if ((parcel.landData.Flags & (uint)Parcel.ParcelFlags.AllowGroupScripts) != 0) |
3079 | { | 2968 | { |
3080 | if (part.OwnerID == parcel.landData.OwnerID || (parcel.landData.IsGroupOwned && part.GroupID == parcel.landData.GroupID) || Permissions.IsGod(part.OwnerID)) | 2969 | if (part.OwnerID == parcel.landData.OwnerID |
2970 | || (parcel.landData.IsGroupOwned && part.GroupID == parcel.landData.GroupID) | ||
2971 | || Permissions.IsGod(part.OwnerID)) | ||
3081 | { | 2972 | { |
3082 | return true; | 2973 | return true; |
3083 | } | 2974 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 69f5205..d6aca31 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -696,7 +696,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
696 | } | 696 | } |
697 | } | 697 | } |
698 | 698 | ||
699 | protected internal void removeUserCount(bool TypeRCTF) | 699 | public void removeUserCount(bool TypeRCTF) |
700 | { | 700 | { |
701 | if (TypeRCTF) | 701 | if (TypeRCTF) |
702 | { | 702 | { |