#include "../core/hooks.h" #include "trusts.h" static int commandsregistered; static void registercommands(int hooknum, void *arg) { if(commandsregistered) return; commandsregistered = 1; /* do init stuff here */ } static void deregistercommands(int hooknum, void *arg) { if(!commandsregistered) return; commandsregistered = 0; /* do fini stuff here */ } void _init(void) { registerhook(HOOK_TRUSTS_DB_LOADED, registercommands); registerhook(HOOK_TRUSTS_DB_CLOSED, deregistercommands); if(trustsdbloaded) registercommands(0, NULL); } void _fini(void) { deregisterhook(HOOK_TRUSTS_DB_LOADED, registercommands); deregisterhook(HOOK_TRUSTS_DB_CLOSED, deregistercommands); deregistercommands(0, NULL); }