+#define MESSAGE_FORMAT "request client=%s from=<%s> to=<%s> at %s: "
+#define MESSAGE_PARAMS query->client_name, \
+ query->sender == NULL ? "undefined" : query->sender, \
+ query->recipient == NULL ? "undefined" : query->recipient, \
+ smtp_state_names[query->state]
+
+ if (hook != NULL) {
+ query_context_t *context = client_data(pcy);
+ if (hook->counter >= 0 && hook->counter < MAX_COUNTERS && hook->cost > 0) {
+ context->context.counters[hook->counter] += hook->cost;
+ debug(MESSAGE_FORMAT "added %d to counter %d (now %u)", MESSAGE_PARAMS,
+ hook->cost, hook->counter, context->context.counters[hook->counter]);
+ }
+ }