const char *description;
gboolean is_controller;
gboolean is_privileged;
+ gboolean need_input;
void (*command_output_func)(ucl_object_t *obj);
} rspamc_commands[] = {
{
.description = "scan message and show symbols (default command)",
.is_controller = FALSE,
.is_privileged = FALSE,
+ .need_input = TRUE,
.command_output_func = rspamc_symbols_output
},
{
.description = "learn message as spam",
.is_controller = TRUE,
.is_privileged = TRUE,
+ .need_input = TRUE,
.command_output_func = NULL
},
{
.description = "learn message as ham",
.is_controller = TRUE,
.is_privileged = TRUE,
+ .need_input = TRUE,
.command_output_func = NULL
},
{
.description = "add message to fuzzy storage (check -f and -w options for this command)",
.is_controller = TRUE,
.is_privileged = TRUE,
+ .need_input = TRUE,
.command_output_func = NULL
},
{
.description = "delete message from fuzzy storage (check -f option for this command)",
.is_controller = TRUE,
.is_privileged = TRUE,
+ .need_input = TRUE,
.command_output_func = NULL
},
{
.description = "show rspamd statistics",
.is_controller = TRUE,
.is_privileged = FALSE,
+ .need_input = FALSE,
.command_output_func = NULL
},
{
.description = "show and reset rspamd statistics (useful for graphs)",
.is_controller = TRUE,
.is_privileged = TRUE,
+ .need_input = FALSE,
.command_output_func = NULL
},
{
.description = "display rspamd symbols statistics",
.is_controller = TRUE,
.is_privileged = FALSE,
+ .need_input = FALSE,
.command_output_func = NULL
},
{
.description = "show rspamd uptime",
.is_controller = TRUE,
.is_privileged = FALSE,
+ .need_input = FALSE,
.command_output_func = NULL
},
{
.description = "add or modify symbol settings in rspamd",
.is_controller = TRUE,
.is_privileged = TRUE,
+ .need_input = FALSE,
.command_output_func = NULL
},
{
.description = "add or modify action settings",
.is_controller = TRUE,
.is_privileged = TRUE,
+ .need_input = FALSE,
.command_output_func = NULL
}
};
cbdata = g_slice_alloc (sizeof (struct rspamc_callback_data));
cbdata->cmd = cmd;
cbdata->filename = name;
- rspamd_client_command (conn, cmd->name, attrs, in, rspamc_client_cb, cbdata, &err);
+ if (cmd->need_input) {
+ rspamd_client_command (conn, cmd->name, attrs, in, rspamc_client_cb,
+ cbdata, &err);
+ }
+ else {
+ rspamd_client_command (conn, cmd->name, attrs, NULL, rspamc_client_cb,
+ cbdata, &err);
+ }
}
}