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