Esempio n. 1
0
    void Add(string channel, string nick, string patternsStr, int?assocPat)
    {
        var patterns = InputTools.GetPatterns(patternsStr);

        int amount = 0;

        if (assocPat == null)
        {
            foreach (var pattern in patterns)
            {
                if (feedPatterns.Add(channel, pattern) != -1)
                {
                    amount++;
                }
            }

            irc.SendNotice(nick, "Added {0} pattern(s)", amount);
        }
        else if (assocPat >= 0)
        {
            foreach (var pattern in patterns)
            {
                if (feedPatterns.AddExclude(channel, assocPat.Value, pattern) != -1)
                {
                    amount++;
                }
            }

            irc.SendNotice(nick, "Added {0} exclude pattern(s)", amount);
        }
        else
        {
            foreach (var pattern in patterns)
            {
                if (feedPatterns.AddGlobalExclude(channel, pattern) != -1)
                {
                    amount++;
                }
            }

            irc.SendNotice(nick, "Added {0} global exclude pattern(s)", amount);
        }
    }