コード例 #1
0
        private void sendDetailedEstateData(IClientAPI remote_client, UUID invoice)
        {
            uint sun = 0;

            if (!m_scene.RegionInfo.EstateSettings.UseGlobalTime)
                sun=(uint)(m_scene.RegionInfo.EstateSettings.SunPosition*1024.0) + 0x1800;
            UUID estateOwner;
            if (m_scene.RegionInfo.EstateSettings.EstateOwner != UUID.Zero)
                estateOwner = m_scene.RegionInfo.EstateSettings.EstateOwner;
            else
                estateOwner = m_scene.RegionInfo.MasterAvatarAssignedUUID;

            if (m_scene.Permissions.IsGod(remote_client.AgentId))
                estateOwner = remote_client.AgentId;

            remote_client.SendDetailedEstateData(invoice,
                    m_scene.RegionInfo.EstateSettings.EstateName,
                    m_scene.RegionInfo.EstateSettings.EstateID,
                    m_scene.RegionInfo.EstateSettings.ParentEstateID,
                    GetEstateFlags(),
                    sun,
                    m_scene.RegionInfo.RegionSettings.Covenant,
                    m_scene.RegionInfo.RegionSettings.CovenantLastUpdated,
                    m_scene.RegionInfo.EstateSettings.AbuseEmail,
                    estateOwner);

            remote_client.SendEstateUUIDList(invoice,
                    (int)Constants.EstateAccessDeltaResponse.EstateManagers,
                    m_scene.RegionInfo.EstateSettings.EstateManagers,
                    m_scene.RegionInfo.EstateSettings.EstateID);

            remote_client.SendEstateUUIDList(invoice,
                    (int)Constants.EstateAccessDeltaResponse.AllowedUsers,
                    m_scene.RegionInfo.EstateSettings.EstateAccess,
                    m_scene.RegionInfo.EstateSettings.EstateID);

            remote_client.SendEstateUUIDList(invoice,
                    (int)Constants.EstateAccessDeltaResponse.AllowedGroups,
                    m_scene.RegionInfo.EstateSettings.EstateGroups,
                    m_scene.RegionInfo.EstateSettings.EstateID);

            remote_client.SendBannedUserList(invoice,
                    m_scene.RegionInfo.EstateSettings.EstateBans,
                    m_scene.RegionInfo.EstateSettings.EstateID);
        }
コード例 #2
0
        private void handleEstateAccessDeltaRequest(IClientAPI remote_client, UUID invoice, int estateAccessType, UUID user)
        {
            // EstateAccessDelta handles Estate Managers, Sim Access, Sim Banlist, allowed Groups..  etc.

            // OMV documents AllEstates variants as either bit 0 or bit 1 set.
            // Testing finds it's always bit 0, however to be safe, let's treat either as on.
            bool noReply = ((int)estateAccessType & (int)Constants.EstateAccessDeltaCommands.NoReply) != 0;
            bool allEstates = ((int)estateAccessType & 3) != 0; // mask off lower 2 bits
            int operation = (int)estateAccessType & ~((int)Constants.EstateAccessDeltaCommands.NoReply|3); // mask off lower 2 bits + NoReply

            if ((operation & (int)Constants.EstateAccessDeltaCommands.BanUser) != 0) 
            {
                if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false) || m_scene.Permissions.BypassPermissions())
                {
                    EstateResult result = EstateBanUser(user, true);
                    if (result == EstateResult.Success)
                    {
                        if (!noReply)
                            SendEstateUserAccessChanged(remote_client, invoice, true);
                    }
                    else
                    if (result == EstateResult.AlreadySet)
                    {
                        remote_client.SendAlertMessage("User is already on the region ban list");
                    }
                }
                else
                {
                    remote_client.SendAlertMessage("You are not permitted to change the estate ban list.");
                }
            }

            if ((operation & (int)Constants.EstateAccessDeltaCommands.UnbanUser) != 0) 
            {
                if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false) || m_scene.Permissions.BypassPermissions())
                {
                    EstateResult result = EstateBanUser(user, false);
                    if (result == EstateResult.Success)
                    {
                        if (!noReply)
                            SendEstateUserAccessChanged(remote_client, invoice, true);
                    }
                    else
                    if (result == EstateResult.AlreadySet)
                    {
                        remote_client.SendAlertMessage("User is not on the region ban list");
                    }
                }
                else
                {
                    remote_client.SendAlertMessage("You are not permitted to change the estate ban list.");
                }
            }

            if ((operation & (int)Constants.EstateAccessDeltaCommands.AddUserAsAllowed) != 0) 
            {
                if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false) || m_scene.Permissions.BypassPermissions())
                {
                    EstateResult result = EstateAllowUser(user, true);
                    if (result == EstateResult.Success)
                    {
                        if (!noReply)
                            SendEstateUserAccessChanged(remote_client, invoice, false);
                    }
                    else
                    if (result == EstateResult.AlreadySet)
                    {
                        remote_client.SendAlertMessage("User is already on the region access list.");
                    }
                }
                else
                {
                    remote_client.SendAlertMessage("You are not permitted to change the estate access list.");
                }
            }

            if ((operation & (int)Constants.EstateAccessDeltaCommands.RemoveUserAsAllowed) != 0) 
            {
                if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false) || m_scene.Permissions.BypassPermissions())
                {
                    EstateResult result = EstateAllowUser(user, false);
                    if (result == EstateResult.Success)
                    {
                        if (!noReply)
                            SendEstateUserAccessChanged(remote_client, invoice, false);
                    }
                    else
                    if (result == EstateResult.AlreadySet)
                    {
                        remote_client.SendAlertMessage("User is not on the region access list");
                    }
                }
                else
                {
                    remote_client.SendAlertMessage("You are not permitted to change the estate access list.");
                }
            }

            if ((operation & (int)Constants.EstateAccessDeltaCommands.AddGroupAsAllowed) != 0) 
            {
                if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false) || m_scene.Permissions.BypassPermissions())
                {
                    EstateResult result = EstateAllowGroup(user, true);
                    if (result == EstateResult.Success)
                    {
                        if (!noReply)
                            remote_client.SendEstateUUIDList(invoice, (int)Constants.EstateAccessDeltaResponse.AllowedGroups,
                                        m_scene.RegionInfo.EstateSettings.EstateGroups, m_scene.RegionInfo.EstateSettings.EstateID);
                    }
                    else
                    if (result == EstateResult.AlreadySet)
                    {
                        remote_client.SendAlertMessage("Group is already in the region group access list.");
                    }
                }
                else
                {
                    remote_client.SendAlertMessage("You are not permitted to change the estate group access list.");
                }
            }

            if ((operation & (int)Constants.EstateAccessDeltaCommands.RemoveGroupAsAllowed) != 0) 
            {
                if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false) || m_scene.Permissions.BypassPermissions())
                {
                    EstateResult result = EstateAllowGroup(user, false);
                    if (result == EstateResult.Success)
                    {
                        if (!noReply)
                            remote_client.SendEstateUUIDList(invoice, (int)Constants.EstateAccessDeltaResponse.AllowedGroups,
                                        m_scene.RegionInfo.EstateSettings.EstateGroups, m_scene.RegionInfo.EstateSettings.EstateID);
                    }
                    else
                    if (result == EstateResult.AlreadySet)
                    {
                        remote_client.SendAlertMessage("Group is not on the estate group access list");
                    }
                }
                else
                {
                    remote_client.SendAlertMessage("You are not permitted to change the estate group access list.");
                }
            }

            if ((operation & (int)Constants.EstateAccessDeltaCommands.AddManager) != 0)
            {
                if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions())
                {
                    m_scene.RegionInfo.EstateSettings.AddEstateManager(user);
                    SaveEstateDataAndUpdateRegions((uint)EstateSettings.EstateSaveOptions.EstateSaveManagers);
                    if (!noReply)
                        remote_client.SendEstateUUIDList(invoice, (int)Constants.EstateAccessDeltaResponse.EstateManagers,
                                m_scene.RegionInfo.EstateSettings.EstateManagers, m_scene.RegionInfo.EstateSettings.EstateID);
                }
                else
                {
                    remote_client.SendAlertMessage("You are not permitted to change the estate manager list.");
                }
            }

            if ((operation & (int)Constants.EstateAccessDeltaCommands.RemoveManager) != 0)
            {
                if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions())
                {
                    m_scene.RegionInfo.EstateSettings.RemoveEstateManager(user);
                    SaveEstateDataAndUpdateRegions((uint)EstateSettings.EstateSaveOptions.EstateSaveManagers);

                    if (!noReply)
                        remote_client.SendEstateUUIDList(invoice, (int)Constants.EstateAccessDeltaResponse.EstateManagers,
                                m_scene.RegionInfo.EstateSettings.EstateManagers, m_scene.RegionInfo.EstateSettings.EstateID);
                }
                else
                {
                    remote_client.SendAlertMessage("You are not permitted to change the estate manager list.");
                }
            }

            if (allEstates)
                remote_client.SendAlertMessage("The 'All Estates' option is not implemented yet. Change applied to This Estate only.");
        }
コード例 #3
0
        private void SendEstateUserAccessChanged(IClientAPI remote_client, UUID invoice, bool bannedChanged)
        {
            // Any time the viewer sends a change to the banned user list or the user access list, it clears both lists.
            // So for any change request for either, we will send both back. Factored here.

            // use 'bannedChanged' to send whichever one changed last

            if (bannedChanged)
                remote_client.SendEstateUUIDList(invoice, (int)Constants.EstateAccessDeltaResponse.AllowedUsers,
                                m_scene.RegionInfo.EstateSettings.EstateAccess, m_scene.RegionInfo.EstateSettings.EstateID);

            remote_client.SendBannedUserList(invoice, m_scene.RegionInfo.EstateSettings.EstateBans, m_scene.RegionInfo.EstateSettings.EstateID);

            if (!bannedChanged)
                remote_client.SendEstateUUIDList(invoice, (int)Constants.EstateAccessDeltaResponse.AllowedUsers,
                                m_scene.RegionInfo.EstateSettings.EstateAccess, m_scene.RegionInfo.EstateSettings.EstateID);
        }