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

Function json_add_opt_plugins_array

lightningd/plugin.c:2369–2396  ·  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

2367 * plugins to be added.
2368 */
2369static
2370void json_add_opt_plugins_array(struct json_stream *response,
2371 const char *name,
2372 const struct plugins *plugins,
2373 bool important)
2374{
2375 struct plugin *p;
2376
2377 /* we output 'plugins' and their options as an array of substructures */
2378 json_array_start(response, name);
2379 list_for_each(&plugins->plugins, p, list) {
2380 /* Skip if not matching. */
2381 if (p->important != important)
2382 continue;
2383
2384 json_object_start(response, NULL);
2385 json_add_string(response, "path", p->cmd);
2386
2387 /* FIXME: use executables basename until plugins can define their names */
2388 json_add_string(response, "name", p->shortname);
2389
2390 if (!list_empty(&p->plugin_opts)) {
2391 json_add_plugin_options(response, "options", p, false);
2392 }
2393 json_object_end(response);
2394 }
2395 json_array_end(response);
2396}
2397
2398void json_add_opt_plugins(struct json_stream *response,
2399 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