diff options
Diffstat (limited to 'OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AgentAssetTransactionsManager.cs')
-rw-r--r-- | OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AgentAssetTransactionsManager.cs | 231 |
1 files changed, 0 insertions, 231 deletions
diff --git a/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AgentAssetTransactionsManager.cs b/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AgentAssetTransactionsManager.cs deleted file mode 100644 index 82325b7..0000000 --- a/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AgentAssetTransactionsManager.cs +++ /dev/null | |||
@@ -1,231 +0,0 @@ | |||
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 OpenSim 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.Collections.Generic; | ||
29 | //using System.Reflection; | ||
30 | //using log4net; | ||
31 | using OpenMetaverse; | ||
32 | using OpenSim.Framework; | ||
33 | using OpenSim.Region.Framework.Scenes; | ||
34 | using OpenSim.Region.Framework.Interfaces; | ||
35 | |||
36 | namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction | ||
37 | { | ||
38 | /* | ||
39 | public class AgentAssetTransactionsManager | ||
40 | { | ||
41 | //private static readonly ILog m_log | ||
42 | // = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
43 | |||
44 | /// <summary> | ||
45 | /// Each agent has its own singleton collection of transactions | ||
46 | /// </summary> | ||
47 | private Dictionary<UUID, AgentAssetTransactions> AgentTransactions = | ||
48 | new Dictionary<UUID, AgentAssetTransactions>(); | ||
49 | |||
50 | /// <summary> | ||
51 | /// Should we dump uploaded assets to the filesystem? | ||
52 | /// </summary> | ||
53 | private bool m_dumpAssetsToFile; | ||
54 | |||
55 | public Scene MyScene; | ||
56 | |||
57 | public AgentAssetTransactionsManager(Scene scene, bool dumpAssetsToFile) | ||
58 | { | ||
59 | MyScene = scene; | ||
60 | m_dumpAssetsToFile = dumpAssetsToFile; | ||
61 | } | ||
62 | |||
63 | /// <summary> | ||
64 | /// Get the collection of asset transactions for the given user. If one does not already exist, it | ||
65 | /// is created. | ||
66 | /// </summary> | ||
67 | /// <param name="userID"></param> | ||
68 | /// <returns></returns> | ||
69 | private AgentAssetTransactions GetUserTransactions(UUID userID) | ||
70 | { | ||
71 | lock (AgentTransactions) | ||
72 | { | ||
73 | if (!AgentTransactions.ContainsKey(userID)) | ||
74 | { | ||
75 | AgentAssetTransactions transactions = null; | ||
76 | //= new AgentAssetTransactions(userID, this, m_dumpAssetsToFile); | ||
77 | AgentTransactions.Add(userID, transactions); | ||
78 | } | ||
79 | |||
80 | return AgentTransactions[userID]; | ||
81 | } | ||
82 | } | ||
83 | |||
84 | /// <summary> | ||
85 | /// Remove the given agent asset transactions. This should be called when a client is departing | ||
86 | /// from a scene (and hence won't be making any more transactions here). | ||
87 | /// </summary> | ||
88 | /// <param name="userID"></param> | ||
89 | public void RemoveAgentAssetTransactions(UUID userID) | ||
90 | { | ||
91 | // m_log.DebugFormat("Removing agent asset transactions structure for agent {0}", userID); | ||
92 | |||
93 | lock (AgentTransactions) | ||
94 | { | ||
95 | AgentTransactions.Remove(userID); | ||
96 | } | ||
97 | } | ||
98 | |||
99 | /// <summary> | ||
100 | /// Create an inventory item from data that has been received through a transaction. | ||
101 | /// | ||
102 | /// This is called when new clothing or body parts are created. It may also be called in other | ||
103 | /// situations. | ||
104 | /// </summary> | ||
105 | /// <param name="remoteClient"></param> | ||
106 | /// <param name="transactionID"></param> | ||
107 | /// <param name="folderID"></param> | ||
108 | /// <param name="callbackID"></param> | ||
109 | /// <param name="description"></param> | ||
110 | /// <param name="name"></param> | ||
111 | /// <param name="invType"></param> | ||
112 | /// <param name="type"></param> | ||
113 | /// <param name="wearableType"></param> | ||
114 | /// <param name="nextOwnerMask"></param> | ||
115 | public void HandleItemCreationFromTransaction(IClientAPI remoteClient, UUID transactionID, UUID folderID, | ||
116 | uint callbackID, string description, string name, sbyte invType, | ||
117 | sbyte type, byte wearableType, uint nextOwnerMask) | ||
118 | { | ||
119 | // m_log.DebugFormat( | ||
120 | // "[TRANSACTIONS MANAGER] Called HandleItemCreationFromTransaction with item {0}", name); | ||
121 | |||
122 | AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId); | ||
123 | |||
124 | transactions.RequestCreateInventoryItem( | ||
125 | remoteClient, transactionID, folderID, callbackID, description, | ||
126 | name, invType, type, wearableType, nextOwnerMask); | ||
127 | } | ||
128 | |||
129 | /// <summary> | ||
130 | /// Update an inventory item with data that has been received through a transaction. | ||
131 | /// | ||
132 | /// This is called when clothing or body parts are updated (for instance, with new textures or | ||
133 | /// colours). It may also be called in other situations. | ||
134 | /// </summary> | ||
135 | /// <param name="remoteClient"></param> | ||
136 | /// <param name="transactionID"></param> | ||
137 | /// <param name="item"></param> | ||
138 | public void HandleItemUpdateFromTransaction(IClientAPI remoteClient, UUID transactionID, | ||
139 | InventoryItemBase item) | ||
140 | { | ||
141 | // m_log.DebugFormat( | ||
142 | // "[TRANSACTIONS MANAGER] Called HandleItemUpdateFromTransaction with item {0}", | ||
143 | // item.Name); | ||
144 | |||
145 | AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId); | ||
146 | |||
147 | transactions.RequestUpdateInventoryItem(remoteClient, transactionID, item); | ||
148 | } | ||
149 | |||
150 | /// <summary> | ||
151 | /// Update a task inventory item with data that has been received through a transaction. | ||
152 | /// | ||
153 | /// This is currently called when, for instance, a notecard in a prim is saved. The data is sent | ||
154 | /// up through a single AssetUploadRequest. A subsequent UpdateTaskInventory then references the transaction | ||
155 | /// and comes through this method. | ||
156 | /// </summary> | ||
157 | /// <param name="remoteClient"></param> | ||
158 | /// <param name="transactionID"></param> | ||
159 | /// <param name="item"></param> | ||
160 | public void HandleTaskItemUpdateFromTransaction( | ||
161 | IClientAPI remoteClient, SceneObjectPart part, UUID transactionID, TaskInventoryItem item) | ||
162 | { | ||
163 | // m_log.DebugFormat( | ||
164 | // "[TRANSACTIONS MANAGER] Called HandleTaskItemUpdateFromTransaction with item {0}", | ||
165 | // item.Name); | ||
166 | |||
167 | AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId); | ||
168 | |||
169 | transactions.RequestUpdateTaskInventoryItem(remoteClient, part, transactionID, item); | ||
170 | } | ||
171 | |||
172 | /// <summary> | ||
173 | /// Request that a client (agent) begin an asset transfer. | ||
174 | /// </summary> | ||
175 | /// <param name="remoteClient"></param> | ||
176 | /// <param name="assetID"></param> | ||
177 | /// <param name="transaction"></param> | ||
178 | /// <param name="type"></param> | ||
179 | /// <param name="data"></param></param> | ||
180 | /// <param name="tempFile"></param> | ||
181 | public void HandleUDPUploadRequest(IClientAPI remoteClient, UUID assetID, UUID transaction, sbyte type, | ||
182 | byte[] data, bool storeLocal, bool tempFile) | ||
183 | { | ||
184 | //System.Console.WriteLine("HandleUDPUploadRequest - assetID: " + assetID.ToString() + " transaction: " + transaction.ToString() + " type: " + type.ToString() + " storelocal: " + storeLocal + " tempFile: " + tempFile); | ||
185 | if (((AssetType)type == AssetType.Texture || | ||
186 | (AssetType)type == AssetType.Sound || | ||
187 | (AssetType)type == AssetType.TextureTGA || | ||
188 | (AssetType)type == AssetType.Animation) && | ||
189 | tempFile == false) | ||
190 | { | ||
191 | Scene scene = (Scene)remoteClient.Scene; | ||
192 | IMoneyModule mm = scene.RequestModuleInterface<IMoneyModule>(); | ||
193 | |||
194 | if (mm != null) | ||
195 | { | ||
196 | if (!mm.UploadCovered(remoteClient)) | ||
197 | { | ||
198 | remoteClient.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); | ||
199 | return; | ||
200 | } | ||
201 | } | ||
202 | } | ||
203 | |||
204 | //Console.WriteLine("asset upload of " + assetID); | ||
205 | AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId); | ||
206 | |||
207 | AssetXferUploader uploader = transactions.RequestXferUploader(transaction); | ||
208 | if (uploader != null) | ||
209 | { | ||
210 | uploader.Initialise(remoteClient, assetID, transaction, type, data, storeLocal, tempFile); | ||
211 | } | ||
212 | } | ||
213 | |||
214 | /// <summary> | ||
215 | /// Handle asset transfer data packets received in response to the asset upload request in | ||
216 | /// HandleUDPUploadRequest() | ||
217 | /// </summary> | ||
218 | /// <param name="remoteClient"></param> | ||
219 | /// <param name="xferID"></param> | ||
220 | /// <param name="packetID"></param> | ||
221 | /// <param name="data"></param> | ||
222 | public void HandleXfer(IClientAPI remoteClient, ulong xferID, uint packetID, byte[] data) | ||
223 | { | ||
224 | //System.Console.WriteLine("xferID: " + xferID + " packetID: " + packetID + " data!"); | ||
225 | AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId); | ||
226 | |||
227 | transactions.HandleXfer(xferID, packetID, data); | ||
228 | } | ||
229 | } | ||
230 | */ | ||
231 | } | ||