/// <summary> /// Request that a client (agent) begin an asset transfer. /// </summary> /// <param name="remoteClient"></param> /// <param name="assetID"></param> /// <param name="transaction"></param> /// <param name="type"></param> /// <param name="data"></param></param> /// <param name="tempFile"></param> public void HandleUDPUploadRequest(IClientAPI remoteClient, UUID assetID, UUID transaction, sbyte type, byte[] data, bool storeLocal, bool tempFile) { //m_log.Debug("HandleUDPUploadRequest - assetID: " + assetID.ToString() + " transaction: " + transaction.ToString() + " type: " + type.ToString() + " storelocal: " + storeLocal + " tempFile: " + tempFile); if (((AssetType)type == AssetType.Texture || (AssetType)type == AssetType.Sound || (AssetType)type == AssetType.TextureTGA || (AssetType)type == AssetType.Animation) && tempFile == false) { Scene scene = (Scene)remoteClient.Scene; IMoneyModule mm = scene.RequestModuleInterface <IMoneyModule>(); if (mm != null) { if (!mm.UploadCovered(remoteClient)) { remoteClient.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); return; } } } //m_log.Debug("asset upload of " + assetID); AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId); AssetXferUploader uploader = transactions.RequestXferUploader(transaction); if (uploader != null) { uploader.Initialise(remoteClient, assetID, transaction, type, data, storeLocal, tempFile); } }
/// <summary> /// Request that a client (agent) begin an asset transfer. /// </summary> /// <param name="remoteClient"></param> /// <param name="assetID"></param> /// <param name="transactionID"></param> /// <param name="type"></param> /// <param name="data"></param></param> /// <param name="tempFile"></param> public void HandleUDPUploadRequest(IClientAPI remoteClient, UUID assetID, UUID transactionID, sbyte type, byte[] data, bool storeLocal, bool tempFile) { // m_log.DebugFormat( // "[ASSET TRANSACTION MODULE]: HandleUDPUploadRequest - assetID: {0}, transaction {1}, type {2}, storeLocal {3}, tempFile {4}, data.Length {5}", // assetID, transactionID, type, storeLocal, tempFile, data.Length); if (((AssetType)type == AssetType.Texture || (AssetType)type == AssetType.Sound || (AssetType)type == AssetType.TextureTGA || (AssetType)type == AssetType.Animation) && tempFile == false) { ScenePresence avatar = null; Scene scene = (Scene)remoteClient.Scene; scene.TryGetScenePresence(remoteClient.AgentId, out avatar); // check user level if (avatar != null) { if (avatar.UserLevel < m_levelUpload) { remoteClient.SendAgentAlertMessage("Unable to upload asset. Insufficient permissions.", false); return; } } // check funds IMoneyModule mm = scene.RequestModuleInterface <IMoneyModule>(); if (mm != null) { if (!mm.UploadCovered(remoteClient.AgentId, mm.UploadCharge)) { remoteClient.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); return; } } } AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId); AssetXferUploader uploader = transactions.RequestXferUploader(transactionID); uploader.StartUpload(remoteClient, assetID, transactionID, type, data, storeLocal, tempFile); }
/// <summary> /// Request that a client (agent) begin an asset transfer. /// </summary> /// <param name="remoteClient"></param> /// <param name="assetID"></param> /// <param name="transaction"></param> /// <param name="type"></param> /// <param name="data"></param></param> /// <param name="tempFile"></param> public void HandleUDPUploadRequest(IClientAPI remoteClient, UUID assetID, UUID transaction, sbyte type, byte[] data, bool storeLocal, bool tempFile) { // m_log.Debug("HandleUDPUploadRequest - assetID: " + assetID.ToString() + " transaction: " + transaction.ToString() + " type: " + type.ToString() + " storelocal: " + storeLocal + " tempFile: " + tempFile); if (((AssetType)type == AssetType.Texture || (AssetType)type == AssetType.Sound || (AssetType)type == AssetType.TextureTGA || (AssetType)type == AssetType.Animation) && tempFile == false) { ScenePresence avatar = null; Scene scene = (Scene)remoteClient.Scene; scene.TryGetScenePresence(remoteClient.AgentId, out avatar); // check user level if (avatar != null) { if (avatar.UserLevel < m_levelUpload) { remoteClient.SendAgentAlertMessage("Unable to upload asset. Insufficient permissions.", false); return; } } // check funds IMoneyModule mm = scene.RequestModuleInterface <IMoneyModule>(); if (mm != null) { if (!mm.UploadCovered(remoteClient.AgentId, mm.UploadCharge)) { remoteClient.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); return; } } } AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId); AssetXferUploader uploader = transactions.RequestXferUploader(transaction); uploader.StartUpload(remoteClient, assetID, transaction, type, data, storeLocal, tempFile); }
/// <summary> /// Request that a client (agent) begin an asset transfer. /// </summary> /// <param name="remoteClient"></param> /// <param name="assetID"></param> /// <param name="transaction"></param> /// <param name="type"></param> /// <param name="data"></param></param> /// <param name="tempFile"></param> public void HandleUDPUploadRequest(IClientAPI remoteClient, UUID assetID, UUID transaction, sbyte type, byte[] data, bool storeLocal, bool tempFile) { // m_log.Debug("HandleUDPUploadRequest - assetID: " + assetID.ToString() + " transaction: " + transaction.ToString() + " type: " + type.ToString() + " storelocal: " + storeLocal + " tempFile: " + tempFile); Scene scene = (Scene)remoteClient.Scene; IMoneyModule mm = scene.RequestModuleInterface <IMoneyModule>(); if (mm == null) { remoteClient.SendAgentAlertMessage("Server configuration error - cannot upload asset.", false); return; } if (mm.UploadChargeApplies((AssetType)type) && !tempFile) { if (!mm.UploadCovered(remoteClient.AgentId)) { remoteClient.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); return; } } //m_log.Debug("asset upload of " + assetID); AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId); AssetXferUploader uploader = transactions.RequestXferUploader(transaction); if (uploader == null) { remoteClient.SendAgentAlertMessage("Server error uploading asset. Could not allocate uploader.", false); return; } // m_log.Debug("HandleUDPUploadRequest(Initialize) - assetID: " + assetID.ToString() + " transaction: " + transaction.ToString() + " type: " + type.ToString() + " storelocal: " + storeLocal + " tempFile: " + tempFile); // Okay, start the upload. uploader.Initialize(remoteClient, assetID, transaction, type, data, storeLocal, tempFile); }