[DONE] Persistently store TKLines/X:Lines across reboots

Need a module converted from 3.2.x to UnrealIRCd 4? Or looking for a certain module? Ask here.

Moderators: Gottem, Supporters

Post Reply
Gottem
Posts: 171
Joined: Fri Aug 19, 2016 5:26 pm
Location: NL

[DONE] Persistently store TKLines/X:Lines across reboots

Post by Gottem » Tue Apr 04, 2017 3:41 pm

Even though servers sync all X:Lines (G:Line, Z:Line, GZ:Line, Shun (S:Line), spamfilter (F:Line), ...) upon linkage, some people may want to keep them stored in a .db file local to every server. An example use case would be storing Q:Lines in case services are down and the IRCd was rebooted/had crashed/whatever; people could use nicks like NickServ until services are back to re-add their own Q:Lines.

This module re-adds all X:Lines at IRCd boot only, inside MOD_INIT (so before it has fully booted), as long as they shouldn't expire at the time of booting. It also skips spamfilters added through config files entirely, as there's really no need to keep track of those. ;] The DB file is refreshed everytime someone adds/removes an X:Line (this includes using RMTKL if you update that one), when they expire and if they should expire when "cold" booting the IRCd.

Module output can be seen through the Unreal user's shell session as the IRCd boots (it's logged to LOG_ERROR which only becomes the actual ircd.log file once Unreal has forked off):

Code: Select all

$ /home/unreal/ircd/unrealircd start
Starting UnrealIRCd
...
Loading IRCd configuration..
[storetkl] Reading stored X:Lines from '/home/unreal/ircd/data/tkl.db'
[storetkl] Not re-adding G:Line 'ham@*' [AYYYY LMAO] because it should be expired
[storetkl] Not re-adding G:Line 'hueaj@*' [AYYYY LMAO] because it should be expired
[storetkl] Not re-adding G:Line 'hhhh@*' [AYYYY LMAO] because it should be expired
[storetkl] Re-added 15 X:Lines
[storetkl] Rewriting DB file due to 3 skipped/expired X:Lines
Configuration loaded without any problems.
...
UnrealIRCd started.
Grab it here.
If you like my modules, pls consider donating (through PayPal) or becoming a monthly Patron ;];]

Post Reply