TextBan v0.1

These are old archives. They are kept for historic purposes only.
Post Reply
Syzop
UnrealIRCd head coder
Posts: 2135
Joined: Sat Mar 06, 2004 8:57 pm
Location: .nl
Contact:

TextBan v0.1

Post by Syzop »

I've added a new experimental module which I had in the queue for a long time now: TextBan (*NIX only version available currently). What it does is let chanops ban certain words or (part of) sentences by for example: +b ~T:block:*http://*. This module is currently experimental, if I get good feedback it'll get added to the Windows (and *NIX) Module Pack later on.
--

README:

Code: Select all

ABOUT
======
This module adds a new extban type ~T by which you can block
certain text.

The syntax is: ~T:<action>:<wildcardexpression>
For example:   ~T:block:*is_using*

A few additional notes:
- Currently 'block' is the only supported action.
- Regexes are not accepted, so only '*' and '?'.
- an underscore ('_') will match both '_' and ' ' (space).
- Colors and control codes (underline/bold/reverse) are stripped
  before we try to match, so they should not (and cannot) be
  specified in the +b ~T.
- Unlike mode +G, the text is matched against the whole sentence
  and not per-word. This doesn't matter much at the moment, but
  might be an important aspect in the future.
- Only messages from normal and voiced users are blocked/filtered,
  messages from halfops and higher are not.

WARNING: This module is currently EXPERIMENTAL. Although I doubt
it will crash, it might have side effects I didn't think of.
Additionally, it's work-in-progress, which means new features will
be added later on.

NOTE ABOUT SPEED
=================
The speed impact is usually acceptable (thanks to simple '* and '?'
matching it is very fast). On an A1800+ with the default settings
of this module, the module is capable of processing ~20.000 (20K)
messages per second.
Note that messages are only processed (and thus consume CPU) if..:
- The channel has any textban
- The client the message is from is LOCAL
- The client the message is from is not an halfop or higher
- The client the message is from is not an IRCOp
Also note that this 20K of messages is a PEAK/MAX, it was calculated
in a situation with all bans max length and all text said with max
length (~500 bytes per message).
The average speed impact is usually much lower (<1% CPU).

(see the .c file for a bit more complete story)

NOTE: max # of bans per channel can be tweaked in the .c file,
      the default is to allow 15 textbans per channel.

REQUIRES
=========
This module requires Unreal3.2 or higher, it has been tested on 3.2.3.

INSTALL
========
Automatically (recommended)
----------------------------
Just run: ./build

Manual
-------
Copy textban.c to your src/modules from your UnrealIrcd dir.
Run: make custommodule MODULEFILE=textban

CONFIG
=======
WARNING: THE MODULE IS PERMANENT -- Once loaded it cannot be removed
         without uncommenting the loadmodule line and restarting the IRCd.

Just add the following line to your unrealircd.conf (or whatever):
loadmodule "src/modules/textban.so";

Then rehash and you are done.
Feedback is welcomed :)
Stealth
Head of Support
Posts: 2085
Joined: Tue Jun 15, 2004 8:50 pm
Location: Chino Hills, CA, US
Contact:

Post by Stealth »

I like this idea, and I think it would be a great thing for networks to have.
w00t
Posts: 1136
Joined: Thu Mar 25, 2004 3:31 am
Location: Nowra, Australia

Post by w00t »

Yay, saves me the trouble of trying syzop ;).

May it never become part of the core itself (viva la modules!) :p
-ChatSpike IRC Network [http://www.chatspike.net]
-Denora Stats [http://denora.nomadirc.net]
-Omerta [http://www.barafranca.com]
dboyz
Posts: 68
Joined: Tue Jun 14, 2011 6:36 am

Re: TextBan v0.1

Post by dboyz »

I find this module very interesting and useful. The current version of this module is 2.1.

Here's a small suggestion. Instead of the current syntax which is:
~T:<action>:<wildcardexpression>
I think it would be a good idea if the syntax is simplified when CENSOR is disabled (which leaves only BLOCK enabled, of course):
~T:<wildcardexpression>
dboyz
Posts: 68
Joined: Tue Jun 14, 2011 6:36 am

Re: TextBan v0.1

Post by dboyz »

Looks like nobody is looking into my suggestion. Sent an e-mail to Syzop in January but no reply/respond/notification till today.
katsklaw
Posts: 1124
Joined: Sun Apr 18, 2004 5:06 pm
Contact:

Re: TextBan v0.1

Post by katsklaw »

Removing the action field isn't logical. Extbans and spam filters need to know what you want done when the specified expression is returned true. Seriously, what good is it to watch for <expression> if you do nothing when it's found and nothing if it isn't found? That's a waste of resources from square 1. The current syntax allows for the most flexibility on a per channel basis.

Even ~T:none:expression is pointless because NOT extban'ing "expression" will have the exact same effect.
dboyz
Posts: 68
Joined: Tue Jun 14, 2011 6:36 am

Re: TextBan v0.1

Post by dboyz »

Actually what I meant is, before compiling the module, the person who installs the module will decide if he/she wants CENSOR to be disabled or enabled.
Case 1: If ENABLED, this module will set the syntax to be:
~T:<action>:<wildcardexpression>
Case 2: Meanwhile, If DISABLED, this module will set the syntax to be:
~T:<wildcardexpression>
And since CENSOR is disabled, this new syntax allows anyone who sets this extban to skip telling the ircd "to CENSOR or to BLOCK" while the only option is BLOCK (because CENSOR is disabled).
dboyz
Posts: 68
Joined: Tue Jun 14, 2011 6:36 am

Re: TextBan v0.1

Post by dboyz »

Oh and the module should be written in a way that it will recognize that
~T:<wildcardexpression>
will BLOCK <wildcardexpression>.

I hope you are getting me.
Post Reply