コード例 #1
0
        public void HandleParcelReclaim(AgentCircuit circuit, SceneInterface scene, Message m)
        {
            var req = (ParcelReclaim)m;

            if (req.AgentID != req.CircuitAgentID ||
                req.SessionID != req.CircuitSessionID)
            {
                return;
            }

            IAgent agent = circuit.Agent;

            ParcelInfo pInfo;

            if (scene.Parcels.TryGetValue(req.LocalID, out pInfo) &&
                scene.CanReclaimParcel(agent.Owner, pInfo))
            {
                pInfo.Group      = UGI.Unknown;
                pInfo.GroupOwned = false;
                pInfo.ClaimDate  = Date.Now;
                pInfo.SalePrice  = 0;
                pInfo.AuthBuyer  = UGUI.Unknown;
                pInfo.Owner      = scene.Owner;
                pInfo.Flags     &= ~(ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory);
                scene.TriggerParcelUpdate(pInfo);
            }
        }
コード例 #2
0
ファイル: ViewerVoice.cs プロジェクト: ft-/silversim-testing
        public void HandleParcelVoiceInfoRequest(ViewerAgent agent, AgentCircuit circuit, HttpRequest req)
        {
            if (req.CallerIP != circuit.RemoteIP)
            {
                req.ErrorResponse(HttpStatusCode.Forbidden, "Forbidden");
                return;
            }
            if (req.Method != "POST")
            {
                req.ErrorResponse(HttpStatusCode.MethodNotAllowed, "Method not allowed");
                return;
            }

            SceneInterface scene = circuit.Scene;
            ParcelInfo     pInfo;
            IValue         res;

            if (!scene.Parcels.TryGetValue(agent.GlobalPosition, out pInfo))
            {
                res = new Undef();
            }
            else if (scene.EstateAllowsVoice &&
                     ((pInfo.Flags & ParcelFlags.AllowVoiceChat) != 0 || scene.HasGroupPower(agent.Owner, pInfo.Group, GroupPowers.AllowVoiceChat)))
            {
                VoiceChannelInfo channelInfo;

                try
                {
                    if ((pInfo.Flags & ParcelFlags.UseEstateVoiceChan) != 0)
                    {
                        channelInfo = m_VoiceService.GetEstateChannel(scene.EstateService[scene.EstateService.RegionMap[scene.ID]]);
                    }
                    else
                    {
                        channelInfo = m_VoiceService.GetParcelChannel(scene, pInfo);
                    }
                    res = new Map {
                        { "channel_uri", channelInfo.ChannelSipUri }
                    };
                }
                catch
                {
                    res = new Map {
                        { "channel_uri", string.Empty }
                    };
                }
            }
            else
            {
                res = new Map {
                    { "channel_uri", string.Empty }
                };
            }

            using (HttpResponse resp = req.BeginResponse("application/llsd+xml"))
                using (Stream s = resp.GetOutputStream())
                {
                    LlsdXml.Serialize(res, s);
                }
        }
コード例 #3
0
ファイル: ViewerSearch.cs プロジェクト: ft-/silversim-testing
        private void ProcessDirFindQuery(ViewerAgent agent, AgentCircuit circuit, Message m)
        {
            var            req   = (DirFindQuery)m;
            SceneInterface scene = circuit.Scene;

            if (scene == null)
            {
                return;
            }

            if (req.CircuitSessionID != req.SessionID ||
                req.CircuitAgentID != req.AgentID)
            {
                return;
            }

            if ((req.QueryFlags & SearchFlags.People) != 0)
            {
                ProcessDirFindQuery_People(agent, scene, req);
            }

            if ((req.QueryFlags & SearchFlags.Groups) != 0)
            {
                ProcessDirFindQuery_Groups(agent, scene, req);
            }

            if ((req.QueryFlags & SearchFlags.Events) != 0)
            {
                ProcessDirFindQuery_Events(agent, scene, req);
            }
        }
コード例 #4
0
        private void HandleUpdateMuteListEntry(AgentCircuit circuit, Message m)
        {
            ViewerAgent agent = circuit.Agent;
            MuteListServiceInterface muteListService = agent.MuteListService;
            var req = (UpdateMuteListEntry)m;

            if (req.AgentID != req.CircuitAgentID ||
                req.SessionID != req.CircuitSessionID)
            {
                return;
            }

            if (muteListService == null)
            {
                return;
            }

            muteListService.Store(agent.ID, new MuteListEntry
            {
                Flags    = req.MuteFlags,
                MuteID   = req.MuteID,
                MuteName = req.MuteName,
                Type     = req.MuteType
            });
        }
コード例 #5
0
        public void HandleParcelGodForceOwner(AgentCircuit circuit, SceneInterface scene, Message m)
        {
            var          req = (ParcelGodForceOwner)m;
            UGUIWithName agentID;
            ParcelInfo   pInfo;
            IAgent       godAgent = circuit.Agent;

            if (req.CircuitSessionID != req.SessionID ||
                req.CircuitAgentID != req.AgentID ||
                req.OwnerID != req.AgentID ||
                !scene.Agents.TryGetValue(req.AgentID, out godAgent) ||
                !scene.AvatarNameService.TryGetValue(req.OwnerID, out agentID) ||
                !scene.Parcels.TryGetValue(req.LocalID, out pInfo) ||
                !godAgent.IsActiveGod ||
                !godAgent.IsInScene(scene))
            {
                return;
            }
            m_Log.InfoFormat("Forced parcel {0} ({1}) to be owned by {2}", pInfo.Name, pInfo.ID, agentID.FullName);
            pInfo.Group      = UGI.Unknown;
            pInfo.GroupOwned = false;
            pInfo.ClaimDate  = Date.Now;
            pInfo.SalePrice  = 0;
            pInfo.AuthBuyer  = UGUI.Unknown;
            pInfo.Owner      = agentID;
            pInfo.Flags     &= ~(ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory);
            scene.TriggerParcelUpdate(pInfo);
        }
コード例 #6
0
        private void GetExperiencesResponse(ViewerAgent agent, AgentCircuit circuit, HttpRequest req)
        {
            Dictionary <UEI, bool> result = circuit.Scene.ExperienceService.Permissions[agent.Owner];
            var resdata = new Map();
            var allowed = new AnArray();
            var blocked = new AnArray();

            resdata.Add("experiences", allowed);
            resdata.Add("blocked", blocked);

            foreach (KeyValuePair <UEI, bool> kvp in result)
            {
                if (kvp.Value)
                {
                    allowed.Add(kvp.Key.ID);
                }
                else
                {
                    blocked.Add(kvp.Key.ID);
                }
            }

            using (var res = req.BeginResponse("application/llsd+xml"))
            {
                using (Stream s = res.GetOutputStream())
                {
                    LlsdXml.Serialize(resdata, s);
                }
            }
        }
コード例 #7
0
 public ChatSessionRequest(ViewerAgent agent, AgentCircuit circuit, string remoteIP, RwLockedDictionary <string, Func <ViewerAgent, AgentCircuit, HttpRequest, Map, Map> > handlers)
 {
     m_Agent    = agent;
     m_Circuit  = circuit;
     m_RemoteIP = remoteIP;
     ChatSessionRequestMethodHandlers = handlers;
 }
コード例 #8
0
        public void HandleExperiencePerferencesCapability(ViewerAgent agent, AgentCircuit circuit, HttpRequest httpreq)
        {
            if (httpreq.CallerIP != circuit.RemoteIP)
            {
                httpreq.ErrorResponse(HttpStatusCode.Forbidden, "Forbidden");
                return;
            }

            switch (httpreq.Method)
            {
            case "GET":
                break;

            case "PUT":
                HandleExperiencePreferencesPut(agent, circuit, httpreq);
                break;

            case "DELETE":
                HandleExperiencePreferencesDelete(agent, circuit, httpreq);
                break;

            default:
                httpreq.ErrorResponse(HttpStatusCode.MethodNotAllowed, "Method not allowed");
                return;
            }

            GetExperiencesResponse(agent, circuit, httpreq);
        }
コード例 #9
0
        public void HandleParcelPropertiesUpdate(AgentCircuit circuit, SceneInterface scene, Message m)
        {
            var req = (ParcelPropertiesUpdate)m;

            if (req.AgentID != req.CircuitAgentID ||
                req.SessionID != req.CircuitSessionID)
            {
                return;
            }

            IAgent agent = circuit.Agent;

            ParcelInfo pInfo;

            if (scene.Parcels.TryGetValue(req.LocalID, out pInfo) &&
                scene.CanEditParcelDetails(agent.Owner, pInfo))
            {
                pInfo.Flags       = req.ParcelFlags;
                pInfo.SalePrice   = req.SalePrice;
                pInfo.Name        = req.Name;
                pInfo.Description = req.Description;
                pInfo.MusicURI    = (req.MusicURL.Length != 0) && Uri.IsWellFormedUriString(req.MusicURL, UriKind.Absolute) ?
                                    new URI(req.MusicURL) : null;

                pInfo.MediaURI = (req.MediaURL.Length != 0) && Uri.IsWellFormedUriString(req.MediaURL, UriKind.Absolute) ?
                                 new URI(req.MediaURL) : null;
                pInfo.MediaAutoScale = req.MediaAutoScale;
                UGI ugi;
                if (req.GroupID == UUID.Zero)
                {
                    ugi = UGI.Unknown;
                }
                else if (scene.GroupsNameService.TryGetValue(req.GroupID, out ugi))
                {
                    pInfo.Group = ugi;
                }
                else
                {
                    pInfo.Group = UGI.Unknown;
                }

                pInfo.PassPrice = req.PassPrice;
                pInfo.PassHours = req.PassHours;
                pInfo.Category  = req.Category;
                if (req.AuthBuyerID == UUID.Zero ||
                    !scene.AvatarNameService.TryGetValue(req.AuthBuyerID, out pInfo.AuthBuyer))
                {
                    pInfo.AuthBuyer = UGUI.Unknown;
                }

                pInfo.SnapshotID      = req.SnapshotID;
                pInfo.LandingPosition = req.UserLocation;
                pInfo.LandingLookAt   = req.UserLookAt;
                pInfo.LandingType     = req.LandingType;
                scene.TriggerParcelUpdate(pInfo);
            }
        }
コード例 #10
0
        private void HandleParcelInfoOnLocal(AgentCircuit circuit, GridVector location, SceneInterface scene, ParcelInfoRequest req)
        {
            ParcelInfo pinfo;

            if (scene.Parcels.TryGetValue(req.ParcelID.RegionPos, out pinfo))
            {
                SendParcelInfo(circuit, location, scene.Name, pinfo);
            }
        }
コード例 #11
0
        private void HandleRegionExperiencesGet(ViewerAgent agent, AgentCircuit circuit, HttpRequest httpreq)
        {
            var allowed = new List <UEI>();
            var blocked = new List <UEI>();

            SceneInterface scene = circuit.Scene;

            if (scene == null)
            {
                httpreq.ErrorResponse(HttpStatusCode.InternalServerError, "Internal server error");
                return;
            }
            EstateServiceInterface estateService = scene.EstateService;

            foreach (EstateExperienceInfo info in estateService.Experiences[scene.ParentEstateID])
            {
                if (info.IsAllowed)
                {
                    allowed.Add(info.ExperienceID);
                }
                else
                {
                    blocked.Add(info.ExperienceID);
                }
            }
            List <UEI> trusted = estateService.TrustedExperiences[scene.ParentEstateID];

            Map     resdata = new Map();
            AnArray array   = new AnArray();

            foreach (UEI id in allowed)
            {
                array.Add(id.ID);
            }
            resdata.Add("allowed", array);
            array = new AnArray();
            foreach (UEI id in blocked)
            {
                array.Add(id.ID);
            }
            resdata.Add("blocked", array);
            array = new AnArray();
            foreach (UEI id in trusted)
            {
                array.Add(id.ID);
            }
            resdata.Add("trusted", array);

            using (HttpResponse res = httpreq.BeginResponse("application/llsd+xml"))
            {
                using (Stream o = res.GetOutputStream())
                {
                    LlsdXml.Serialize(resdata, o);
                }
            }
        }
コード例 #12
0
        public void HandleInventoryDeclined(ViewerAgent dstAgent, AgentCircuit circuit, Message m)
        {
            var im = (ImprovedInstantMessage)m;

            UserAgentServiceInterface userAgentService = dstAgent.UserAgentService;
            InventoryServiceInterface inventorySerice  = dstAgent.InventoryService;

            if (userAgentService == null)
            {
                return;
            }

            if (userAgentService.SupportsInventoryTransfer)
            {
                userAgentService.DeclineInventoryTransfer(dstAgent.ID, im.ID);
            }
            else
            {
                SceneInterface scene = circuit.Scene;
                if (scene == null)
                {
                    return;
                }

                UGUI toAgent;
                if (!scene.AvatarNameService.TryGetValue(im.ToAgentID, out toAgent))
                {
                    /* pass the unresolved here */
                    toAgent = new UGUI(im.ToAgentID);
                }

                InventoryFolder trashFolder;
                if (userAgentService.RequiresInventoryIDAsIMSessionID &&
                    inventorySerice != null &&
                    inventorySerice.Folder.TryGetValue(dstAgent.ID, AssetType.TrashFolder, out trashFolder))
                {
                    if (inventorySerice.Item.ContainsKey(dstAgent.ID, im.ID))
                    {
                        inventorySerice.Item.Move(dstAgent.ID, im.ID, trashFolder.ID);
                    }
                    else
                    {
                        inventorySerice.Folder.Move(dstAgent.ID, im.ID, trashFolder.ID);
                    }
                }

                m_IMService.Send(new GridInstantMessage
                {
                    ToAgent     = toAgent,
                    FromAgent   = dstAgent.NamedOwner,
                    Message     = string.Empty,
                    IMSessionID = im.ID,
                    Dialog      = GridInstantMessageDialog.InventoryDeclined
                });
            }
        }
コード例 #13
0
        public void HandleCreateInventoryCategory(ViewerAgent agent, AgentCircuit circuit, HttpRequest req)
        {
            if (req.CallerIP != circuit.RemoteIP)
            {
                req.ErrorResponse(HttpStatusCode.Forbidden, "Forbidden");
                return;
            }

            HandleHttpRequest(req, agent.InventoryService, agent.Owner);
        }
コード例 #14
0
        private void HandleExperiencePreferencesPut(ViewerAgent agent, AgentCircuit circuit, HttpRequest httpreq)
        {
            Map reqdata;

            using (Stream input = httpreq.Body)
            {
                reqdata = LlsdXml.Deserialize(input) as Map;
            }

            if (reqdata == null)
            {
                httpreq.ErrorResponse(HttpStatusCode.BadRequest, "Bad request");
                return;
            }

            SceneInterface scene = circuit.Scene;

            if (scene == null)
            {
                httpreq.ErrorResponse(HttpStatusCode.NotFound, "Not Found");
                return;
            }

            ExperienceServiceInterface experienceService = scene.ExperienceService;

            if (experienceService == null)
            {
                httpreq.ErrorResponse(HttpStatusCode.NotFound, "Not Found");
                return;
            }

            foreach (KeyValuePair <string, IValue> kvp in reqdata)
            {
                Map    entry = kvp.Value as Map;
                IValue iv;
                UUID   experienceid;
                UEI    uei;
                if (!UUID.TryParse(kvp.Key, out experienceid) || entry == null || !entry.TryGetValue("permission", out iv) || !experienceService.TryGetValue(experienceid, out uei))
                {
                    continue;
                }

                switch (iv.ToString())
                {
                case "Allow":
                    experienceService.Permissions[uei, agent.Owner] = true;
                    break;

                case "Block":
                    experienceService.Permissions[uei, agent.Owner] = false;
                    break;
                }
            }
        }
コード例 #15
0
        public void HandleIsExperienceAdminCapability(ViewerAgent agent, AgentCircuit circuit, HttpRequest httpreq)
        {
            if (httpreq.CallerIP != circuit.RemoteIP)
            {
                httpreq.ErrorResponse(HttpStatusCode.Forbidden, "Forbidden");
                return;
            }
            if (httpreq.Method != "GET")
            {
                httpreq.ErrorResponse(HttpStatusCode.MethodNotAllowed, "Method not allowed");
                return;
            }

            Dictionary <string, object> reqdata = REST.ParseRESTFromRawUrl(httpreq.RawUrl);
            UUID experienceid = UUID.Parse((string)reqdata["experience_id"]);

            SceneInterface scene = circuit.Scene;

            if (scene == null)
            {
                httpreq.ErrorResponse(HttpStatusCode.NotFound, "Not Found");
                return;
            }

            ExperienceServiceInterface experienceService = scene.ExperienceService;

            if (experienceService == null)
            {
                httpreq.ErrorResponse(HttpStatusCode.NotFound, "Not Found");
                return;
            }

            ExperienceInfo info;
            bool           isadmin = false;

            if (experienceService.TryGetValue(experienceid, out info))
            {
                isadmin = info.Owner.EqualsGrid(agent.Owner) || experienceService.Admins[info.ID, agent.Owner];
            }

            Map resdata = new Map
            {
                { "status", isadmin }
            };

            using (HttpResponse res = httpreq.BeginResponse("application/llsd+xml"))
            {
                using (Stream o = res.GetOutputStream())
                {
                    LlsdXml.Serialize(resdata, o);
                }
            }
        }
コード例 #16
0
 private Map Invite(ViewerAgent agent, AgentCircuit circuit, HttpRequest req, Map reqdata)
 {
     /*
      * <llsd>
      * <map>
      * <key>method</key><string>invite</string>
      * <key>session-id</key><uuid></uuid>
      * <key>params</key><array><uuid></uuid></array>
      * </map>
      * </llsd>
      */
     return(new Map());
 }
コード例 #17
0
        public void HandleParcelDivide(AgentCircuit circuit, SceneInterface scene, Message m)
        {
            var req = (ParcelDivide)m;

            if (req.AgentID != req.CircuitAgentID ||
                req.SessionID != req.CircuitSessionID)
            {
                return;
            }

            IAgent agent = circuit.Agent;

            scene.DivideParcel(agent.Owner, (int)Math.Round(req.West), (int)Math.Round(req.South), (int)Math.Round(req.East), (int)Math.Round(req.North));
        }
コード例 #18
0
ファイル: ViewerSearch.cs プロジェクト: ft-/silversim-testing
        private void ProcessAvatarPickerRequest(ViewerAgent agent, AgentCircuit circuit, Message m)
        {
            var req   = (AvatarPickerRequest)m;
            var res   = new AvatarPickerReply();
            var scene = circuit.Scene;

            if (scene == null)
            {
                return;
            }

            if (req.CircuitSessionID != req.SessionID ||
                req.CircuitAgentID != req.AgentID)
            {
                return;
            }

            res.AgentID = req.AgentID;
            res.QueryID = req.QueryID;
            if (string.IsNullOrEmpty(req.Name) || req.Name.Length < 3)
            {
                agent.SendMessageAlways(res, scene.ID);
                return;
            }

            string[] names = req.Name.Split(' ');

            if (names.Length < 1 || names.Length > 2)
            {
                agent.SendMessageAlways(res, scene.ID);
                return;
            }

            var results = scene.AvatarNameService.Search(names);

            for (int offset = 0; offset < results.Count && offset < 100; ++offset)
            {
                string[] sp = results[offset].FullName.Split(new char[] { ' ' }, 2);
                var      d  = new AvatarPickerReply.DataEntry
                {
                    AvatarID  = results[offset].ID,
                    FirstName = sp[0],
                    LastName  = (sp.Length > 1) ?
                                sp[1] :
                                string.Empty
                };
                res.Data.Add(d);
            }
            agent.SendMessageAlways(res, scene.ID);
        }
コード例 #19
0
        private void HandleParcelBuy(AgentCircuit circuit, SceneInterface scene, Message m)
        {
            var req = (ParcelBuy)m;

            if (req.CircuitAgentID != req.AgentID ||
                req.CircuitSessionID != req.SessionID)
            {
                return;
            }

            ViewerAgent agent = circuit.Agent;

            ParcelInfo pinfo;

            if (scene.Parcels.TryGetValue(req.LocalID, out pinfo) && (pinfo.Flags & ParcelFlags.ForSale) != 0)
            {
                if (pinfo.AuthBuyer.EqualsGrid(agent.Owner) || pinfo.AuthBuyer == UGUI.Unknown)
                {
                    if (pinfo.SalePrice != 0)
                    {
                        /* we have to process it on economy */
                        EconomyServiceInterface economyService = agent.EconomyService;
                        if (economyService != null)
                        {
                            if (pinfo.GroupOwned)
                            {
                                economyService.TransferMoney(agent.Owner, pinfo.Group, new LandSaleTransaction(scene.GetRegionInfo().Location, scene.ID, scene.Name)
                                {
                                    ParcelID   = pinfo.ID,
                                    ParcelName = pinfo.Name
                                }, pinfo.SalePrice, () => ChangeParcelOwnership(scene, pinfo, agent.Owner, pinfo.SalePrice, req));
                            }
                            else
                            {
                                economyService.TransferMoney(agent.Owner, pinfo.Owner, new LandSaleTransaction(scene.GetRegionInfo().Location, scene.ID, scene.Name)
                                {
                                    ParcelID   = pinfo.ID,
                                    ParcelName = pinfo.Name
                                }, pinfo.SalePrice, () => ChangeParcelOwnership(scene, pinfo, agent.Owner, pinfo.SalePrice, req));
                            }
                        }
                    }
                    else
                    {
                        ChangeParcelOwnership(scene, pinfo, agent.Owner, pinfo.SalePrice, req);
                    }
                }
            }
        }
コード例 #20
0
        public void HandleGroupExperiencesCapability(ViewerAgent agent, AgentCircuit circuit, HttpRequest httpreq)
        {
            if (httpreq.CallerIP != circuit.RemoteIP)
            {
                httpreq.ErrorResponse(HttpStatusCode.Forbidden, "Forbidden");
                return;
            }
            if (httpreq.Method != "GET")
            {
                httpreq.ErrorResponse(HttpStatusCode.MethodNotAllowed, "Method not allowed");
                return;
            }

            SceneInterface scene = circuit.Scene;

            if (scene == null)
            {
                httpreq.ErrorResponse(HttpStatusCode.NotFound, "Not Found");
                return;
            }

            ExperienceServiceInterface experienceService = scene.ExperienceService;

            if (experienceService == null)
            {
                httpreq.ErrorResponse(HttpStatusCode.NotFound, "Not Found");
                return;
            }

            List <UEI> experienceids = experienceService.GetGroupExperiences(agent.Group);
            var        ids           = new AnArray();

            foreach (UEI id in experienceids)
            {
                ids.Add(id.ID);
            }
            var resdata = new Map
            {
                ["experience_ids"] = ids
            };

            using (HttpResponse res = httpreq.BeginResponse("application/llsd+xml"))
            {
                using (Stream o = res.GetOutputStream())
                {
                    LlsdXml.Serialize(resdata, o);
                }
            }
        }
コード例 #21
0
        private void HandleParcelClaim(AgentCircuit circuit, SceneInterface scene, Message m)
        {
            var req = (ParcelClaim)m;

            if (req.CircuitAgentID != req.AgentID ||
                req.CircuitSessionID != req.SessionID)
            {
                return;
            }

            ViewerAgent agent = circuit.Agent;

            int totalPrice = 0;

            foreach (ParcelClaim.ParcelDataEntry d in req.ParcelData)
            {
                if (!scene.IsParcelClaimable((int)Math.Round(d.West), (int)Math.Round(d.South), (int)Math.Round(d.East), (int)Math.Round(d.North)))
                {
                    return;
                }
                totalPrice += CalculateClaimPrice(d);
            }

            int    parcelClaimPrice  = scene.EconomyData.PriceParcelClaim;
            double parcelClaimFactor = scene.EconomyData.PriceParcelClaimFactor;

            totalPrice = (int)Math.Ceiling(totalPrice * parcelClaimPrice * parcelClaimFactor);
            EconomyServiceInterface economyService = agent.EconomyService;

            if (totalPrice == 0)
            {
                foreach (ParcelClaim.ParcelDataEntry d in req.ParcelData)
                {
                    scene.ClaimParcel(agent.Owner, (int)Math.Round(d.West), (int)Math.Round(d.South), (int)Math.Round(d.East), (int)Math.Round(d.North),
                                      CalculateClaimPrice(d));
                }
            }
            else if (economyService != null)
            {
                economyService.ChargeAmount(agent.Owner, new LandClaimTransaction(scene.GridPosition, scene.ID, scene.Name), totalPrice, () =>
                {
                    foreach (ParcelClaim.ParcelDataEntry d in req.ParcelData)
                    {
                        scene.ClaimParcel(agent.Owner, (int)Math.Round(d.West), (int)Math.Round(d.South), (int)Math.Round(d.East), (int)Math.Round(d.North),
                                          CalculateClaimPrice(d));
                    }
                });
            }
        }
コード例 #22
0
        public void HandleGetExperiencesCapability(ViewerAgent agent, AgentCircuit circuit, HttpRequest httpreq)
        {
            if (httpreq.CallerIP != circuit.RemoteIP)
            {
                httpreq.ErrorResponse(HttpStatusCode.Forbidden, "Forbidden");
                return;
            }
            if (httpreq.Method != "GET")
            {
                httpreq.ErrorResponse(HttpStatusCode.MethodNotAllowed, "Method not allowed");
                return;
            }

            GetExperiencesResponse(agent, circuit, httpreq);
        }
コード例 #23
0
        public void HandleReadOfflineMsgs(ViewerAgent agent, AgentCircuit circuit, HttpRequest req)
        {
            if (req.CallerIP != circuit.RemoteIP)
            {
                req.ErrorResponse(HttpStatusCode.Forbidden, "Forbidden");
                return;
            }
            if (req.Method != "GET")
            {
                req.ErrorResponse(HttpStatusCode.MethodNotAllowed, "Method not allowed");
                return;
            }

            ProcessReadOfflineMsgs(agent.Owner.ID, req, agent.OfflineIMService);
        }
コード例 #24
0
        public void HandleFetchLibDescendents2(ViewerAgent agent, AgentCircuit circuit, HttpRequest req)
        {
            if (req.CallerIP != circuit.RemoteIP)
            {
                req.ErrorResponse(HttpStatusCode.Forbidden, "Forbidden");
                return;
            }

            UUID libraryOwner;
            lock (m_ConfigUpdateLock)
            {
                libraryOwner = m_GridLibraryOwner;
            }

            HandleHttpRequest(req, agent.InventoryService, agent.Owner.ID, libraryOwner);
        }
コード例 #25
0
        public void HandleInventoryAPIv3(ViewerAgent agent, AgentCircuit circuit, HttpRequest req)
        {
            string capsUrl      = req.IsSsl ? m_HttpsServer.ServerURI : m_HttpServer.ServerURI;
            string rawPrefixUrl = req.RawUrl.Substring(0, PrefixCapsUrl.Length);

            capsUrl += rawPrefixUrl.Substring(1);

            if (req.CallerIP != circuit.RemoteIP)
            {
                req.ErrorResponse(HttpStatusCode.Forbidden, "Forbidden");
                return;
            }

            var reqcontext = new AISv3Handler.Request(req, agent.InventoryService, agent.Owner, false, rawPrefixUrl, capsUrl);

            AISv3Handler.MainHandler(reqcontext);
        }
コード例 #26
0
        private void HandleRemoveMuteListEntry(AgentCircuit circuit, Message m)
        {
            ViewerAgent agent = circuit.Agent;
            MuteListServiceInterface muteListService = agent.MuteListService;
            var req = (RemoveMuteListEntry)m;

            if (req.AgentID != req.CircuitAgentID ||
                req.SessionID != req.CircuitSessionID)
            {
                return;
            }

            if (muteListService == null)
            {
                return;
            }

            muteListService.Remove(agent.ID, req.MuteID, req.MuteName);
        }
コード例 #27
0
        private void HandleMoneyBalanceRequest(AgentCircuit circuit, Message m)
        {
            var mbr = (MoneyBalanceRequest)m;

            if (mbr.AgentID == mbr.CircuitAgentID && mbr.SessionID == mbr.CircuitSessionID)
            {
                SceneInterface scene;
                ViewerAgent    agent;
                try
                {
                    scene = circuit.Scene;
                    if (scene == null)
                    {
                        return;
                    }
                    agent = circuit.Agent;
                }
                catch
                {
                    return;
                }
                var mbrep = new MoneyBalanceReply
                {
                    ForceZeroFlag = true, /* lots of NUL at the end of the message */
                    AgentID       = mbr.AgentID,
                    TransactionID = mbr.TransactionID
                };
                try
                {
                    var economyService = agent.EconomyService;
                    mbrep.MoneyBalance = (economyService != null) ?
                                         economyService.MoneyBalance[agent.Owner] :
                                         0;
                    mbrep.TransactionSuccess = true;
                }
                catch
                {
                    mbrep.TransactionSuccess = false;
                }
                circuit.SendMessage(mbrep);
            }
        }
コード例 #28
0
        private void HandleEconomyDataRequest(AgentCircuit circuit)
        {
            SceneInterface scene;
            ViewerAgent    agent;

            try
            {
                scene = circuit.Scene;
                if (scene == null)
                {
                    return;
                }
                agent = circuit.Agent;
            }
            catch
            {
                return;
            }
            var ei = scene.EconomyData;
            var ed = new EconomyData();

            if (ei != null)
            {
                ed.ObjectCapacity          = ei.ObjectCapacity;
                ed.ObjectCount             = ei.ObjectCount;
                ed.PriceEnergyUnit         = ei.PriceEnergyUnit;
                ed.PriceGroupCreate        = ei.PriceGroupCreate;
                ed.PriceObjectClaim        = ei.PriceObjectClaim;
                ed.PriceObjectRent         = ei.PriceObjectRent;
                ed.PriceObjectScaleFactor  = ei.PriceObjectScaleFactor;
                ed.PriceParcelClaim        = ei.PriceParcelClaim;
                ed.PriceParcelClaimFactor  = ei.PriceParcelClaimFactor;
                ed.PriceParcelRent         = ei.PriceParcelRent;
                ed.PricePublicObjectDecay  = ei.PricePublicObjectDecay;
                ed.PricePublicObjectDelete = ei.PricePublicObjectDelete;
                ed.PriceRentLight          = ei.PriceRentLight;
                ed.PriceUpload             = ei.PriceUpload;
                ed.TeleportMinPrice        = ei.TeleportMinPrice;
                ed.TeleportPriceExponent   = ei.TeleportPriceExponent;
            }
            agent.SendMessageAlways(ed, scene.ID);
        }
コード例 #29
0
        public void HandleParcelSetOtherCleanTime(AgentCircuit circuit, SceneInterface scene, Message m)
        {
            var req = (ParcelSetOtherCleanTime)m;

            if (req.AgentID != req.CircuitAgentID ||
                req.SessionID != req.CircuitSessionID)
            {
                return;
            }

            IAgent     agent = circuit.Agent;
            ParcelInfo pInfo;

            if (scene.Parcels.TryGetValue(req.LocalID, out pInfo) &&
                scene.CanEditParcelDetails(agent.Owner, pInfo))
            {
                pInfo.OtherCleanTime = req.OtherCleanTime;
                scene.TriggerParcelUpdate(pInfo);
            }
        }
コード例 #30
0
        private void HandleRegionExperiencesPost(ViewerAgent agent, AgentCircuit circuit, HttpRequest httpreq)
        {
            Map reqmap;

            using (Stream s = httpreq.Body)
            {
                reqmap = LlsdXml.Deserialize(s) as Map;
            }

            if (reqmap == null)
            {
                httpreq.ErrorResponse(HttpStatusCode.BadRequest, "Bad request");
                return;
            }

            /* process map */
            /* process experience addition and authorization */

            HandleRegionExperiencesGet(agent, circuit, httpreq);
        }