private static bool CheckCommandMessage(CommandMessage message, CommandProcessorAttribute attrib)
 {
     if (message.Channel == null && attrib.NeedsChannel == ParameterStatus.Needed)
     {
         return(false);
     }
     if (message.User == null && attrib.NeedsUser == ParameterStatus.Needed)
     {
         return(false);
     }
     if (message.Text.IsEmpty() && attrib.NeedsText == ParameterStatus.Needed)
     {
         return(false);
     }
     return(true);
 }
        private static SplitInfo ParseCommand(IrcNetwork network, string text, CommandProcessorAttribute attrib)
        {
            if (text.IsEmpty())
            {
                return(new SplitInfo(string.Empty, string.Empty, string.Empty));
            }

            string[] twoFirst = text.Split(CommandSeparators, 2, StringSplitOptions.RemoveEmptyEntries);

            if (network.Parameters.IsChannelName(twoFirst[0]))
            {
                if (attrib.NeedsChannel == ParameterStatus.NotNeeded)
                {
                    return(new SplitInfo(text, string.Empty, string.Empty));
                }

                if (twoFirst.Length > 1 && attrib.NeedsUser != ParameterStatus.NotNeeded)
                {
                    string content = RemoveFirstWords(text, 2);
                    return(new SplitInfo(content, twoFirst[0], twoFirst[1]));
                }
                else
                {
                    string content = RemoveFirstWords(text, 1);
                    return(new SplitInfo(content, twoFirst[0], string.Empty));
                }
            }
            else
            {
                if (attrib.NeedsUser == ParameterStatus.NotNeeded)
                {
                    return(new SplitInfo(text, string.Empty, string.Empty));
                }

                if (twoFirst.Length > 1 && network.Parameters.IsChannelName(twoFirst[1]) && attrib.NeedsChannel != ParameterStatus.NotNeeded)
                {
                    string content = RemoveFirstWords(text, 2);
                    return(new SplitInfo(content, twoFirst[1], twoFirst[0]));
                }
                else
                {
                    string content = RemoveFirstWords(text, 1);
                    return(new SplitInfo(content, string.Empty, twoFirst[0]));
                }
            }
        }
        private static CommandMessage GetMessage(IrcNetwork network, string text, string targetName, CommandProcessorAttribute attrib)
        {
            var split = ParseCommand(network, text, attrib);

            split.SetChannelFallback(network, targetName);

            var chan = split.ChannelName.HasText() ? network.GetChannel(split.ChannelName) : null;
            var user = split.UserName.HasText() ? network.GetUser(split.UserName) : null;

            return(new CommandMessage(split.Text.Trim(), chan, user, targetName));
        }