A moderation request sent from a conference moderator Contains an agent and an optional action to take
상속: IChatSessionRequest
예제 #1
0
        /// <summary>
        /// Moderate a chat session
        /// </summary>
        /// <param name="sessionID">the <see cref="UUID"/> of the session to moderate, for group chats this will be the groups UUID</param>
        /// <param name="memberID">the <see cref="UUID"/> of the avatar to moderate</param>
        /// <param name="key">Either "voice" to moderate users voice, or "text" to moderate users text session</param>
        /// <param name="moderate">true to moderate (silence user), false to allow avatar to speak</param>
        public void ModerateChatSessions(UUID sessionID, UUID memberID, string key, bool moderate)
        {
            if (Client.Network.CurrentSim == null || Client.Network.CurrentSim.Caps == null)
                throw new Exception("ChatSessionRequest capability is not currently available");

            Uri url = Client.Network.CurrentSim.Caps.CapabilityURI("ChatSessionRequest");

            if (url != null)
            {
                ChatSessionRequestMuteUpdate req = new ChatSessionRequestMuteUpdate();

                req.RequestKey = key;
                req.RequestValue = moderate;
                req.SessionID = sessionID;
                req.AgentID = memberID;

                CapsClient request = new CapsClient(url);
                request.BeginGetResponse(req.Serialize(), OSDFormat.Xml, Client.Settings.CAPS_TIMEOUT);
            }
            else
            {
                throw new Exception("ChatSessionRequest capability is not currently available");
            }
        }
        public void ChatSessionRequestMuteUpdate()
        {
            ChatSessionRequestMuteUpdate s = new ChatSessionRequestMuteUpdate();
            s.AgentID = UUID.Random();
            s.RequestKey = "text";
            s.RequestValue = true;
            s.SessionID = UUID.Random();

            OSDMap map = s.Serialize();

            ChatSessionRequestMuteUpdate t = new ChatSessionRequestMuteUpdate();
            t.Deserialize(map);

            Assert.AreEqual(s.AgentID, t.AgentID);
            Assert.AreEqual(s.Method, t.Method);
            Assert.AreEqual(s.RequestKey, t.RequestKey);
            Assert.AreEqual(s.RequestValue, t.RequestValue);
            Assert.AreEqual(s.SessionID, t.SessionID);
        }