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

Function json_add_opt_plugins_array

lightningd/plugin.c:2381–2408  ·  view source on GitHub ↗

json_add_opt_plugins_array * * @brief add a named array of plugins to the given response, * depending on whether it is important or not important. * * @param response - the `json_stream` to write into. * @param name - the field name of the array. * @param plugins - the plugins object to query. * @param important - match the `important` setting of the * plugins to be added. */

Source from the content-addressed store, hash-verified

2379 * plugins to be added.
2380 */
2381static
2382void json_add_opt_plugins_array(struct json_stream *response,
2383 const char *name,
2384 const struct plugins *plugins,
2385 bool important)
2386{
2387 struct plugin *p;
2388
2389 /* we output 'plugins' and their options as an array of substructures */
2390 json_array_start(response, name);
2391 list_for_each(&plugins->plugins, p, list) {
2392 /* Skip if not matching. */
2393 if (p->important != important)
2394 continue;
2395
2396 json_object_start(response, NULL);
2397 json_add_string(response, "path", p->cmd);
2398
2399 /* FIXME: use executables basename until plugins can define their names */
2400 json_add_string(response, "name", p->shortname);
2401
2402 if (!list_empty(&p->plugin_opts)) {
2403 json_add_plugin_options(response, "options", p, false);
2404 }
2405 json_object_end(response);
2406 }
2407 json_array_end(response);
2408}
2409
2410void json_add_opt_plugins(struct json_stream *response,
2411 const struct plugins *plugins)

Callers 1

json_add_opt_pluginsFunction · 0.85

Calls 6

json_array_startFunction · 0.85
json_object_startFunction · 0.85
json_add_plugin_optionsFunction · 0.85
json_object_endFunction · 0.85
json_array_endFunction · 0.85
json_add_stringFunction · 0.50

Tested by

no test coverage detected