#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 */
hashinit(&chook_mevents, sz);
for (sz = i = 0; chook_tab[i].key != NULL; i++)
if (chook_tab[i].mush_key != NULL)
- hashadd(chook_tab[i].mush_key, (void *) chook_tab[i].key,
- &chook_mevents);
+ hashadd(chook_tab[i].mush_key, (void *) chook_tab[i].key, &chook_mevents);
}
struct core_hook_t *
char *key;
char *s;
+ if(!arg_left[0] || !arg_right[0]) {
+ notify(player, "Not gonna cut it.");
+ return;
+ }
+
+ /* Look for event */
+ if (!(key = (char *) hashfind(arg_left, &chook_mevents))) {
+ notify(player, "No such event.");
+ return;
+ }
+
s = strchr(arg_right, '/');
*s++ = '\0';
notify(player, "Bad Event format");
return;
}
+
thing = match_thing(player, arg_right);
if (!GoodObject(thing))
return;
- /* Look for event */
- if (!(key = (char *) hashfind(arg_left, &chook_mevents))) {
- notify(player, "No such event.");
- return;
- }
if (!CHook_Insert_SC(key, thing, s)) {
/* This shouldn't happen.. */
int rval;
int (*module_func) (struct core_entry_t * entry, va_list argp);
+ if (cancel_hooks)
+ return -1;
module_func = NULL; /* Just for initialization purposes */
va_start(argp, format);
if (entry->flags & MODHOOK_SOFTCODE) {
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);
+ copy_namedregs(&global_eval_context.namedregs, &preserve_namedregs);
free_namedregs(&preserve_namedregs);
restore_global_regs("chook_sc_save", preserveq);
restore_global_env("chook_sc_save", preserves);
local_ooref = ooref;
ooref = atr->creator;
process_expression(cmd_buf, &r, &s,
- executor, enactor, cause, PE_NOTHING, PT_SEMI,
- NULL);
+ executor, enactor, cause, PE_NOTHING, PT_SEMI, NULL);
*r = '\0';
if (*s == ';')
s++;
handle = lt_dlopen(file);
if (!handle) {
- do_rawlog(LT_ERR, "Error Loading Module: %s | %s ", file,
- lt_dlerror());
+ do_rawlog(LT_ERR, "Error Loading Module: %s | %s ", file, lt_dlerror());
return 0;
}
if (!module_loader) {
do_rawlog(LT_ERR,
- "Error Loading Module: Could not call module_load | %s",
- file);
+ "Error Loading Module: Could not call module_load | %s", file);
return 0;
}
}
if (!module_entry_del(m)) {
- do_rawlog(LT_ERR, "Could not unload module: %s/%d ", __FILE__,
- __LINE__);
+ do_rawlog(LT_ERR, "Could not unload module: %s/%d ", __FILE__, __LINE__);
return 0;
}