Exemplo n.º 1
0
        /// <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);
        }
Exemplo n.º 2
0
        /// <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);
        }