@@ -0,0 +1,2486 @@
+# ignore-together.py - a distributed ignore list engine for IRC.%0A%0Afrom __future__ import print_function%0A%0Aimport sys%0Aimport yaml%0A%0Atry:%0A    import weechat%0Aexcept:%0A    class FakeWeechat:%0A        def command(self, cmd):%0A            print(cmd)%0A     weechat = FakeWeechat()%0A%0A%0Aclass IgnoreRule:%0A    %22%22%22An ignore rule.%0A    This provides instrumentation for converting ignore rules into weechat filters.%0A    It handles both types of ignore-together ignore rules.%0A    %22%22%22%0A    def __init__(self, ignorelist, rulename, typename='ignore', hostmasks=%5B%5D, accountnames=%5B%5D, patterns=%5B%5D):%0A        self.ignorelist = ignorelist%0A        self.rulename = rulename%0A        self.typename = typename%0A        self.hostmasks = hostmasks%0A        self.accountnames = accountnames%0A        self.patterns = patterns%0A%0A    def install(self):%0A        %22Install an ignore rule.%22%0A        subrule_ctr = 0%0A        if self.typename == 'ignore':%0A            for pattern in self.hostmasks:%0A                weechat.command('/filter add ignore-together.%7Bignorelist%7D.%7Brulename%7D.%7Bctr%7D irc.* * %7Bpattern%7D'.format(%0A                    ignorelist=self.ignorelist.name, rulename=self.rulename, ctr=subrule_ctr, pattern=pattern)%0A                subrule_ctr++%0A            # XXX - accountnames%0A        elif self.typename == 'message':%0A            for pattern in self.patterns:%0A                weechat.command('/filter add ignore-together.%7Bignorelist%7D.%7Brulename%7D.%7Bctr%7D irc.* * %7Bpattern%7D'.format(%0A                    ignorelist=self.ignorelist.name, rulename=self.rulename, ctr=subrule_ctr, pattern=pattern)%0A                subrule_ctr++%0A%0A    def uninstall(self):%0A        %22Uninstall an ignore rule.%22%0A        subrule_ctr = 0%0A        if self.typename == 'ignore':%0A            for pattern in self.hostmasks:%0A                weechat.command('/filter del ignore-together.%7Bignorelist%7D.%7Brulename%7D.%7Bctr%7D'.format(%0A                    ignorelist=self.ignorelist.name, rulename=self.rulename, ctr=subrule_ctr)%0A                subrule_ctr++%0A        elif self.typename == 'message':%0A            for pattern in self.patterns:%0A                weechat.command('/filter del ignore-together.%7Bignorelist%7D.%7Brulename%7D.%7Bctr%7D'.format(%0A                    ignorelist=self.ignorelist.name, rulename=self.rulename, ctr=subrule_ctr)%0A                subrule_ctr++%0A%0A%0Aclass IgnoreRuleSet:%0A    %22%22%22A downloaded collection of rules.%0A    Handles merging updates vs current state, and so on.%22%22%22%0A    def __init__(self, name, uri):%0A        self.name = name%0A        self.uri = uri%0A%0A

Add work in progress script.