Example #1
0
 def testJoinModes(self):
     plusE = ('+e', '*!*@*ohio-state.edu')
     plusB = ('+b', '*!*@*umich.edu')
     minusL = ('-l', None)
     modes = [plusB, plusE, minusL]
     self.assertEqual(ircutils.joinModes(modes),
                      ['+be-l', plusB[1], plusE[1]])
Example #2
0
 def testJoinModes(self):
     plusE = ('+e', '*!*@*ohio-state.edu')
     plusB = ('+b', '*!*@*umich.edu')
     minusL = ('-l', None)
     modes = [plusB, plusE, minusL]
     self.assertEqual(ircutils.joinModes(modes),
                      ['+be-l', plusB[1], plusE[1]])
Example #3
0
def modes(channel, args=(), prefix="", msg=None):
    """Returns a MODE to quiet each of nicks on channel."""
    if conf.supybot.protocols.irc.strictRfc():
        assert isChannel(channel), repr(channel)
    modes = args
    if msg and not prefix:
        prefix = msg.prefix
    return IrcMsg(prefix=prefix, command="MODE", args=[channel] + ircutils.joinModes(modes), msg=msg)
Example #4
0
def unquiets(channel, hostmasks, prefix="", msg=None):
    """Returns a MODE to unquiet each of nicks on channel."""
    if conf.supybot.protocols.irc.strictRfc():
        assert isChannel(channel), repr(channel)
        assert all(isUserHostmask, hostmasks), hostmasks
    modes = [("-q", s) for s in hostmasks]
    if msg and not prefix:
        prefix = msg.prefix
    return IrcMsg(prefix=prefix, command="MODE", args=[channel] + ircutils.joinModes(modes), msg=msg)
Example #5
0
def modes(channel, args=(), prefix='', msg=None):
    """Returns a MODE to quiet each of nicks on channel."""
    if conf.supybot.protocols.irc.strictRfc():
        assert isChannel(channel), repr(channel)
    modes = args
    if msg and not prefix:
        prefix = msg.prefix
    return IrcMsg(prefix=prefix, command='MODE',
                  args=[channel] + ircutils.joinModes(modes), msg=msg)
Example #6
0
def bans(channel, hostmasks, exceptions=(), prefix='', msg=None):
    """Returns a MODE to ban each of nicks on channel."""
    if conf.supybot.protocols.irc.strictRfc():
        assert isChannel(channel), repr(channel)
        assert all(isUserHostmask, hostmasks), hostmasks
    modes = [('+b', s) for s in hostmasks] + [('+e', s) for s in exceptions]
    if msg and not prefix:
        prefix = msg.prefix
    return IrcMsg(prefix=prefix, command='MODE',
                  args=[channel] + ircutils.joinModes(modes), msg=msg)
Example #7
0
def unbans(channel, hostmasks, prefix='', msg=None):
    """Returns a MODE to unban each of nicks on channel."""
    if conf.supybot.protocols.irc.strictRfc():
        assert isChannel(channel), repr(channel)
        assert all(isUserHostmask, hostmasks), hostmasks
    modes = [('-b', s) for s in hostmasks]
    if msg and not prefix:
        prefix = msg.prefix
    return IrcMsg(prefix=prefix, command='MODE',
                  args=[channel] + ircutils.joinModes(modes), msg=msg)
Example #8
0
def quiet(channel, hostmask, exception="", prefix="", msg=None):
    """Returns a MODE to quiet nick on channel."""
    if conf.supybot.protocols.irc.strictRfc():
        assert isChannel(channel), repr(channel)
        assert isUserHostmask(hostmask), repr(hostmask)
    modes = [("+q", hostmask)]
    if exception:
        modes.append(("+e", exception))
    if msg and not prefix:
        prefix = msg.prefix
    return IrcMsg(prefix=prefix, command="MODE", args=[channel] + ircutils.joinModes(modes), msg=msg)
Example #9
0
def ban(channel, hostmask, exception='', prefix='', msg=None):
    """Returns a MODE to ban nick on channel."""
    if conf.supybot.protocols.irc.strictRfc():
        assert isChannel(channel), repr(channel)
        assert isUserHostmask(hostmask), repr(hostmask)
    modes = [('+b', hostmask)]
    if exception:
        modes.append(('+e', exception))
    if msg and not prefix:
        prefix = msg.prefix
    return IrcMsg(prefix=prefix, command='MODE',
                  args=[channel] + ircutils.joinModes(modes), msg=msg)
Example #10
0
def ban(channel, hostmask, exception='', prefix='', msg=None):
    """Returns a MODE to ban nick on channel."""
    if conf.supybot.protocols.irc.strictRfc():
        assert isChannel(channel), repr(channel)
        assert isUserHostmask(hostmask), repr(hostmask)
    modes = [('+b', hostmask)]
    if exception:
        modes.append(('+e', exception))
    if msg and not prefix:
        prefix = msg.prefix
    return IrcMsg(prefix=prefix, command='MODE',
                  args=[channel] + ircutils.joinModes(modes), msg=msg)
Example #11
0
 def testJoinModes(self):
     plusE = ("+e", "*!*@*ohio-state.edu")
     plusB = ("+b", "*!*@*umich.edu")
     minusL = ("-l", None)
     modes = [plusB, plusE, minusL]
     self.assertEqual(ircutils.joinModes(modes), ["+be-l", plusB[1], plusE[1]])