splidge [Tue, 5 Jun 2007 22:16:02 +0000 (23:16 +0100)]
Newsearch overhauled.
Removed the confusion of having both a return type specified in each node
and the return type being passed in on execute.
Now each node should always return the type indicated in its "returntype"
member. Nodes who want its callees to return a certain type can call the
new "coerceNode()" to insert a conversion node as necessary to convert
types. Note that coerceNode() has no overhead if the node already returns
the correct type.
The "type" parameter passed to search execute functions has been removed.
All existing modules have been rewritten to honour these rules, in a lot of
cases this means ripping out useless code to return different types (and as
a side-effect it has fixed all problems where a node was unable to correctly
return some types). Sadly some nodes (eq, lt, gt) have got a bit messier as
they now need to coerce each subsequent parameter to match the type of the
first parameter.
Also fixed up some of the channel nodes to just return the relevant piece of
data rather than a BOOL acquired by performing some arbitrary operation on
that data.
Added the (length) function which returns the length of its input string.
Removed the (namelen) function as you can now call (length (name)) - or, to
reproduce the old function, (gt (length (name)) <constant>) which will
return all channel names above a constant length.
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.