diff options
Diffstat (limited to 'degesch.c')
-rw-r--r-- | degesch.c | 25 |
1 files changed, 12 insertions, 13 deletions
@@ -4147,20 +4147,20 @@ static char * irc_process_hooks (struct server *s, char *input) { log_server_debug (s, "#a>> \"#S\"#r", ATTR_JOIN, input); + uint64_t hash = siphash_wrapper (input, strlen (input)); LIST_FOR_EACH (struct hook, iter, s->ctx->irc_hooks) { struct irc_hook *hook = (struct irc_hook *) iter; - char *processed = hook->vtable->filter (hook, s, input); - if (input == processed) - continue; - - if (processed == NULL) + if (!(input = hook->vtable->filter (hook, s, input))) { log_server_debug (s, "#a>= #s#r", ATTR_JOIN, "thrown away by hook"); return NULL; } - log_server_debug (s, "#a>= \"#S\"#r", ATTR_JOIN, (input = processed)); + uint64_t new_hash = siphash_wrapper (input, strlen (input)); + if (new_hash != hash) + log_server_debug (s, "#a>= \"#S\"#r", ATTR_JOIN, input); + hash = new_hash; } return input; } @@ -9546,21 +9546,20 @@ static char * process_input_hooks (struct app_context *ctx, struct buffer *buffer, char *input) { + uint64_t hash = siphash_wrapper (input, strlen (input)); LIST_FOR_EACH (struct hook, iter, ctx->input_hooks) { struct input_hook *hook = (struct input_hook *) iter; - char *processed = hook->vtable->filter (hook, buffer, input); - if (input == processed) - continue; - - if (processed == NULL) + if (!(input = hook->vtable->filter (hook, buffer, input))) { log_global_debug (ctx, "Input thrown away by hook"); return NULL; } - log_global_debug (ctx, - "Input transformed to \"#s\"#r", (input = processed)); + uint64_t new_hash = siphash_wrapper (input, strlen (input)); + if (new_hash != hash) + log_global_debug (ctx, "Input transformed to \"#s\"#r", input); + hash = new_hash; } return input; } |