/// <summary>
        /// Classifieds info update.
        /// </summary>
        /// <param name='queryclassifiedID'>
        /// Queryclassified I.
        /// </param>
        /// <param name='queryCategory'>
        /// Query category.
        /// </param>
        /// <param name='queryName'>
        /// Query name.
        /// </param>
        /// <param name='queryDescription'>
        /// Query description.
        /// </param>
        /// <param name='queryParcelID'>
        /// Query parcel I.
        /// </param>
        /// <param name='queryParentEstate'>
        /// Query parent estate.
        /// </param>
        /// <param name='querySnapshotID'>
        /// Query snapshot I.
        /// </param>
        /// <param name='queryGlobalPos'>
        /// Query global position.
        /// </param>
        /// <param name='queryclassifiedFlags'>
        /// Queryclassified flags.
        /// </param>
        /// <param name='queryclassifiedPrice'>
        /// Queryclassified price.
        /// </param>
        /// <param name='remoteClient'>
        /// Remote client.
        /// </param>
        public void ClassifiedInfoUpdate(UUID queryclassifiedID, uint queryCategory, string queryName, string queryDescription, UUID queryParcelID,
                                         uint queryParentEstate, UUID querySnapshotID, Vector3 queryGlobalPos, byte queryclassifiedFlags,
                                         int queryclassifiedPrice, IClientAPI remoteClient)
        {
            Scene        s     = (Scene)remoteClient.Scene;
            IMoneyModule money = s.RequestModuleInterface <IMoneyModule>();

            if (money != null)
            {
                if (!money.AmountCovered(remoteClient.AgentId, queryclassifiedPrice))
                {
                    remoteClient.SendAgentAlertMessage("You do not have enough money to create requested classified.", false);
                    return;
                }
                money.ApplyCharge(remoteClient.AgentId, queryclassifiedPrice, MoneyTransactionType.ClassifiedCharge);
            }

            UserClassifiedAdd ad = new UserClassifiedAdd();

            Vector3       pos  = remoteClient.SceneAgent.AbsolutePosition;
            ILandObject   land = s.LandChannel.GetLandObject(pos.X, pos.Y);
            ScenePresence p    = FindPresence(remoteClient.AgentId);

            string serverURI = string.Empty;

            GetUserProfileServerURI(remoteClient.AgentId, out serverURI);

            if (land == null)
            {
                ad.ParcelName = string.Empty;
            }
            else
            {
                ad.ParcelName = land.LandData.Name;
            }

            ad.CreatorId    = remoteClient.AgentId;
            ad.ClassifiedId = queryclassifiedID;
            ad.Category     = Convert.ToInt32(queryCategory);
            ad.Name         = queryName;
            ad.Description  = queryDescription;
            ad.ParentEstate = Convert.ToInt32(queryParentEstate);
            ad.SnapshotId   = querySnapshotID;
            ad.SimName      = remoteClient.Scene.RegionInfo.RegionName;
            ad.GlobalPos    = queryGlobalPos.ToString();
            ad.Flags        = queryclassifiedFlags;
            ad.Price        = queryclassifiedPrice;
            ad.ParcelId     = p.currentParcelUUID;

            object Ad = ad;

            OSD.SerializeMembers(Ad);

            if (!rpc.JsonRpcRequest(ref Ad, "classified_update", serverURI, UUID.Random().ToString()))
            {
                remoteClient.SendAgentAlertMessage(
                    "Error updating classified", false);
                return;
            }
        }
예제 #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)
            {
                Scene        scene = (Scene)remoteClient.Scene;
                IMoneyModule mm    = scene.RequestModuleInterface <IMoneyModule>();

                if (mm != null)
                {
                    if (!mm.AmountCovered(remoteClient, mm.UploadCharge))
                    {
                        remoteClient.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false);
                        return;
                    }
                }
            }

            AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId);

            IMonitorModule monitorModule = m_scene.RequestModuleInterface <IMonitorModule>();

            if (monitorModule != null)
            {
                INetworkMonitor networkMonitor = (INetworkMonitor)monitorModule.GetMonitor(m_scene.RegionInfo.RegionID.ToString(), "Network Monitor");
                networkMonitor.AddPendingUploads(1);
            }

            AssetXferUploader uploader = transactions.RequestXferUploader(transaction);

            if (uploader != null)
            {
                uploader.Initialise(remoteClient, assetID, transaction, type, data, storeLocal, tempFile);
            }
        }
예제 #3
0
        // Classifieds Update
        public void ClassifiedInfoUpdate(UUID queryclassifiedID, uint queryCategory, string queryName, string queryDescription, UUID queryParcelID,
                                         uint queryParentEstate, UUID querySnapshotID, Vector3 queryGlobalPos, byte queryclassifiedFlags,
                                         int queryclassifiedPrice, IClientAPI remoteClient)
        {
            Hashtable ReqHash = new Hashtable();

            Scene       s    = (Scene)remoteClient.Scene;
            Vector3     pos  = remoteClient.SceneAgent.AbsolutePosition;
            ILandObject land = s.LandChannel.GetLandObject(pos.X, pos.Y);

            if (land == null)
            {
                ReqHash["parcelname"] = String.Empty;
            }
            else
            {
                ReqHash["parcelname"] = land.LandData.Name;
            }

            ReqHash["creatorUUID"]     = remoteClient.AgentId.ToString();
            ReqHash["classifiedUUID"]  = queryclassifiedID.ToString();
            ReqHash["category"]        = queryCategory.ToString();
            ReqHash["name"]            = queryName;
            ReqHash["description"]     = queryDescription;
            ReqHash["parentestate"]    = queryParentEstate.ToString();
            ReqHash["snapshotUUID"]    = querySnapshotID.ToString();
            ReqHash["sim_name"]        = remoteClient.Scene.RegionInfo.RegionName;
            ReqHash["globalpos"]       = queryGlobalPos.ToString();
            ReqHash["classifiedFlags"] = queryclassifiedFlags.ToString();
            ReqHash["classifiedPrice"] = queryclassifiedPrice.ToString();

            ScenePresence p = FindPresence(remoteClient.AgentId);


            string serverURI = string.Empty;

            GetUserProfileServerURI(remoteClient.AgentId, out serverURI);

            Vector3 avaPos = p.AbsolutePosition;

            // Getting the parceluuid for this parcel
            ReqHash["parcelUUID"] = p.currentParcelUUID.ToString();

            // Getting the global position for the Avatar
            Vector3 posGlobal = new Vector3(remoteClient.Scene.RegionInfo.RegionLocX * Constants.RegionSize + avaPos.X,
                                            remoteClient.Scene.RegionInfo.RegionLocY * Constants.RegionSize + avaPos.Y,
                                            avaPos.Z);

            ReqHash["pos_global"] = posGlobal.ToString();

            //Check available funds if there is a money module present
            IMoneyModule money = s.RequestModuleInterface <IMoneyModule>();

            if (money != null)
            {
                if (!money.AmountCovered(remoteClient.AgentId, queryclassifiedPrice))
                {
                    remoteClient.SendCreateGroupReply(UUID.Zero, false, "Insufficient funds to create a classified ad.");
                    return;
                }
            }

            Hashtable result = GenericXMLRPCRequest(ReqHash,
                                                    "classified_update", serverURI);

            if (!Convert.ToBoolean(result["success"]))
            {
                remoteClient.SendAgentAlertMessage(
                    result["errorMessage"].ToString(), false);
                return;
            }

            if (money != null && Convert.ToBoolean(result["created"]))
            {
                money.ApplyCharge(remoteClient.AgentId, queryclassifiedPrice,
                                  MoneyTransactionType.ClassifiedCharge,
                                  queryName);
            }
        }
 private string dotransaction(UUID from, UUID to, int amount, int type, string message)
 {
     IClientAPI clientAPI = LocateClient (from);
     Scene scene = (Scene)clientAPI.Scene;
     m_MoneyModule = scene.RequestModuleInterface<IMoneyModule> ();
     m_TransferModule = scene.RequestModuleInterface<IMessageTransferModule> ();
     if (m_MoneyModule == null) {
         return "No Money Module Configured";
     }
     bool flag = m_MoneyModule.AmountCovered (from, amount);
     if (flag) {
         scene.ProcessMoneyTransferRequest (from, to, amount, type, message);
         if (m_TransferModule != null) {
             GridInstantMessage im = new GridInstantMessage(
                 scene, UUID.Zero, "Web Store",
                 from,
                 (byte)InstantMessageDialog.MessageFromAgent,
                 "You made a Web Store purchase your item will be delivered shortly", false,
                 new Vector3());
             m_TransferModule.SendInstantMessage (im, delegate(bool success) {
             });
         }
         m_Database.UpdateTranPaid (transID);
         return "transaction ok";
     }
     return "Insuficient Funds";
 }