Пример #1
0
/* 'ping' takes no parameters, and provides information about this mu
 * server using a (:pong ...) message (details: see code below)
 */
static MuError
cmd_ping (ServerContext *ctx, GSList *args, GError **err)
{
	unsigned doccount;
	doccount = mu_store_count (ctx->store, err);

	if (doccount == (unsigned)-1)
		return print_and_clear_g_error (err);

	print_expr ("(:pong \"" PACKAGE_NAME "\" "
		    " :props (:crypto %s :guile %s "
		    "  :version \"" VERSION "\" "
		    "  :doccount %u))",
		    mu_util_supports (MU_FEATURE_CRYPTO) ? "t" : "nil",
		    mu_util_supports (MU_FEATURE_GUILE|MU_FEATURE_GNUPLOT)
		    ? "t" : "nil",
		    doccount);

	return MU_OK;
}
Пример #2
0
static gboolean
check_params (MuConfig *opts, GError **err)
{
	if (!mu_util_supports (MU_FEATURE_GUILE | MU_FEATURE_GNUPLOT)) {
		mu_util_g_set_error (err, MU_ERROR_IN_PARAMETERS,
				     "the 'script' command is not available "
				     "in this version of mu");
		return FALSE;
	}

	return TRUE;
}