mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-02-18 14:40:51 +01:00
Fixed a bug and caught some interesting issues with strictRfc. Still need
to look into Channel.kban
This commit is contained in:
parent
d9d1aefac3
commit
90a0529696
@ -362,6 +362,24 @@ class Channel(callbacks.Privmsg):
|
|||||||
irc.replySuccess()
|
irc.replySuccess()
|
||||||
unlobotomize = privmsgs.checkChannelCapability(unlobotomize, 'op')
|
unlobotomize = privmsgs.checkChannelCapability(unlobotomize, 'op')
|
||||||
|
|
||||||
|
def _getBanmask(self, irc, arg):
|
||||||
|
if ircutils.isNick(arg):
|
||||||
|
if not conf.supybot.protocols.irc.strictRfc():
|
||||||
|
try:
|
||||||
|
hostmask = irc.state.nickToHostmask(arg)
|
||||||
|
banmask = ircutils.banmask(hostmask)
|
||||||
|
except KeyError:
|
||||||
|
if ircutils.isUserHostmask(arg):
|
||||||
|
banmask = arg
|
||||||
|
else:
|
||||||
|
hostmask = irc.state.nickToHostmask(arg)
|
||||||
|
banmask = ircutils.banmask(hostmask)
|
||||||
|
elif ircutils.isUserHostmask(arg):
|
||||||
|
banmask = arg
|
||||||
|
else:
|
||||||
|
banmask = None
|
||||||
|
return banmask
|
||||||
|
|
||||||
def permban(self, irc, msg, args, channel):
|
def permban(self, irc, msg, args, channel):
|
||||||
"""[<channel>] <nick|hostmask>
|
"""[<channel>] <nick|hostmask>
|
||||||
|
|
||||||
@ -371,11 +389,8 @@ class Channel(callbacks.Privmsg):
|
|||||||
necessary if the message isn't sent in the channel itself.
|
necessary if the message isn't sent in the channel itself.
|
||||||
"""
|
"""
|
||||||
arg = privmsgs.getArgs(args)
|
arg = privmsgs.getArgs(args)
|
||||||
if ircutils.isNick(arg):
|
banmask = self._getBanmask(irc, arg)
|
||||||
banmask = ircutils.banmask(irc.state.nickToHostmask(arg))
|
if banmask is None:
|
||||||
elif ircutils.isUserHostmask(arg):
|
|
||||||
banmask = arg
|
|
||||||
else:
|
|
||||||
irc.error('That\'s not a valid nick or hostmask.')
|
irc.error('That\'s not a valid nick or hostmask.')
|
||||||
return
|
return
|
||||||
c = ircdb.channels.getChannel(channel)
|
c = ircdb.channels.getChannel(channel)
|
||||||
@ -407,11 +422,8 @@ class Channel(callbacks.Privmsg):
|
|||||||
the channel itself.
|
the channel itself.
|
||||||
"""
|
"""
|
||||||
arg = privmsgs.getArgs(args)
|
arg = privmsgs.getArgs(args)
|
||||||
if ircutils.isNick(arg):
|
banmask = self._getBanmask(irc, arg)
|
||||||
banmask = ircutils.banmask(irc.state.nickToHostmask(arg))
|
if banmask is None:
|
||||||
elif ircutils.isUserHostmask(arg):
|
|
||||||
banmask = arg
|
|
||||||
else:
|
|
||||||
irc.error('That\'s not a valid nick or hostmask.')
|
irc.error('That\'s not a valid nick or hostmask.')
|
||||||
return
|
return
|
||||||
c = ircdb.channels.getChannel(channel)
|
c = ircdb.channels.getChannel(channel)
|
||||||
@ -541,9 +553,12 @@ class Channel(callbacks.Privmsg):
|
|||||||
"""
|
"""
|
||||||
capability = privmsgs.getArgs(args)
|
capability = privmsgs.getArgs(args)
|
||||||
c = ircdb.channels.getChannel(channel)
|
c = ircdb.channels.getChannel(channel)
|
||||||
c.removeCapability(capability)
|
try:
|
||||||
ircdb.channels.setChannel(channel, c)
|
c.removeCapability(capability)
|
||||||
irc.replySuccess()
|
ircdb.channels.setChannel(channel, c)
|
||||||
|
irc.replySuccess()
|
||||||
|
except KeyError:
|
||||||
|
irc.error('I do not know about that channel capability.')
|
||||||
unsetcapability = privmsgs.checkChannelCapability(unsetcapability, 'op')
|
unsetcapability = privmsgs.checkChannelCapability(unsetcapability, 'op')
|
||||||
|
|
||||||
def capabilities(self, irc, msg, args):
|
def capabilities(self, irc, msg, args):
|
||||||
|
@ -56,6 +56,9 @@ class ChannelTestCase(ChannelPluginTestCase, PluginDocumentation):
|
|||||||
|
|
||||||
def testCapabilities(self):
|
def testCapabilities(self):
|
||||||
self.assertNotError('channel capabilities')
|
self.assertNotError('channel capabilities')
|
||||||
|
self.assertNotError('channel setcapability -foo')
|
||||||
|
self.assertNotError('channel unsetcapability -foo')
|
||||||
|
self.assertError('channel unsetcapability -foo')
|
||||||
|
|
||||||
def testUnban(self):
|
def testUnban(self):
|
||||||
self.assertError('unban foo!bar@baz')
|
self.assertError('unban foo!bar@baz')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user