29 using System.Collections.Generic;
30 using System.Reflection;
34 using OpenSim.Framework;
35 using OpenSim.Region.Framework.Interfaces;
36 using OpenSim.Region.Framework.Scenes;
39 namespace OpenSim.
Region.CoreModules.
Agent.AssetTransaction
41 [Extension(Path =
"/OpenSim/RegionModules", NodeName =
"RegionModule", Id =
"AssetTransactionModule")]
48 private bool m_dumpAssetsToFile =
false;
49 private int m_levelUpload = 0;
54 private Dictionary<UUID, AgentAssetTransactions> AgentTransactions =
55 new Dictionary<UUID, AgentAssetTransactions>();
57 #region Region Module interface
61 IConfig sconfig = source.Configs[
"Startup"];
64 m_levelUpload = sconfig.GetInt(
"LevelUpload", 0);
72 scene.EventManager.OnNewClient += NewClient;
89 get {
return "AgentTransactionModule"; }
92 public Type ReplaceableInterface
101 client.OnAssetUploadRequest += HandleUDPUploadRequest;
102 client.OnXferReceive += HandleXfer;
105 #region AgentAssetTransactions
114 lock (AgentTransactions)
116 if (!AgentTransactions.ContainsKey(userID))
122 AgentTransactions.Add(userID, transactions);
125 return AgentTransactions[userID];
139 lock (AgentTransactions)
141 AgentTransactions.Remove(userID);
162 UUID transactionID, UUID folderID, uint callbackID,
163 string description,
string name, sbyte invType,
164 sbyte type, byte wearableType, uint nextOwnerMask)
170 GetUserTransactions(remoteClient.
AgentId);
172 return transactions.RequestCreateInventoryItem(remoteClient, transactionID,
173 folderID, callbackID, description, name, invType, type,
174 wearableType, nextOwnerMask);
198 transactions.RequestUpdateInventoryItem(remoteClient, transactionID, item);
222 GetUserTransactions(remoteClient.
AgentId);
224 transactions.RequestUpdateTaskInventoryItem(remoteClient, part,
225 transactionID, item);
238 UUID assetID, UUID transactionID, sbyte type, byte[] data,
239 bool storeLocal,
bool tempFile)
245 if (((AssetType)type == AssetType.Texture ||
246 (AssetType)type == AssetType.Sound ||
247 (AssetType)type == AssetType.TextureTGA ||
248 (AssetType)type == AssetType.Animation) &&
258 if (avatar.UserLevel < m_levelUpload)
260 remoteClient.SendAgentAlertMessage(
"Unable to upload asset. Insufficient permissions.",
false);
272 remoteClient.SendAgentAlertMessage(
"Unable to upload asset. Insufficient funds.",
false);
280 uploader.StartUpload(remoteClient, assetID, transactionID, type, data, storeLocal, tempFile);
292 uint packetID, byte[] data)
297 transactions.HandleXfer(xferID, packetID, data);
void Initialise(IConfigSource source)
This is called to initialize the region module. For shared modules, this is called exactly once...
bool HandleItemCreationFromTransaction(IClientAPI remoteClient, UUID transactionID, UUID folderID, uint callbackID, string description, string name, sbyte invType, sbyte type, byte wearableType, uint nextOwnerMask)
Create an inventory item from data that has been received through a transaction. This is called when ...
void HandleItemUpdateFromTransaction(IClientAPI remoteClient, UUID transactionID, InventoryItemBase item)
Update an inventory item with data that has been received through a transaction.
void RegionLoaded(Scene scene)
This will be called once for every scene loaded. In a shared module this will be multiple times in on...
bool UploadCovered(UUID agentID, int amount)
Represents an item in a task inventory
void AddRegion(Scene scene)
This is called whenever a Scene is added. For shared modules, this can happen several times...
void HandleTaskItemUpdateFromTransaction(IClientAPI remoteClient, SceneObjectPart part, UUID transactionID, TaskInventoryItem item)
Update a task inventory item with data that has been received through a transaction.
void HandleXfer(IClientAPI remoteClient, ulong xferID, uint packetID, byte[] data)
Handle asset transfer data packets received in response to the asset upload request in HandleUDPUploa...
void RemoveRegion(Scene scene)
This is called whenever a Scene is removed. For shared modules, this can happen several times...
Inventory Item - contains all the properties associated with an individual inventory piece...
void NewClient(IClientAPI client)
override bool TryGetScenePresence(UUID agentID, out ScenePresence sp)
Try to get a scene presence from the scene
void HandleUDPUploadRequest(IClientAPI remoteClient, UUID assetID, UUID transactionID, sbyte type, byte[] data, bool storeLocal, bool tempFile)
Request that a client (agent) begin an asset transfer.
void Close()
This is the inverse to Initialise. After a Close(), this instance won't be usable anymore...
Manage asset transactions for a single agent.
void RemoveAgentAssetTransactions(UUID userID)
Remove the given agent asset transactions. This should be called when a client is departing from a sc...