mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-02-02 15:44:06 +01:00
Added exception list support for ban and bans; changed the order of arguments in user; added password command
This commit is contained in:
parent
4f54eb864e
commit
584237d818
@ -277,16 +277,21 @@ def devoices(channel, nicks, prefix=''):
|
|||||||
return IrcMsg(prefix=prefix, command=MODE,
|
return IrcMsg(prefix=prefix, command=MODE,
|
||||||
args=(channel, '-' + ('v'*len(nicks)), nicks))
|
args=(channel, '-' + ('v'*len(nicks)), nicks))
|
||||||
|
|
||||||
def ban(channel, hostmask, prefix=''):
|
def ban(channel, hostmask, exception='', prefix=''):
|
||||||
"""Returns a MODE to ban nick on channel."""
|
"""Returns a MODE to ban nick on channel."""
|
||||||
assert isChannel(channel) and isUserHostmask(hostmask)
|
assert isChannel(channel) and isUserHostmask(hostmask)
|
||||||
return IrcMsg(prefix=prefix, command=MODE, args=(channel, '+b', hostmask))
|
modes = [('+b', hostmask)]
|
||||||
|
if exception:
|
||||||
|
modes.append(('+e', exception))
|
||||||
|
return IrcMsg(prefix=prefix, command=MODE,
|
||||||
|
args=[channel] + ircutils.joinModes(modes))
|
||||||
|
|
||||||
def bans(channel, hostmasks, prefix=''):
|
def bans(channel, hostmasks, exceptions=(), prefix=''):
|
||||||
"""Returns a MODE to ban each of nicks on channel."""
|
"""Returns a MODE to ban each of nicks on channel."""
|
||||||
assert filter(isUserHostmask, hostmasks) == hostmasks
|
assert filter(isUserHostmask, hostmasks) == hostmasks
|
||||||
|
modes = [('+b', s) for s in hostmasks] + [('+e', s) for s in exceptions]
|
||||||
return IrcMsg(prefix=prefix, command=MODE,
|
return IrcMsg(prefix=prefix, command=MODE,
|
||||||
args=(channel, '+' + ('b'*len(hostmasks)), hostmasks))
|
args=[channel] + ircutils.joinModes(modes))
|
||||||
|
|
||||||
def unban(channel, hostmask, prefix=''):
|
def unban(channel, hostmask, prefix=''):
|
||||||
"""Returns a MODE to unban nick on channel."""
|
"""Returns a MODE to unban nick on channel."""
|
||||||
@ -379,7 +384,7 @@ def nick(nick, prefix=''):
|
|||||||
assert isNick(nick)
|
assert isNick(nick)
|
||||||
return IrcMsg(prefix=prefix, command='NICK', args=(nick,))
|
return IrcMsg(prefix=prefix, command='NICK', args=(nick,))
|
||||||
|
|
||||||
def user(user, ident, prefix=''):
|
def user(ident, user, prefix=''):
|
||||||
"""Returns a USER with ident ident and user user."""
|
"""Returns a USER with ident ident and user user."""
|
||||||
return IrcMsg(prefix=prefix, command='USER', args=(ident, '0', '*', user))
|
return IrcMsg(prefix=prefix, command='USER', args=(ident, '0', '*', user))
|
||||||
|
|
||||||
@ -398,4 +403,7 @@ def invite(channel, nick, prefix=''):
|
|||||||
assert isNick(nick)
|
assert isNick(nick)
|
||||||
return IrcMsg(prefix=prefix, command='INVITE', args=(channel, nick))
|
return IrcMsg(prefix=prefix, command='INVITE', args=(channel, nick))
|
||||||
|
|
||||||
|
def password(password, prefix=''):
|
||||||
|
return IrcMsg(prefix=prefix, command='PASS', args=(password,))
|
||||||
|
|
||||||
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
||||||
|
Loading…
Reference in New Issue
Block a user