Add support for only_if pre-hook

First step towards stuff like "don't send during AR transactions"

@wvanbergen @Sirupsen