progval / Limnoria

A robust, full-featured, and user/programmer-friendly Python IRC bot, with many existing plugins.
https://docs.limnoria.net/
Other
615 stars 172 forks source link

Add an option to quiet instead of/with kick in BadWords plugin #1212

Open damascene opened 8 years ago

damascene commented 8 years ago

It would be useful to fight spam and abuser by having an option to set quiet instead of just kicking out.

the command to set quite could be used to quite both the host and the user name (not to be confused with nick) like this in line 90 BadWords/plugin.py:

Currently it is:

irc.queueMsg(ircmsgs.kick(channel, msg.nick, message))                  #kick only

You can add:

irc.queueMsg(ircmsgs.mode(channel, ('+q', '*!*@%s' % (msg.host))))      #quiet host
irc.queueMsg(ircmsgs.mode(channel, ('+q', '*!%s*' % (msg.user))))       #quiet username

as abusers and spammers use to change their host quickly they will now have to change their username too which makes it more difficult for them

jlu5 commented 8 years ago

There's no standard way of setting quiets that works on all IRCds. Charybdis style uses +q *!*@host, InspIRCd uses +b m:*!*@host, and UnrealIRCd uses +b ~q:*!*@host. I assume there are others which don't support quiet at all.

Support for this should look at the IRCd being used (possibly in core as an ircmsgs.quiet command?). It's a nice idea though.

Mikaela commented 8 years ago

You could always watch for CHANMODES.

CHANMODES=eIbq,k,flj,ACFLOPQScgimnprstz

jlu5 commented 8 years ago

That doesn't tell which extban format to use.

IotaSpencer commented 7 years ago

Could watch for EXTBANS in VERSION? If not possible, it shouldn't be hard to init a variable to return the ircd type/version, say InspIRCd- or UnrealIRCd etc. if it catches it on connect it shouldn't be too hard to add that functionality

progval commented 7 years ago

I prefer not to have code that uses a fancy non-standard feature of an IRCd. Allowing arbitrary modes would make it work on any server, even ones with exotic modes.

IotaSpencer commented 7 years ago

Well, should it be config option? plugins.BadWords.quiet_string or what are you suggesting as in 'arbitrary modes'

progval commented 7 years ago

Arbitrary modes.

progval commented 7 years ago

AttackProtector already supports those.

IotaSpencer commented 7 years ago

This could probably be in some format, like if using +q on freenode, it would be Something like,

    method = self.registryValue(channel, 'method'
    action = self.registryValue(channel, 'trigger_action')
    # and lets say they put '+q'
    if c.isHalfopPlus(msg.nick) or \
            ircdb.checkCapability(msg.prefix, cap):
        # ... current code
    elif method == 'mode':
    # that variable would then translate down here
        banmaskstyle = conf.supybot.protocols.irc.banmask
        banmask = banmaskstyle.makeBanmask(prefix)
        ircmsgs.mode(channel, '%s %s %s' % (method, action, banmask))

Of course that's just a stub of what it could be. It could also be ircmsgs.mode('channel', '%s %s%s%s' % (method, action, needsSpace, prefix)) also granted, action and prefix could be combined depending on if there is a positive(read: true) value for it, like 'plugins.BadWords.action.actionNeedsSpace'