clockwerk-opensim – 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 OpenMetaverse;
30  
31 namespace OpenSim.Framework
32 {
33 /// <summary>
34 /// Inventory Item - contains all the properties associated with an individual inventory piece.
35 /// </summary>
36 public class InventoryItemBase : InventoryNodeBase, ICloneable
37 {
38 public static readonly string SUITCASE_FOLDER_NAME = "My Suitcase";
39 public static readonly sbyte SUITCASE_FOLDER_TYPE = 100;
40 public static readonly sbyte SUITCASE_FOLDER_FAKE_TYPE = 8;
41  
42 /// <value>
43 /// The inventory type of the item. This is slightly different from the asset type in some situations.
44 /// </value>
45 public int InvType
46 {
47 get
48 {
49 return m_invType;
50 }
51  
52 set
53 {
54 m_invType = value;
55 }
56 }
57 protected int m_invType;
58  
59 /// <value>
60 /// The folder this item is contained in
61 /// </value>
62 public UUID Folder
63 {
64 get
65 {
66 return m_folder;
67 }
68  
69 set
70 {
71 m_folder = value;
72 }
73 }
74 protected UUID m_folder;
75  
76 /// <value>
77 /// The creator of this item
78 /// </value>
79 public string CreatorId
80 {
81 get
82 {
83 return m_creatorId;
84 }
85  
86 set
87 {
88 m_creatorId = value;
89  
90 if ((m_creatorId == null) || !UUID.TryParse(m_creatorId, out m_creatorIdAsUuid))
91 m_creatorIdAsUuid = UUID.Zero;
92 }
93 }
94 protected string m_creatorId;
95  
96 /// <value>
97 /// The CreatorId expressed as a UUID.
98 /// </value>
99 public UUID CreatorIdAsUuid
100 {
101 get
102 {
103 if (UUID.Zero == m_creatorIdAsUuid)
104 {
105 UUID.TryParse(CreatorId, out m_creatorIdAsUuid);
106 }
107  
108 return m_creatorIdAsUuid;
109 }
110 }
111 protected UUID m_creatorIdAsUuid = UUID.Zero;
112  
113 /// <summary>
114 /// Extended creator information of the form <profile url>;<name>
115 /// </summary>
116 public string CreatorData // = <profile url>;<name>
117 {
118 get { return m_creatorData; }
119 set { m_creatorData = value; }
120 }
121 protected string m_creatorData = string.Empty;
122  
123 /// <summary>
124 /// Used by the DB layer to retrieve / store the entire user identification.
125 /// The identification can either be a simple UUID or a string of the form
126 /// uuid[;profile_url[;name]]
127 /// </summary>
128 public string CreatorIdentification
129 {
130 get
131 {
132 if (!string.IsNullOrEmpty(m_creatorData))
133 return m_creatorId + ';' + m_creatorData;
134 else
135 return m_creatorId;
136 }
137 set
138 {
139 if ((value == null) || (value != null && value == string.Empty))
140 {
141 m_creatorData = string.Empty;
142 return;
143 }
144  
145 if (!value.Contains(";")) // plain UUID
146 {
147 m_creatorId = value;
148 }
149 else // <uuid>[;<endpoint>[;name]]
150 {
151 string name = "Unknown User";
152 string[] parts = value.Split(';');
153 if (parts.Length >= 1)
154 m_creatorId = parts[0];
155 if (parts.Length >= 2)
156 m_creatorData = parts[1];
157 if (parts.Length >= 3)
158 name = parts[2];
159  
160 m_creatorData += ';' + name;
161 }
162 }
163 }
164  
165 /// <value>
166 /// The description of the inventory item (must be less than 64 characters)
167 /// </value>
168 public string Description
169 {
170 get
171 {
172 return m_description;
173 }
174  
175 set
176 {
177 m_description = value;
178 }
179 }
180 protected string m_description = String.Empty;
181  
182 /// <value>
183 ///
184 /// </value>
185 public uint NextPermissions
186 {
187 get
188 {
189 return m_nextPermissions;
190 }
191  
192 set
193 {
194 m_nextPermissions = value;
195 }
196 }
197 protected uint m_nextPermissions;
198  
199 /// <value>
200 /// A mask containing permissions for the current owner (cannot be enforced)
201 /// </value>
202 public uint CurrentPermissions
203 {
204 get
205 {
206 return m_currentPermissions;
207 }
208  
209 set
210 {
211 m_currentPermissions = value;
212 }
213 }
214 protected uint m_currentPermissions;
215  
216 /// <value>
217 ///
218 /// </value>
219 public uint BasePermissions
220 {
221 get
222 {
223 return m_basePermissions;
224 }
225  
226 set
227 {
228 m_basePermissions = value;
229 }
230 }
231 protected uint m_basePermissions;
232  
233 /// <value>
234 ///
235 /// </value>
236 public uint EveryOnePermissions
237 {
238 get
239 {
240 return m_everyonePermissions;
241 }
242  
243 set
244 {
245 m_everyonePermissions = value;
246 }
247 }
248 protected uint m_everyonePermissions;
249  
250 /// <value>
251 ///
252 /// </value>
253 public uint GroupPermissions
254 {
255 get
256 {
257 return m_groupPermissions;
258 }
259  
260 set
261 {
262 m_groupPermissions = value;
263 }
264 }
265 protected uint m_groupPermissions;
266  
267 /// <value>
268 /// This is an enumerated value determining the type of asset (eg Notecard, Sound, Object, etc)
269 /// </value>
270 public int AssetType
271 {
272 get
273 {
274 return m_assetType;
275 }
276  
277 set
278 {
279 m_assetType = value;
280 }
281 }
282 protected int m_assetType;
283  
284 /// <value>
285 /// The UUID of the associated asset on the asset server
286 /// </value>
287 public UUID AssetID
288 {
289 get
290 {
291 return m_assetID;
292 }
293  
294 set
295 {
296 m_assetID = value;
297 }
298 }
299 protected UUID m_assetID;
300  
301 /// <value>
302 ///
303 /// </value>
304 public UUID GroupID
305 {
306 get
307 {
308 return m_groupID;
309 }
310  
311 set
312 {
313 m_groupID = value;
314 }
315 }
316 protected UUID m_groupID;
317  
318 /// <value>
319 ///
320 /// </value>
321 public bool GroupOwned
322 {
323 get
324 {
325 return m_groupOwned;
326 }
327  
328 set
329 {
330 m_groupOwned = value;
331 }
332 }
333 protected bool m_groupOwned;
334  
335 /// <value>
336 ///
337 /// </value>
338 public int SalePrice
339 {
340 get
341 {
342 return m_salePrice;
343 }
344  
345 set
346 {
347 m_salePrice = value;
348 }
349 }
350 protected int m_salePrice;
351  
352 /// <value>
353 ///
354 /// </value>
355 public byte SaleType
356 {
357 get
358 {
359 return m_saleType;
360 }
361  
362 set
363 {
364 m_saleType = value;
365 }
366 }
367 protected byte m_saleType;
368  
369 /// <value>
370 ///
371 /// </value>
372 public uint Flags
373 {
374 get
375 {
376 return m_flags;
377 }
378  
379 set
380 {
381 m_flags = value;
382 }
383 }
384 protected uint m_flags;
385  
386 /// <value>
387 ///
388 /// </value>
389 public int CreationDate
390 {
391 get
392 {
393 return m_creationDate;
394 }
395  
396 set
397 {
398 m_creationDate = value;
399 }
400 }
401 protected int m_creationDate = (int)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
402  
403 public InventoryItemBase()
404 {
405 }
406  
407 public InventoryItemBase(UUID id)
408 {
409 ID = id;
410 }
411  
412 public InventoryItemBase(UUID id, UUID owner)
413 {
414 ID = id;
415 Owner = owner;
416 }
417  
418 public object Clone()
419 {
420 return MemberwiseClone();
421 }
422 }
423 }