some changes related to users tracking and default op status

This commit is contained in:
Nicolas Coevoet 2014-06-25 13:24:40 +02:00
parent b341a7c46f
commit 91388d9ad9
3 changed files with 38 additions and 19 deletions

View File

@ -2,7 +2,7 @@
This supybot plugin keeps records of channel mode changes in a sqlite database and permits management of them over time. It stores affected users, enabling deep searching through them, reviewing actives, editing duration, showing logs, marking/annotating them, etc
The plugin is used in various and large channels on freenode ( #bitcoin, #bitcoin-otc, #bitcoin-pricetalk, #defocus, #wrongplanet, + 40 french channels and )
The plugin is used in various and large channels on freenode ( #bitcoin, #bitcoin-otc, #bitcoin-pricetalk, #defocus, #wrongplanet, #ubuntu-fr*, + 40 french channels)
## Commands ##
@ -58,33 +58,50 @@ ChanTracker also allows you to work out which users would be affected by a ban b
/msg bigbadbot match #myChannel ian <-- will return
<bigbadbot> [#21 +b ian!*@* by me!~me@example.net expires at 2014-04-13 15:20:03 GMT] "even angrier"
## Settings ##
You should increase the ping interval because when the bot joins a channel, it requests lots of data and sometimes the server takes time to answer
If you want the bot to manage its own op status, you can change the config value :
!config supybot.plugins.ChanTracker.doNothingAboutOwnOpStatus False
!config channel #myChannel supybot.plugins.ChanTracker.doNothingAboutOwnOpStatus True
After the 'doNothingAboutOwnOpStatus' changed to False, bot will deop in each channel is in ( if opped ) so take a look at :
!config supybot.plugins.ChanTracker.keepOp False
!config channel #myChannel supybot.plugins.ChanTracker.keepOp True
You should increase the ping interval because when the bot joins a channel because it requests lots of data and sometimes the server takes time to answer
!config supybot.protocols.irc.ping.interval 3600
By default, **bot will not stay opped**, but you can configure that globally or per channel:
Here list of data requested by the bot at join :
!config supybot.plugins.ChanTracker.keepOp False
!config channel #myChannel supybot.plugins.ChanTracker.keepOp True
JOIN :#channel
MODE :#channel
MODE :#channel b
MODE :#channel q
WHO :#channel
WHO #CHANNEL %tnuhiar,42
If you don't want the bot to manage its own op status, you can change the config value :
!config supybot.plugins.ChanTracker.doNothingAboutOwnOpStatus True
!config channel #myChannel supybot.plugins.ChanTracker.doNothingAboutOwnOpStatus False
and if opped or at first op:
MODE :#channel e
MODE :#channel I
The channel modes that will be tracked are currently defined here (qb, and eI if opped -- only ops can see the e and I lists for a channel):
!config supybot.plugins.ChanTracker.modesToAsk
!config supybot.plugins.ChanTracker.modesToAskWhenOpped
!config channel #myChannel supybot.plugins.ChanTracker.modesToAsk b
!config channel #myChannel supybot.plugins.ChanTracker.modesToAskWhenOpped e
The command used by the bot to op itself is editable here:
!config supybot.plugins.ChanTracker.opCommand by default it's "CS OP $channel $nick"
where $channel and $nick will be replaced by targeted channel and bot's nick at runtime
Where $channel and $nick will be replaced by targeted channel and bot's nick at runtime, so you could replace it with :
!config supybot.plugins.ChanTracker.opCommand "PRIVMSG ChanServ :OP $channel $nick"
For more readable date information in output, you should change this:
@ -132,7 +149,6 @@ By default, if the bot is asked to set a ban (+b), it will also kick affected us
The bot will remove exception modes (that is exempt e, or invite exempt I) for people banned if 'doActionAgainstAffected' for given channel is True.
## Channel Protection ##
The plugin has a lot of built-in channel protection features that can be enabled either individually and per channel, or globally:
@ -182,7 +198,7 @@ Example: not flooding: catch a wave of bots which sends the same message from di
Example: a user repeating the same thing: (use repeat detection rather than massRepeat for this):
!config channel #channel supybot.plugins.ChanTracker.repeatPermit 3 <-- triggered after 3 similar message
!config channel #channel supybot.plugins.ChanTracker.repeatLife 40 <-- keep previous messages during 60 seconds
!config channel #channel supybot.plugins.ChanTracker.repeatLife 40 <-- keep previous messages during 40 seconds
!config channel #channel supybot.plugins.ChanTracker.repeatPercent 0.88 <-- 1.00 for identical message, don't go too lower, you will get false positive
!config channel #channel supybot.plugins.ChanTracker.repeatMode q <-- quiet
!config channel #channel supybot.plugins.ChanTracker.repeatDuration 180 <-- for 3 minutes

View File

@ -43,7 +43,7 @@ def configure(advanced):
ChanTracker = conf.registerPlugin('ChanTracker')
conf.registerGlobalValue(ChanTracker, 'pool',
registry.Integer(60, """delay between two checks about mode removal, in seconds. Note, check is also based on irc activity, so removal may be delayed a bit"""))
registry.Integer(60, """delay between two checks about mode removal, in seconds. Note, check is also based on irc activity, so removal may be delayed a bit, -1 to disable delay"""))
conf.registerGlobalValue(ChanTracker, 'CAPS',
registry.CommaSeparatedListOfStrings(['account-notify','extended-join'], """CAP asked of ircd that permits tracking username and account changes"""))
@ -87,7 +87,7 @@ conf.registerChannelValue(ChanTracker, 'announceWithNotice',
registry.Boolean(False,"""use NOTICE instead of PRIVMSG to logChannel"""))
conf.registerChannelValue(ChanTracker, 'announceModes',
registry.CommaSeparatedListOfStrings(['b','q','e','I','r','l','v','o','h','k','n','t','F','i','t'],"""announce modes listed to logChannel"""))
registry.CommaSeparatedListOfStrings(['b','q','e','I','r','l','v','o','h','k','n','t','F','i','t','s','n','c','C'],"""announce modes listed to logChannel"""))
conf.registerChannelValue(ChanTracker, 'announceModeSync',
registry.Boolean(False,"""announce to logChannel that synchronisation of channel modes to tracking database has completed"""))
@ -125,7 +125,7 @@ conf.registerChannelValue(ChanTracker, 'announceCtcp',
# others settings
conf.registerChannelValue(ChanTracker, 'doNothingAboutOwnOpStatus',
registry.Boolean(False, """bot will never try to change his own op status"""))
registry.Boolean(True, """bot will never try to change his own op status"""))
conf.registerChannelValue(ChanTracker, 'keepOp',
registry.Boolean(False, """bot stays opped"""))
@ -137,11 +137,14 @@ conf.registerChannelValue(ChanTracker, 'kickMode',
conf.registerChannelValue(ChanTracker, 'kickMessage',
registry.String("You are banned from this channel", """bot kick reason"""))
conf.registerChannelValue(ChanTracker, 'trackAffected',
registry.Boolean(True, """bot tracks affected users by mode change, if you encounters too much lags/cpu usage, you could disable this feature, but bot will never kick again affected users or remove voice/op/exempt etc of affected users"""))
conf.registerChannelValue(ChanTracker, 'doActionAgainstAffected',
registry.Boolean(True, """devoice, deop, dehalfop user affected by a mode change"""))
conf.registerChannelValue(ChanTracker, 'useChannelBansForPermanentBan',
registry.Boolean(True, """when users join the channel, check if the match a permanent ban"""))
registry.Boolean(True, """when users join the channel, check if user matchs a permanent ban setted in Channel plugin"""))
conf.registerChannelValue(ChanTracker, 'addKickMessageInComment',
registry.Boolean(False, """add kick message to mode comment in tracking database"""))
@ -150,7 +153,7 @@ conf.registerChannelValue(ChanTracker, 'askOpAboutMode',
registry.Boolean(False,"""In a private message, ask the op who added a mode about the duration of the ban and a comment on why it was set"""))
conf.registerChannelValue(ChanTracker, 'checkEvade',
registry.Boolean(True,"""bot will apply same duration and mode than the ban evaded, currently only work when someone identify to an account, and has ip computed"""))
registry.Boolean(True,"""bot will apply same duration and mode than the ban evaded, currently only work when someone identify to an account, and the account is banned $a:account, and has ip computed"""))
conf.registerChannelValue(ChanTracker, 'useChanServForQuiets',
registry.Boolean(False,"""if bot is not opped, use services for quiet / unquiets"""))

View File

@ -2691,7 +2691,7 @@ class ChanTracker(callbacks.Plugin,plugins.ChannelDBHandler):
item = None
if '+' in mode:
if m in self.registryValue('modesToAskWhenOpped',channel=channel) or m in self.registryValue('modesToAsk',channel=channel):
item = chan.addItem(m,value,msg.prefix,now,self.getDb(irc.network))
item = chan.addItem(m,value,msg.prefix,now,self.getDb(irc.network),self.registryValue('trackAffected',channel=channel))
if msg.nick != irc.nick and self.registryValue('askOpAboutMode',channel=channel) and ircdb.checkCapability(msg.prefix, '%s,op' % channel):
data = [item.uid,m,value,channel,msg.prefix,'For [#%s +%s %s in %s - %s user(s)] type <duration> <reason>, you have 3 minutes' % (item.uid,m,value,channel,len(item.affects)),False]
self.addToAsked (irc,msg.prefix,data,msg.nick)