Ejemplo n.º 1
0
        private bool DeliverKey(InfobotKey Key, string OriginalText, Channel chan, libirc.UserInfo fu)
        {
            if (Key == null)
            {
                return(false);
            }
            string Target_ = "";
            string text    = OriginalText;

            // we remove the key name from message so that only parameters remain
            if (text.Contains(" "))
            {
                text = text.Substring(text.IndexOf(" ") + 1);
            }
            else
            {
                text = "";
            }
            if (text.Contains("|"))
            {
                Target_ = OriginalText.Substring(OriginalText.IndexOf("|") + 1);
                if (Module.GetConfig(chan, "Infobot.Trim-white-space-in-name", true))
                {
                    Target_ = Target_.Trim();
                }
                text = text.Substring(0, text.IndexOf("|"));
            }
            List <string> Parameters = new List <string>(text.Split(' '));
            string        value_     = ParseInfo(Parameters, text, Key, fu);

            if (Key.IsAct)
            {
                if (String.IsNullOrEmpty(Target_))
                {
                    IRC.DeliverAction(value_, chan);
                }
                else
                {
                    IRC.DeliverAction(Target_ + ": " + value_, chan);
                }
            }
            else
            {
                if (String.IsNullOrEmpty(Target_))
                {
                    IRC.DeliverMessage(value_, chan);
                }
                else
                {
                    IRC.DeliverMessage(Target_ + ": " + value_, chan);
                }
            }
            Key.Displayed++;
            Key.LastTime = DateTime.Now;
            this.StoreDB();
            return(true);
        }