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.cs93
1 files changed, 69 insertions, 24 deletions
diff --git a/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs b/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs
index 0bf23f1..d3c46c9 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,12 +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
62 string permissionModules = Util.GetConfigVarFromSections<string>(config, "permissionmodules", 61 string permissionModules = Util.GetConfigVarFromSections<string>(config, "permissionmodules",
63 new string[] { "Startup", "Permissions" }, "DefaultPermissionsModule"); 62 new string[] { "Startup", "Permissions" }, "DefaultPermissionsModule");
64 63
65 List<string> modules=new List<string>(permissionModules.Split(',')); 64 List<string> modules = new List<string>(permissionModules.Split(',').Select(m => m.Trim()));
66 65
67 if(!modules.Contains("PrimLimitsModule")) 66 if(!modules.Contains("PrimLimitsModule"))
68 return; 67 return;
@@ -103,20 +102,34 @@ namespace OpenSim.Region.OptionalModules
103 public void RegionLoaded(Scene scene) 102 public void RegionLoaded(Scene scene)
104 { 103 {
105 m_dialogModule = scene.RequestModuleInterface<IDialogModule>(); 104 m_dialogModule = scene.RequestModuleInterface<IDialogModule>();
106 } 105 }
107 106
108 private bool CanRezObject(int objectCount, UUID owner, Vector3 objectPosition, Scene scene) 107 private bool CanRezObject(int objectCount, UUID ownerID, Vector3 objectPosition, Scene scene)
109 { 108 {
110 ILandObject lo = scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y); 109 ILandObject lo = scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y);
111 int usedPrims = lo.PrimCounts.Total;
112 int simulatorCapacity = lo.GetSimulatorMaxPrimCount();
113 110
114 if (objectCount + usedPrims > simulatorCapacity) 111 string response = DoCommonChecks(objectCount, ownerID, lo, scene);
112
113 if (response != null)
115 { 114 {
116 m_dialogModule.SendAlertToUser(owner, "Unable to rez object because the parcel is too full"); 115 m_dialogModule.SendAlertToUser(ownerID, response);
117 return false; 116 return false;
118 } 117 }
118 return true;
119 }
119 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 }
120 return true; 133 return true;
121 } 134 }
122 135
@@ -140,6 +153,14 @@ namespace OpenSim.Region.OptionalModules
140 153
141 ILandObject newParcel = scene.LandChannel.GetLandObject(newPoint.X, newPoint.Y); 154 ILandObject newParcel = scene.LandChannel.GetLandObject(newPoint.X, newPoint.Y);
142 155
156<<<<<<< HEAD
157 // newParcel will be null only if it outside of our current region. If this is the case, then the
158 // receiving permissions will perform the check.
159 if (newParcel == null)
160 return true;
161
162 // The prim hasn't crossed a region boundary so we don't need to worry
163=======
143 if (newParcel == null) 164 if (newParcel == null)
144 return true; 165 return true;
145 166
@@ -147,6 +168,7 @@ namespace OpenSim.Region.OptionalModules
147 ILandObject oldParcel = scene.LandChannel.GetLandObject(oldPoint.X, oldPoint.Y); 168 ILandObject oldParcel = scene.LandChannel.GetLandObject(oldPoint.X, oldPoint.Y);
148 169
149 // The prim hasn't crossed a region boundry so we don't need to worry 170 // The prim hasn't crossed a region boundry so we don't need to worry
171>>>>>>> avn/ubitvar
150 // about prim counts here 172 // about prim counts here
151 if(oldParcel != null && oldParcel.Equals(newParcel)) 173 if(oldParcel != null && oldParcel.Equals(newParcel))
152 { 174 {
@@ -158,30 +180,53 @@ namespace OpenSim.Region.OptionalModules
158 int simulatorCapacity = newParcel.GetSimulatorMaxPrimCount(); 180 int simulatorCapacity = newParcel.GetSimulatorMaxPrimCount();
159 181
160 // TODO: Add Special Case here for temporary prims 182 // TODO: Add Special Case here for temporary prims
161 183
162 if(objectCount + usedPrims > simulatorCapacity) 184 string response = DoCommonChecks(objectCount, obj.OwnerID, newParcel, scene);
185
186 if (response != null)
163 { 187 {
164 m_dialogModule.SendAlertToUser(obj.OwnerID, "Unable to move object because the destination parcel is too full"); 188 m_dialogModule.SendAlertToUser(obj.OwnerID, response);
165 return false; 189 return false;
166 } 190 }
167
168 return true; 191 return true;
169 } 192 }
170 193
171 //OnDuplicateObject 194 private string DoCommonChecks(int objectCount, UUID ownerID, ILandObject lo, Scene scene)
172 private bool CanDuplicateObject(int objectCount, UUID objectID, UUID owner, Scene scene, Vector3 objectPosition)
173 { 195 {
174 ILandObject lo = scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y); 196 string response = null;
175 int usedPrims = lo.PrimCounts.Total;
176 int simulatorCapacity = lo.GetSimulatorMaxPrimCount();
177 197
178 if(objectCount + usedPrims > simulatorCapacity) 198 int simulatorCapacity = lo.GetSimulatorMaxPrimCount();
199 if ((objectCount + lo.PrimCounts.Total) > simulatorCapacity)
179 { 200 {
180 m_dialogModule.SendAlertToUser(owner, "Unable to duplicate object because the parcel is too full"); 201 response = "Unable to rez object because the parcel is too full";
181 return false;
182 } 202 }
183 203 else
184 return true; 204 {
205 int maxPrimsPerUser = scene.RegionInfo.MaxPrimsPerUser;
206 if (maxPrimsPerUser >= 0)
207 {
208 // per-user prim limit is set
209 if (ownerID != lo.LandData.OwnerID || lo.LandData.IsGroupOwned)
210 {
211 // caller is not the sole Parcel owner
212 EstateSettings estateSettings = scene.RegionInfo.EstateSettings;
213 if (ownerID != estateSettings.EstateOwner)
214 {
215 // caller is NOT the Estate owner
216 List<UUID> mgrs = new List<UUID>(estateSettings.EstateManagers);
217 if (!mgrs.Contains(ownerID))
218 {
219 // caller is not an Estate Manager
220 if ((lo.PrimCounts.Users[ownerID] + objectCount) > maxPrimsPerUser)
221 {
222 response = "Unable to rez object because you have reached your limit";
223 }
224 }
225 }
226 }
227 }
228 }
229 return response;
185 } 230 }
186 } 231 }
187} 232}