libplugin: support wildcard subscriptions.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2023-07-11 07:51:36 +09:30
parent 279b3aa7e8
commit 4d507065f3
4 changed files with 32 additions and 4 deletions

View File

@@ -101,6 +101,17 @@ static struct command_result *json_shutdown(struct command *cmd,
plugin_exit(cmd->plugin, 0);
}
static struct command_result *json_all_notifs(struct command *cmd,
const char *buf,
const jsmntok_t *params)
{
plugin_log(cmd->plugin, LOG_DBG, "all: %s: %.*s",
cmd->methodname,
json_tok_full_len(params),
json_tok_full(buf, params));
return notification_handled(cmd);
}
static struct command_result *testrpc_cb(struct command *cmd,
const char *buf,
const jsmntok_t *params,
@@ -209,6 +220,9 @@ static const struct plugin_notification notifs[] = { {
}, {
"shutdown",
json_shutdown
}, {
"*",
json_all_notifs
}
};