aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs
diff options
context:
space:
mode:
authorMelanie2010-12-04 04:33:14 +0100
committerMelanie2010-12-04 04:24:55 +0000
commitea17b262a35df16ebdd79891520907b05d3b78a6 (patch)
treeffbf06ea2de75d8b2c2b7db698a39feccfef1c14 /OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs
parentVarious bug fixes for appearance handling: more aggressive reset of textures ... (diff)
downloadopensim-SC_OLD-ea17b262a35df16ebdd79891520907b05d3b78a6.zip
opensim-SC_OLD-ea17b262a35df16ebdd79891520907b05d3b78a6.tar.gz
opensim-SC_OLD-ea17b262a35df16ebdd79891520907b05d3b78a6.tar.bz2
opensim-SC_OLD-ea17b262a35df16ebdd79891520907b05d3b78a6.tar.xz
Convert the agent asset transactions module to a new style module.
Refactor to remove the property "MyScene" and the pointless circular refs to the managing classes. Converted the module to a non-shared module. Reformatted source for 80 columns. Removed the special role the module had in the old loader.
Diffstat (limited to 'OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs')
-rw-r--r--OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs115
1 files changed, 43 insertions, 72 deletions
diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs
index 3d6e7f3..0af113a 100644
--- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs
+++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs
@@ -41,19 +41,22 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
41 /// </summary> 41 /// </summary>
42 public class AgentAssetTransactions 42 public class AgentAssetTransactions
43 { 43 {
44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 44 private static readonly ILog m_log = LogManager.GetLogger(
45 MethodBase.GetCurrentMethod().DeclaringType);
45 46
46 // Fields 47 // Fields
47 private bool m_dumpAssetsToFile; 48 private bool m_dumpAssetsToFile;
48 public AssetTransactionModule Manager; 49 private Scene m_Scene;
49 public UUID UserID; 50 public UUID UserID;
50 public Dictionary<UUID, AssetXferUploader> XferUploaders = new Dictionary<UUID, AssetXferUploader>(); 51 public Dictionary<UUID, AssetXferUploader> XferUploaders =
52 new Dictionary<UUID, AssetXferUploader>();
51 53
52 // Methods 54 // Methods
53 public AgentAssetTransactions(UUID agentID, AssetTransactionModule manager, bool dumpAssetsToFile) 55 public AgentAssetTransactions(UUID agentID, Scene scene,
56 bool dumpAssetsToFile)
54 { 57 {
58 m_Scene = scene;
55 UserID = agentID; 59 UserID = agentID;
56 Manager = manager;
57 m_dumpAssetsToFile = dumpAssetsToFile; 60 m_dumpAssetsToFile = dumpAssetsToFile;
58 } 61 }
59 62
@@ -61,7 +64,8 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
61 { 64 {
62 if (!XferUploaders.ContainsKey(transactionID)) 65 if (!XferUploaders.ContainsKey(transactionID))
63 { 66 {
64 AssetXferUploader uploader = new AssetXferUploader(this, m_dumpAssetsToFile); 67 AssetXferUploader uploader = new AssetXferUploader(m_Scene,
68 m_dumpAssetsToFile);
65 69
66 lock (XferUploaders) 70 lock (XferUploaders)
67 { 71 {
@@ -88,22 +92,25 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
88 } 92 }
89 } 93 }
90 94
91 public void RequestCreateInventoryItem(IClientAPI remoteClient, UUID transactionID, UUID folderID, 95 public void RequestCreateInventoryItem(IClientAPI remoteClient,
92 uint callbackID, string description, string name, sbyte invType, 96 UUID transactionID, UUID folderID, uint callbackID,
93 sbyte type, byte wearableType, uint nextOwnerMask) 97 string description, string name, sbyte invType,
98 sbyte type, byte wearableType, uint nextOwnerMask)
94 { 99 {
95 if (XferUploaders.ContainsKey(transactionID)) 100 if (XferUploaders.ContainsKey(transactionID))
96 { 101 {
97 XferUploaders[transactionID].RequestCreateInventoryItem(remoteClient, transactionID, folderID, 102 XferUploaders[transactionID].RequestCreateInventoryItem(
98 callbackID, description, name, invType, type, 103 remoteClient, transactionID, folderID,
99 wearableType, nextOwnerMask); 104 callbackID, description, name, invType, type,
105 wearableType, nextOwnerMask);
100 } 106 }
101 } 107 }
102 108
103 109
104 110
105 /// <summary> 111 /// <summary>
106 /// Get an uploaded asset. If the data is successfully retrieved, the transaction will be removed. 112 /// Get an uploaded asset. If the data is successfully retrieved,
113 /// the transaction will be removed.
107 /// </summary> 114 /// </summary>
108 /// <param name="transactionID"></param> 115 /// <param name="transactionID"></param>
109 /// <returns>The asset if the upload has completed, null if it has not.</returns> 116 /// <returns>The asset if the upload has completed, null if it has not.</returns>
@@ -125,48 +132,21 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
125 return null; 132 return null;
126 } 133 }
127 134
128 //private void CreateItemFromUpload(AssetBase asset, IClientAPI ourClient, UUID inventoryFolderID, uint nextPerms, uint wearableType) 135 public void RequestUpdateTaskInventoryItem(IClientAPI remoteClient,
129 //{ 136 SceneObjectPart part, UUID transactionID,
130 // Manager.MyScene.CommsManager.AssetCache.AddAsset(asset); 137 TaskInventoryItem item)
131 // CachedUserInfo userInfo = Manager.MyScene.CommsManager.UserProfileCacheService.GetUserDetails(
132 // ourClient.AgentId);
133
134 // if (userInfo != null)
135 // {
136 // InventoryItemBase item = new InventoryItemBase();
137 // item.Owner = ourClient.AgentId;
138 // item.Creator = ourClient.AgentId;
139 // item.ID = UUID.Random();
140 // item.AssetID = asset.FullID;
141 // item.Description = asset.Description;
142 // item.Name = asset.Name;
143 // item.AssetType = asset.Type;
144 // item.InvType = asset.Type;
145 // item.Folder = inventoryFolderID;
146 // item.BasePermissions = 0x7fffffff;
147 // item.CurrentPermissions = 0x7fffffff;
148 // item.EveryOnePermissions = 0;
149 // item.NextPermissions = nextPerms;
150 // item.Flags = wearableType;
151 // item.CreationDate = Util.UnixTimeSinceEpoch();
152
153 // userInfo.AddItem(item);
154 // ourClient.SendInventoryItemCreateUpdate(item);
155 // }
156 // else
157 // {
158 // m_log.ErrorFormat(
159 // "[ASSET TRANSACTIONS]: Could not find user {0} for inventory item creation",
160 // ourClient.AgentId);
161 // }
162 //}
163
164 public void RequestUpdateTaskInventoryItem(
165 IClientAPI remoteClient, SceneObjectPart part, UUID transactionID, TaskInventoryItem item)
166 { 138 {
167 if (XferUploaders.ContainsKey(transactionID)) 139 if (XferUploaders.ContainsKey(transactionID))
168 { 140 {
169 AssetBase asset = XferUploaders[transactionID].GetAssetData(); 141 AssetBase asset = GetTransactionAsset(transactionID);
142
143 // Only legacy viewers use this, and they prefer CAPS, which
144 // we have, so this really never runs.
145 // Allow it, but only for "safe" types.
146 if ((InventoryType)item.InvType != InventoryType.Notecard &&
147 (InventoryType)item.InvType != InventoryType.LSL)
148 return;
149
170 if (asset != null) 150 if (asset != null)
171 { 151 {
172 m_log.DebugFormat( 152 m_log.DebugFormat(
@@ -178,32 +158,23 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
178 asset.Type = (sbyte)item.Type; 158 asset.Type = (sbyte)item.Type;
179 item.AssetID = asset.FullID; 159 item.AssetID = asset.FullID;
180 160
181 Manager.MyScene.AssetService.Store(asset); 161 m_Scene.AssetService.Store(asset);
182 162
183 if (part.Inventory.UpdateInventoryItem(item)) 163 part.Inventory.UpdateInventoryItem(item);
184 {
185 if ((InventoryType)item.InvType == InventoryType.Notecard)
186 remoteClient.SendAgentAlertMessage("Notecard saved", false);
187 else if ((InventoryType)item.InvType == InventoryType.LSL)
188 remoteClient.SendAgentAlertMessage("Script saved", false);
189 else
190 remoteClient.SendAgentAlertMessage("Item saved", false);
191
192 part.GetProperties(remoteClient);
193 }
194 } 164 }
195 } 165 }
196 } 166 }
197 167
198 168 public void RequestUpdateInventoryItem(IClientAPI remoteClient,
199 public void RequestUpdateInventoryItem(IClientAPI remoteClient, UUID transactionID, 169 UUID transactionID, InventoryItemBase item)
200 InventoryItemBase item)
201 { 170 {
202 if (XferUploaders.ContainsKey(transactionID)) 171 if (XferUploaders.ContainsKey(transactionID))
203 { 172 {
204 UUID assetID = UUID.Combine(transactionID, remoteClient.SecureSessionId); 173 UUID assetID = UUID.Combine(transactionID,
174 remoteClient.SecureSessionId);
205 175
206 AssetBase asset = Manager.MyScene.AssetService.Get(assetID.ToString()); 176 AssetBase asset = m_Scene.AssetService.Get(
177 assetID.ToString());
207 178
208 if (asset == null) 179 if (asset == null)
209 { 180 {
@@ -219,10 +190,10 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
219 asset.Type = (sbyte)item.AssetType; 190 asset.Type = (sbyte)item.AssetType;
220 item.AssetID = asset.FullID; 191 item.AssetID = asset.FullID;
221 192
222 Manager.MyScene.AssetService.Store(asset); 193 m_Scene.AssetService.Store(asset);
223 } 194 }
224 195
225 IInventoryService invService = Manager.MyScene.InventoryService; 196 IInventoryService invService = m_Scene.InventoryService;
226 invService.UpdateItem(item); 197 invService.UpdateItem(item);
227 } 198 }
228 } 199 }