Rick Widmer wrote:
> I don't see any value in reporting a delete operation after the fact,
> other than to log it.  On the other hand it might be a good idea to move
> the script before the delete.  That  would give you a chance to take a
> snapshot of the resource usage right before delete, or maybe make a backup.

If you look at qpsmtpd (which is where I believe the idea of onchange
hooks came from), it is moving to the idea of pre- and post- hooks for
all actions.

It also calls different "scripts" for each hook rather than having one
monolithic "something's changed" script. Would that be a better approach
for vpopmail?

It could work something like this [warning: pseudo-code alert]:

if (defined $user_add_pre) {
  if ( exists $user_add_pre ) {
    $hook_return = execute $user_add_pre;
    if $hook_return = failure {
      warning/error "user_add pre-hook execution failed (error here)"
      # bail out here?
    }
  } else {
    warning/error "user_add pre-hook defined but not found"
    # bail out here?
  }
}

# Now, add the user
if $hook_return = OK {
  user_add;
}

if (defined $user_add_post) {
  if ( exists $user_add_post ) {
    $hook_return = execute $user_add_post;
    if $hook_return = failure {
      warning/error "user_add post-hook execution failed (error here)"
      # bail out here?
    }
  } else {
    warning/error "user_add post-hook defined but not found"
    # bail out here?
  }
}


>> would it be better to use the vpopmail function names for all of the 
>> notifications, so that they are all consistent? if so, now is the 
>> time to make the decision, since nobody (as far as i know) has 
>> written any onchange scripts which would look for specific strings.
> 
> I don't really care.  Robin - what do you think the names should be?
> 
> As far as I'm concerned, all I need is a complete list in front of me
> when I sit down to write the script.

I don't really care either, but they should be consistent - add_user or
user_add, but not a mix.

R.

Reply via email to