aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs84
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Permissions.cs1143
2 files changed, 395 insertions, 832 deletions
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index 7b4a571..25bfd7d 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -122,51 +122,51 @@ namespace OpenSim.Region.CoreModules.World.Permissions
122 m_log.Debug("[PERMISSIONS]: Enabling all region service permission checks"); 122 m_log.Debug("[PERMISSIONS]: Enabling all region service permission checks");
123 123
124 //Register functions with Scene External Checks! 124 //Register functions with Scene External Checks!
125 m_scene.Permissions.AddBypassPermissionsHandler(BypassPermissions); //FULLY IMPLEMENTED 125 m_scene.Permissions.OnBypassPermissions += BypassPermissions;
126 m_scene.Permissions.AddSetBypassPermissionsHandler(SetBypassPermissions); //FULLY IMPLEMENTED 126 m_scene.Permissions.OnSetBypassPermissions += SetBypassPermissions;
127 m_scene.Permissions.AddPropagatePermissionsHandler(PropagatePermissions); //FULLY IMPLEMENTED 127 m_scene.Permissions.OnPropagatePermissions += PropagatePermissions;
128 m_scene.Permissions.AddGenerateClientFlagsHandler(GenerateClientFlags); //NOT YET FULLY IMPLEMENTED 128 m_scene.Permissions.OnGenerateClientFlags += GenerateClientFlags;
129 m_scene.Permissions.AddAbandonParcelHandler(CanAbandonParcel); //FULLY IMPLEMENTED 129 m_scene.Permissions.OnAbandonParcel += CanAbandonParcel;
130 m_scene.Permissions.AddReclaimParcelHandler(CanReclaimParcel); //FULLY IMPLEMENTED 130 m_scene.Permissions.OnReclaimParcel += CanReclaimParcel;
131 m_scene.Permissions.AddIsGodHandler(IsGod); //FULLY IMPLEMENTED 131 m_scene.Permissions.OnIsGod += IsGod;
132 m_scene.Permissions.AddDuplicateObjectHandler(CanDuplicateObject); //FULLY IMPLEMENTED 132 m_scene.Permissions.OnDuplicateObject += CanDuplicateObject;
133 m_scene.Permissions.AddDeleteObjectHandler(CanDeleteObject); //MAYBE FULLY IMPLEMENTED 133 m_scene.Permissions.OnDeleteObject += CanDeleteObject; //MAYBE FULLY IMPLEMENTED
134 m_scene.Permissions.AddEditObjectHandler(CanEditObject);//MAYBE FULLY IMPLEMENTED 134 m_scene.Permissions.OnEditObject += CanEditObject; //MAYBE FULLY IMPLEMENTED
135 m_scene.Permissions.AddEditParcelHandler(CanEditParcel); //FULLY IMPLEMENTED 135 m_scene.Permissions.OnEditParcel += CanEditParcel; //MAYBE FULLY IMPLEMENTED
136 m_scene.Permissions.AddInstantMessageHandler(CanInstantMessage); //FULLY IMPLEMENTED 136 m_scene.Permissions.OnInstantMessage += CanInstantMessage;
137 m_scene.Permissions.AddInventoryTransferHandler(CanInventoryTransfer); //NOT YET IMPLEMENTED 137 m_scene.Permissions.OnInventoryTransfer += CanInventoryTransfer; //NOT YET IMPLEMENTED
138 m_scene.Permissions.AddIssueEstateCommandHandler(CanIssueEstateCommand); //FULLY IMPLEMENTED 138 m_scene.Permissions.OnIssueEstateCommand += CanIssueEstateCommand; //FULLY IMPLEMENTED
139 m_scene.Permissions.AddMoveObjectHandler(CanMoveObject); //HOPEFULLY FULLY IMPLEMENTED 139 m_scene.Permissions.OnMoveObject += CanMoveObject; //MAYBE FULLY IMPLEMENTED
140 m_scene.Permissions.AddObjectEntryHandler(CanObjectEntry); //FULLY IMPLEMENTED 140 m_scene.Permissions.OnObjectEntry += CanObjectEntry;
141 m_scene.Permissions.AddReturnObjectHandler(CanReturnObject); //NOT YET IMPLEMENTED 141 m_scene.Permissions.OnReturnObject += CanReturnObject; //NOT YET IMPLEMENTED
142 m_scene.Permissions.AddRezObjectHandler(CanRezObject); //HOPEFULLY FULLY IMPLEMENTED 142 m_scene.Permissions.OnRezObject += CanRezObject; //MAYBE FULLY IMPLEMENTED
143 m_scene.Permissions.AddRunConsoleCommandHandler(CanRunConsoleCommand); //FULLY IMPLEMENTED 143 m_scene.Permissions.OnRunConsoleCommand += CanRunConsoleCommand;
144 m_scene.Permissions.AddRunScriptHandler(CanRunScript); //NOT YET IMPLEMENTED 144 m_scene.Permissions.OnRunScript += CanRunScript; //NOT YET IMPLEMENTED
145 m_scene.Permissions.AddSellParcelHandler(CanSellParcel); //FULLY IMPLEMENTED 145 m_scene.Permissions.OnSellParcel += CanSellParcel;
146 m_scene.Permissions.AddTakeObjectHandler(CanTakeObject); //FULLY IMPLEMENTED 146 m_scene.Permissions.OnTakeObject += CanTakeObject;
147 m_scene.Permissions.AddTakeCopyObjectHandler(CanTakeCopyObject); //FULLY IMPLEMENTED 147 m_scene.Permissions.OnTakeCopyObject += CanTakeCopyObject;
148 m_scene.Permissions.AddTerraformLandHandler(CanTerraformLand); //FULL IMPLEMENTED (POINT ONLY!!! NOT AREA!!!) 148 m_scene.Permissions.OnTerraformLand += CanTerraformLand;
149 m_scene.Permissions.AddCanLinkObjectHandler(CanLinkObject); //NOT YET IMPLEMENTED 149 m_scene.Permissions.OnLinkObject += CanLinkObject; //NOT YET IMPLEMENTED
150 m_scene.Permissions.AddCanDelinkObjectHandler(CanDelinkObject); //NOT YET IMPLEMENTED 150 m_scene.Permissions.OnDelinkObject += CanDelinkObject; //NOT YET IMPLEMENTED
151 m_scene.Permissions.AddCanBuyLandHandler(CanBuyLand); //NOT YET IMPLEMENTED 151 m_scene.Permissions.OnBuyLand += CanBuyLand; //NOT YET IMPLEMENTED
152 152
153 m_scene.Permissions.AddViewNotecardHandler(CanViewNotecard); //NOT YET IMPLEMENTED 153 m_scene.Permissions.OnViewNotecard += CanViewNotecard; //NOT YET IMPLEMENTED
154 m_scene.Permissions.AddViewScriptHandler(CanViewScript); //NOT YET IMPLEMENTED 154 m_scene.Permissions.OnViewScript += CanViewScript; //NOT YET IMPLEMENTED
155 m_scene.Permissions.AddEditNotecardHandler(CanEditNotecard); //NOT YET IMPLEMENTED 155 m_scene.Permissions.OnEditNotecard += CanEditNotecard; //NOT YET IMPLEMENTED
156 m_scene.Permissions.AddEditScriptHandler(CanEditScript); //NOT YET IMPLEMENTED 156 m_scene.Permissions.OnEditScript += CanEditScript; //NOT YET IMPLEMENTED
157 157
158 m_scene.Permissions.AddCanCreateObjectInventoryHandler(CanCreateObjectInventory); //NOT IMPLEMENTED HERE 158 m_scene.Permissions.OnCreateObjectInventory += CanCreateObjectInventory; //NOT IMPLEMENTED HERE
159 m_scene.Permissions.AddEditObjectInventoryHandler(CanEditObjectInventory);//MAYBE FULLY IMPLEMENTED 159 m_scene.Permissions.OnEditObjectInventory += CanEditObjectInventory;//MAYBE FULLY IMPLEMENTED
160 m_scene.Permissions.AddCanCopyObjectInventoryHandler(CanCopyObjectInventory); //NOT YET IMPLEMENTED 160 m_scene.Permissions.OnCopyObjectInventory += CanCopyObjectInventory; //NOT YET IMPLEMENTED
161 m_scene.Permissions.AddCanDeleteObjectInventoryHandler(CanDeleteObjectInventory); //NOT YET IMPLEMENTED 161 m_scene.Permissions.OnDeleteObjectInventory += CanDeleteObjectInventory; //NOT YET IMPLEMENTED
162 m_scene.Permissions.AddResetScriptHandler(CanResetScript); 162 m_scene.Permissions.OnResetScript += CanResetScript;
163 163
164 m_scene.Permissions.AddCanCreateUserInventoryHandler(CanCreateUserInventory); //NOT YET IMPLEMENTED 164 m_scene.Permissions.OnCreateUserInventory += CanCreateUserInventory; //NOT YET IMPLEMENTED
165 m_scene.Permissions.AddCanCopyUserInventoryHandler(CanCopyUserInventory); //NOT YET IMPLEMENTED 165 m_scene.Permissions.OnCopyUserInventory += CanCopyUserInventory; //NOT YET IMPLEMENTED
166 m_scene.Permissions.AddCanEditUserInventoryHandler(CanEditUserInventory); //NOT YET IMPLEMENTED 166 m_scene.Permissions.OnEditUserInventory += CanEditUserInventory; //NOT YET IMPLEMENTED
167 m_scene.Permissions.AddCanDeleteUserInventoryHandler(CanDeleteUserInventory); //NOT YET IMPLEMENTED 167 m_scene.Permissions.OnDeleteUserInventory += CanDeleteUserInventory; //NOT YET IMPLEMENTED
168 168
169 m_scene.Permissions.AddCanTeleportHandler(CanTeleport); //NOT YET IMPLEMENTED 169 m_scene.Permissions.OnTeleport += CanTeleport; //NOT YET IMPLEMENTED
170 170
171 m_scene.AddCommand(this, "bypass permissions", 171 m_scene.AddCommand(this, "bypass permissions",
172 "bypass permissions <true / false>", 172 "bypass permissions <true / false>",
@@ -1469,7 +1469,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1469 return true; 1469 return true;
1470 } 1470 }
1471 1471
1472 private bool CanTeleport(UUID userID) 1472 private bool CanTeleport(UUID userID, Scene scene)
1473 { 1473 {
1474 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 1474 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1475 if (m_bypassPermissions) return m_bypassPermissionsValue; 1475 if (m_bypassPermissions) return m_bypassPermissionsValue;
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
index 6aa617f..985179c 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
@@ -34,6 +34,52 @@ using OpenSim.Region.Framework.Interfaces;
34 34
35namespace OpenSim.Region.Framework.Scenes 35namespace OpenSim.Region.Framework.Scenes
36{ 36{
37 #region Delegates
38 public delegate uint GenerateClientFlagsHandler(UUID userID, UUID objectIDID);
39 public delegate void SetBypassPermissionsHandler(bool value);
40 public delegate bool BypassPermissionsHandler();
41 public delegate bool PropagatePermissionsHandler();
42 public delegate bool RezObjectHandler(int objectCount, UUID owner, Vector3 objectPosition, Scene scene);
43 public delegate bool DeleteObjectHandler(UUID objectID, UUID deleter, Scene scene);
44 public delegate bool TakeObjectHandler(UUID objectID, UUID stealer, Scene scene);
45 public delegate bool TakeCopyObjectHandler(UUID objectID, UUID userID, Scene inScene);
46 public delegate bool DuplicateObjectHandler(int objectCount, UUID objectID, UUID owner, Scene scene, Vector3 objectPosition);
47 public delegate bool EditObjectHandler(UUID objectID, UUID editorID, Scene scene);
48 public delegate bool EditObjectInventoryHandler(UUID objectID, UUID editorID, Scene scene);
49 public delegate bool MoveObjectHandler(UUID objectID, UUID moverID, Scene scene);
50 public delegate bool ObjectEntryHandler(UUID objectID, bool enteringRegion, Vector3 newPoint, Scene scene);
51 public delegate bool ReturnObjectHandler(UUID objectID, UUID returnerID, Scene scene);
52 public delegate bool InstantMessageHandler(UUID user, UUID target, Scene startScene);
53 public delegate bool InventoryTransferHandler(UUID user, UUID target, Scene startScene);
54 public delegate bool ViewScriptHandler(UUID script, UUID objectID, UUID user, Scene scene);
55 public delegate bool ViewNotecardHandler(UUID script, UUID objectID, UUID user, Scene scene);
56 public delegate bool EditScriptHandler(UUID script, UUID objectID, UUID user, Scene scene);
57 public delegate bool EditNotecardHandler(UUID notecard, UUID objectID, UUID user, Scene scene);
58 public delegate bool RunScriptHandler(UUID script, UUID objectID, UUID user, Scene scene);
59 public delegate bool StartScriptHandler(UUID script, UUID user, Scene scene);
60 public delegate bool StopScriptHandler(UUID script, UUID user, Scene scene);
61 public delegate bool ResetScriptHandler(UUID prim, UUID script, UUID user, Scene scene);
62 public delegate bool TerraformLandHandler(UUID user, Vector3 position, Scene requestFromScene);
63 public delegate bool RunConsoleCommandHandler(UUID user, Scene requestFromScene);
64 public delegate bool IssueEstateCommandHandler(UUID user, Scene requestFromScene, bool ownerCommand);
65 public delegate bool IsGodHandler(UUID user, Scene requestFromScene);
66 public delegate bool EditParcelHandler(UUID user, ILandObject parcel, Scene scene);
67 public delegate bool SellParcelHandler(UUID user, ILandObject parcel, Scene scene);
68 public delegate bool AbandonParcelHandler(UUID user, ILandObject parcel, Scene scene);
69 public delegate bool ReclaimParcelHandler(UUID user, ILandObject parcel, Scene scene);
70 public delegate bool BuyLandHandler(UUID user, ILandObject parcel, Scene scene);
71 public delegate bool LinkObjectHandler(UUID user, UUID objectID);
72 public delegate bool DelinkObjectHandler(UUID user, UUID objectID);
73 public delegate bool CreateObjectInventoryHandler(int invType, UUID objectID, UUID userID);
74 public delegate bool CopyObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID);
75 public delegate bool DeleteObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID);
76 public delegate bool CreateUserInventoryHandler(int invType, UUID userID);
77 public delegate bool EditUserInventoryHandler(UUID itemID, UUID userID);
78 public delegate bool CopyUserInventoryHandler(UUID itemID, UUID userID);
79 public delegate bool DeleteUserInventoryHandler(UUID itemID, UUID userID);
80 public delegate bool TeleportHandler(UUID userID, Scene scene);
81 #endregion
82
37 public class ScenePermissions 83 public class ScenePermissions
38 { 84 {
39 private Scene m_scene; 85 private Scene m_scene;
@@ -43,22 +89,53 @@ namespace OpenSim.Region.Framework.Scenes
43 m_scene = scene; 89 m_scene = scene;
44 } 90 }
45 91
46 #region Object Permission Checks 92 #region Events
47 93 public event GenerateClientFlagsHandler OnGenerateClientFlags;
48 public delegate uint GenerateClientFlagsHandler(UUID userID, UUID objectIDID); 94 public event SetBypassPermissionsHandler OnSetBypassPermissions;
49 private List<GenerateClientFlagsHandler> GenerateClientFlagsCheckFunctions = new List<GenerateClientFlagsHandler>(); 95 public event BypassPermissionsHandler OnBypassPermissions;
50 96 public event PropagatePermissionsHandler OnPropagatePermissions;
51 public void AddGenerateClientFlagsHandler(GenerateClientFlagsHandler delegateFunc) 97 public event RezObjectHandler OnRezObject;
52 { 98 public event DeleteObjectHandler OnDeleteObject;
53 if (!GenerateClientFlagsCheckFunctions.Contains(delegateFunc)) 99 public event TakeObjectHandler OnTakeObject;
54 GenerateClientFlagsCheckFunctions.Add(delegateFunc); 100 public event TakeCopyObjectHandler OnTakeCopyObject;
55 } 101 public event DuplicateObjectHandler OnDuplicateObject;
102 public event EditObjectHandler OnEditObject;
103 public event EditObjectInventoryHandler OnEditObjectInventory;
104 public event MoveObjectHandler OnMoveObject;
105 public event ObjectEntryHandler OnObjectEntry;
106 public event ReturnObjectHandler OnReturnObject;
107 public event InstantMessageHandler OnInstantMessage;
108 public event InventoryTransferHandler OnInventoryTransfer;
109 public event ViewScriptHandler OnViewScript;
110 public event ViewNotecardHandler OnViewNotecard;
111 public event EditScriptHandler OnEditScript;
112 public event EditNotecardHandler OnEditNotecard;
113 public event RunScriptHandler OnRunScript;
114 public event StartScriptHandler OnStartScript;
115 public event StopScriptHandler OnStopScript;
116 public event ResetScriptHandler OnResetScript;
117 public event TerraformLandHandler OnTerraformLand;
118 public event RunConsoleCommandHandler OnRunConsoleCommand;
119 public event IssueEstateCommandHandler OnIssueEstateCommand;
120 public event IsGodHandler OnIsGod;
121 public event EditParcelHandler OnEditParcel;
122 public event SellParcelHandler OnSellParcel;
123 public event AbandonParcelHandler OnAbandonParcel;
124 public event ReclaimParcelHandler OnReclaimParcel;
125 public event BuyLandHandler OnBuyLand;
126 public event LinkObjectHandler OnLinkObject;
127 public event DelinkObjectHandler OnDelinkObject;
128 public event CreateObjectInventoryHandler OnCreateObjectInventory;
129 public event CopyObjectInventoryHandler OnCopyObjectInventory;
130 public event DeleteObjectInventoryHandler OnDeleteObjectInventory;
131 public event CreateUserInventoryHandler OnCreateUserInventory;
132 public event EditUserInventoryHandler OnEditUserInventory;
133 public event CopyUserInventoryHandler OnCopyUserInventory;
134 public event DeleteUserInventoryHandler OnDeleteUserInventory;
135 public event TeleportHandler OnTeleport;
136 #endregion
56 137
57 public void RemoveGenerateClientFlagsHandler(GenerateClientFlagsHandler delegateFunc) 138 #region Object Permission Checks
58 {
59 if (GenerateClientFlagsCheckFunctions.Contains(delegateFunc))
60 GenerateClientFlagsCheckFunctions.Remove(delegateFunc);
61 }
62 139
63 public uint GenerateClientFlags(UUID userID, UUID objectID) 140 public uint GenerateClientFlags(UUID userID, UUID objectID)
64 { 141 {
@@ -81,113 +158,68 @@ namespace OpenSim.Region.Framework.Scenes
81 (uint)PrimFlags.ObjectYouOfficer; 158 (uint)PrimFlags.ObjectYouOfficer;
82 #pragma warning restore 0612 159 #pragma warning restore 0612
83 160
84 foreach (GenerateClientFlagsHandler check in GenerateClientFlagsCheckFunctions) 161 GenerateClientFlagsHandler handlerGenerateClientFlags =
162 OnGenerateClientFlags;
163
164 if (handlerGenerateClientFlags != null)
85 { 165 {
86 perms &= check(userID, objectID); 166 Delegate[] list = handlerGenerateClientFlags.GetInvocationList();
167 foreach (GenerateClientFlagsHandler check in list)
168 {
169 perms &= check(userID, objectID);
170 }
87 } 171 }
88 return perms; 172 return perms;
89 } 173 }
90 174
91 public delegate void SetBypassPermissionsHandler(bool value);
92 private List<SetBypassPermissionsHandler> SetBypassPermissionsCheckFunctions = new List<SetBypassPermissionsHandler>();
93
94 public void AddSetBypassPermissionsHandler(SetBypassPermissionsHandler delegateFunc)
95 {
96 if (!SetBypassPermissionsCheckFunctions.Contains(delegateFunc))
97 SetBypassPermissionsCheckFunctions.Add(delegateFunc);
98 }
99
100 public void RemoveSetBypassPermissionsHandler(SetBypassPermissionsHandler delegateFunc)
101 {
102 if (SetBypassPermissionsCheckFunctions.Contains(delegateFunc))
103 SetBypassPermissionsCheckFunctions.Remove(delegateFunc);
104 }
105
106 public void SetBypassPermissions(bool value) 175 public void SetBypassPermissions(bool value)
107 { 176 {
108 foreach (SetBypassPermissionsHandler check in SetBypassPermissionsCheckFunctions) 177 SetBypassPermissionsHandler handler = OnSetBypassPermissions;
109 { 178 if (handler != null)
110 check(value); 179 handler(value);
111 }
112 }
113
114 public delegate bool BypassPermissionsHandler();
115 private List<BypassPermissionsHandler> BypassPermissionsCheckFunctions = new List<BypassPermissionsHandler>();
116
117 public void AddBypassPermissionsHandler(BypassPermissionsHandler delegateFunc)
118 {
119 if (!BypassPermissionsCheckFunctions.Contains(delegateFunc))
120 BypassPermissionsCheckFunctions.Add(delegateFunc);
121 }
122
123 public void RemoveBypassPermissionsHandler(BypassPermissionsHandler delegateFunc)
124 {
125 if (BypassPermissionsCheckFunctions.Contains(delegateFunc))
126 BypassPermissionsCheckFunctions.Remove(delegateFunc);
127 } 180 }
128 181
129 public bool BypassPermissions() 182 public bool BypassPermissions()
130 { 183 {
131 foreach (BypassPermissionsHandler check in BypassPermissionsCheckFunctions) 184 BypassPermissionsHandler handler = OnBypassPermissions;
185 if (handler != null)
132 { 186 {
133 if (check() == false) 187 Delegate[] list = handler.GetInvocationList();
188 foreach (BypassPermissionsHandler h in list)
134 { 189 {
135 return false; 190 if (h() == false)
191 return false;
136 } 192 }
137 } 193 }
138 return true; 194 return true;
139 } 195 }
140 196
141 public delegate bool PropagatePermissionsHandler();
142 private List<PropagatePermissionsHandler> PropagatePermissionsCheckFunctions = new List<PropagatePermissionsHandler>();
143
144 public void AddPropagatePermissionsHandler(PropagatePermissionsHandler delegateFunc)
145 {
146 if (!PropagatePermissionsCheckFunctions.Contains(delegateFunc))
147 PropagatePermissionsCheckFunctions.Add(delegateFunc);
148 }
149
150 public void RemovePropagatePermissionsHandler(PropagatePermissionsHandler delegateFunc)
151 {
152 if (PropagatePermissionsCheckFunctions.Contains(delegateFunc))
153 PropagatePermissionsCheckFunctions.Remove(delegateFunc);
154 }
155
156 public bool PropagatePermissions() 197 public bool PropagatePermissions()
157 { 198 {
158 foreach (PropagatePermissionsHandler check in PropagatePermissionsCheckFunctions) 199 PropagatePermissionsHandler handler = OnPropagatePermissions;
200 if (handler != null)
159 { 201 {
160 if (check() == false) 202 Delegate[] list = handler.GetInvocationList();
203 foreach (PropagatePermissionsHandler h in list)
161 { 204 {
162 return false; 205 if (h() == false)
206 return false;
163 } 207 }
164 } 208 }
165 return true; 209 return true;
166 } 210 }
167 211
168 #region REZ OBJECT 212 #region REZ OBJECT
169 public delegate bool CanRezObjectHandler(int objectCount, UUID owner, Vector3 objectPosition, Scene scene);
170 private List<CanRezObjectHandler> CanRezObjectCheckFunctions = new List<CanRezObjectHandler>();
171
172 public void AddRezObjectHandler(CanRezObjectHandler delegateFunc)
173 {
174 if (!CanRezObjectCheckFunctions.Contains(delegateFunc))
175 CanRezObjectCheckFunctions.Add(delegateFunc);
176 }
177
178 public void RemoveRezObjectHandler(CanRezObjectHandler delegateFunc)
179 {
180 if (CanRezObjectCheckFunctions.Contains(delegateFunc))
181 CanRezObjectCheckFunctions.Remove(delegateFunc);
182 }
183
184 public bool CanRezObject(int objectCount, UUID owner, Vector3 objectPosition) 213 public bool CanRezObject(int objectCount, UUID owner, Vector3 objectPosition)
185 { 214 {
186 foreach (CanRezObjectHandler check in CanRezObjectCheckFunctions) 215 RezObjectHandler handler = OnRezObject;
216 if (handler != null)
187 { 217 {
188 if (check(objectCount, owner,objectPosition, m_scene) == false) 218 Delegate[] list = handler.GetInvocationList();
219 foreach (RezObjectHandler h in list)
189 { 220 {
190 return false; 221 if (h(objectCount, owner,objectPosition, m_scene) == false)
222 return false;
191 } 223 }
192 } 224 }
193 return true; 225 return true;
@@ -196,28 +228,16 @@ namespace OpenSim.Region.Framework.Scenes
196 #endregion 228 #endregion
197 229
198 #region DELETE OBJECT 230 #region DELETE OBJECT
199 public delegate bool CanDeleteObjectHandler(UUID objectID, UUID deleter, Scene scene);
200 private List<CanDeleteObjectHandler> CanDeleteObjectCheckFunctions = new List<CanDeleteObjectHandler>();
201
202 public void AddDeleteObjectHandler(CanDeleteObjectHandler delegateFunc)
203 {
204 if (!CanDeleteObjectCheckFunctions.Contains(delegateFunc))
205 CanDeleteObjectCheckFunctions.Add(delegateFunc);
206 }
207
208 public void RemoveDeleteObjectHandler(CanDeleteObjectHandler delegateFunc)
209 {
210 if (CanDeleteObjectCheckFunctions.Contains(delegateFunc))
211 CanDeleteObjectCheckFunctions.Remove(delegateFunc);
212 }
213
214 public bool CanDeleteObject(UUID objectID, UUID deleter) 231 public bool CanDeleteObject(UUID objectID, UUID deleter)
215 { 232 {
216 foreach (CanDeleteObjectHandler check in CanDeleteObjectCheckFunctions) 233 DeleteObjectHandler handler = OnDeleteObject;
234 if (handler != null)
217 { 235 {
218 if (check(objectID,deleter,m_scene) == false) 236 Delegate[] list = handler.GetInvocationList();
237 foreach (DeleteObjectHandler h in list)
219 { 238 {
220 return false; 239 if (h(objectID, deleter, m_scene) == false)
240 return false;
221 } 241 }
222 } 242 }
223 return true; 243 return true;
@@ -226,28 +246,16 @@ namespace OpenSim.Region.Framework.Scenes
226 #endregion 246 #endregion
227 247
228 #region TAKE OBJECT 248 #region TAKE OBJECT
229 public delegate bool CanTakeObjectHandler(UUID objectID, UUID stealer, Scene scene);
230 private List<CanTakeObjectHandler> CanTakeObjectCheckFunctions = new List<CanTakeObjectHandler>();
231
232 public void AddTakeObjectHandler(CanTakeObjectHandler delegateFunc)
233 {
234 if (!CanTakeObjectCheckFunctions.Contains(delegateFunc))
235 CanTakeObjectCheckFunctions.Add(delegateFunc);
236 }
237
238 public void RemoveTakeObjectHandler(CanTakeObjectHandler delegateFunc)
239 {
240 if (CanTakeObjectCheckFunctions.Contains(delegateFunc))
241 CanTakeObjectCheckFunctions.Remove(delegateFunc);
242 }
243
244 public bool CanTakeObject(UUID objectID, UUID AvatarTakingUUID) 249 public bool CanTakeObject(UUID objectID, UUID AvatarTakingUUID)
245 { 250 {
246 foreach (CanTakeObjectHandler check in CanTakeObjectCheckFunctions) 251 TakeObjectHandler handler = OnTakeObject;
252 if (handler != null)
247 { 253 {
248 if (check(objectID, AvatarTakingUUID, m_scene) == false) 254 Delegate[] list = handler.GetInvocationList();
255 foreach (TakeObjectHandler h in list)
249 { 256 {
250 return false; 257 if (h(objectID, AvatarTakingUUID, m_scene) == false)
258 return false;
251 } 259 }
252 } 260 }
253 return true; 261 return true;
@@ -256,28 +264,16 @@ namespace OpenSim.Region.Framework.Scenes
256 #endregion 264 #endregion
257 265
258 #region TAKE COPY OBJECT 266 #region TAKE COPY OBJECT
259 public delegate bool CanTakeCopyObjectHandler(UUID objectID, UUID userID, Scene inScene);
260 private List<CanTakeCopyObjectHandler> CanTakeCopyObjectCheckFunctions = new List<CanTakeCopyObjectHandler>();
261
262 public void AddTakeCopyObjectHandler(CanTakeCopyObjectHandler delegateFunc)
263 {
264 if (!CanTakeCopyObjectCheckFunctions.Contains(delegateFunc))
265 CanTakeCopyObjectCheckFunctions.Add(delegateFunc);
266 }
267
268 public void RemoveTakeCopyObjectHandler(CanTakeCopyObjectHandler delegateFunc)
269 {
270 if (CanTakeCopyObjectCheckFunctions.Contains(delegateFunc))
271 CanTakeCopyObjectCheckFunctions.Remove(delegateFunc);
272 }
273
274 public bool CanTakeCopyObject(UUID objectID, UUID userID) 267 public bool CanTakeCopyObject(UUID objectID, UUID userID)
275 { 268 {
276 foreach (CanTakeCopyObjectHandler check in CanTakeCopyObjectCheckFunctions) 269 TakeCopyObjectHandler handler = OnTakeCopyObject;
270 if (handler != null)
277 { 271 {
278 if (check(objectID,userID,m_scene) == false) 272 Delegate[] list = handler.GetInvocationList();
273 foreach (TakeCopyObjectHandler h in list)
279 { 274 {
280 return false; 275 if (h(objectID, userID, m_scene) == false)
276 return false;
281 } 277 }
282 } 278 }
283 return true; 279 return true;
@@ -286,28 +282,16 @@ namespace OpenSim.Region.Framework.Scenes
286 #endregion 282 #endregion
287 283
288 #region DUPLICATE OBJECT 284 #region DUPLICATE OBJECT
289 public delegate bool CanDuplicateObjectHandler(int objectCount, UUID objectID, UUID owner, Scene scene, Vector3 objectPosition);
290 private List<CanDuplicateObjectHandler> CanDuplicateObjectCheckFunctions = new List<CanDuplicateObjectHandler>();
291
292 public void AddDuplicateObjectHandler(CanDuplicateObjectHandler delegateFunc)
293 {
294 if (!CanDuplicateObjectCheckFunctions.Contains(delegateFunc))
295 CanDuplicateObjectCheckFunctions.Add(delegateFunc);
296 }
297
298 public void RemoveDuplicateObjectHandler(CanDuplicateObjectHandler delegateFunc)
299 {
300 if (CanDuplicateObjectCheckFunctions.Contains(delegateFunc))
301 CanDuplicateObjectCheckFunctions.Remove(delegateFunc);
302 }
303
304 public bool CanDuplicateObject(int objectCount, UUID objectID, UUID owner, Vector3 objectPosition) 285 public bool CanDuplicateObject(int objectCount, UUID objectID, UUID owner, Vector3 objectPosition)
305 { 286 {
306 foreach (CanDuplicateObjectHandler check in CanDuplicateObjectCheckFunctions) 287 DuplicateObjectHandler handler = OnDuplicateObject;
288 if (handler != null)
307 { 289 {
308 if (check(objectCount, objectID, owner, m_scene, objectPosition) == false) 290 Delegate[] list = handler.GetInvocationList();
291 foreach (DuplicateObjectHandler h in list)
309 { 292 {
310 return false; 293 if (h(objectCount, objectID, owner, m_scene, objectPosition) == false)
294 return false;
311 } 295 }
312 } 296 }
313 return true; 297 return true;
@@ -316,55 +300,31 @@ namespace OpenSim.Region.Framework.Scenes
316 #endregion 300 #endregion
317 301
318 #region EDIT OBJECT 302 #region EDIT OBJECT
319 public delegate bool CanEditObjectHandler(UUID objectID, UUID editorID, Scene scene);
320 private List<CanEditObjectHandler> CanEditObjectCheckFunctions = new List<CanEditObjectHandler>();
321
322 public void AddEditObjectHandler(CanEditObjectHandler delegateFunc)
323 {
324 if (!CanEditObjectCheckFunctions.Contains(delegateFunc))
325 CanEditObjectCheckFunctions.Add(delegateFunc);
326 }
327
328 public void RemoveEditObjectHandler(CanEditObjectHandler delegateFunc)
329 {
330 if (CanEditObjectCheckFunctions.Contains(delegateFunc))
331 CanEditObjectCheckFunctions.Remove(delegateFunc);
332 }
333
334 public bool CanEditObject(UUID objectID, UUID editorID) 303 public bool CanEditObject(UUID objectID, UUID editorID)
335 { 304 {
336 foreach (CanEditObjectHandler check in CanEditObjectCheckFunctions) 305 EditObjectHandler handler = OnEditObject;
306 if (handler != null)
337 { 307 {
338 if (check(objectID, editorID, m_scene) == false) 308 Delegate[] list = handler.GetInvocationList();
309 foreach (EditObjectHandler h in list)
339 { 310 {
340 return false; 311 if (h(objectID, editorID, m_scene) == false)
312 return false;
341 } 313 }
342 } 314 }
343 return true; 315 return true;
344 } 316 }
345 317
346 public delegate bool CanEditObjectInventoryHandler(UUID objectID, UUID editorID, Scene scene);
347 private List<CanEditObjectInventoryHandler> CanEditObjectInventoryCheckFunctions = new List<CanEditObjectInventoryHandler>();
348
349 public void AddEditObjectInventoryHandler(CanEditObjectInventoryHandler delegateFunc)
350 {
351 if (!CanEditObjectInventoryCheckFunctions.Contains(delegateFunc))
352 CanEditObjectInventoryCheckFunctions.Add(delegateFunc);
353 }
354
355 public void RemoveEditObjectInventoryHandler(CanEditObjectInventoryHandler delegateFunc)
356 {
357 if (CanEditObjectInventoryCheckFunctions.Contains(delegateFunc))
358 CanEditObjectInventoryCheckFunctions.Remove(delegateFunc);
359 }
360
361 public bool CanEditObjectInventory(UUID objectID, UUID editorID) 318 public bool CanEditObjectInventory(UUID objectID, UUID editorID)
362 { 319 {
363 foreach (CanEditObjectInventoryHandler check in CanEditObjectInventoryCheckFunctions) 320 EditObjectInventoryHandler handler = OnEditObjectInventory;
321 if (handler != null)
364 { 322 {
365 if (check(objectID, editorID, m_scene) == false) 323 Delegate[] list = handler.GetInvocationList();
324 foreach (EditObjectInventoryHandler h in list)
366 { 325 {
367 return false; 326 if (h(objectID, editorID, m_scene) == false)
327 return false;
368 } 328 }
369 } 329 }
370 return true; 330 return true;
@@ -373,28 +333,16 @@ namespace OpenSim.Region.Framework.Scenes
373 #endregion 333 #endregion
374 334
375 #region MOVE OBJECT 335 #region MOVE OBJECT
376 public delegate bool CanMoveObjectHandler(UUID objectID, UUID moverID, Scene scene);
377 private List<CanMoveObjectHandler> CanMoveObjectCheckFunctions = new List<CanMoveObjectHandler>();
378
379 public void AddMoveObjectHandler(CanMoveObjectHandler delegateFunc)
380 {
381 if (!CanMoveObjectCheckFunctions.Contains(delegateFunc))
382 CanMoveObjectCheckFunctions.Add(delegateFunc);
383 }
384
385 public void RemoveMoveObjectHandler(CanMoveObjectHandler delegateFunc)
386 {
387 if (CanMoveObjectCheckFunctions.Contains(delegateFunc))
388 CanMoveObjectCheckFunctions.Remove(delegateFunc);
389 }
390
391 public bool CanMoveObject(UUID objectID, UUID moverID) 336 public bool CanMoveObject(UUID objectID, UUID moverID)
392 { 337 {
393 foreach (CanMoveObjectHandler check in CanMoveObjectCheckFunctions) 338 MoveObjectHandler handler = OnMoveObject;
339 if (handler != null)
394 { 340 {
395 if (check(objectID,moverID,m_scene) == false) 341 Delegate[] list = handler.GetInvocationList();
342 foreach (MoveObjectHandler h in list)
396 { 343 {
397 return false; 344 if (h(objectID, moverID, m_scene) == false)
345 return false;
398 } 346 }
399 } 347 }
400 return true; 348 return true;
@@ -403,28 +351,16 @@ namespace OpenSim.Region.Framework.Scenes
403 #endregion 351 #endregion
404 352
405 #region OBJECT ENTRY 353 #region OBJECT ENTRY
406 public delegate bool CanObjectEntryHandler(UUID objectID, bool enteringRegion, Vector3 newPoint, Scene scene);
407 private List<CanObjectEntryHandler> CanObjectEntryCheckFunctions = new List<CanObjectEntryHandler>();
408
409 public void AddObjectEntryHandler(CanObjectEntryHandler delegateFunc)
410 {
411 if (!CanObjectEntryCheckFunctions.Contains(delegateFunc))
412 CanObjectEntryCheckFunctions.Add(delegateFunc);
413 }
414
415 public void RemoveObjectEntryHandler(CanObjectEntryHandler delegateFunc)
416 {
417 if (CanObjectEntryCheckFunctions.Contains(delegateFunc))
418 CanObjectEntryCheckFunctions.Remove(delegateFunc);
419 }
420
421 public bool CanObjectEntry(UUID objectID, bool enteringRegion, Vector3 newPoint) 354 public bool CanObjectEntry(UUID objectID, bool enteringRegion, Vector3 newPoint)
422 { 355 {
423 foreach (CanObjectEntryHandler check in CanObjectEntryCheckFunctions) 356 ObjectEntryHandler handler = OnObjectEntry;
357 if (handler != null)
424 { 358 {
425 if (check(objectID, enteringRegion, newPoint, m_scene) == false) 359 Delegate[] list = handler.GetInvocationList();
360 foreach (ObjectEntryHandler h in list)
426 { 361 {
427 return false; 362 if (h(objectID, enteringRegion, newPoint, m_scene) == false)
363 return false;
428 } 364 }
429 } 365 }
430 return true; 366 return true;
@@ -433,28 +369,16 @@ namespace OpenSim.Region.Framework.Scenes
433 #endregion 369 #endregion
434 370
435 #region RETURN OBJECT 371 #region RETURN OBJECT
436 public delegate bool CanReturnObjectHandler(UUID objectID, UUID returnerID, Scene scene);
437 private List<CanReturnObjectHandler> CanReturnObjectCheckFunctions = new List<CanReturnObjectHandler>();
438
439 public void AddReturnObjectHandler(CanReturnObjectHandler delegateFunc)
440 {
441 if (!CanReturnObjectCheckFunctions.Contains(delegateFunc))
442 CanReturnObjectCheckFunctions.Add(delegateFunc);
443 }
444
445 public void RemoveReturnObjectHandler(CanReturnObjectHandler delegateFunc)
446 {
447 if (CanReturnObjectCheckFunctions.Contains(delegateFunc))
448 CanReturnObjectCheckFunctions.Remove(delegateFunc);
449 }
450
451 public bool CanReturnObject(UUID objectID, UUID returnerID) 372 public bool CanReturnObject(UUID objectID, UUID returnerID)
452 { 373 {
453 foreach (CanReturnObjectHandler check in CanReturnObjectCheckFunctions) 374 ReturnObjectHandler handler = OnReturnObject;
375 if (handler != null)
454 { 376 {
455 if (check(objectID,returnerID,m_scene) == false) 377 Delegate[] list = handler.GetInvocationList();
378 foreach (ReturnObjectHandler h in list)
456 { 379 {
457 return false; 380 if (h(objectID, returnerID, m_scene) == false)
381 return false;
458 } 382 }
459 } 383 }
460 return true; 384 return true;
@@ -463,28 +387,16 @@ namespace OpenSim.Region.Framework.Scenes
463 #endregion 387 #endregion
464 388
465 #region INSTANT MESSAGE 389 #region INSTANT MESSAGE
466 public delegate bool CanInstantMessageHandler(UUID user, UUID target, Scene startScene);
467 private List<CanInstantMessageHandler> CanInstantMessageCheckFunctions = new List<CanInstantMessageHandler>();
468
469 public void AddInstantMessageHandler(CanInstantMessageHandler delegateFunc)
470 {
471 if (!CanInstantMessageCheckFunctions.Contains(delegateFunc))
472 CanInstantMessageCheckFunctions.Add(delegateFunc);
473 }
474
475 public void RemoveInstantMessageHandler(CanInstantMessageHandler delegateFunc)
476 {
477 if (CanInstantMessageCheckFunctions.Contains(delegateFunc))
478 CanInstantMessageCheckFunctions.Remove(delegateFunc);
479 }
480
481 public bool CanInstantMessage(UUID user, UUID target) 390 public bool CanInstantMessage(UUID user, UUID target)
482 { 391 {
483 foreach (CanInstantMessageHandler check in CanInstantMessageCheckFunctions) 392 InstantMessageHandler handler = OnInstantMessage;
393 if (handler != null)
484 { 394 {
485 if (check(user, target, m_scene) == false) 395 Delegate[] list = handler.GetInvocationList();
396 foreach (InstantMessageHandler h in list)
486 { 397 {
487 return false; 398 if (h(user, target, m_scene) == false)
399 return false;
488 } 400 }
489 } 401 }
490 return true; 402 return true;
@@ -493,28 +405,16 @@ namespace OpenSim.Region.Framework.Scenes
493 #endregion 405 #endregion
494 406
495 #region INVENTORY TRANSFER 407 #region INVENTORY TRANSFER
496 public delegate bool CanInventoryTransferHandler(UUID user, UUID target, Scene startScene);
497 private List<CanInventoryTransferHandler> CanInventoryTransferCheckFunctions = new List<CanInventoryTransferHandler>();
498
499 public void AddInventoryTransferHandler(CanInventoryTransferHandler delegateFunc)
500 {
501 if (!CanInventoryTransferCheckFunctions.Contains(delegateFunc))
502 CanInventoryTransferCheckFunctions.Add(delegateFunc);
503 }
504
505 public void RemoveInventoryTransferHandler(CanInventoryTransferHandler delegateFunc)
506 {
507 if (CanInventoryTransferCheckFunctions.Contains(delegateFunc))
508 CanInventoryTransferCheckFunctions.Remove(delegateFunc);
509 }
510
511 public bool CanInventoryTransfer(UUID user, UUID target) 408 public bool CanInventoryTransfer(UUID user, UUID target)
512 { 409 {
513 foreach (CanInventoryTransferHandler check in CanInventoryTransferCheckFunctions) 410 InventoryTransferHandler handler = OnInventoryTransfer;
411 if (handler != null)
514 { 412 {
515 if (check(user, target, m_scene) == false) 413 Delegate[] list = handler.GetInvocationList();
414 foreach (InventoryTransferHandler h in list)
516 { 415 {
517 return false; 416 if (h(user, target, m_scene) == false)
417 return false;
518 } 418 }
519 } 419 }
520 return true; 420 return true;
@@ -523,55 +423,31 @@ namespace OpenSim.Region.Framework.Scenes
523 #endregion 423 #endregion
524 424
525 #region VIEW SCRIPT 425 #region VIEW SCRIPT
526 public delegate bool CanViewScriptHandler(UUID script, UUID objectID, UUID user, Scene scene);
527 private List<CanViewScriptHandler> CanViewScriptCheckFunctions = new List<CanViewScriptHandler>();
528
529 public void AddViewScriptHandler(CanViewScriptHandler delegateFunc)
530 {
531 if (!CanViewScriptCheckFunctions.Contains(delegateFunc))
532 CanViewScriptCheckFunctions.Add(delegateFunc);
533 }
534
535 public void RemoveViewScriptHandler(CanViewScriptHandler delegateFunc)
536 {
537 if (CanViewScriptCheckFunctions.Contains(delegateFunc))
538 CanViewScriptCheckFunctions.Remove(delegateFunc);
539 }
540
541 public bool CanViewScript(UUID script, UUID objectID, UUID user) 426 public bool CanViewScript(UUID script, UUID objectID, UUID user)
542 { 427 {
543 foreach (CanViewScriptHandler check in CanViewScriptCheckFunctions) 428 ViewScriptHandler handler = OnViewScript;
429 if (handler != null)
544 { 430 {
545 if (check(script, objectID, user, m_scene) == false) 431 Delegate[] list = handler.GetInvocationList();
432 foreach (ViewScriptHandler h in list)
546 { 433 {
547 return false; 434 if (h(script, objectID, user, m_scene) == false)
435 return false;
548 } 436 }
549 } 437 }
550 return true; 438 return true;
551 } 439 }
552 440
553 public delegate bool CanViewNotecardHandler(UUID script, UUID objectID, UUID user, Scene scene);
554 private List<CanViewNotecardHandler> CanViewNotecardCheckFunctions = new List<CanViewNotecardHandler>();
555
556 public void AddViewNotecardHandler(CanViewNotecardHandler delegateFunc)
557 {
558 if (!CanViewNotecardCheckFunctions.Contains(delegateFunc))
559 CanViewNotecardCheckFunctions.Add(delegateFunc);
560 }
561
562 public void RemoveViewNotecardHandler(CanViewNotecardHandler delegateFunc)
563 {
564 if (CanViewNotecardCheckFunctions.Contains(delegateFunc))
565 CanViewNotecardCheckFunctions.Remove(delegateFunc);
566 }
567
568 public bool CanViewNotecard(UUID script, UUID objectID, UUID user) 441 public bool CanViewNotecard(UUID script, UUID objectID, UUID user)
569 { 442 {
570 foreach (CanViewNotecardHandler check in CanViewNotecardCheckFunctions) 443 ViewNotecardHandler handler = OnViewNotecard;
444 if (handler != null)
571 { 445 {
572 if (check(script, objectID, user, m_scene) == false) 446 Delegate[] list = handler.GetInvocationList();
447 foreach (ViewNotecardHandler h in list)
573 { 448 {
574 return false; 449 if (h(script, objectID, user, m_scene) == false)
450 return false;
575 } 451 }
576 } 452 }
577 return true; 453 return true;
@@ -580,85 +456,49 @@ namespace OpenSim.Region.Framework.Scenes
580 #endregion 456 #endregion
581 457
582 #region EDIT SCRIPT 458 #region EDIT SCRIPT
583 public delegate bool CanEditScriptHandler(UUID script, UUID objectID, UUID user, Scene scene);
584 private List<CanEditScriptHandler> CanEditScriptCheckFunctions = new List<CanEditScriptHandler>();
585
586 public void AddEditScriptHandler(CanEditScriptHandler delegateFunc)
587 {
588 if (!CanEditScriptCheckFunctions.Contains(delegateFunc))
589 CanEditScriptCheckFunctions.Add(delegateFunc);
590 }
591
592 public void RemoveEditScriptHandler(CanEditScriptHandler delegateFunc)
593 {
594 if (CanEditScriptCheckFunctions.Contains(delegateFunc))
595 CanEditScriptCheckFunctions.Remove(delegateFunc);
596 }
597
598 public bool CanEditScript(UUID script, UUID objectID, UUID user) 459 public bool CanEditScript(UUID script, UUID objectID, UUID user)
599 { 460 {
600 foreach (CanEditScriptHandler check in CanEditScriptCheckFunctions) 461 EditScriptHandler handler = OnEditScript;
462 if (handler != null)
601 { 463 {
602 if (check(script, objectID, user, m_scene) == false) 464 Delegate[] list = handler.GetInvocationList();
465 foreach (EditScriptHandler h in list)
603 { 466 {
604 return false; 467 if (h(script, objectID, user, m_scene) == false)
468 return false;
605 } 469 }
606 } 470 }
607 return true; 471 return true;
608 } 472 }
609 473
610 public delegate bool CanEditNotecardHandler(UUID notecard, UUID objectID, UUID user, Scene scene);
611 private List<CanEditNotecardHandler> CanEditNotecardCheckFunctions = new List<CanEditNotecardHandler>();
612
613 public void AddEditNotecardHandler(CanEditNotecardHandler delegateFunc)
614 {
615 if (!CanEditNotecardCheckFunctions.Contains(delegateFunc))
616 CanEditNotecardCheckFunctions.Add(delegateFunc);
617 }
618
619 public void RemoveEditNotecardHandler(CanEditNotecardHandler delegateFunc)
620 {
621 if (CanEditNotecardCheckFunctions.Contains(delegateFunc))
622 CanEditNotecardCheckFunctions.Remove(delegateFunc);
623 }
624
625 public bool CanEditNotecard(UUID script, UUID objectID, UUID user) 474 public bool CanEditNotecard(UUID script, UUID objectID, UUID user)
475 {
476 EditNotecardHandler handler = OnEditNotecard;
477 if (handler != null)
626 { 478 {
627 foreach (CanEditNotecardHandler check in CanEditNotecardCheckFunctions) 479 Delegate[] list = handler.GetInvocationList();
480 foreach (EditNotecardHandler h in list)
628 { 481 {
629 if (check(script, objectID, user, m_scene) == false) 482 if (h(script, objectID, user, m_scene) == false)
630 {
631 return false; 483 return false;
632 }
633 } 484 }
634 return true;
635 } 485 }
486 return true;
487 }
636 488
637 #endregion 489 #endregion
638 490
639 #region RUN SCRIPT (When Script Placed in Object) 491 #region RUN SCRIPT (When Script Placed in Object)
640 public delegate bool CanRunScriptHandler(UUID script, UUID objectID, UUID user, Scene scene);
641 private List<CanRunScriptHandler> CanRunScriptCheckFunctions = new List<CanRunScriptHandler>();
642
643 public void AddRunScriptHandler(CanRunScriptHandler delegateFunc)
644 {
645 if (!CanRunScriptCheckFunctions.Contains(delegateFunc))
646 CanRunScriptCheckFunctions.Add(delegateFunc);
647 }
648
649 public void RemoveRunScriptHandler(CanRunScriptHandler delegateFunc)
650 {
651 if (CanRunScriptCheckFunctions.Contains(delegateFunc))
652 CanRunScriptCheckFunctions.Remove(delegateFunc);
653 }
654
655 public bool CanRunScript(UUID script, UUID objectID, UUID user) 492 public bool CanRunScript(UUID script, UUID objectID, UUID user)
656 { 493 {
657 foreach (CanRunScriptHandler check in CanRunScriptCheckFunctions) 494 RunScriptHandler handler = OnRunScript;
495 if (handler != null)
658 { 496 {
659 if (check(script, objectID, user, m_scene) == false) 497 Delegate[] list = handler.GetInvocationList();
498 foreach (RunScriptHandler h in list)
660 { 499 {
661 return false; 500 if (h(script, objectID, user, m_scene) == false)
501 return false;
662 } 502 }
663 } 503 }
664 return true; 504 return true;
@@ -667,28 +507,16 @@ namespace OpenSim.Region.Framework.Scenes
667 #endregion 507 #endregion
668 508
669 #region START SCRIPT (When Script run box is Checked after placed in object) 509 #region START SCRIPT (When Script run box is Checked after placed in object)
670 public delegate bool CanStartScriptHandler(UUID script, UUID user, Scene scene);
671 private List<CanStartScriptHandler> CanStartScriptCheckFunctions = new List<CanStartScriptHandler>();
672
673 public void AddStartScriptHandler(CanStartScriptHandler delegateFunc)
674 {
675 if (!CanStartScriptCheckFunctions.Contains(delegateFunc))
676 CanStartScriptCheckFunctions.Add(delegateFunc);
677 }
678
679 public void RemoveStartScriptHandler(CanStartScriptHandler delegateFunc)
680 {
681 if (CanStartScriptCheckFunctions.Contains(delegateFunc))
682 CanStartScriptCheckFunctions.Remove(delegateFunc);
683 }
684
685 public bool CanStartScript(UUID script, UUID user) 510 public bool CanStartScript(UUID script, UUID user)
686 { 511 {
687 foreach (CanStartScriptHandler check in CanStartScriptCheckFunctions) 512 StartScriptHandler handler = OnStartScript;
513 if (handler != null)
688 { 514 {
689 if (check(script, user, m_scene) == false) 515 Delegate[] list = handler.GetInvocationList();
516 foreach (StartScriptHandler h in list)
690 { 517 {
691 return false; 518 if (h(script, user, m_scene) == false)
519 return false;
692 } 520 }
693 } 521 }
694 return true; 522 return true;
@@ -697,28 +525,16 @@ namespace OpenSim.Region.Framework.Scenes
697 #endregion 525 #endregion
698 526
699 #region STOP SCRIPT (When Script run box is unchecked after placed in object) 527 #region STOP SCRIPT (When Script run box is unchecked after placed in object)
700 public delegate bool CanStopScriptHandler(UUID script, UUID user, Scene scene);
701 private List<CanStopScriptHandler> CanStopScriptCheckFunctions = new List<CanStopScriptHandler>();
702
703 public void AddStopScriptHandler(CanStopScriptHandler delegateFunc)
704 {
705 if (!CanStopScriptCheckFunctions.Contains(delegateFunc))
706 CanStopScriptCheckFunctions.Add(delegateFunc);
707 }
708
709 public void RemoveStopScriptHandler(CanStopScriptHandler delegateFunc)
710 {
711 if (CanStopScriptCheckFunctions.Contains(delegateFunc))
712 CanStopScriptCheckFunctions.Remove(delegateFunc);
713 }
714
715 public bool CanStopScript(UUID script, UUID user) 528 public bool CanStopScript(UUID script, UUID user)
716 { 529 {
717 foreach (CanStopScriptHandler check in CanStopScriptCheckFunctions) 530 StopScriptHandler handler = OnStopScript;
531 if (handler != null)
718 { 532 {
719 if (check(script, user, m_scene) == false) 533 Delegate[] list = handler.GetInvocationList();
534 foreach (StopScriptHandler h in list)
720 { 535 {
721 return false; 536 if (h(script, user, m_scene) == false)
537 return false;
722 } 538 }
723 } 539 }
724 return true; 540 return true;
@@ -727,28 +543,16 @@ namespace OpenSim.Region.Framework.Scenes
727 #endregion 543 #endregion
728 544
729 #region RESET SCRIPT 545 #region RESET SCRIPT
730 public delegate bool CanResetScriptHandler(UUID prim, UUID script, UUID user, Scene scene);
731 private List<CanResetScriptHandler> CanResetScriptCheckFunctions = new List<CanResetScriptHandler>();
732
733 public void AddResetScriptHandler(CanResetScriptHandler delegateFunc)
734 {
735 if (!CanResetScriptCheckFunctions.Contains(delegateFunc))
736 CanResetScriptCheckFunctions.Add(delegateFunc);
737 }
738
739 public void RemoveResetScriptHandler(CanResetScriptHandler delegateFunc)
740 {
741 if (CanResetScriptCheckFunctions.Contains(delegateFunc))
742 CanResetScriptCheckFunctions.Remove(delegateFunc);
743 }
744
745 public bool CanResetScript(UUID prim, UUID script, UUID user) 546 public bool CanResetScript(UUID prim, UUID script, UUID user)
746 { 547 {
747 foreach (CanResetScriptHandler check in CanResetScriptCheckFunctions) 548 ResetScriptHandler handler = OnResetScript;
549 if (handler != null)
748 { 550 {
749 if (check(prim, script, user, m_scene) == false) 551 Delegate[] list = handler.GetInvocationList();
552 foreach (ResetScriptHandler h in list)
750 { 553 {
751 return false; 554 if (h(prim, script, user, m_scene) == false)
555 return false;
752 } 556 }
753 } 557 }
754 return true; 558 return true;
@@ -757,28 +561,16 @@ namespace OpenSim.Region.Framework.Scenes
757 #endregion 561 #endregion
758 562
759 #region TERRAFORM LAND 563 #region TERRAFORM LAND
760 public delegate bool CanTerraformLandHandler(UUID user, Vector3 position, Scene requestFromScene);
761 private List<CanTerraformLandHandler> CanTerraformLandCheckFunctions = new List<CanTerraformLandHandler>();
762
763 public void AddTerraformLandHandler(CanTerraformLandHandler delegateFunc)
764 {
765 if (!CanTerraformLandCheckFunctions.Contains(delegateFunc))
766 CanTerraformLandCheckFunctions.Add(delegateFunc);
767 }
768
769 public void RemoveTerraformLandHandler(CanTerraformLandHandler delegateFunc)
770 {
771 if (CanTerraformLandCheckFunctions.Contains(delegateFunc))
772 CanTerraformLandCheckFunctions.Remove(delegateFunc);
773 }
774
775 public bool CanTerraformLand(UUID user, Vector3 pos) 564 public bool CanTerraformLand(UUID user, Vector3 pos)
776 { 565 {
777 foreach (CanTerraformLandHandler check in CanTerraformLandCheckFunctions) 566 TerraformLandHandler handler = OnTerraformLand;
567 if (handler != null)
778 { 568 {
779 if (check(user, pos, m_scene) == false) 569 Delegate[] list = handler.GetInvocationList();
570 foreach (TerraformLandHandler h in list)
780 { 571 {
781 return false; 572 if (h(user, pos, m_scene) == false)
573 return false;
782 } 574 }
783 } 575 }
784 return true; 576 return true;
@@ -787,28 +579,16 @@ namespace OpenSim.Region.Framework.Scenes
787 #endregion 579 #endregion
788 580
789 #region RUN CONSOLE COMMAND 581 #region RUN CONSOLE COMMAND
790 public delegate bool CanRunConsoleCommandHandler(UUID user, Scene requestFromScene);
791 private List<CanRunConsoleCommandHandler> CanRunConsoleCommandCheckFunctions = new List<CanRunConsoleCommandHandler>();
792
793 public void AddRunConsoleCommandHandler(CanRunConsoleCommandHandler delegateFunc)
794 {
795 if (!CanRunConsoleCommandCheckFunctions.Contains(delegateFunc))
796 CanRunConsoleCommandCheckFunctions.Add(delegateFunc);
797 }
798
799 public void RemoveRunConsoleCommandHandler(CanRunConsoleCommandHandler delegateFunc)
800 {
801 if (CanRunConsoleCommandCheckFunctions.Contains(delegateFunc))
802 CanRunConsoleCommandCheckFunctions.Remove(delegateFunc);
803 }
804
805 public bool CanRunConsoleCommand(UUID user) 582 public bool CanRunConsoleCommand(UUID user)
806 { 583 {
807 foreach (CanRunConsoleCommandHandler check in CanRunConsoleCommandCheckFunctions) 584 RunConsoleCommandHandler handler = OnRunConsoleCommand;
585 if (handler != null)
808 { 586 {
809 if (check(user, m_scene) == false) 587 Delegate[] list = handler.GetInvocationList();
588 foreach (RunConsoleCommandHandler h in list)
810 { 589 {
811 return false; 590 if (h(user, m_scene) == false)
591 return false;
812 } 592 }
813 } 593 }
814 return true; 594 return true;
@@ -817,28 +597,16 @@ namespace OpenSim.Region.Framework.Scenes
817 #endregion 597 #endregion
818 598
819 #region CAN ISSUE ESTATE COMMAND 599 #region CAN ISSUE ESTATE COMMAND
820 public delegate bool CanIssueEstateCommandHandler(UUID user, Scene requestFromScene, bool ownerCommand);
821 private List<CanIssueEstateCommandHandler> CanIssueEstateCommandCheckFunctions = new List<CanIssueEstateCommandHandler>();
822
823 public void AddIssueEstateCommandHandler(CanIssueEstateCommandHandler delegateFunc)
824 {
825 if (!CanIssueEstateCommandCheckFunctions.Contains(delegateFunc))
826 CanIssueEstateCommandCheckFunctions.Add(delegateFunc);
827 }
828
829 public void RemoveIssueEstateCommandHandler(CanIssueEstateCommandHandler delegateFunc)
830 {
831 if (CanIssueEstateCommandCheckFunctions.Contains(delegateFunc))
832 CanIssueEstateCommandCheckFunctions.Remove(delegateFunc);
833 }
834
835 public bool CanIssueEstateCommand(UUID user, bool ownerCommand) 600 public bool CanIssueEstateCommand(UUID user, bool ownerCommand)
836 { 601 {
837 foreach (CanIssueEstateCommandHandler check in CanIssueEstateCommandCheckFunctions) 602 IssueEstateCommandHandler handler = OnIssueEstateCommand;
603 if (handler != null)
838 { 604 {
839 if (check(user, m_scene, ownerCommand) == false) 605 Delegate[] list = handler.GetInvocationList();
606 foreach (IssueEstateCommandHandler h in list)
840 { 607 {
841 return false; 608 if (h(user, m_scene, ownerCommand) == false)
609 return false;
842 } 610 }
843 } 611 }
844 return true; 612 return true;
@@ -846,28 +614,16 @@ namespace OpenSim.Region.Framework.Scenes
846 #endregion 614 #endregion
847 615
848 #region CAN BE GODLIKE 616 #region CAN BE GODLIKE
849 public delegate bool IsGodHandler(UUID user, Scene requestFromScene);
850 private List<IsGodHandler> IsGodCheckFunctions = new List<IsGodHandler>();
851
852 public void AddIsGodHandler(IsGodHandler delegateFunc)
853 {
854 if (!IsGodCheckFunctions.Contains(delegateFunc))
855 IsGodCheckFunctions.Add(delegateFunc);
856 }
857
858 public void RemoveIsGodHandler(IsGodHandler delegateFunc)
859 {
860 if (IsGodCheckFunctions.Contains(delegateFunc))
861 IsGodCheckFunctions.Remove(delegateFunc);
862 }
863
864 public bool IsGod(UUID user) 617 public bool IsGod(UUID user)
865 { 618 {
866 foreach (IsGodHandler check in IsGodCheckFunctions) 619 IsGodHandler handler = OnIsGod;
620 if (handler != null)
867 { 621 {
868 if (check(user, m_scene) == false) 622 Delegate[] list = handler.GetInvocationList();
623 foreach (IsGodHandler h in list)
869 { 624 {
870 return false; 625 if (h(user, m_scene) == false)
626 return false;
871 } 627 }
872 } 628 }
873 return true; 629 return true;
@@ -875,28 +631,16 @@ namespace OpenSim.Region.Framework.Scenes
875 #endregion 631 #endregion
876 632
877 #region EDIT PARCEL 633 #region EDIT PARCEL
878 public delegate bool CanEditParcelHandler(UUID user, ILandObject parcel, Scene scene);
879 private List<CanEditParcelHandler> CanEditParcelCheckFunctions = new List<CanEditParcelHandler>();
880
881 public void AddEditParcelHandler(CanEditParcelHandler delegateFunc)
882 {
883 if (!CanEditParcelCheckFunctions.Contains(delegateFunc))
884 CanEditParcelCheckFunctions.Add(delegateFunc);
885 }
886
887 public void RemoveEditParcelHandler(CanEditParcelHandler delegateFunc)
888 {
889 if (CanEditParcelCheckFunctions.Contains(delegateFunc))
890 CanEditParcelCheckFunctions.Remove(delegateFunc);
891 }
892
893 public bool CanEditParcel(UUID user, ILandObject parcel) 634 public bool CanEditParcel(UUID user, ILandObject parcel)
894 { 635 {
895 foreach (CanEditParcelHandler check in CanEditParcelCheckFunctions) 636 EditParcelHandler handler = OnEditParcel;
637 if (handler != null)
896 { 638 {
897 if (check(user, parcel, m_scene) == false) 639 Delegate[] list = handler.GetInvocationList();
640 foreach (EditParcelHandler h in list)
898 { 641 {
899 return false; 642 if (h(user, parcel, m_scene) == false)
643 return false;
900 } 644 }
901 } 645 }
902 return true; 646 return true;
@@ -904,28 +648,16 @@ namespace OpenSim.Region.Framework.Scenes
904 #endregion 648 #endregion
905 649
906 #region SELL PARCEL 650 #region SELL PARCEL
907 public delegate bool CanSellParcelHandler(UUID user, ILandObject parcel, Scene scene);
908 private List<CanSellParcelHandler> CanSellParcelCheckFunctions = new List<CanSellParcelHandler>();
909
910 public void AddSellParcelHandler(CanSellParcelHandler delegateFunc)
911 {
912 if (!CanSellParcelCheckFunctions.Contains(delegateFunc))
913 CanSellParcelCheckFunctions.Add(delegateFunc);
914 }
915
916 public void RemoveSellParcelHandler(CanSellParcelHandler delegateFunc)
917 {
918 if (CanSellParcelCheckFunctions.Contains(delegateFunc))
919 CanSellParcelCheckFunctions.Remove(delegateFunc);
920 }
921
922 public bool CanSellParcel(UUID user, ILandObject parcel) 651 public bool CanSellParcel(UUID user, ILandObject parcel)
923 { 652 {
924 foreach (CanSellParcelHandler check in CanSellParcelCheckFunctions) 653 SellParcelHandler handler = OnSellParcel;
654 if (handler != null)
925 { 655 {
926 if (check(user, parcel, m_scene) == false) 656 Delegate[] list = handler.GetInvocationList();
657 foreach (SellParcelHandler h in list)
927 { 658 {
928 return false; 659 if (h(user, parcel, m_scene) == false)
660 return false;
929 } 661 }
930 } 662 }
931 return true; 663 return true;
@@ -933,136 +665,77 @@ namespace OpenSim.Region.Framework.Scenes
933 #endregion 665 #endregion
934 666
935 #region ABANDON PARCEL 667 #region ABANDON PARCEL
936 public delegate bool CanAbandonParcelHandler(UUID user, ILandObject parcel, Scene scene);
937 private List<CanAbandonParcelHandler> CanAbandonParcelCheckFunctions = new List<CanAbandonParcelHandler>();
938
939 public void AddAbandonParcelHandler(CanAbandonParcelHandler delegateFunc)
940 {
941 if (!CanAbandonParcelCheckFunctions.Contains(delegateFunc))
942 CanAbandonParcelCheckFunctions.Add(delegateFunc);
943 }
944
945 public void RemoveAbandonParcelHandler(CanAbandonParcelHandler delegateFunc)
946 {
947 if (CanAbandonParcelCheckFunctions.Contains(delegateFunc))
948 CanAbandonParcelCheckFunctions.Remove(delegateFunc);
949 }
950
951 public bool CanAbandonParcel(UUID user, ILandObject parcel) 668 public bool CanAbandonParcel(UUID user, ILandObject parcel)
952 { 669 {
953 foreach (CanAbandonParcelHandler check in CanAbandonParcelCheckFunctions) 670 AbandonParcelHandler handler = OnAbandonParcel;
671 if (handler != null)
954 { 672 {
955 if (check(user, parcel, m_scene) == false) 673 Delegate[] list = handler.GetInvocationList();
674 foreach (AbandonParcelHandler h in list)
956 { 675 {
957 return false; 676 if (h(user, parcel, m_scene) == false)
677 return false;
958 } 678 }
959 } 679 }
960 return true; 680 return true;
961 } 681 }
962 #endregion 682 #endregion
963 683
964 public delegate bool CanReclaimParcelHandler(UUID user, ILandObject parcel, Scene scene);
965 private List<CanReclaimParcelHandler> CanReclaimParcelCheckFunctions = new List<CanReclaimParcelHandler>();
966
967 public void AddReclaimParcelHandler(CanReclaimParcelHandler delegateFunc)
968 {
969 if (!CanReclaimParcelCheckFunctions.Contains(delegateFunc))
970 CanReclaimParcelCheckFunctions.Add(delegateFunc);
971 }
972
973 public void RemoveReclaimParcelHandler(CanReclaimParcelHandler delegateFunc)
974 {
975 if (CanReclaimParcelCheckFunctions.Contains(delegateFunc))
976 CanReclaimParcelCheckFunctions.Remove(delegateFunc);
977 }
978
979 public bool CanReclaimParcel(UUID user, ILandObject parcel) 684 public bool CanReclaimParcel(UUID user, ILandObject parcel)
980 { 685 {
981 foreach (CanReclaimParcelHandler check in CanReclaimParcelCheckFunctions) 686 ReclaimParcelHandler handler = OnReclaimParcel;
687 if (handler != null)
982 { 688 {
983 if (check(user, parcel, m_scene) == false) 689 Delegate[] list = handler.GetInvocationList();
690 foreach (ReclaimParcelHandler h in list)
984 { 691 {
985 return false; 692 if (h(user, parcel, m_scene) == false)
693 return false;
986 } 694 }
987 } 695 }
988 return true; 696 return true;
989 } 697 }
990 public delegate bool CanBuyLandHandler(UUID user, ILandObject parcel, Scene scene);
991 private List<CanBuyLandHandler> CanBuyLandCheckFunctions = new List<CanBuyLandHandler>();
992
993 public void AddCanBuyLandHandler(CanBuyLandHandler delegateFunc)
994 {
995 if (!CanBuyLandCheckFunctions.Contains(delegateFunc))
996 CanBuyLandCheckFunctions.Add(delegateFunc);
997 }
998
999 public void RemoveCanBuyLandHandler(CanBuyLandHandler delegateFunc)
1000 {
1001 if (CanBuyLandCheckFunctions.Contains(delegateFunc))
1002 CanBuyLandCheckFunctions.Remove(delegateFunc);
1003 }
1004 698
1005 public bool CanBuyLand(UUID user, ILandObject parcel) 699 public bool CanBuyLand(UUID user, ILandObject parcel)
1006 { 700 {
1007 foreach (CanBuyLandHandler check in CanBuyLandCheckFunctions) 701 BuyLandHandler handler = OnBuyLand;
702 if (handler != null)
1008 { 703 {
1009 if (check(user, parcel, m_scene) == false) 704 Delegate[] list = handler.GetInvocationList();
705 foreach (BuyLandHandler h in list)
1010 { 706 {
1011 return false; 707 if (h(user, parcel, m_scene) == false)
708 return false;
1012 } 709 }
1013 } 710 }
1014 return true; 711 return true;
1015 } 712 }
1016 713
1017 public delegate bool CanLinkObjectHandler(UUID user, UUID objectID);
1018 private List<CanLinkObjectHandler> CanLinkObjectCheckFunctions = new List<CanLinkObjectHandler>();
1019
1020 public void AddCanLinkObjectHandler(CanLinkObjectHandler delegateFunc)
1021 {
1022 if (!CanLinkObjectCheckFunctions.Contains(delegateFunc))
1023 CanLinkObjectCheckFunctions.Add(delegateFunc);
1024 }
1025
1026 public void RemoveCanLinkObjectHandler(CanLinkObjectHandler delegateFunc)
1027 {
1028 if (CanLinkObjectCheckFunctions.Contains(delegateFunc))
1029 CanLinkObjectCheckFunctions.Remove(delegateFunc);
1030 }
1031
1032 public bool CanLinkObject(UUID user, UUID objectID) 714 public bool CanLinkObject(UUID user, UUID objectID)
715 {
716 LinkObjectHandler handler = OnLinkObject;
717 if (handler != null)
1033 { 718 {
1034 foreach (CanLinkObjectHandler check in CanLinkObjectCheckFunctions) 719 Delegate[] list = handler.GetInvocationList();
720 foreach (LinkObjectHandler h in list)
1035 { 721 {
1036 if (check(user, objectID) == false) 722 if (h(user, objectID) == false)
1037 {
1038 return false; 723 return false;
1039 }
1040 } 724 }
1041 return true;
1042 } 725 }
1043 726 return true;
1044 public delegate bool CanDelinkObjectHandler(UUID user, UUID objectID);
1045 private List<CanDelinkObjectHandler> CanDelinkObjectCheckFunctions = new List<CanDelinkObjectHandler>();
1046
1047 public void AddCanDelinkObjectHandler(CanDelinkObjectHandler delegateFunc)
1048 {
1049 if (!CanDelinkObjectCheckFunctions.Contains(delegateFunc))
1050 CanDelinkObjectCheckFunctions.Add(delegateFunc);
1051 }
1052
1053 public void RemoveCanDelinkObjectHandler(CanDelinkObjectHandler delegateFunc)
1054 {
1055 if (CanDelinkObjectCheckFunctions.Contains(delegateFunc))
1056 CanDelinkObjectCheckFunctions.Remove(delegateFunc);
1057 } 727 }
1058 728
1059 public bool CanDelinkObject(UUID user, UUID objectID) 729 public bool CanDelinkObject(UUID user, UUID objectID)
1060 { 730 {
1061 foreach (CanDelinkObjectHandler check in CanDelinkObjectCheckFunctions) 731 DelinkObjectHandler handler = OnDelinkObject;
732 if (handler != null)
1062 { 733 {
1063 if (check(user, objectID) == false) 734 Delegate[] list = handler.GetInvocationList();
735 foreach (DelinkObjectHandler h in list)
1064 { 736 {
1065 return false; 737 if (h(user, objectID) == false)
738 return false;
1066 } 739 }
1067 } 740 }
1068 return true; 741 return true;
@@ -1070,24 +743,6 @@ namespace OpenSim.Region.Framework.Scenes
1070 743
1071 #endregion 744 #endregion
1072 745
1073 public delegate bool CanCreateObjectInventoryHandler(int invType, UUID objectID, UUID userID);
1074 private List<CanCreateObjectInventoryHandler> CanCreateObjectInventoryCheckFunctions
1075 = new List<CanCreateObjectInventoryHandler>();
1076
1077
1078 public void AddCanCreateObjectInventoryHandler(CanCreateObjectInventoryHandler delegateFunc)
1079 {
1080 if (!CanCreateObjectInventoryCheckFunctions.Contains(delegateFunc))
1081 CanCreateObjectInventoryCheckFunctions.Add(delegateFunc);
1082 }
1083
1084 public void RemoveCanCreateObjectInventoryHandler(CanCreateObjectInventoryHandler delegateFunc)
1085 {
1086 if (CanCreateObjectInventoryCheckFunctions.Contains(delegateFunc))
1087 CanCreateObjectInventoryCheckFunctions.Remove(delegateFunc);
1088 }
1089
1090 /// <summary>
1091 /// Check whether the specified user is allowed to directly create the given inventory type in a prim's 746 /// Check whether the specified user is allowed to directly create the given inventory type in a prim's
1092 /// inventory (e.g. the New Script button in the 1.21 Linden Lab client). 747 /// inventory (e.g. the New Script button in the 1.21 Linden Lab client).
1093 /// </summary> 748 /// </summary>
@@ -1097,89 +752,49 @@ namespace OpenSim.Region.Framework.Scenes
1097 /// <returns></returns> 752 /// <returns></returns>
1098 public bool CanCreateObjectInventory(int invType, UUID objectID, UUID userID) 753 public bool CanCreateObjectInventory(int invType, UUID objectID, UUID userID)
1099 { 754 {
1100 foreach (CanCreateObjectInventoryHandler check in CanCreateObjectInventoryCheckFunctions) 755 CreateObjectInventoryHandler handler = OnCreateObjectInventory;
756 if (handler != null)
1101 { 757 {
1102 if (check(invType, objectID, userID) == false) 758 Delegate[] list = handler.GetInvocationList();
759 foreach (CreateObjectInventoryHandler h in list)
1103 { 760 {
1104 return false; 761 if (h(invType, objectID, userID) == false)
762 return false;
1105 } 763 }
1106 } 764 }
1107
1108 return true; 765 return true;
1109 } 766 }
1110 767
1111 public delegate bool CanCopyObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID);
1112 private List<CanCopyObjectInventoryHandler> CanCopyObjectInventoryCheckFunctions = new List<CanCopyObjectInventoryHandler>();
1113
1114 public void AddCanCopyObjectInventoryHandler(CanCopyObjectInventoryHandler delegateFunc)
1115 {
1116 if (!CanCopyObjectInventoryCheckFunctions.Contains(delegateFunc))
1117 CanCopyObjectInventoryCheckFunctions.Add(delegateFunc);
1118 }
1119
1120 public void RemoveCanCopyObjectInventoryHandler(CanCopyObjectInventoryHandler delegateFunc)
1121 {
1122 if (CanCopyObjectInventoryCheckFunctions.Contains(delegateFunc))
1123 CanCopyObjectInventoryCheckFunctions.Remove(delegateFunc);
1124 }
1125
1126 public bool CanCopyObjectInventory(UUID itemID, UUID objectID, UUID userID) 768 public bool CanCopyObjectInventory(UUID itemID, UUID objectID, UUID userID)
1127 { 769 {
1128 foreach (CanCopyObjectInventoryHandler check in CanCopyObjectInventoryCheckFunctions) 770 CopyObjectInventoryHandler handler = OnCopyObjectInventory;
771 if (handler != null)
1129 { 772 {
1130 if (check(itemID, objectID, userID) == false) 773 Delegate[] list = handler.GetInvocationList();
774 foreach (CopyObjectInventoryHandler h in list)
1131 { 775 {
1132 return false; 776 if (h(itemID, objectID, userID) == false)
777 return false;
1133 } 778 }
1134 } 779 }
1135 return true; 780 return true;
1136 } 781 }
1137 782
1138 public delegate bool CanDeleteObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID);
1139 private List<CanDeleteObjectInventoryHandler> CanDeleteObjectInventoryCheckFunctions
1140 = new List<CanDeleteObjectInventoryHandler>();
1141
1142 public void AddCanDeleteObjectInventoryHandler(CanDeleteObjectInventoryHandler delegateFunc)
1143 {
1144 if (!CanDeleteObjectInventoryCheckFunctions.Contains(delegateFunc))
1145 CanDeleteObjectInventoryCheckFunctions.Add(delegateFunc);
1146 }
1147
1148 public void RemoveCanDeleteObjectInventoryHandler(CanDeleteObjectInventoryHandler delegateFunc)
1149 {
1150 if (CanDeleteObjectInventoryCheckFunctions.Contains(delegateFunc))
1151 CanDeleteObjectInventoryCheckFunctions.Remove(delegateFunc);
1152 }
1153
1154 public bool CanDeleteObjectInventory(UUID itemID, UUID objectID, UUID userID) 783 public bool CanDeleteObjectInventory(UUID itemID, UUID objectID, UUID userID)
1155 { 784 {
1156 foreach (CanDeleteObjectInventoryHandler check in CanDeleteObjectInventoryCheckFunctions) 785 DeleteObjectInventoryHandler handler = OnDeleteObjectInventory;
786 if (handler != null)
1157 { 787 {
1158 if (check(itemID, objectID, userID) == false) 788 Delegate[] list = handler.GetInvocationList();
789 foreach (DeleteObjectInventoryHandler h in list)
1159 { 790 {
1160 return false; 791 if (h(itemID, objectID, userID) == false)
792 return false;
1161 } 793 }
1162 } 794 }
1163
1164 return true; 795 return true;
1165 } 796 }
1166 797
1167 public delegate bool CanCreateUserInventoryHandler(int invType, UUID userID);
1168 private List<CanCreateUserInventoryHandler> CanCreateUserInventoryCheckFunctions
1169 = new List<CanCreateUserInventoryHandler>();
1170
1171 public void AddCanCreateUserInventoryHandler(CanCreateUserInventoryHandler delegateFunc)
1172 {
1173 if (!CanCreateUserInventoryCheckFunctions.Contains(delegateFunc))
1174 CanCreateUserInventoryCheckFunctions.Add(delegateFunc);
1175 }
1176
1177 public void RemoveCanCreateUserInventoryHandler(CanCreateUserInventoryHandler delegateFunc)
1178 {
1179 if (CanCreateUserInventoryCheckFunctions.Contains(delegateFunc))
1180 CanCreateUserInventoryCheckFunctions.Remove(delegateFunc);
1181 }
1182
1183 /// <summary> 798 /// <summary>
1184 /// Check whether the specified user is allowed to create the given inventory type in their inventory. 799 /// Check whether the specified user is allowed to create the given inventory type in their inventory.
1185 /// </summary> 800 /// </summary>
@@ -1188,33 +803,19 @@ namespace OpenSim.Region.Framework.Scenes
1188 /// <returns></returns> 803 /// <returns></returns>
1189 public bool CanCreateUserInventory(int invType, UUID userID) 804 public bool CanCreateUserInventory(int invType, UUID userID)
1190 { 805 {
1191 foreach (CanCreateUserInventoryHandler check in CanCreateUserInventoryCheckFunctions) 806 CreateUserInventoryHandler handler = OnCreateUserInventory;
807 if (handler != null)
1192 { 808 {
1193 if (check(invType, userID) == false) 809 Delegate[] list = handler.GetInvocationList();
810 foreach (CreateUserInventoryHandler h in list)
1194 { 811 {
1195 return false; 812 if (h(invType, userID) == false)
813 return false;
1196 } 814 }
1197 } 815 }
1198
1199 return true; 816 return true;
1200 } 817 }
1201 818
1202 public delegate bool CanEditUserInventoryHandler(UUID itemID, UUID userID);
1203 private List<CanEditUserInventoryHandler> CanEditUserInventoryCheckFunctions
1204 = new List<CanEditUserInventoryHandler>();
1205
1206 public void AddCanEditUserInventoryHandler(CanEditUserInventoryHandler delegateFunc)
1207 {
1208 if (!CanEditUserInventoryCheckFunctions.Contains(delegateFunc))
1209 CanEditUserInventoryCheckFunctions.Add(delegateFunc);
1210 }
1211
1212 public void RemoveCanEditUserInventoryHandler(CanEditUserInventoryHandler delegateFunc)
1213 {
1214 if (CanEditUserInventoryCheckFunctions.Contains(delegateFunc))
1215 CanEditUserInventoryCheckFunctions.Remove(delegateFunc);
1216 }
1217
1218 /// <summary> 819 /// <summary>
1219 /// Check whether the specified user is allowed to edit the given inventory item within their own inventory. 820 /// Check whether the specified user is allowed to edit the given inventory item within their own inventory.
1220 /// </summary> 821 /// </summary>
@@ -1223,33 +824,19 @@ namespace OpenSim.Region.Framework.Scenes
1223 /// <returns></returns> 824 /// <returns></returns>
1224 public bool CanEditUserInventory(UUID itemID, UUID userID) 825 public bool CanEditUserInventory(UUID itemID, UUID userID)
1225 { 826 {
1226 foreach (CanEditUserInventoryHandler check in CanEditUserInventoryCheckFunctions) 827 EditUserInventoryHandler handler = OnEditUserInventory;
828 if (handler != null)
1227 { 829 {
1228 if (check(itemID, userID) == false) 830 Delegate[] list = handler.GetInvocationList();
831 foreach (EditUserInventoryHandler h in list)
1229 { 832 {
1230 return false; 833 if (h(itemID, userID) == false)
834 return false;
1231 } 835 }
1232 } 836 }
1233
1234 return true; 837 return true;
1235 } 838 }
1236 839
1237 public delegate bool CanCopyUserInventoryHandler(UUID itemID, UUID userID);
1238 private List<CanCopyUserInventoryHandler> CanCopyUserInventoryCheckFunctions
1239 = new List<CanCopyUserInventoryHandler>();
1240
1241 public void AddCanCopyUserInventoryHandler(CanCopyUserInventoryHandler delegateFunc)
1242 {
1243 if (!CanCopyUserInventoryCheckFunctions.Contains(delegateFunc))
1244 CanCopyUserInventoryCheckFunctions.Add(delegateFunc);
1245 }
1246
1247 public void RemoveCanCopyUserInventoryHandler(CanCopyUserInventoryHandler delegateFunc)
1248 {
1249 if (CanCopyUserInventoryCheckFunctions.Contains(delegateFunc))
1250 CanCopyUserInventoryCheckFunctions.Remove(delegateFunc);
1251 }
1252
1253 /// <summary> 840 /// <summary>
1254 /// Check whether the specified user is allowed to copy the given inventory item from their own inventory. 841 /// Check whether the specified user is allowed to copy the given inventory item from their own inventory.
1255 /// </summary> 842 /// </summary>
@@ -1258,33 +845,19 @@ namespace OpenSim.Region.Framework.Scenes
1258 /// <returns></returns> 845 /// <returns></returns>
1259 public bool CanCopyUserInventory(UUID itemID, UUID userID) 846 public bool CanCopyUserInventory(UUID itemID, UUID userID)
1260 { 847 {
1261 foreach (CanCopyUserInventoryHandler check in CanCopyUserInventoryCheckFunctions) 848 CopyUserInventoryHandler handler = OnCopyUserInventory;
849 if (handler != null)
1262 { 850 {
1263 if (check(itemID, userID) == false) 851 Delegate[] list = handler.GetInvocationList();
852 foreach (CopyUserInventoryHandler h in list)
1264 { 853 {
1265 return false; 854 if (h(itemID, userID) == false)
855 return false;
1266 } 856 }
1267 } 857 }
1268
1269 return true; 858 return true;
1270 } 859 }
1271 860
1272 public delegate bool CanDeleteUserInventoryHandler(UUID itemID, UUID userID);
1273 private List<CanDeleteUserInventoryHandler> CanDeleteUserInventoryCheckFunctions
1274 = new List<CanDeleteUserInventoryHandler>();
1275
1276 public void AddCanDeleteUserInventoryHandler(CanDeleteUserInventoryHandler delegateFunc)
1277 {
1278 if (!CanDeleteUserInventoryCheckFunctions.Contains(delegateFunc))
1279 CanDeleteUserInventoryCheckFunctions.Add(delegateFunc);
1280 }
1281
1282 public void RemoveCanDeleteUserInventoryHandler(CanDeleteUserInventoryHandler delegateFunc)
1283 {
1284 if (CanDeleteUserInventoryCheckFunctions.Contains(delegateFunc))
1285 CanDeleteUserInventoryCheckFunctions.Remove(delegateFunc);
1286 }
1287
1288 /// <summary> 861 /// <summary>
1289 /// Check whether the specified user is allowed to edit the given inventory item within their own inventory. 862 /// Check whether the specified user is allowed to edit the given inventory item within their own inventory.
1290 /// </summary> 863 /// </summary>
@@ -1293,39 +866,29 @@ namespace OpenSim.Region.Framework.Scenes
1293 /// <returns></returns> 866 /// <returns></returns>
1294 public bool CanDeleteUserInventory(UUID itemID, UUID userID) 867 public bool CanDeleteUserInventory(UUID itemID, UUID userID)
1295 { 868 {
1296 foreach (CanDeleteUserInventoryHandler check in CanDeleteUserInventoryCheckFunctions) 869 DeleteUserInventoryHandler handler = OnDeleteUserInventory;
870 if (handler != null)
1297 { 871 {
1298 if (check(itemID, userID) == false) 872 Delegate[] list = handler.GetInvocationList();
873 foreach (DeleteUserInventoryHandler h in list)
1299 { 874 {
1300 return false; 875 if (h(itemID, userID) == false)
876 return false;
1301 } 877 }
1302 } 878 }
1303
1304 return true; 879 return true;
1305 } 880 }
1306 881
1307 public delegate bool CanTeleportHandler(UUID userID);
1308 private List<CanTeleportHandler> CanTeleportCheckFunctions = new List<CanTeleportHandler>();
1309
1310 public void AddCanTeleportHandler(CanTeleportHandler delegateFunc)
1311 {
1312 if (!CanTeleportCheckFunctions.Contains(delegateFunc))
1313 CanTeleportCheckFunctions.Add(delegateFunc);
1314 }
1315
1316 public void RemoveCanTeleportHandler(CanTeleportHandler delegateFunc)
1317 {
1318 if (CanTeleportCheckFunctions.Contains(delegateFunc))
1319 CanTeleportCheckFunctions.Remove(delegateFunc);
1320 }
1321
1322 public bool CanTeleport(UUID userID) 882 public bool CanTeleport(UUID userID)
1323 { 883 {
1324 foreach (CanTeleportHandler check in CanTeleportCheckFunctions) 884 TeleportHandler handler = OnTeleport;
885 if (handler != null)
1325 { 886 {
1326 if (check(userID) == false) 887 Delegate[] list = handler.GetInvocationList();
888 foreach (TeleportHandler h in list)
1327 { 889 {
1328 return false; 890 if (h(userID, m_scene) == false)
891 return false;
1329 } 892 }
1330 } 893 }
1331 return true; 894 return true;