If --enable-onchange-script is added to the ./configure command
many vpopmail commands, and calls into the library will call the
script ~vpopmail/etc/onchange.  Commands that add or update call
the script after making their changes.  Commands that delete
something call the script before doing the delete.

When a command calls other commands in the process of doing its job
only the inital call triggers the script.  For example vadddomain uses
vadduser and vmoduser to create the postmaster user, and set its 
attributes.  Your script will be called once with cmd set to
add_domain, and arg1 set to the domain being added.  By the time the
script is called, the domain and the postmaster user have already
been created.

When the script is called, it will be passed the following values 
on the command line to indicate what was changed.  Your script should
check the cmd value to determine what has happened and act accordingly.


function called         cmd               arg1            arg2		
----------------------  ------------      -----------     ----------

vadddomain()            add_domain        domain
vdeldomain()            del_domain        domain
vadduser()              add_user          user@domain
vdeluser()              del_user          user@domain
vaddaliasdomain()       add_alias_domain  domain          real_domain
vauth_setpw             mod_user          user@domain
valias_insert           insert_alias      user@domain     alias_line
valias_remove           remove_alias      user@domain     alias_line
valias_delete           del_alias         user@domain
valias_delete_domain()  del_all_alias     domain



The program, daemon command or function call that triggered the onchange
script will not return until the script ends.  That means that you should
keep the run time of the script down, or have the script trigger any 
long running process.

This is based on the onchange patch by John Simpson, used to support
his validrcptto.cdb patch.  Robin Bowes made the suggestion to return  
information on what was done.

http://qmail.jms1.net/vpopmail



List of code changes to implement onchange, and what is sent to the script:

file	function		cmd		arg1		arg2
-----	---------		----		-----		-----
vcdb.c
	vauth_setpw()		mod_user	user@domain

vldap.c
	vauth_setpw()		mod_user	user@domain

vmysql.c
	vauth_setpw()		mod_user	user@domain
	valias_insert()		insert_alias	user@domain	alias_line
	valias_remove()		remove_alias	user@domain	alias_line
	valias_delete()		del_alias	user@domain
	valias_delete_domain()	del_all_alias	domain

vpalias.c
	valias_insert()		insert_alias	user@domain	alias_line
	valias_delete()		del_alias	user@domain

vpgsql.c
	vauth_setpw()		mod_user	user@domain
	valias_insert()		insert_alias	user@domain	alias_line
	valias_delete()		del_alias	user@domain	alias_line
	valias_delete_domain()	del_all_alias	domain

vsybase.c
	vauth_setpw_size()	mod_user	user@domain

vpopmail.c
	vadddomain()		add_domain	domain
	vdeldomain()		del_domain	domain
	vadduser()		add_user	user@domain
	vdeluser()		del_user	user@domain
	vaddaliasdomain()	add_alias_domain domain		real_domain

