mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-24 11:42:52 +01:00
'Fixed' bug #853791 (really, just fixed the error message).
This commit is contained in:
parent
8242302a07
commit
417f57f4e8
@ -175,7 +175,9 @@ class Channel(callbacks.Privmsg):
|
|||||||
"""
|
"""
|
||||||
channel = privmsgs.getChannel(msg, args)
|
channel = privmsgs.getChannel(msg, args)
|
||||||
(bannedNick, length) = privmsgs.getArgs(args, optional=1)
|
(bannedNick, length) = privmsgs.getArgs(args, optional=1)
|
||||||
|
# Check that they're not trying to make us kickban ourself.
|
||||||
if bannedNick == irc.nick:
|
if bannedNick == irc.nick:
|
||||||
|
self.log.warning('%r tried to make me kban myself.', msg.prefix)
|
||||||
irc.error(msg, 'I cowardly refuse to kickban myself.')
|
irc.error(msg, 'I cowardly refuse to kickban myself.')
|
||||||
return
|
return
|
||||||
length = int(length or 0)
|
length = int(length or 0)
|
||||||
@ -186,21 +188,41 @@ class Channel(callbacks.Privmsg):
|
|||||||
return
|
return
|
||||||
capability = ircdb.makeChannelCapability(channel, 'op')
|
capability = ircdb.makeChannelCapability(channel, 'op')
|
||||||
banmask = ircutils.banmask(bannedHostmask)
|
banmask = ircutils.banmask(bannedHostmask)
|
||||||
|
# Check (again) that they're not trying to make us kickban ourself.
|
||||||
if ircutils.hostmaskPatternEqual(banmask, irc.prefix):
|
if ircutils.hostmaskPatternEqual(banmask, irc.prefix):
|
||||||
banmask = bannedHostmask
|
if ircutils.hostmaskPatternEqual(banmask, irc.prefix):
|
||||||
if bannedNick == msg.nick or \
|
self.log.warning('%r tried to make me kban myself.',msg.prefix)
|
||||||
(ircdb.checkCapability(msg.prefix, capability) \
|
irc.error(msg, 'I cowardly refuse to ban myself.')
|
||||||
and not ircdb.checkCapability(bannedHostmask, capability)):
|
return
|
||||||
if irc.nick in irc.state.channels[channel].ops:
|
|
||||||
irc.queueMsg(ircmsgs.ban(channel, banmask))
|
|
||||||
irc.queueMsg(ircmsgs.kick(channel, bannedNick, msg.nick))
|
|
||||||
if length > 0:
|
|
||||||
def f():
|
|
||||||
irc.queueMsg(ircmsgs.unban(channel, banmask))
|
|
||||||
schedule.addEvent(f, time.time() + length)
|
|
||||||
else:
|
else:
|
||||||
irc.error(msg, 'How can I do that? I\'m not opped.')
|
banmask = bannedHostmask
|
||||||
|
# Check that we have ops.
|
||||||
|
if irc.nick not in irc.state.channels[channel].ops:
|
||||||
|
irc.error(msg, 'How can I kick or ban someone? I\'m not opped.')
|
||||||
|
return
|
||||||
|
# Now, let's actually get to it. Check to make sure they have
|
||||||
|
# #channel.op and the bannee doesn't have #channel.op; or that the
|
||||||
|
# bannee and the banner are both the same person.
|
||||||
|
def doBan():
|
||||||
|
irc.queueMsg(ircmsgs.ban(channel, banmask))
|
||||||
|
irc.queueMsg(ircmsgs.kick(channel, bannedNick, msg.nick))
|
||||||
|
if length > 0:
|
||||||
|
def f():
|
||||||
|
irc.queueMsg(ircmsgs.unban(channel, banmask))
|
||||||
|
schedule.addEvent(f, time.time() + length)
|
||||||
|
if bannedNick == msg.nick:
|
||||||
|
doBan()
|
||||||
|
elif ircdb.checkCapability(msg.prefix, capability):
|
||||||
|
if ircdb.checkCapability(bannedHostmask, capability):
|
||||||
|
self.log.warning('%r tried to ban %r, but both have %s',
|
||||||
|
msg.prefix, bannedHostmask, capability)
|
||||||
|
irc.error(msg, '%s has %s too, you can\'t ban him/her/it.' %
|
||||||
|
bannedNick, capability)
|
||||||
|
else:
|
||||||
|
doBan()
|
||||||
else:
|
else:
|
||||||
|
self.log.warning('%r attempted kban without %s',
|
||||||
|
msg.prefix, capability)
|
||||||
irc.error(msg, conf.replyNoCapability % capability)
|
irc.error(msg, conf.replyNoCapability % capability)
|
||||||
|
|
||||||
def unban(self, irc, msg, args, channel):
|
def unban(self, irc, msg, args, channel):
|
||||||
@ -366,7 +388,7 @@ class Channel(callbacks.Privmsg):
|
|||||||
(name, capability) = privmsgs.getArgs(args, 2)
|
(name, capability) = privmsgs.getArgs(args, 2)
|
||||||
capability = ircdb.makeChannelCapability(channel, capability)
|
capability = ircdb.makeChannelCapability(channel, capability)
|
||||||
try:
|
try:
|
||||||
id = ircdb.users.getUser(name)
|
id = ircdb.users.getUserId(name)
|
||||||
user = ircdb.users.getUser(id)
|
user = ircdb.users.getUser(id)
|
||||||
user.removeCapability(capability)
|
user.removeCapability(capability)
|
||||||
ircdb.users.setUser(id, user)
|
ircdb.users.setUser(id, user)
|
||||||
|
Loading…
Reference in New Issue
Block a user