Collection of muh ZNC modules m8 =]

Wazakindjes 8be4944318 Kickban: added Add/DelHostmasks commands to add m0ar of em to users, "tagged" error/warning messages accordingly and did some optimisati0ne =]] 4 months ago
z1 8be4944318 Kickban: added Add/DelHostmasks commands to add m0ar of em to users, "tagged" error/warning messages accordingly and did some optimisati0ne =]] 4 months ago
.editorconfig 168232ccf2 Added editorc0nfig =] 5 months ago
.gitignore 4ea1d11537 Updated gitignore w/ OSX bullshit 6 years ago
LICENSE 3c6587eabf initial commit 6 years ago
README.md 8be4944318 Kickban: added Add/DelHostmasks commands to add m0ar of em to users, "tagged" error/warning messages accordingly and did some optimisati0ne =]] 4 months ago

README.md

This is now a collection of my modules for ZNC. ;3 Everything is tested with ZNC v1.6.3, UnrealIRCd v4.0.x and Anope v2.0.x, so it may or may not work with other versions/IRCds/services.

If you don't know how2compile modules, check this paeg

Repo structure

  • z1: Modules for ZNC 1.x obviously
  • uncommon: Quite specialised/complex modules, doubt you'll care about them ;3

Index lol

This README contains all modules and their descriptions/usage info (ordered from new to old). If it says UNC then it's an uncommon module, meaning most people won't have a real use for it. There will be others but they should be self-explanatory. =]

Module Description
kickban Automatically kick certain users
regexwatch Watch for certain users/messages
sapart_rejoin Automatically rejoin channels after a SAPART
queryspam_prot Ignore duplicate messages to prevent cluttering up y0 client
sajoin_prot Automatically part channels you were SAJOINed into

kickban

Derived from autovoice, this module automatically kicks and bans people matching a certain nick!ident@host mask when people join a channel, you get re-opped or someone changes their nick.

Commands:

  • adduser <user> <hostmask[,channel2[,...]]> [channel1,channel2,...] <reason> -- you need to add a user before you can do any of the below commands ;]
  • deluser <user>
  • listusers
  • addhostmasks <user> <hostmask[,hostmask2[,...]]>
  • delhostmasks <user> <hostmask[,hostmask2[,...]]>
  • addchans <user> <channel[,channel2[,...]]>
  • delchans <user> <channel[,channel2[,...]]>

Usage:
An example for adding an autokicker would be: /msg *kickban adduser guests Guest*!*@* * lmao ur an fuckstick. This will kick everyone with a nick like Guest13, Guest239, etc and sets a ban on the specified hostmask (Guest*!*@*). This check runs for every channel (notice the individual *), meaning any channel you have hops/ops/etc in will see the Guest users being kicked. You can also restrict it to specific channels by doing something like: /msg *kickban adduser guests Guest*!*@* #chan1,#chan2,#chan3 lmao ur an fuckstick

The user field is merely the display name of that entry, it doesn't affect who it kicks.

Besides the wildcard * (matches 0 or more of any character), you can also use ? (must match exactly 1 character). This is not something implemented by ZNC or even this module, it's simply how wildcards work.

regexwatch

Similar to watch, but this one works with ECMASCRIPT regexes. Currently it watches an entire network and channel messages/notices only (I see no point in having more hooks atm =]). The regexes are all case-insensitive.

C++ regexes require a GCC version of v4.9 or greater

Usage:
Doesn't require any arguments at load time. Just load it at user or network level and add some regexes. Because of the nature of CString::Token, use \s for spaces instead of literal spaces

Commands:
The module has some in-IRC commands obviously. ;3

  • add [nickregex] <regex> => Add an entry to monitor for, optionally limited to nickregex
  • del <id> => Deletes id from the regex list
  • list => List all regex patterns yo
  • test <id> [nick] <string> => Check if regex pattern id matches the message string, optionally with a nickname
  • buffer [count] => Show/Set the amount of buffered lines while detached
  • halp => Show in-IRC halp

sapart_rejoin

Rejoins a channel after being SAPARTed. Since that shit actually sends a PART message on your behalf, it may get removed from ZNC entirely. The module tries to keep yo settings.

Usage:
Has one optional argument delay. That shit is in seconds and defines how long to wait before tryna rejoin. It's always at least 1 so clients don't shit themselves (i.e. Textual shows the channel grayed out even though you can send messages).

queryspam_prot

Prevents your client from opening up a bunch of tabs/windows for queries when getting spammed (usually by butts).

Usage:
Takes 2 arguments: threshold and timeout.
threshold is how many times a message must be seen before it gets blocked entirely (default = 5).
timeout is in minutes and defines how long this exact message will be blocked for (default = 15).

The module checks for PRIVMSGs aimed directly at you. If the message repeats more than threshold times (from any source) all messages exactly like that will be blocked for timeout minutes. This means your client will stop opening tabs/windows and you won't see any subsequent messages. =] When it gets unblocked you'll get a notification from the module.

Also, two minutes after receiving a message that wasn't classified as spam it will "cool down". This means the counter for that particular message will be reset to 0.

sajoin_prot

Protects you against forced joins (/sajoin etc). =]

This shit works by intercepting JOIN messages and verifying if you even initiated them. If you didn't then you're being SAJOINed and the mod will check if they are allowed ("trusted") channels (i.e. because you have them configured). If it's still like nope.avi it will send a PART message in response (this all is invisible to the ZNC user). This may induce some "lag" because of the IRCd throttling your shit, so bnice k?

It also reports back every 2 minutes how many channels you were tried to join into. If there are none there will be no message obviously.

Updated shit

  • Now reports back to the user how many channels they were SAJOINed into (or attempted to kek)
  • When opering up it wouldn't attach your client to the force-joined #opers but ZNC also wouldn't part it, resulting in a desync. The same happened with /cycles done by modules like autocycle. This is now fixed by temporarily holding off on joining such channels (2 seconds to be exact), then checking if you're supposed to attach to them.

Usage:
Doesn't take any arguments, just load it and go. ;3

If you wanna edit the reporting timespan, you'll have to edit the source and recompile. Just look for:

netwerk->PutUser(":" + prefix + "sajoin_prot!sjprot@znc.in NOTICE " + nick + " :*** Over the last 2 minutes you were (tried to be) SAJOINed into " + count + " channels");
....
AddTimer(new CReportTimer(this, 120, 0, "sajoin_prot_report", "sajoin_prot_report"));

And change the 120 to the amount of seconds it should wait for its next report. May also wanna adjust the message it sends you. =]