static bool cmd_test_imap_metadata_operation_dump
(const struct sieve_dumptime_env *denv, sieve_size_t *address)
{
	int opt_code = 0;

	sieve_code_dumpf(denv, "%s:", sieve_operation_mnemonic(denv->oprtn));
	sieve_code_descend(denv);

	/* Dump optional operands */

	for (;;) {
		int opt;
		bool opok = TRUE;

		if ( (opt=sieve_opr_optional_dump(denv, address, &opt_code)) < 0 )
			return FALSE;

		if ( opt == 0 ) break;

		switch ( opt_code ) {
		case OPT_MAILBOX:
			opok = sieve_opr_string_dump(denv, address, "mailbox");
			break;
		default:
			return FALSE;
		}

		if ( !opok ) return FALSE;
	}	

	return 
		( sieve_opr_string_dump(denv, address, "annotation") &&
			sieve_opr_string_dump(denv, address, "value") );
}
Ejemplo n.º 2
0
static bool tst_spamvirustest_operation_dump
(const struct sieve_dumptime_env *denv, sieve_size_t *address)
{
	int opt_code = 0;
	const struct sieve_operation *op = denv->oprtn;

	sieve_code_dumpf(denv, "%s", sieve_operation_mnemonic(op));
	sieve_code_descend(denv);

	/* Optional operands */
	for (;;) {
		int opt;

		if ( (opt=sieve_match_opr_optional_dump(denv, address, &opt_code)) < 0 )
			return FALSE;

		if ( opt == 0 ) break;

		switch ( opt_code ) {
		case OPT_SPAMTEST_PERCENT:
			sieve_code_dumpf(denv, "percent");
			break;
    default:
			return FALSE;
		}
	}

	return
		sieve_opr_string_dump(denv, address, "value");
}
Ejemplo n.º 3
0
static bool cmd_test_binary_operation_dump
(const struct sieve_dumptime_env *denv, sieve_size_t *address)
{
	sieve_code_dumpf(denv, "%s:", sieve_operation_mnemonic(denv->oprtn));
	
	sieve_code_descend(denv);
	
	return sieve_opr_string_dump(denv, address, "binary-name");
}
void _sieve_runtime_trace_error
(const struct sieve_runtime_env *renv, const char *fmt, va_list args)
{
	string_t *trline = _trace_line_new(renv, renv->pc, 0);

	str_printfa(trline, "%s: #ERROR#: ", sieve_operation_mnemonic(renv->oprtn));
	str_vprintfa(trline, fmt, args);

	_trace_line_print(trline, renv);
}
void _sieve_runtime_trace_operand_error
(const struct sieve_runtime_env *renv, const struct sieve_operand *oprnd,
	const char *fmt, va_list args)
{
	string_t *trline = _trace_line_new(renv, oprnd->address,
		sieve_runtime_get_source_location(renv, oprnd->address));

	str_printfa(trline, "%s: #ERROR#: ", sieve_operation_mnemonic(renv->oprtn));

	if ( oprnd->field_name != NULL )
		str_printfa(trline, "%s: ", oprnd->field_name);

	str_vprintfa(trline, fmt, args);

	_trace_line_print(trline, renv);
}