plugins->announceEvents($this->module_name, $this->actions_available); /* As we want to get notified of any changes on several database tables, we register for them. The following function registers the function "functionname" to be executed when a record for the table "dbtable" is processed in the sys_datalog. "classname" is the name of the class that contains the function functionname. */ $app->modules->registerTableHook('mail_access', 'mail_module', 'process'); $app->modules->registerTableHook('mail_domain', 'mail_module', 'process'); $app->modules->registerTableHook('mail_forwarding', 'mail_module', 'process'); $app->modules->registerTableHook('mail_transport', 'mail_module', 'process'); $app->modules->registerTableHook('mail_user', 'mail_module', 'process'); $app->modules->registerTableHook('mail_get', 'mail_module', 'process'); $app->modules->registerTableHook('mail_content_filter', 'mail_module', 'process'); $app->modules->registerTableHook('mail_mailinglist', 'mail_module', 'process'); } /* This function is called when a change in one of the registered tables is detected. The function then raises the events for the plugins. */ function process($tablename, $action, $data) { global $app; switch ($tablename) { case 'mail_access': if($action == 'i') $app->plugins->raiseEvent('mail_access_insert', $data); if($action == 'u') $app->plugins->raiseEvent('mail_access_update', $data); if($action == 'd') $app->plugins->raiseEvent('mail_access_delete', $data); break; case 'mail_domain': if($action == 'i') $app->plugins->raiseEvent('mail_domain_insert', $data); if($action == 'u') $app->plugins->raiseEvent('mail_domain_update', $data); if($action == 'd') $app->plugins->raiseEvent('mail_domain_delete', $data); break; case 'mail_forwarding': if($action == 'i') $app->plugins->raiseEvent('mail_forwarding_insert', $data); if($action == 'u') $app->plugins->raiseEvent('mail_forwarding_update', $data); if($action == 'd') $app->plugins->raiseEvent('mail_forwarding_delete', $data); break; case 'mail_transport': if($action == 'i') $app->plugins->raiseEvent('mail_transport_insert', $data); if($action == 'u') $app->plugins->raiseEvent('mail_transport_update', $data); if($action == 'd') $app->plugins->raiseEvent('mail_transport_delete', $data); break; case 'mail_user': if($action == 'i') $app->plugins->raiseEvent('mail_user_insert', $data); if($action == 'u') $app->plugins->raiseEvent('mail_user_update', $data); if($action == 'd') $app->plugins->raiseEvent('mail_user_delete', $data); break; case 'mail_get': if($action == 'i') $app->plugins->raiseEvent('mail_get_insert', $data); if($action == 'u') $app->plugins->raiseEvent('mail_get_update', $data); if($action == 'd') $app->plugins->raiseEvent('mail_get_delete', $data); break; case 'mail_content_filter': if($action == 'i') $app->plugins->raiseEvent('mail_content_filter_insert', $data); if($action == 'u') $app->plugins->raiseEvent('mail_content_filter_update', $data); if($action == 'd') $app->plugins->raiseEvent('mail_content_filter_delete', $data); break; case 'mail_mailinglist': if($action == 'i') $app->plugins->raiseEvent('mail_mailinglist_insert', $data); if($action == 'u') $app->plugins->raiseEvent('mail_mailinglist_update', $data); if($action == 'd') $app->plugins->raiseEvent('mail_mailinglist_delete', $data); break; } // end switch } // end function } // end class ?>