aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/PrimLimitsModule
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/OptionalModules/PrimLimitsModule')
-rw-r--r--OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs99
1 files changed, 69 insertions, 30 deletions
diff --git a/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs b/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs
index c1957e2..395bbf1 100644
--- a/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs
+++ b/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs
@@ -26,8 +26,9 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Reflection;
30using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Linq;
31using System.Reflection;
31using log4net; 32using log4net;
32using Mono.Addins; 33using Mono.Addins;
33using Nini.Config; 34using Nini.Config;
@@ -57,11 +58,10 @@ namespace OpenSim.Region.OptionalModules
57 58
58 public void Initialise(IConfigSource config) 59 public void Initialise(IConfigSource config)
59 { 60 {
60 IConfig myConfig = config.Configs["Startup"]; 61 string permissionModules = Util.GetConfigVarFromSections<string>(config, "permissionmodules",
62 new string[] { "Startup", "Permissions" }, "DefaultPermissionsModule");
61 63
62 string permissionModules = myConfig.GetString("permissionmodules", "DefaultPermissionsModule"); 64 List<string> modules = new List<string>(permissionModules.Split(',').Select(m => m.Trim()));
63
64 List<string> modules=new List<string>(permissionModules.Split(','));
65 65
66 if(!modules.Contains("PrimLimitsModule")) 66 if(!modules.Contains("PrimLimitsModule"))
67 return; 67 return;
@@ -102,20 +102,34 @@ namespace OpenSim.Region.OptionalModules
102 public void RegionLoaded(Scene scene) 102 public void RegionLoaded(Scene scene)
103 { 103 {
104 m_dialogModule = scene.RequestModuleInterface<IDialogModule>(); 104 m_dialogModule = scene.RequestModuleInterface<IDialogModule>();
105 } 105 }
106 106
107 private bool CanRezObject(int objectCount, UUID owner, Vector3 objectPosition, Scene scene) 107 private bool CanRezObject(int objectCount, UUID ownerID, Vector3 objectPosition, Scene scene)
108 { 108 {
109 ILandObject lo = scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y); 109 ILandObject lo = scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y);
110 int usedPrims = lo.PrimCounts.Total;
111 int simulatorCapacity = lo.GetSimulatorMaxPrimCount();
112 110
113 if (objectCount + usedPrims > simulatorCapacity) 111 string response = DoCommonChecks(objectCount, ownerID, lo, scene);
112
113 if (response != null)
114 { 114 {
115 m_dialogModule.SendAlertToUser(owner, "Unable to rez object because the parcel is too full"); 115 m_dialogModule.SendAlertToUser(ownerID, response);
116 return false; 116 return false;
117 } 117 }
118 return true;
119 }
118 120
121 //OnDuplicateObject
122 private bool CanDuplicateObject(int objectCount, UUID objectID, UUID ownerID, Scene scene, Vector3 objectPosition)
123 {
124 ILandObject lo = scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y);
125
126 string response = DoCommonChecks(objectCount, ownerID, lo, scene);
127
128 if (response != null)
129 {
130 m_dialogModule.SendAlertToUser(ownerID, response);
131 return false;
132 }
119 return true; 133 return true;
120 } 134 }
121 135
@@ -127,10 +141,12 @@ namespace OpenSim.Region.OptionalModules
127 ILandObject oldParcel = scene.LandChannel.GetLandObject(oldPoint.X, oldPoint.Y); 141 ILandObject oldParcel = scene.LandChannel.GetLandObject(oldPoint.X, oldPoint.Y);
128 ILandObject newParcel = scene.LandChannel.GetLandObject(newPoint.X, newPoint.Y); 142 ILandObject newParcel = scene.LandChannel.GetLandObject(newPoint.X, newPoint.Y);
129 143
130 int usedPrims = newParcel.PrimCounts.Total; 144 // newParcel will be null only if it outside of our current region. If this is the case, then the
131 int simulatorCapacity = newParcel.GetSimulatorMaxPrimCount(); 145 // receiving permissions will perform the check.
132 146 if (newParcel == null)
133 // The prim hasn't crossed a region boundry so we don't need to worry 147 return true;
148
149 // The prim hasn't crossed a region boundary so we don't need to worry
134 // about prim counts here 150 // about prim counts here
135 if(oldParcel.Equals(newParcel)) 151 if(oldParcel.Equals(newParcel))
136 { 152 {
@@ -145,30 +161,53 @@ namespace OpenSim.Region.OptionalModules
145 } 161 }
146 162
147 // TODO: Add Special Case here for temporary prims 163 // TODO: Add Special Case here for temporary prims
148 164
149 if(objectCount + usedPrims > simulatorCapacity) 165 string response = DoCommonChecks(objectCount, obj.OwnerID, newParcel, scene);
166
167 if (response != null)
150 { 168 {
151 m_dialogModule.SendAlertToUser(obj.OwnerID, "Unable to move object because the destination parcel is too full"); 169 m_dialogModule.SendAlertToUser(obj.OwnerID, response);
152 return false; 170 return false;
153 } 171 }
154
155 return true; 172 return true;
156 } 173 }
157 174
158 //OnDuplicateObject 175 private string DoCommonChecks(int objectCount, UUID ownerID, ILandObject lo, Scene scene)
159 private bool CanDuplicateObject(int objectCount, UUID objectID, UUID owner, Scene scene, Vector3 objectPosition)
160 { 176 {
161 ILandObject lo = scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y); 177 string response = null;
162 int usedPrims = lo.PrimCounts.Total;
163 int simulatorCapacity = lo.GetSimulatorMaxPrimCount();
164 178
165 if(objectCount + usedPrims > simulatorCapacity) 179 int simulatorCapacity = lo.GetSimulatorMaxPrimCount();
180 if ((objectCount + lo.PrimCounts.Total) > simulatorCapacity)
166 { 181 {
167 m_dialogModule.SendAlertToUser(owner, "Unable to duplicate object because the parcel is too full"); 182 response = "Unable to rez object because the parcel is too full";
168 return false;
169 } 183 }
170 184 else
171 return true; 185 {
186 int maxPrimsPerUser = scene.RegionInfo.MaxPrimsPerUser;
187 if (maxPrimsPerUser >= 0)
188 {
189 // per-user prim limit is set
190 if (ownerID != lo.LandData.OwnerID || lo.LandData.IsGroupOwned)
191 {
192 // caller is not the sole Parcel owner
193 EstateSettings estateSettings = scene.RegionInfo.EstateSettings;
194 if (ownerID != estateSettings.EstateOwner)
195 {
196 // caller is NOT the Estate owner
197 List<UUID> mgrs = new List<UUID>(estateSettings.EstateManagers);
198 if (!mgrs.Contains(ownerID))
199 {
200 // caller is not an Estate Manager
201 if ((lo.PrimCounts.Users[ownerID] + objectCount) > maxPrimsPerUser)
202 {
203 response = "Unable to rez object because you have reached your limit";
204 }
205 }
206 }
207 }
208 }
209 }
210 return response;
172 } 211 }
173 } 212 }
174} \ No newline at end of file 213}