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]])
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)
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)
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)
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)
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)
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)
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)
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]])