mirror of
https://github.com/ncoevoet/ChanTracker.git
synced 2025-04-26 13:01:06 -05:00
added --perm option for ub, to remove persistant bans from Channel.ban list
This commit is contained in:
parent
fdf8cee9a2
commit
e33c69219a
33
plugin.py
33
plugin.py
@ -1498,7 +1498,7 @@ class ChanTracker(callbacks.Plugin,plugins.ChannelDBHandler):
|
|||||||
"""[<channel>] <mode> <nick|hostmask|*> [<nick|hostmask|*>]
|
"""[<channel>] <mode> <nick|hostmask|*> [<nick|hostmask|*>]
|
||||||
|
|
||||||
sets -<mode> on them, if * found, remove them all"""
|
sets -<mode> on them, if * found, remove them all"""
|
||||||
b = self._removes(irc,msg,args,channel,mode,items)
|
b = self._removes(irc,msg,args,channel,mode,items,False)
|
||||||
if not msg.nick == irc.nick and not b:
|
if not msg.nick == irc.nick and not b:
|
||||||
irc.reply('unknown patterns, already removed or unsupported mode')
|
irc.reply('unknown patterns, already removed or unsupported mode')
|
||||||
undo = wrap(undo,['op','letter',many('something')])
|
undo = wrap(undo,['op','letter',many('something')])
|
||||||
@ -1507,25 +1507,29 @@ class ChanTracker(callbacks.Plugin,plugins.ChannelDBHandler):
|
|||||||
"""[<channel>] <nick|hostmask|*> [<nick|hostmask|*>]
|
"""[<channel>] <nick|hostmask|*> [<nick|hostmask|*>]
|
||||||
|
|
||||||
sets -q on them, if * found, remove them all"""
|
sets -q on them, if * found, remove them all"""
|
||||||
b = self._removes(irc,msg,args,channel,'q',items)
|
b = self._removes(irc,msg,args,channel,'q',items,False)
|
||||||
if not msg.nick == irc.nick and not b:
|
if not msg.nick == irc.nick and not b:
|
||||||
irc.reply('unknown patterns, already removed or unsupported mode')
|
irc.reply('unknown patterns, already removed or unsupported mode')
|
||||||
uq = wrap(uq,['op',many('something')])
|
uq = wrap(uq,['op',many('something')])
|
||||||
|
|
||||||
def ub (self, irc, msg, args, channel, items):
|
def ub (self, irc, msg, args, channel, optlist, items):
|
||||||
"""[<channel>] <nick|hostmask|*> [<nick|hostmask>]
|
"""[<channel>] [--perm] <nick|hostmask|*> [<nick|hostmask>]
|
||||||
|
|
||||||
sets -b on them, if * found, remove them all"""
|
sets -b on them, if * found, remove them all, --perm to remove them for permanent bans"""
|
||||||
b = self._removes(irc,msg,args,channel,'b',items)
|
perm = False
|
||||||
|
for (option, arg) in optlist:
|
||||||
|
if option == 'perm':
|
||||||
|
perm = True
|
||||||
|
b = self._removes(irc,msg,args,channel,'b',items,perm)
|
||||||
if not msg.nick == irc.nick and not b:
|
if not msg.nick == irc.nick and not b:
|
||||||
irc.reply('unknown patterns, already removed or unsupported mode')
|
irc.reply('unknown patterns, already removed or unsupported mode')
|
||||||
ub = wrap(ub,['op',many('something')])
|
ub = wrap(ub,['op',getopts({'perm':''}),many('something')])
|
||||||
|
|
||||||
def ui (self, irc, msg, args, channel, items):
|
def ui (self, irc, msg, args, channel, items):
|
||||||
"""[<channel>] <nick|hostmask|*> [<nick|hostmask|*>]
|
"""[<channel>] <nick|hostmask|*> [<nick|hostmask|*>]
|
||||||
|
|
||||||
sets -I on them, if * found, remove them all"""
|
sets -I on them, if * found, remove them all"""
|
||||||
b = self._removes(irc,msg,args,channel,'I',items)
|
b = self._removes(irc,msg,args,channel,'I',items,False)
|
||||||
if not msg.nick == irc.nick and not b:
|
if not msg.nick == irc.nick and not b:
|
||||||
irc.reply('unknown patterns, already removed or unsupported mode')
|
irc.reply('unknown patterns, already removed or unsupported mode')
|
||||||
ui = wrap(ui,['op',many('something')])
|
ui = wrap(ui,['op',many('something')])
|
||||||
@ -1534,7 +1538,7 @@ class ChanTracker(callbacks.Plugin,plugins.ChannelDBHandler):
|
|||||||
"""[<channel>] <nick|hostmask|*> [<nick|hostmask|*>]
|
"""[<channel>] <nick|hostmask|*> [<nick|hostmask|*>]
|
||||||
|
|
||||||
sets -e on them, if * found, remove them all"""
|
sets -e on them, if * found, remove them all"""
|
||||||
b = self._removes(irc,msg,args,channel,'e',items)
|
b = self._removes(irc,msg,args,channel,'e',items,False)
|
||||||
if not msg.nick == irc.nick and not b:
|
if not msg.nick == irc.nick and not b:
|
||||||
irc.reply('unknown patterns, already removed or unsupported mode')
|
irc.reply('unknown patterns, already removed or unsupported mode')
|
||||||
ue = wrap(ue,['op',many('something')])
|
ue = wrap(ue,['op',many('something')])
|
||||||
@ -1714,7 +1718,7 @@ class ChanTracker(callbacks.Plugin,plugins.ChannelDBHandler):
|
|||||||
for item in targets:
|
for item in targets:
|
||||||
r = self.getIrcdMode(irc,mode,item)
|
r = self.getIrcdMode(irc,mode,item)
|
||||||
if i.add(irc,channel,r[0],r[1],duration,msg.prefix,self.getDb(irc.network)):
|
if i.add(irc,channel,r[0],r[1],duration,msg.prefix,self.getDb(irc.network)):
|
||||||
if perm and r[1].find(self.getIrcdExtbansPrefix(irc)) == -1:
|
if perm:
|
||||||
chan = ircdb.channels.getChannel(channel)
|
chan = ircdb.channels.getChannel(channel)
|
||||||
chan.addBan(r[1],0)
|
chan.addBan(r[1],0)
|
||||||
ircdb.channels.setChannel(channel, chan)
|
ircdb.channels.setChannel(channel, chan)
|
||||||
@ -1731,7 +1735,7 @@ class ChanTracker(callbacks.Plugin,plugins.ChannelDBHandler):
|
|||||||
self._tickle(irc)
|
self._tickle(irc)
|
||||||
return len(items) == n
|
return len(items) == n
|
||||||
|
|
||||||
def _removes (self,irc,msg,args,channel,mode,items):
|
def _removes (self,irc,msg,args,channel,mode,items,perm=False):
|
||||||
i = self.getIrc(irc)
|
i = self.getIrc(irc)
|
||||||
chan = self.getChan(irc,channel)
|
chan = self.getChan(irc,channel)
|
||||||
targets = []
|
targets = []
|
||||||
@ -1768,6 +1772,13 @@ class ChanTracker(callbacks.Plugin,plugins.ChannelDBHandler):
|
|||||||
f = self._logChan
|
f = self._logChan
|
||||||
for item in targets:
|
for item in targets:
|
||||||
r = self.getIrcdMode(irc,mode,item)
|
r = self.getIrcdMode(irc,mode,item)
|
||||||
|
if perm:
|
||||||
|
chan = ircdb.channels.getChannel(channel)
|
||||||
|
try:
|
||||||
|
chan.removeBan(item)
|
||||||
|
except:
|
||||||
|
self.log.info('%s is not in Channel.ban' % item)
|
||||||
|
ircdb.channels.setChannel(channel, chan)
|
||||||
if i.edit(irc,channel,r[0],r[1],0,msg.prefix,self.getDb(irc.network),None,f,self):
|
if i.edit(irc,channel,r[0],r[1],0,msg.prefix,self.getDb(irc.network),None,f,self):
|
||||||
count = count + 1
|
count = count + 1
|
||||||
self.forceTickle = True
|
self.forceTickle = True
|
||||||
|
Loading…
x
Reference in New Issue
Block a user