opensim – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | eva | 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.Reflection; |
||
30 | using log4net; |
||
31 | using OpenMetaverse; |
||
32 | |||
33 | namespace OpenSim.Framework |
||
34 | { |
||
35 | /// <summary> |
||
36 | /// Represents an item in a task inventory |
||
37 | /// </summary> |
||
38 | public class TaskInventoryItem : ICloneable |
||
39 | { |
||
40 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
||
41 | |||
42 | /// <summary> |
||
43 | /// XXX This should really be factored out into some constants class. |
||
44 | /// </summary> |
||
45 | private const uint FULL_MASK_PERMISSIONS_GENERAL = 2147483647; |
||
46 | |||
47 | private UUID _assetID = UUID.Zero; |
||
48 | |||
49 | private uint _baseMask = FULL_MASK_PERMISSIONS_GENERAL; |
||
50 | private uint _creationDate = 0; |
||
51 | private UUID _creatorID = UUID.Zero; |
||
52 | private string _creatorData = String.Empty; |
||
53 | private string _description = String.Empty; |
||
54 | private uint _everyoneMask = FULL_MASK_PERMISSIONS_GENERAL; |
||
55 | private uint _flags = 0; |
||
56 | private UUID _groupID = UUID.Zero; |
||
57 | private uint _groupMask = FULL_MASK_PERMISSIONS_GENERAL; |
||
58 | |||
59 | private int _invType = 0; |
||
60 | private UUID _itemID = UUID.Zero; |
||
61 | private UUID _lastOwnerID = UUID.Zero; |
||
62 | private string _name = String.Empty; |
||
63 | private uint _nextOwnerMask = FULL_MASK_PERMISSIONS_GENERAL; |
||
64 | private UUID _ownerID = UUID.Zero; |
||
65 | private uint _ownerMask = FULL_MASK_PERMISSIONS_GENERAL; |
||
66 | private UUID _parentID = UUID.Zero; //parent folder id |
||
67 | private UUID _parentPartID = UUID.Zero; // SceneObjectPart this is inside |
||
68 | private UUID _permsGranter; |
||
69 | private int _permsMask; |
||
70 | private int _type = 0; |
||
71 | private UUID _oldID; |
||
72 | private UUID _loadedID = UUID.Zero; |
||
73 | |||
74 | private bool _ownerChanged = false; |
||
75 | |||
76 | public UUID AssetID { |
||
77 | get { |
||
78 | return _assetID; |
||
79 | } |
||
80 | set { |
||
81 | _assetID = value; |
||
82 | } |
||
83 | } |
||
84 | |||
85 | public uint BasePermissions { |
||
86 | get { |
||
87 | return _baseMask; |
||
88 | } |
||
89 | set { |
||
90 | _baseMask = value; |
||
91 | } |
||
92 | } |
||
93 | |||
94 | public uint CreationDate { |
||
95 | get { |
||
96 | return _creationDate; |
||
97 | } |
||
98 | set { |
||
99 | _creationDate = value; |
||
100 | } |
||
101 | } |
||
102 | |||
103 | public UUID CreatorID { |
||
104 | get { |
||
105 | return _creatorID; |
||
106 | } |
||
107 | set { |
||
108 | _creatorID = value; |
||
109 | } |
||
110 | } |
||
111 | |||
112 | public string CreatorData // = <profile url>;<name> |
||
113 | { |
||
114 | get { return _creatorData; } |
||
115 | set { _creatorData = value; } |
||
116 | } |
||
117 | |||
118 | /// <summary> |
||
119 | /// Used by the DB layer to retrieve / store the entire user identification. |
||
120 | /// The identification can either be a simple UUID or a string of the form |
||
121 | /// uuid[;profile_url[;name]] |
||
122 | /// </summary> |
||
123 | public string CreatorIdentification |
||
124 | { |
||
125 | get |
||
126 | { |
||
127 | if (!string.IsNullOrEmpty(_creatorData)) |
||
128 | return _creatorID.ToString() + ';' + _creatorData; |
||
129 | else |
||
130 | return _creatorID.ToString(); |
||
131 | } |
||
132 | set |
||
133 | { |
||
134 | if ((value == null) || (value != null && value == string.Empty)) |
||
135 | { |
||
136 | _creatorData = string.Empty; |
||
137 | return; |
||
138 | } |
||
139 | |||
140 | if (!value.Contains(";")) // plain UUID |
||
141 | { |
||
142 | UUID uuid = UUID.Zero; |
||
143 | UUID.TryParse(value, out uuid); |
||
144 | _creatorID = uuid; |
||
145 | } |
||
146 | else // <uuid>[;<endpoint>[;name]] |
||
147 | { |
||
148 | string name = "Unknown User"; |
||
149 | string[] parts = value.Split(';'); |
||
150 | if (parts.Length >= 1) |
||
151 | { |
||
152 | UUID uuid = UUID.Zero; |
||
153 | UUID.TryParse(parts[0], out uuid); |
||
154 | _creatorID = uuid; |
||
155 | } |
||
156 | if (parts.Length >= 2) |
||
157 | _creatorData = parts[1]; |
||
158 | if (parts.Length >= 3) |
||
159 | name = parts[2]; |
||
160 | |||
161 | _creatorData += ';' + name; |
||
162 | |||
163 | } |
||
164 | } |
||
165 | } |
||
166 | |||
167 | public string Description { |
||
168 | get { |
||
169 | return _description; |
||
170 | } |
||
171 | set { |
||
172 | _description = value; |
||
173 | } |
||
174 | } |
||
175 | |||
176 | public uint EveryonePermissions { |
||
177 | get { |
||
178 | return _everyoneMask; |
||
179 | } |
||
180 | set { |
||
181 | _everyoneMask = value; |
||
182 | } |
||
183 | } |
||
184 | |||
185 | public uint Flags { |
||
186 | get { |
||
187 | return _flags; |
||
188 | } |
||
189 | set { |
||
190 | _flags = value; |
||
191 | } |
||
192 | } |
||
193 | |||
194 | public UUID GroupID { |
||
195 | get { |
||
196 | return _groupID; |
||
197 | } |
||
198 | set { |
||
199 | _groupID = value; |
||
200 | } |
||
201 | } |
||
202 | |||
203 | public uint GroupPermissions { |
||
204 | get { |
||
205 | return _groupMask; |
||
206 | } |
||
207 | set { |
||
208 | _groupMask = value; |
||
209 | } |
||
210 | } |
||
211 | |||
212 | public int InvType { |
||
213 | get { |
||
214 | return _invType; |
||
215 | } |
||
216 | set { |
||
217 | _invType = value; |
||
218 | } |
||
219 | } |
||
220 | |||
221 | public UUID ItemID { |
||
222 | get { |
||
223 | return _itemID; |
||
224 | } |
||
225 | set { |
||
226 | _itemID = value; |
||
227 | } |
||
228 | } |
||
229 | |||
230 | public UUID OldItemID { |
||
231 | get { |
||
232 | return _oldID; |
||
233 | } |
||
234 | set { |
||
235 | _oldID = value; |
||
236 | } |
||
237 | } |
||
238 | |||
239 | public UUID LoadedItemID { |
||
240 | get { |
||
241 | return _loadedID; |
||
242 | } |
||
243 | set { |
||
244 | _loadedID = value; |
||
245 | } |
||
246 | } |
||
247 | |||
248 | public UUID LastOwnerID { |
||
249 | get { |
||
250 | return _lastOwnerID; |
||
251 | } |
||
252 | set { |
||
253 | _lastOwnerID = value; |
||
254 | } |
||
255 | } |
||
256 | |||
257 | public string Name { |
||
258 | get { |
||
259 | return _name; |
||
260 | } |
||
261 | set { |
||
262 | _name = value; |
||
263 | } |
||
264 | } |
||
265 | |||
266 | public uint NextPermissions { |
||
267 | get { |
||
268 | return _nextOwnerMask; |
||
269 | } |
||
270 | set { |
||
271 | _nextOwnerMask = value; |
||
272 | } |
||
273 | } |
||
274 | |||
275 | public UUID OwnerID { |
||
276 | get { |
||
277 | return _ownerID; |
||
278 | } |
||
279 | set { |
||
280 | _ownerID = value; |
||
281 | } |
||
282 | } |
||
283 | |||
284 | public uint CurrentPermissions { |
||
285 | get { |
||
286 | return _ownerMask; |
||
287 | } |
||
288 | set { |
||
289 | _ownerMask = value; |
||
290 | } |
||
291 | } |
||
292 | |||
293 | public UUID ParentID { |
||
294 | get { |
||
295 | return _parentID; |
||
296 | } |
||
297 | set { |
||
298 | _parentID = value; |
||
299 | } |
||
300 | } |
||
301 | |||
302 | public UUID ParentPartID { |
||
303 | get { |
||
304 | return _parentPartID; |
||
305 | } |
||
306 | set { |
||
307 | _parentPartID = value; |
||
308 | } |
||
309 | } |
||
310 | |||
311 | public UUID PermsGranter { |
||
312 | get { |
||
313 | return _permsGranter; |
||
314 | } |
||
315 | set { |
||
316 | _permsGranter = value; |
||
317 | } |
||
318 | } |
||
319 | |||
320 | public int PermsMask { |
||
321 | get { |
||
322 | return _permsMask; |
||
323 | } |
||
324 | set { |
||
325 | _permsMask = value; |
||
326 | } |
||
327 | } |
||
328 | |||
329 | public int Type { |
||
330 | get { |
||
331 | return _type; |
||
332 | } |
||
333 | set { |
||
334 | _type = value; |
||
335 | } |
||
336 | } |
||
337 | |||
338 | public bool OwnerChanged |
||
339 | { |
||
340 | get |
||
341 | { |
||
342 | return _ownerChanged; |
||
343 | } |
||
344 | set |
||
345 | { |
||
346 | _ownerChanged = value; |
||
347 | // m_log.DebugFormat( |
||
348 | // "[TASK INVENTORY ITEM]: Owner changed set {0} for {1} {2} owned by {3}", |
||
349 | // _ownerChanged, Name, ItemID, OwnerID); |
||
350 | } |
||
351 | } |
||
352 | |||
353 | /// <summary> |
||
354 | /// This used ONLY during copy. It can't be relied on at other times! |
||
355 | /// </summary> |
||
356 | /// <remarks> |
||
357 | /// For true script running status, use IEntityInventory.TryGetScriptInstanceRunning() for now. |
||
358 | /// </remarks> |
||
359 | public bool ScriptRunning { get; set; } |
||
360 | |||
361 | // See ICloneable |
||
362 | |||
363 | #region ICloneable Members |
||
364 | |||
365 | public Object Clone() |
||
366 | { |
||
367 | return MemberwiseClone(); |
||
368 | } |
||
369 | |||
370 | #endregion |
||
371 | |||
372 | /// <summary> |
||
373 | /// Reset the UUIDs for this item. |
||
374 | /// </summary> |
||
375 | /// <param name="partID">The new part ID to which this item belongs</param> |
||
376 | public void ResetIDs(UUID partID) |
||
377 | { |
||
378 | LoadedItemID = OldItemID; |
||
379 | OldItemID = ItemID; |
||
380 | ItemID = UUID.Random(); |
||
381 | ParentPartID = partID; |
||
382 | ParentID = partID; |
||
383 | } |
||
384 | |||
385 | public TaskInventoryItem() |
||
386 | { |
||
387 | ScriptRunning = true; |
||
388 | CreationDate = (uint)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; |
||
389 | } |
||
390 | } |
||
391 | } |