Esempio n. 1
0
 /// <summary>
 /// Using the rules set forth in RFC 2812 determine if
 /// the nickname is valid.
 /// </summary>
 /// <returns>True is the nickname is valid</returns>
 public static bool IsValidNick(string nick)
 {
     if (nick == null || nick.Trim().Length == 0)
     {
         return(false);
     }
     if (Rfc2812Util.ContainsSpace(nick))
     {
         return(false);
     }
     if (nickRegex.IsMatch(nick))
     {
         return(true);
     }
     return(false);
 }
Esempio n. 2
0
        /// <summary>
        /// Using the rules set forth in RFC 2812 determine if
        /// the channel name is valid.
        /// </summary>
        /// <returns>True if the channel name is valid.</returns>
        public static bool IsValidChannelName(string channel)
        {
            if (channel == null || channel.Trim().Length == 0)
            {
                return(false);
            }

            if (Rfc2812Util.ContainsSpace(channel))
            {
                return(false);
            }
            if (ChannelPrefix.IndexOf(channel[0]) != -1)
            {
                if (channel.Length <= 50)
                {
                    return(true);
                }
            }
            return(false);
        }