public void EncodeMessage_RfcExample2()
        {
            // from the CTCP RFC: http://www.irchelp.org/irchelp/rfc/ctcpspec.html
            string text     = "SED \n\t\big" + '\x10' + '\x1' + '\0' + @"\:";
            string expected = CtcpDelimiter + "SED " + '\x10' + "n\t\big" + '\x10' + '\x10' + @"\a" + '\x10' + @"0\\:" + CtcpDelimiter;

            Assert.AreEqual(expected, CtcpUtils.EncodeMessage(text));
        }
        public void EncodeMessage_RfcExample1()
        {
            // directly from the CTCP RFC: http://www.irchelp.org/irchelp/rfc/ctcpspec.html
            string text     = "Hi there!\n" + "How are you? " + @"\K?";
            string expected = CtcpDelimiter + @"Hi there!" + '\x10' + @"nHow are you? \\K?" + CtcpDelimiter;

            Assert.AreEqual(expected, CtcpUtils.EncodeMessage(text));
        }
        /// <summary>
        /// Sends a CTCP notice.
        /// </summary>
        /// <param name="text">The notice text.</param>
        /// <remarks>This is a low-level method that should be used to send custom CTCP commands if needed.</remarks>
        public void SendNotice(string text)
        {
            Validate.HasText(text, "text");

            this._user.SendNotice(CtcpUtils.EncodeMessage(text));
        }
Esempio n. 4
0
        /// <summary>
        /// Sends a CTCP message to the <see cref="IrcChannel"/>.
        /// </summary>
        /// <param name="text">The message text.</param>
        /// <remarks>This is a low-level method that should be used to send custom CTCP commands if needed.</remarks>
        public void SendMessage(string text)
        {
            Validate.HasText(text, "text");

            this._channel.SendMessage(CtcpUtils.EncodeMessage(text));
        }