Skip to content

Commit

Permalink
single plugin_notification_serialize function
Browse files Browse the repository at this point in the history
  • Loading branch information
gudnuf committed Aug 1, 2024
1 parent 2034309 commit bb2399f
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions lightningd/notification.c
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ void notify_log(struct lightningd *ld, const struct log_entry *l)
notify_send(ld, n);
}

static void plugin_started_notification_serialize(struct json_stream *stream,
static void plugin_notification_serialize(struct json_stream *stream,
struct plugin *plugin)
{
json_add_string(stream, "plugin_name", plugin->shortname);
Expand All @@ -656,27 +656,15 @@ REGISTER_NOTIFICATION(plugin_started);
void notify_plugin_started(struct lightningd *ld, struct plugin *plugin)
{
struct jsonrpc_notification *n = notify_start("plugin_started");
plugin_started_notification_serialize(n->stream, plugin);
plugin_notification_serialize(n->stream, plugin);
notify_send(ld, n);
}

static void plugin_stopped_notification_serialize(struct json_stream *stream,
struct plugin *plugin)
{
json_add_string(stream, "plugin_name", plugin->shortname);
json_add_string(stream, "plugin_path", plugin->cmd);
json_array_start(stream, "methods");
for (size_t i = 0; i < tal_count(plugin->methods); i++) {
json_add_string(stream, NULL, plugin->methods[i]);
}
json_array_end(stream);
}

REGISTER_NOTIFICATION(plugin_stopped);

void notify_plugin_stopped(struct lightningd *ld, struct plugin *plugin)
{
struct jsonrpc_notification *n = notify_start("plugin_stopped");
plugin_stopped_notification_serialize(n->stream, plugin);
plugin_notification_serialize(n->stream, plugin);
notify_send(ld, n);
}

0 comments on commit bb2399f

Please sign in to comment.