MCPcopy Create free account
hub / github.com/ElementsProject/lightning / hook_callable

Function hook_callable

lightningd/plugin_hook.c:302–330  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

300}
301
302static bool hook_callable(const struct hook_instance *hook,
303 const char *strfilterfield,
304 u64 intfilterfield)
305{
306 /* NULL? Skip */
307 if (!hook)
308 return false;
309
310 /* String filters? If there are some we must match one. */
311 if (hook->strfilters) {
312 for (size_t i = 0; i < tal_count(hook->strfilters); i++) {
313 if (streq(strfilterfield, hook->strfilters[i]))
314 return true;
315 }
316 return false;
317 }
318
319 /* Integer filters? */
320 if (hook->intfilters) {
321 for (size_t i = 0; i < tal_count(hook->intfilters); i++) {
322 if (intfilterfield == hook->intfilters[i])
323 return true;
324 }
325 return false;
326 }
327
328 /* No filters: always call. */
329 return true;
330}
331
332/* Returns true if it finished all the hooks (and thus didn't call anything) */
333static bool plugin_hook_call_next(struct plugin_hook_request *ph_req)

Callers 1

plugin_hook_call_nextFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected