clockwerk-opensim-stable – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 vero 1 /*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27  
28 using System;
29 using System.Collections.Generic;
30 using System.IO;
31 using OpenMetaverse;
32  
33 namespace OpenSim.Framework
34 {
35 public class EstateSettings
36 {
37 // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
38  
39 public delegate void SaveDelegate(EstateSettings rs);
40  
41 public event SaveDelegate OnSave;
42  
43 // Only the client uses these
44 //
45 private uint m_EstateID = 0;
46  
47 public uint EstateID
48 {
49 get { return m_EstateID; }
50 set { m_EstateID = value; }
51 }
52  
53 private string m_EstateName = "My Estate";
54  
55 public string EstateName
56 {
57 get { return m_EstateName; }
58 set { m_EstateName = value; }
59 }
60  
61 private bool m_AllowLandmark = true;
62  
63 public bool AllowLandmark
64 {
65 get { return m_AllowLandmark; }
66 set { m_AllowLandmark = value; }
67 }
68  
69 private bool m_AllowParcelChanges = true;
70  
71 public bool AllowParcelChanges
72 {
73 get { return m_AllowParcelChanges; }
74 set { m_AllowParcelChanges = value; }
75 }
76  
77 private bool m_AllowSetHome = true;
78  
79 public bool AllowSetHome
80 {
81 get { return m_AllowSetHome; }
82 set { m_AllowSetHome = value; }
83 }
84  
85 private uint m_ParentEstateID = 1;
86  
87 public uint ParentEstateID
88 {
89 get { return m_ParentEstateID; }
90 set { m_ParentEstateID = value; }
91 }
92  
93 private float m_BillableFactor = 0.0f;
94  
95 public float BillableFactor
96 {
97 get { return m_BillableFactor; }
98 set { m_BillableFactor = value; }
99 }
100  
101 private int m_PricePerMeter = 1;
102  
103 public int PricePerMeter
104 {
105 get { return m_PricePerMeter; }
106 set { m_PricePerMeter = value; }
107 }
108  
109 private int m_RedirectGridX = 0;
110  
111 public int RedirectGridX
112 {
113 get { return m_RedirectGridX; }
114 set { m_RedirectGridX = value; }
115 }
116  
117 private int m_RedirectGridY = 0;
118  
119 public int RedirectGridY
120 {
121 get { return m_RedirectGridY; }
122 set { m_RedirectGridY = value; }
123 }
124  
125 // Used by the sim
126 //
127 private bool m_UseGlobalTime = true;
128  
129 public bool UseGlobalTime
130 {
131 get { return m_UseGlobalTime; }
132 set { m_UseGlobalTime = value; }
133 }
134  
135 private bool m_FixedSun = false;
136  
137 public bool FixedSun
138 {
139 get { return m_FixedSun; }
140 set { m_FixedSun = value; }
141 }
142  
143 private double m_SunPosition = 0.0;
144  
145 public double SunPosition
146 {
147 get { return m_SunPosition; }
148 set { m_SunPosition = value; }
149 }
150  
151 private bool m_AllowVoice = true;
152  
153 public bool AllowVoice
154 {
155 get { return m_AllowVoice; }
156 set { m_AllowVoice = value; }
157 }
158  
159 private bool m_AllowDirectTeleport = true;
160  
161 public bool AllowDirectTeleport
162 {
163 get { return m_AllowDirectTeleport; }
164 set { m_AllowDirectTeleport = value; }
165 }
166  
167 private bool m_DenyAnonymous = false;
168  
169 public bool DenyAnonymous
170 {
171 get { return m_DenyAnonymous; }
172 set { m_DenyAnonymous = value; }
173 }
174  
175 private bool m_DenyIdentified = false;
176  
177 public bool DenyIdentified
178 {
179 get { return m_DenyIdentified; }
180 set { m_DenyIdentified = value; }
181 }
182  
183 private bool m_DenyTransacted = false;
184  
185 public bool DenyTransacted
186 {
187 get { return m_DenyTransacted; }
188 set { m_DenyTransacted = value; }
189 }
190  
191 private bool m_AbuseEmailToEstateOwner = false;
192  
193 public bool AbuseEmailToEstateOwner
194 {
195 get { return m_AbuseEmailToEstateOwner; }
196 set { m_AbuseEmailToEstateOwner = value; }
197 }
198  
199 private bool m_BlockDwell = false;
200  
201 public bool BlockDwell
202 {
203 get { return m_BlockDwell; }
204 set { m_BlockDwell = value; }
205 }
206  
207 private bool m_EstateSkipScripts = false;
208  
209 public bool EstateSkipScripts
210 {
211 get { return m_EstateSkipScripts; }
212 set { m_EstateSkipScripts = value; }
213 }
214  
215 private bool m_ResetHomeOnTeleport = false;
216  
217 public bool ResetHomeOnTeleport
218 {
219 get { return m_ResetHomeOnTeleport; }
220 set { m_ResetHomeOnTeleport = value; }
221 }
222  
223 private bool m_TaxFree = false;
224  
225 public bool TaxFree
226 {
227 get { return m_TaxFree; }
228 set { m_TaxFree = value; }
229 }
230  
231 private bool m_PublicAccess = true;
232  
233 public bool PublicAccess
234 {
235 get { return m_PublicAccess; }
236 set { m_PublicAccess = value; }
237 }
238  
239 private string m_AbuseEmail = String.Empty;
240  
241 public string AbuseEmail
242 {
243 get { return m_AbuseEmail; }
244 set { m_AbuseEmail= value; }
245 }
246  
247 private UUID m_EstateOwner = UUID.Zero;
248  
249 public UUID EstateOwner
250 {
251 get { return m_EstateOwner; }
252 set { m_EstateOwner = value; }
253 }
254  
255 private bool m_DenyMinors = false;
256  
257 public bool DenyMinors
258 {
259 get { return m_DenyMinors; }
260 set { m_DenyMinors = value; }
261 }
262  
263 // All those lists...
264 //
265 private List<UUID> l_EstateManagers = new List<UUID>();
266  
267 public UUID[] EstateManagers
268 {
269 get { return l_EstateManagers.ToArray(); }
270 set { l_EstateManagers = new List<UUID>(value); }
271 }
272  
273 private List<EstateBan> l_EstateBans = new List<EstateBan>();
274  
275 public EstateBan[] EstateBans
276 {
277 get { return l_EstateBans.ToArray(); }
278 set { l_EstateBans = new List<EstateBan>(value); }
279 }
280  
281 private List<UUID> l_EstateAccess = new List<UUID>();
282  
283 public UUID[] EstateAccess
284 {
285 get { return l_EstateAccess.ToArray(); }
286 set { l_EstateAccess = new List<UUID>(value); }
287 }
288  
289 private List<UUID> l_EstateGroups = new List<UUID>();
290  
291 public UUID[] EstateGroups
292 {
293 get { return l_EstateGroups.ToArray(); }
294 set { l_EstateGroups = new List<UUID>(value); }
295 }
296  
297 public EstateSettings()
298 {
299 }
300  
301 public void Save()
302 {
303 if (OnSave != null)
304 OnSave(this);
305 }
306  
307 public void AddEstateUser(UUID avatarID)
308 {
309 if (avatarID == UUID.Zero)
310 return;
311 if (!l_EstateAccess.Contains(avatarID))
312 l_EstateAccess.Add(avatarID);
313 }
314  
315 public void RemoveEstateUser(UUID avatarID)
316 {
317 if (l_EstateAccess.Contains(avatarID))
318 l_EstateAccess.Remove(avatarID);
319 }
320  
321 public void AddEstateGroup(UUID avatarID)
322 {
323 if (avatarID == UUID.Zero)
324 return;
325 if (!l_EstateGroups.Contains(avatarID))
326 l_EstateGroups.Add(avatarID);
327 }
328  
329 public void RemoveEstateGroup(UUID avatarID)
330 {
331 if (l_EstateGroups.Contains(avatarID))
332 l_EstateGroups.Remove(avatarID);
333 }
334  
335 public void AddEstateManager(UUID avatarID)
336 {
337 if (avatarID == UUID.Zero)
338 return;
339 if (!l_EstateManagers.Contains(avatarID))
340 l_EstateManagers.Add(avatarID);
341 }
342  
343 public void RemoveEstateManager(UUID avatarID)
344 {
345 if (l_EstateManagers.Contains(avatarID))
346 l_EstateManagers.Remove(avatarID);
347 }
348  
349 public bool IsEstateManagerOrOwner(UUID avatarID)
350 {
351 if (IsEstateOwner(avatarID))
352 return true;
353  
354 return l_EstateManagers.Contains(avatarID);
355 }
356  
357 public bool IsEstateOwner(UUID avatarID)
358 {
359 if (avatarID == m_EstateOwner)
360 return true;
361  
362 return false;
363 }
364  
365 public bool IsBanned(UUID avatarID)
366 {
367 foreach (EstateBan ban in l_EstateBans)
368 if (ban.BannedUserID == avatarID)
369 return true;
370 return false;
371 }
372  
373 public void AddBan(EstateBan ban)
374 {
375 if (ban == null)
376 return;
377 if (!IsBanned(ban.BannedUserID))
378 l_EstateBans.Add(ban);
379 }
380  
381 public void ClearBans()
382 {
383 l_EstateBans.Clear();
384 }
385  
386 public void RemoveBan(UUID avatarID)
387 {
388 foreach (EstateBan ban in new List<EstateBan>(l_EstateBans))
389 if (ban.BannedUserID == avatarID)
390 l_EstateBans.Remove(ban);
391 }
392  
393 public bool HasAccess(UUID user)
394 {
395 if (IsEstateManagerOrOwner(user))
396 return true;
397  
398 return l_EstateAccess.Contains(user);
399 }
400  
401 public void SetFromFlags(ulong regionFlags)
402 {
403 ResetHomeOnTeleport = ((regionFlags & (ulong)OpenMetaverse.RegionFlags.ResetHomeOnTeleport) == (ulong)OpenMetaverse.RegionFlags.ResetHomeOnTeleport);
404 BlockDwell = ((regionFlags & (ulong)OpenMetaverse.RegionFlags.BlockDwell) == (ulong)OpenMetaverse.RegionFlags.BlockDwell);
405 AllowLandmark = ((regionFlags & (ulong)OpenMetaverse.RegionFlags.AllowLandmark) == (ulong)OpenMetaverse.RegionFlags.AllowLandmark);
406 AllowParcelChanges = ((regionFlags & (ulong)OpenMetaverse.RegionFlags.AllowParcelChanges) == (ulong)OpenMetaverse.RegionFlags.AllowParcelChanges);
407 AllowSetHome = ((regionFlags & (ulong)OpenMetaverse.RegionFlags.AllowSetHome) == (ulong)OpenMetaverse.RegionFlags.AllowSetHome);
408 }
409  
410 public bool GroupAccess(UUID groupID)
411 {
412 return l_EstateGroups.Contains(groupID);
413 }
414 }
415 }