Пример #1
0
        /// <summary>
        /// Interprets an <see cref="IrcMessage"/> and returns the <see cref="IrcMessage"/>s that should be interpreted by an <see cref="IrcClient"/>.
        /// </summary>
        internal IEnumerable <IrcMessage> InterpretMessage(IrcMessage message)
        {
            if (!CtcpUtils.IsCtcpMessage(message))
            {
                return(new[] { message });
            }

            var info = CtcpUtils.FilterMessage(message);

            foreach (var ctcpMessage in info.CtcpMessages)
            {
                this.HandleMessage(ctcpMessage);
            }

            return(info.IrcMessages);
        }
        public void IsCtcpMessage_CtcpMessageInWrongCommand()
        {
            var message = new IrcMessage(this._user, "join", new[] { "example" }, CtcpDelimiter + "FINGER" + CtcpDelimiter);

            Assert.IsFalse(CtcpUtils.IsCtcpMessage(message));
        }
        public void IsCtcpMessage_CtcpMessage()
        {
            var message = new IrcMessage(this._user, "privmsg", new[] { "example" }, CtcpDelimiter + "FINGER" + CtcpDelimiter);

            Assert.IsTrue(CtcpUtils.IsCtcpMessage(message));
        }
        public void IsCtcpMessage_IrcMessage()
        {
            var message = new IrcMessage(this._user, "privmsg", new[] { "example" }, "Hi");

            Assert.IsFalse(CtcpUtils.IsCtcpMessage(message));
        }