splidge [Mon, 4 Jun 2007 10:22:58 +0000 (11:22 +0100)]
Make burst joins work properly for -j channels.
With the change to the bursting logic it's now OK to have chanflag -j
channels set +ik - legit users can start the channel, other users are
netrider kicked.
splidge [Mon, 4 Jun 2007 10:09:57 +0000 (11:09 +0100)]
Tidied up the joining behaviour a bit.
A few changes:
* Burst with the default modes as well as the forcemodes (unless some of
the default modes are denied, of course).
* If there's only one user on the channel and they are known, don't burst
with +i or +k - this avoids kicking the users off their own channels.
Obviously if the user isn't known they shouldn't be joining so we leave
the modes set to get rid of them
* Ripped out the #ifdef 0'd code that used to try and deal with imposters -
there is no need for this now that we can burst into channels.
splidge [Sun, 3 Jun 2007 17:58:51 +0000 (18:58 +0100)]
New authtracker module.
This module is responsible for keeping the authhistory table up to date, but
has been written to be mostly independent of chanserv itself (the only
explicit reference is to chanservnext - and that can be removed once
userids-on-account are supported).
splidge [Sun, 3 Jun 2007 17:54:03 +0000 (18:54 +0100)]
Changed the hook code so that if one user of a hook deletes their callback
while the hook is running it doesn't prevent another user receiving the
hook.
This is done by setting a handler to NULL instead of deleting it when there
are hook callbacks active. When a new hook is registered, any NULL slots
are replaced before expanding the array.
Paul [Sat, 2 Jun 2007 23:28:49 +0000 (23:28 +0000)]
Add chanlev,account,authhistory.
NOTE: TODO: authhistory still needs tidying as discussed -
[19:15:36] <splidge3> load in authname, accountts, lastseen, logoff, numeric
[19:15:51] <splidge3> if logoff is set, display "AUTHNAME logged in at ACCOUNTTS and out at LOGOFF"
[19:16:08] <splidge3> if logoff isn't set but lastseen is, look at "numeric" on the network and see if it matches the stated authsession
[19:16:25] <splidge3> if it does, then there was a split and it came back, so just display "AUTHNAME logged in at ACCOUNTTS and is still here"
[19:16:47] <splidge3> otherwise you can say "AUTHNAME logged in at ACCOUNTTS and disappeared at LASTSEEN, maybe to return or maybe not"
splidge [Sat, 2 Jun 2007 19:29:44 +0000 (20:29 +0100)]
Added CIDR ban support.
unsigned ints for mask and ipaddr have been added to the chanban structure.
If a CIDR or exact IP ban is detected, these are filled in and subsequently
used during ban matching.
A fix to channel.c to enable "reload channel" to work has also crept in, as
well as a 4-line rewrite of some retarded code in channel.c
splidge [Sat, 2 Jun 2007 16:23:07 +0000 (17:23 +0100)]
Make valgrind a bit happier.
Added some new pools to nsmalloc.
Updated nick and sstring to use nsmalloc.
Changed chanservdb to use nsmalloc instead of its previous similar thing.
Made the core free up the sstring memory when it exits, and also check for
any outstanding blocks in nsmalloc.
Sundry change to allow opers to override chanserv commands by default snuck
in too.
splidge [Sat, 2 Jun 2007 13:38:06 +0000 (14:38 +0100)]
More chanserv refactoring
The previously monolithic "chancmds.c", "usercmds.c", and "authcmds.c" files
have been split up into multiple files in new directories "chancmds",
"usercmds" and "authcmds".
Each command source file now has a comment header which contains tags
indicating the name of the command, the level required to use it, the
maximum argument count, a short description and the name of the command
function to be called. A perl script has been added which reads these tags
and automatically generates a file called "commandlist.c" which sets up
appropriate _init() and _fini() functions for the module. The perl script
also generates the Makefile, so if you add a command it will be added to the
Makefile automatically. The perl script will emit warnings if tags are
incomplete and not include that file.
A perl script called "refactor.pl" has been added which assists in the
splitting up process. This was used to generate the new individual files in
each directory. You may find it useful if you have locally added your own
commands to one of the old monolithic files and want it to automatically
generate new individual files for you. Note it's not perfect, in particular
it won't notice if you have defined helper functions as well as your main
command function, so don't overwrite the checked-in version of files with
ones generated by refactor.pl unless you have made changes to the relevant
command and have checked it first.
If you want to register command aliases, create a dummy .c file with
appropriate tags (see authcmds/auth.c for an example).
splidge [Sat, 2 Jun 2007 11:33:03 +0000 (12:33 +0100)]
Chanserv refactoring
The main change is that the database has been pulled into a separate module.
It now uses the psql module for database services. With the other
refactoring changes to the newserv core, the chanservdb module is now
completely independent of the irc module - so the entire IRC stack can be
restarted without reloading the chanserv database.
Moved the database items into a subdirectory to make things tidier - other
sections will follow in time.
Also changed the top-level Makefile to support modules with their own
specific clean requirements - just add a "clean" target to the
subdirectory's Makefile and then add it to the CLEANDIRS list in the
top-level Makefile.
splidge [Sat, 2 Jun 2007 00:04:32 +0000 (01:04 +0100)]
Added a clean shutdown facility.
A facility to unload all modules and exit has been added - just set
newserv_shutdown_pending to 1 and the main loop will trigger an exit next
time round.
splidge [Sat, 2 Jun 2007 00:02:52 +0000 (01:02 +0100)]
Two small enhancements to depmod.pl
depmod.pl will now print out an error message if it detects a circular
dependency.
Also, depmod.pl now supports the -v or --verbose switch which causes it to
print out each individual symbol dependency - so you can see why one module
depends on another.
splidge [Fri, 1 Jun 2007 23:59:31 +0000 (00:59 +0100)]
Separated the authext functionality from the nick module.
The new authext module does not depend on the irc module, which allows
modules which attach items to authexts to not depend on irc. Perfect for
allowing the IRC module to be reloaded without having to reload your service
database.
splidge [Fri, 1 Jun 2007 23:56:52 +0000 (00:56 +0100)]
Seperated the chanindex functionality into a separate module.
The chanindex module does not depend on IRC, which allows modules which
attach to chanindexes to not depend on IRC either. Useful for (e.g.)
allowing the IRC stack to be restarted without reloading a service database.
splidge [Fri, 1 Jun 2007 23:54:55 +0000 (00:54 +0100)]
Added "nsmalloc" to the core.
This is a simple malloc() wrapper which supports "pools". It is possible to
free all allocations belonging to a given pool at the same time - perfect
for stopping modules from leaking memory.
If you want to use this in your module, add a #define to nsmalloc.h to grab
a number.
splidge [Fri, 1 Jun 2007 09:54:49 +0000 (10:54 +0100)]
Added externally-visible SSTRING_MAX define.
This allows things which might need to allocate very long strings (like,
say, database queries) to decide whether to use a sstring or allocate
their own.
splidge [Fri, 1 Jun 2007 09:33:20 +0000 (10:33 +0100)]
Made control clean up its commandtree on exit.
It might be redundant to remove all those commands individually and then
call "destroycommandtree", but it means in future we can check the tree is
empty as a way of detecting leaks.
splidge [Thu, 31 May 2007 22:55:09 +0000 (23:55 +0100)]
A few sundry changes:
Added an authname extension, and associated users with it when they are
created or loaded. Changed all existing "find user by ID" code to use the
authnameext.
Don't bother printing "Channel type: (unspecified)" on chanlev.
splidge [Thu, 31 May 2007 14:46:59 +0000 (15:46 +0100)]
Added support for remembering the oldest-ever timestamp seen for a channel.
Added to the database with a function to change the timestamp entry on a
channel when needed.
This timestamp is then used when we need to join a channel - the
localburstontochannel() function is used with that timestamp as an argument.
This means we can get the ircd to enforce the sanctity of +i/+k channels via
the netrider code, and also take care of rogue topics, ops, bans and the
like.
Also two unrelated fixes - one to save when we automatically remove +k from
forcemodes because no key was set, and another to prevent the wrong
maxuserid being recorded during load.
splidge [Thu, 31 May 2007 14:40:33 +0000 (15:40 +0100)]
Added "localburstontochannel" function. This allows a burst message to be
sent in order to change the channel's timestamp and modes, and optionally
join the specified user onto the channel as well.
This has the following effects, which are entirely determined by how the
remote ircd is going to interpret the burst message:
If the timestamp is older than the existing one:
* All users are deopped and devoiced
* All bans are removed
* Modes are set to the ones specified
* The named user (if any) is added as the sole op
* Note that if the set modes include +k or +i, all users will be kicked off
the channel by the net rider code. This is handled by the remote ircus
though.
If the timestamps are equal:
* Existing users and bans are unaffected.
* Modes are unchanged - if we try to change them remote ircus will just
merge the two sets of modes which is icky. You will have to change modes
via a separate mode command (which would be the only way to remove modes
in any case).
* The named user (if any) is added as an op.
If the provided timestamp is newer than the existing one:
* The code will bail out and do a join (so if no user was specified it will
do nothing). None of the other effects can be achieved via a burst with
a newer timestamp.
At the moment the code doesn't support non-existing channels (the first
argument needs to be a pre-existing channel *).
splidge [Wed, 30 May 2007 21:09:54 +0000 (22:09 +0100)]
Added module dependency support.
In order for this to work you need to arrange for a modules.dep file to
exist in the same place as your modules. To create this file, cd to the
module directory and run depmod.pl from there. Note that the default
Makefile will do this for you on "make install".
Things should fallback gracefully if you lack a modules.dep file (but then
you won't get the benefit of course).
insmod() now automatically loads needed modules first.
rmmod() now automatically removes dependent modules first.
New functions preparereload() and reloadmarked() can be used either side of
a reload to mark dependent modules which are to be removed, and then reload
them, respectively. control and noperserv's reload methods have been
updated to use these as appropriate.