Robin Bowes wrote:

Rick Widmer wrote:

John Simpson & Robin Bowes

Do you really want the onchange function to be called three times on an
add_domain operation, and two times on an add_user operation?  I find it
problematic that you are notified of the mod_user before the add_user,
and personally would prefer only one call per operation.  (That means
you have to assume the postmaster user was added when you add a domain.)

At the very least I would like to block the mod_user notification in an
add_user operation.  I think it is a good idea to block the add_user
[EMAIL PROTECTED] operation on an add_domain too.  I'll handle coding it
if it is ok with you two.


I must admit I've not actually looked at John's code.

However, my thoughts (based on your comments) are as follows:

add_user should be called as well as add_domain when a new domain is
created - these are separate actions that happen to both occur when you
first create a domain.

I can see that, on the other hand you already know when you write your response to an add_domain that the postmaster user was created. Do you really need to exec the script a second time to handle the postmaster as a separate operation? There is quite a bit of overhead with PHP and Perl starting up the script. (I'll be using PHP.)

I don't really have a problem with both mod_user and add_user triggering
in an add_user operation. What happens to cause mod_user to trigger as
well as add_user?

I believe adduser() calls moduser() to store the data about the user in the vpasswd file, or the database.

I guess the user is added and then modified - the
password is set, perhaps? BUt I would need to look at the code to see
what actually happens. Bottom line; If the user is being added and then
modified then it makes sense to have both hooks triggered.

Actually according to the calls of the script the user was modded before it was added.

Why do you want to change this?

Because it seems wasteful to me to call the script three times just to add a domain, or twice to add a user. In the case of the user the mod_user comes before the add_user, so the user data is not completely updated when the script is called for mod_user. By the time the script is called for add_user the mod_user data is available so you can look it up and act accordingly. Specifically when the initial mod_user exec happens the quota, sqwebmail_pass file, and last_auth processing has not been done yet. (Possibly more, I did not trace out the vauth_adduser() call that actually does the work.)

What is the problem you are trying to solve?

No real problem, just something I consider wasteful of resources. For example, if all you are doing is rebuilding a validrcptto database currently you are doing it three times every time you add a domain. Two of them are instantly thrown away as soon as they finish.

add_domain    domain

Does there need to be a "del_alias_domin" hook? How about a mod_domain,
or mod_alias_domain (not sure if these two would be necessary)?

Delete of an alias is done with del_domain, naming the alias. Mod_domain might be valuable. There may be a problem here since you can't tell from the script if it is an alias or a whole domain. Maybe it should name the parent domain if an alias was deleted, or name the aliases if the parent is deleted.

valias_insert    [EMAIL PROTECTED]

What's the difference between valias_remove and valias_delete ?

Assume an alias [EMAIL PROTECTED] that forwards to [EMAIL PROTECTED] and [EMAIL PROTECTED]

valias_remove [EMAIL PROTECTED] would indicate that the alias no longer forwards to [EMAIL PROTECTED]

valias_delete [EMAIL PROTECTED] would indicate the alias was removed entirely.

Does there need to be a valias_mod?

There is no such thing, just combinations of the above.

Why is this not add_valias, del_valias? (to make it the same as the
user/domain hooks) ?

I don't know.  John?


Reply via email to