| 311 | } |
| 312 | |
| 313 | static bool hook_callable(const struct hook_instance *hook, |
| 314 | const char *strfilterfield, |
| 315 | u64 intfilterfield) |
| 316 | { |
| 317 | /* NULL? Skip */ |
| 318 | if (!hook) |
| 319 | return false; |
| 320 | |
| 321 | /* String filters? If there are some we must match one. */ |
| 322 | if (hook->strfilters) { |
| 323 | for (size_t i = 0; i < tal_count(hook->strfilters); i++) { |
| 324 | if (streq(strfilterfield, hook->strfilters[i])) |
| 325 | return true; |
| 326 | } |
| 327 | return false; |
| 328 | } |
| 329 | |
| 330 | /* Integer filters? */ |
| 331 | if (hook->intfilters) { |
| 332 | for (size_t i = 0; i < tal_count(hook->intfilters); i++) { |
| 333 | if (intfilterfield == hook->intfilters[i]) |
| 334 | return true; |
| 335 | } |
| 336 | return false; |
| 337 | } |
| 338 | |
| 339 | /* No filters: always call. */ |
| 340 | return true; |
| 341 | } |
| 342 | |
| 343 | /* Returns true if it finished all the hooks (and thus didn't call anything) */ |
| 344 | static bool plugin_hook_call_next(struct plugin_hook_request *ph_req) |
no outgoing calls
no test coverage detected