Exemplo n.º 1
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
            });
        }
Exemplo n.º 2
0
        public bool Run()
        {
            var muteowner  = new UUID("11111111-2222-3333-4444-112233445566");
            var mute1id    = new UUID("11223344-1122-1122-1122-112233445566");
            var mute2id    = new UUID("11223344-1122-1122-1122-112233445577");
            var mute1entry = new MuteListEntry
            {
                MuteName = "Mute1 name",
                MuteID   = mute1id,
                Type     = MuteType.ByName,
                Flags    = MuteFlags.ObjectSoundsMuted
            };
            var mute2entry = new MuteListEntry
            {
                MuteName = "Mute2 name",
                MuteID   = mute2id,
                Type     = MuteType.ByName,
                Flags    = MuteFlags.ObjectSoundsMuted
            };

            m_Log.InfoFormat("Check that mute list is empty");
            List <MuteListEntry> list = m_MuteListService.GetList(muteowner, 0);

            if (list.Count != 0)
            {
                m_Log.Error("Mute list is not empty");
                return(false);
            }

            m_MuteListService.Store(muteowner, mute1entry);

            m_Log.InfoFormat("Check that mute list has 1 entry");
            list = m_MuteListService.GetList(muteowner, 0);
            if (list.Count != 1)
            {
                m_Log.Error("Mute list does not match");
                return(false);
            }

            if (!CheckEqual(list[0], mute1entry))
            {
                m_Log.Error("Mute entry content does not match");
                return(false);
            }


            m_MuteListService.Store(muteowner, mute2entry);

            m_Log.InfoFormat("Check that mute list has 2 entries");
            list = m_MuteListService.GetList(muteowner, 0);
            if (list.Count != 2)
            {
                m_Log.Error("Mute list does not match");
                return(false);
            }

            bool found1 = false;
            bool found2 = false;

            foreach (MuteListEntry e in list)
            {
                if (CheckEqual(e, mute1entry, true))
                {
                    found1 = true;
                }
                if (CheckEqual(e, mute2entry, true))
                {
                    found2 = true;
                }
            }
            if (!found1 || !found2)
            {
                m_Log.Error("Mute entries content does not match");
                return(false);
            }

            m_Log.Info("Removing second entry");
            if (!m_MuteListService.Remove(muteowner, mute2entry.MuteID, mute2entry.MuteName))
            {
                m_Log.Error("Failed to remove it");
                return(false);
            }

            m_Log.InfoFormat("Check that mute list has 1 entry");
            list = m_MuteListService.GetList(muteowner, 0);
            if (list.Count != 1)
            {
                m_Log.Error("Mute list does not match");
                return(false);
            }

            if (!CheckEqual(list[0], mute1entry))
            {
                m_Log.Error("Mute entry content does not match");
                return(false);
            }

            m_Log.Info("Change mute");
            mute1entry.Flags |= MuteFlags.ParticlesNotMuted;
            m_MuteListService.Store(muteowner, mute1entry);

            m_Log.InfoFormat("Check that mute list has 1 entry");
            list = m_MuteListService.GetList(muteowner, 0);
            if (list.Count != 1)
            {
                m_Log.Error("Mute list does not match");
                return(false);
            }

            if (!CheckEqual(list[0], mute1entry))
            {
                m_Log.Error("Mute entry content does not match");
                return(false);
            }

            m_Log.Info("Removing first entry");
            if (!m_MuteListService.Remove(muteowner, mute1entry.MuteID, mute1entry.MuteName))
            {
                m_Log.Error("Failed to remove it");
                return(false);
            }

            m_Log.InfoFormat("Check that mute list is empty");
            list = m_MuteListService.GetList(muteowner, 0);
            if (list.Count != 0)
            {
                m_Log.Error("Mute list is not empty");
                return(false);
            }

            return(true);
        }