diff options
author | Justin Clarke Casey | 2009-05-04 16:15:30 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2009-05-04 16:15:30 +0000 |
commit | a61cbab799886e43749bc4d0803e579fec000f4c (patch) | |
tree | be4e32c991268d54c7d6b2d70edd49ac9c816265 /OpenSim | |
parent | * minor: remove some mono compiler warnings, minor cleanup (diff) | |
download | opensim-SC-a61cbab799886e43749bc4d0803e579fec000f4c.zip opensim-SC-a61cbab799886e43749bc4d0803e579fec000f4c.tar.gz opensim-SC-a61cbab799886e43749bc4d0803e579fec000f4c.tar.bz2 opensim-SC-a61cbab799886e43749bc4d0803e579fec000f4c.tar.xz |
* Insert profile references for creators for items saved into iars
Diffstat (limited to 'OpenSim')
4 files changed, 59 insertions, 52 deletions
diff --git a/OpenSim/Framework/Communications/OspResolver.cs b/OpenSim/Framework/Communications/OspResolver.cs index 924a4a9..073abf8 100644 --- a/OpenSim/Framework/Communications/OspResolver.cs +++ b/OpenSim/Framework/Communications/OspResolver.cs | |||
@@ -50,7 +50,22 @@ namespace OpenSim.Framework.Communications | |||
50 | public const string OSPA_PAIR_SEPARATOR = "="; | 50 | public const string OSPA_PAIR_SEPARATOR = "="; |
51 | 51 | ||
52 | /// <summary> | 52 | /// <summary> |
53 | /// Make an OSPA given an avatar name | 53 | /// Make an OSPA given a user UUID |
54 | /// </summary> | ||
55 | /// <param name="userId"></param> | ||
56 | /// <param name="commsManager"></param> | ||
57 | /// <returns>The OSPA. Null if a user with the given UUID could not be found.</returns> | ||
58 | public static string MakeOspa(UUID userId, CommunicationsManager commsManager) | ||
59 | { | ||
60 | CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(userId); | ||
61 | if (userInfo != null) | ||
62 | return MakeOspa(userInfo.UserProfile.FirstName, userInfo.UserProfile.SurName); | ||
63 | |||
64 | return null; | ||
65 | } | ||
66 | |||
67 | /// <summary> | ||
68 | /// Make an OSPA given a user name | ||
54 | /// </summary> | 69 | /// </summary> |
55 | /// <param name="name"></param> | 70 | /// <param name="name"></param> |
56 | /// <returns></returns> | 71 | /// <returns></returns> |
@@ -58,7 +73,7 @@ namespace OpenSim.Framework.Communications | |||
58 | { | 73 | { |
59 | return | 74 | return |
60 | OSPA_PREFIX + OSPA_NAME_KEY + OSPA_PAIR_SEPARATOR + firstName + OSPA_NAME_VALUE_SEPARATOR + lastName; | 75 | OSPA_PREFIX + OSPA_NAME_KEY + OSPA_PAIR_SEPARATOR + firstName + OSPA_NAME_VALUE_SEPARATOR + lastName; |
61 | } | 76 | } |
62 | 77 | ||
63 | /// <summary> | 78 | /// <summary> |
64 | /// Resolve an osp string into the most suitable internal OpenSim identifier. | 79 | /// Resolve an osp string into the most suitable internal OpenSim identifier. |
@@ -74,7 +89,7 @@ namespace OpenSim.Framework.Communications | |||
74 | /// return that same string. If the input string was ospi data but no valid profile information has been found, | 89 | /// return that same string. If the input string was ospi data but no valid profile information has been found, |
75 | /// then returns null. | 90 | /// then returns null. |
76 | /// </returns> | 91 | /// </returns> |
77 | public static string Resolve(string ospa, CommunicationsManager commsManager) | 92 | public static string ResolveOspa(string ospa, CommunicationsManager commsManager) |
78 | { | 93 | { |
79 | m_log.DebugFormat("[OSP RESOLVER]: Resolving {0}", ospa); | 94 | m_log.DebugFormat("[OSP RESOLVER]: Resolving {0}", ospa); |
80 | 95 | ||
diff --git a/OpenSim/Framework/InventoryItemBase.cs b/OpenSim/Framework/InventoryItemBase.cs index b14ce7f..29142af 100644 --- a/OpenSim/Framework/InventoryItemBase.cs +++ b/OpenSim/Framework/InventoryItemBase.cs | |||
@@ -35,14 +35,14 @@ namespace OpenSim.Framework | |||
35 | /// </summary> | 35 | /// </summary> |
36 | public class InventoryItemBase : InventoryNodeBase, ICloneable | 36 | public class InventoryItemBase : InventoryNodeBase, ICloneable |
37 | { | 37 | { |
38 | /// <summary> | 38 | /// <value> |
39 | /// The inventory type of the item. This is slightly different from the asset type in some situations. | 39 | /// The inventory type of the item. This is slightly different from the asset type in some situations. |
40 | /// </summary> | 40 | /// </value> |
41 | public int InvType; | 41 | public int InvType; |
42 | 42 | ||
43 | /// <summary> | 43 | /// <value> |
44 | /// The folder this item is contained in | 44 | /// The folder this item is contained in |
45 | /// </summary> | 45 | /// </value> |
46 | public UUID Folder; | 46 | public UUID Folder; |
47 | 47 | ||
48 | /// <value> | 48 | /// <value> |
@@ -69,9 +69,9 @@ namespace OpenSim.Framework | |||
69 | /// </value> | 69 | /// </value> |
70 | public UUID CreatorIdAsUuid { get; private set; } | 70 | public UUID CreatorIdAsUuid { get; private set; } |
71 | 71 | ||
72 | /// <summary> | 72 | /// <value> |
73 | /// The description of the inventory item (must be less than 64 characters) | 73 | /// The description of the inventory item (must be less than 64 characters) |
74 | /// </summary> | 74 | /// </value> |
75 | public string Description = String.Empty; | 75 | public string Description = String.Empty; |
76 | 76 | ||
77 | /// <value> | 77 | /// <value> |
@@ -79,80 +79,69 @@ namespace OpenSim.Framework | |||
79 | /// </value> | 79 | /// </value> |
80 | public uint NextPermissions; | 80 | public uint NextPermissions; |
81 | 81 | ||
82 | /// <summary> | 82 | /// <value> |
83 | /// A mask containing permissions for the current owner (cannot be enforced) | 83 | /// A mask containing permissions for the current owner (cannot be enforced) |
84 | /// </summary> | 84 | /// </value> |
85 | public uint CurrentPermissions; | 85 | public uint CurrentPermissions; |
86 | 86 | ||
87 | /// <summary> | 87 | /// <value> |
88 | /// | 88 | /// |
89 | /// </summary> | 89 | /// </value> |
90 | public uint BasePermissions; | 90 | public uint BasePermissions; |
91 | 91 | ||
92 | /// <summary> | 92 | /// <value> |
93 | /// | 93 | /// |
94 | /// </summary> | 94 | /// </value> |
95 | public uint EveryOnePermissions; | 95 | public uint EveryOnePermissions; |
96 | 96 | ||
97 | /// <summary> | 97 | /// <value> |
98 | /// | 98 | /// |
99 | /// </summary> | 99 | /// </value> |
100 | public uint GroupPermissions; | 100 | public uint GroupPermissions; |
101 | 101 | ||
102 | /// <summary> | 102 | /// <value> |
103 | /// This is an enumerated value determining the type of asset (eg Notecard, Sound, Object, etc) | 103 | /// This is an enumerated value determining the type of asset (eg Notecard, Sound, Object, etc) |
104 | /// </summary> | 104 | /// </value> |
105 | public int AssetType; | 105 | public int AssetType; |
106 | 106 | ||
107 | /// <summary> | 107 | /// <value> |
108 | /// The UUID of the associated asset on the asset server | 108 | /// The UUID of the associated asset on the asset server |
109 | /// </summary> | 109 | /// </value> |
110 | public UUID AssetID; | 110 | public UUID AssetID; |
111 | 111 | ||
112 | /// <summary> | 112 | /// <value> |
113 | /// | 113 | /// |
114 | /// </summary> | 114 | /// </value> |
115 | public UUID GroupID; | 115 | public UUID GroupID; |
116 | 116 | ||
117 | /// <summary> | 117 | /// <value> |
118 | /// | 118 | /// |
119 | /// </summary> | 119 | /// </value> |
120 | public bool GroupOwned; | 120 | public bool GroupOwned; |
121 | 121 | ||
122 | /// <summary> | 122 | /// <value> |
123 | /// | 123 | /// |
124 | /// </summary> | 124 | /// </value> |
125 | public int SalePrice; | 125 | public int SalePrice; |
126 | 126 | ||
127 | /// <summary> | 127 | /// <value> |
128 | /// | 128 | /// |
129 | /// </summary> | 129 | /// </value> |
130 | public byte SaleType; | 130 | public byte SaleType; |
131 | 131 | ||
132 | /// <summary> | 132 | /// <value> |
133 | /// | 133 | /// |
134 | /// </summary> | 134 | /// </value> |
135 | public uint Flags; | 135 | public uint Flags; |
136 | 136 | ||
137 | /// <summary> | 137 | /// <value> |
138 | /// | 138 | /// |
139 | /// </summary> | 139 | /// </value> |
140 | public int CreationDate; | 140 | public int CreationDate = (int)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; |
141 | |||
142 | public InventoryItemBase() | ||
143 | { | ||
144 | CreationDate = (int)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; | ||
145 | } | ||
146 | 141 | ||
147 | public object Clone() | 142 | public object Clone() |
148 | { | 143 | { |
149 | InventoryItemBase clone = new InventoryItemBase(); | 144 | return MemberwiseClone(); |
150 | clone.AssetID = AssetID; | ||
151 | clone.AssetType = AssetType; | ||
152 | clone.BasePermissions = BasePermissions; | ||
153 | clone.CreationDate = CreationDate; | ||
154 | clone.CreatorId = CreatorId; | ||
155 | |||
156 | } | 145 | } |
157 | } | 146 | } |
158 | } | 147 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index 75e39d1..d9c154a 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs | |||
@@ -156,7 +156,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
156 | // Don't use the item ID that's in the file | 156 | // Don't use the item ID that's in the file |
157 | item.ID = UUID.Random(); | 157 | item.ID = UUID.Random(); |
158 | 158 | ||
159 | string ospResolvedId = OspResolver.Resolve(item.CreatorId, m_commsManager); | 159 | string ospResolvedId = OspResolver.ResolveOspa(item.CreatorId, m_commsManager); |
160 | if (null != ospResolvedId) | 160 | if (null != ospResolvedId) |
161 | item.CreatorId = ospResolvedId; | 161 | item.CreatorId = ospResolvedId; |
162 | 162 | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs index 0144136..4747f1f 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs | |||
@@ -125,13 +125,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
125 | { | 125 | { |
126 | string filename = string.Format("{0}{1}_{2}.xml", path, inventoryItem.Name, inventoryItem.ID); | 126 | string filename = string.Format("{0}{1}_{2}.xml", path, inventoryItem.Name, inventoryItem.ID); |
127 | 127 | ||
128 | string serialization = UserInventoryItemSerializer.Serialize(inventoryItem); | ||
129 | m_archive.WriteFile(filename, serialization); | ||
130 | |||
131 | // Record the creator of this item for user record purposes (which might go away soon) | 128 | // Record the creator of this item for user record purposes (which might go away soon) |
132 | m_userUuids[inventoryItem.CreatorIdAsUuid] = 1; | 129 | m_userUuids[inventoryItem.CreatorIdAsUuid] = 1; |
133 | 130 | ||
134 | m_assetGatherer.GatherAssetUuids(inventoryItem.AssetID, (AssetType)inventoryItem.AssetType, m_assetUuids); | 131 | InventoryItemBase saveItem = (InventoryItemBase)inventoryItem.Clone(); |
132 | saveItem.CreatorId = OspResolver.MakeOspa(saveItem.CreatorIdAsUuid, m_module.CommsManager); | ||
133 | |||
134 | string serialization = UserInventoryItemSerializer.Serialize(saveItem); | ||
135 | m_archive.WriteFile(filename, serialization); | ||
136 | |||
137 | m_assetGatherer.GatherAssetUuids(saveItem.AssetID, (AssetType)saveItem.AssetType, m_assetUuids); | ||
135 | } | 138 | } |
136 | 139 | ||
137 | /// <summary> | 140 | /// <summary> |