mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-20 07:34:24 +01:00
libplugin: Add notification topics to plugin_main
This commit is contained in:
committed by
Rusty Russell
parent
e02e972729
commit
f963a6a551
@@ -91,7 +91,7 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
setup_locale();
|
setup_locale();
|
||||||
plugin_main(argv, init, PLUGIN_STATIC, true, NULL, commands, ARRAY_SIZE(commands),
|
plugin_main(argv, init, PLUGIN_STATIC, true, NULL, commands, ARRAY_SIZE(commands),
|
||||||
NULL, 0, NULL, 0,
|
NULL, 0, NULL, 0, NULL, 0,
|
||||||
plugin_option("autocleaninvoice-cycle",
|
plugin_option("autocleaninvoice-cycle",
|
||||||
"string",
|
"string",
|
||||||
"Perform cleanup of expired invoices every"
|
"Perform cleanup of expired invoices every"
|
||||||
|
|||||||
@@ -972,7 +972,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
plugin_main(argv, init, PLUGIN_STATIC, false /* Do not init RPC on startup*/,
|
plugin_main(argv, init, PLUGIN_STATIC, false /* Do not init RPC on startup*/,
|
||||||
NULL, commands, ARRAY_SIZE(commands),
|
NULL, commands, ARRAY_SIZE(commands),
|
||||||
NULL, 0, NULL, 0,
|
NULL, 0, NULL, 0, NULL, 0,
|
||||||
plugin_option("bitcoin-datadir",
|
plugin_option("bitcoin-datadir",
|
||||||
"string",
|
"string",
|
||||||
"-datadir arg for bitcoin-cli",
|
"-datadir arg for bitcoin-cli",
|
||||||
|
|||||||
@@ -1389,6 +1389,7 @@ int main(int argc, char *argv[])
|
|||||||
/* No notifications */
|
/* No notifications */
|
||||||
NULL, 0,
|
NULL, 0,
|
||||||
hooks, ARRAY_SIZE(hooks),
|
hooks, ARRAY_SIZE(hooks),
|
||||||
|
NULL, 0,
|
||||||
/* No options */
|
/* No options */
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -388,5 +388,5 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
plugin_main(argv, init, PLUGIN_STATIC, true, &features, commands,
|
plugin_main(argv, init, PLUGIN_STATIC, true, &features, commands,
|
||||||
ARRAY_SIZE(commands), NULL, 0, hooks, ARRAY_SIZE(hooks),
|
ARRAY_SIZE(commands), NULL, 0, hooks, ARRAY_SIZE(hooks),
|
||||||
NULL);
|
NULL, 0, NULL);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,7 +92,8 @@ struct plugin {
|
|||||||
* initialization or need to recover from a disconnect. */
|
* initialization or need to recover from a disconnect. */
|
||||||
const char *rpc_location;
|
const char *rpc_location;
|
||||||
|
|
||||||
char **notification_topics;
|
const char **notif_topics;
|
||||||
|
size_t num_notif_topics;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* command_result is mainly used as a compile-time check to encourage you
|
/* command_result is mainly used as a compile-time check to encourage you
|
||||||
@@ -1318,6 +1319,8 @@ static struct plugin *new_plugin(const tal_t *ctx,
|
|||||||
size_t num_notif_subs,
|
size_t num_notif_subs,
|
||||||
const struct plugin_hook *hook_subs,
|
const struct plugin_hook *hook_subs,
|
||||||
size_t num_hook_subs,
|
size_t num_hook_subs,
|
||||||
|
const char **notif_topics,
|
||||||
|
size_t num_notif_topics,
|
||||||
va_list ap)
|
va_list ap)
|
||||||
{
|
{
|
||||||
const char *optname;
|
const char *optname;
|
||||||
@@ -1355,6 +1358,8 @@ static struct plugin *new_plugin(const tal_t *ctx,
|
|||||||
|
|
||||||
p->commands = commands;
|
p->commands = commands;
|
||||||
p->num_commands = num_commands;
|
p->num_commands = num_commands;
|
||||||
|
p->notif_topics = notif_topics;
|
||||||
|
p->num_notif_topics = num_notif_topics;
|
||||||
p->notif_subs = notif_subs;
|
p->notif_subs = notif_subs;
|
||||||
p->num_notif_subs = num_notif_subs;
|
p->num_notif_subs = num_notif_subs;
|
||||||
p->hook_subs = hook_subs;
|
p->hook_subs = hook_subs;
|
||||||
@@ -1387,6 +1392,8 @@ void plugin_main(char *argv[],
|
|||||||
size_t num_notif_subs,
|
size_t num_notif_subs,
|
||||||
const struct plugin_hook *hook_subs,
|
const struct plugin_hook *hook_subs,
|
||||||
size_t num_hook_subs,
|
size_t num_hook_subs,
|
||||||
|
const char **notif_topics,
|
||||||
|
size_t num_notif_topics,
|
||||||
...)
|
...)
|
||||||
{
|
{
|
||||||
struct plugin *plugin;
|
struct plugin *plugin;
|
||||||
@@ -1399,10 +1406,10 @@ void plugin_main(char *argv[],
|
|||||||
/* Note this already prints to stderr, which is enough for now */
|
/* Note this already prints to stderr, which is enough for now */
|
||||||
daemon_setup(argv[0], NULL, NULL);
|
daemon_setup(argv[0], NULL, NULL);
|
||||||
|
|
||||||
va_start(ap, num_hook_subs);
|
va_start(ap, num_notif_topics);
|
||||||
plugin = new_plugin(NULL, init, restartability, init_rpc, features, commands,
|
plugin = new_plugin(NULL, init, restartability, init_rpc, features, commands,
|
||||||
num_commands, notif_subs, num_notif_subs, hook_subs,
|
num_commands, notif_subs, num_notif_subs, hook_subs,
|
||||||
num_hook_subs, ap);
|
num_hook_subs, notif_topics, num_notif_topics, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
setup_command_usage(plugin);
|
setup_command_usage(plugin);
|
||||||
|
|
||||||
|
|||||||
@@ -293,6 +293,8 @@ void NORETURN LAST_ARG_NULL plugin_main(char *argv[],
|
|||||||
size_t num_notif_subs,
|
size_t num_notif_subs,
|
||||||
const struct plugin_hook *hook_subs,
|
const struct plugin_hook *hook_subs,
|
||||||
size_t num_hook_subs,
|
size_t num_hook_subs,
|
||||||
|
const char **notif_topics,
|
||||||
|
size_t num_notif_topics,
|
||||||
...);
|
...);
|
||||||
|
|
||||||
struct listpeers_channel {
|
struct listpeers_channel {
|
||||||
|
|||||||
@@ -722,5 +722,5 @@ int main(int argc, char *argv[])
|
|||||||
setenv("TZ", "", 1);
|
setenv("TZ", "", 1);
|
||||||
plugin_main(argv, init, PLUGIN_RESTARTABLE, true, NULL, commands,
|
plugin_main(argv, init, PLUGIN_RESTARTABLE, true, NULL, commands,
|
||||||
ARRAY_SIZE(commands), NULL, 0, hooks, ARRAY_SIZE(hooks),
|
ARRAY_SIZE(commands), NULL, 0, hooks, ARRAY_SIZE(hooks),
|
||||||
NULL);
|
NULL, 0, NULL);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2198,6 +2198,7 @@ int main(int argc, char *argv[])
|
|||||||
setup_locale();
|
setup_locale();
|
||||||
plugin_main(argv, init, PLUGIN_RESTARTABLE, true, NULL, commands,
|
plugin_main(argv, init, PLUGIN_RESTARTABLE, true, NULL, commands,
|
||||||
ARRAY_SIZE(commands), NULL, 0, NULL, 0,
|
ARRAY_SIZE(commands), NULL, 0, NULL, 0,
|
||||||
|
NULL, 0,
|
||||||
plugin_option("disable-mpp", "flag",
|
plugin_option("disable-mpp", "flag",
|
||||||
"Disable multi-part payments.",
|
"Disable multi-part payments.",
|
||||||
flag_option, &disablempp),
|
flag_option, &disablempp),
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ int main(int argc, char **argv)
|
|||||||
commands, tal_count(commands),
|
commands, tal_count(commands),
|
||||||
notifs, tal_count(notifs),
|
notifs, tal_count(notifs),
|
||||||
NULL, 0,
|
NULL, 0,
|
||||||
|
NULL, 0, /* Notification topics */
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
tal_free(owner);
|
tal_free(owner);
|
||||||
|
|||||||
@@ -553,5 +553,5 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
setup_locale();
|
setup_locale();
|
||||||
plugin_main(argv, NULL, PLUGIN_RESTARTABLE, true, NULL, commands,
|
plugin_main(argv, NULL, PLUGIN_RESTARTABLE, true, NULL, commands,
|
||||||
ARRAY_SIZE(commands), NULL, 0, NULL, 0, NULL);
|
ARRAY_SIZE(commands), NULL, 0, NULL, 0, NULL, 0, NULL);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -146,6 +146,7 @@ int main(int argc, char *argv[])
|
|||||||
plugin_main(argv, init, PLUGIN_RESTARTABLE, true, NULL,
|
plugin_main(argv, init, PLUGIN_RESTARTABLE, true, NULL,
|
||||||
commands, ARRAY_SIZE(commands),
|
commands, ARRAY_SIZE(commands),
|
||||||
notifs, ARRAY_SIZE(notifs), hooks, ARRAY_SIZE(hooks),
|
notifs, ARRAY_SIZE(notifs), hooks, ARRAY_SIZE(hooks),
|
||||||
|
NULL, 0, /* Notification topics we publish */
|
||||||
plugin_option("name",
|
plugin_option("name",
|
||||||
"string",
|
"string",
|
||||||
"Who to say hello to.",
|
"Who to say hello to.",
|
||||||
|
|||||||
Reference in New Issue
Block a user