#define MODHOOK_AROUND 0x04 /* The call hook is an around method.. Take the highest priority & stop */
#define MODHOOK_AFTER 0x08
#define MODHOOK_BEFORE 0x10
+#define MODHOOK_ACTIVE 0x12 /* Is the hook active? */
/* And now our table to load all our chooks at first */
struct chook_table_t {
#include "match.h"
#include "modules.h"
-static int cancel_hooks = 0;
struct module_entry_t *module_list = NULL;
HASHTAB chook_htab;
HASHTAB chook_mevents; /* MUSH Events aliased to Hooks */
int rval;
int (*module_func) (struct core_entry_t * entry, va_list argp);
- if (cancel_hooks)
+ if (entry->up->flags & MODHOOK_ACTIVE)
return -1;
+ entry->up->flags |= MODHOOK_ACTIVE;
module_func = NULL; /* Just for initialization purposes */
va_start(argp, format);
if (entry->flags & MODHOOK_SOFTCODE) {
} else if (entry->flags & MODHOOK_MODULE) {
/* We'll do this code later */
va_end(argp);
+ entry->up->flags &= ~MODHOOK_ACTIVE;
return -1;
} else {
va_end(argp);
+ entry->up->flags &= ~MODHOOK_ACTIVE;
return -1;
}
- /* We get ehre something is wrong */
- return -2;
+ entry->up->flags &= ~MODHOOK_ACTIVE;
+ return rval;
}
break;
default:
/* Bad Format.. don't run & return an error */
- cancel_hooks = 1; /* prevent recursions */
do_rawlog(LT_ERR,
"%s:%d -> Unexpected format character '%c' in format \"%s\"",
__FILE__, __LINE__, *fptr, format);
- cancel_hooks = 0;
/* Restore Environment */
copy_namedregs(&global_eval_context.namedregs, &preserve_namedregs);
free_namedregs(&preserve_namedregs);