From 00c807f23a019cde620b66574599832eb8266a6a Mon Sep 17 00:00:00 2001 From: Stephan Bosch <stephan@rename-it.nl> Date: Wed, 17 Dec 2014 00:35:47 +0100 Subject: [PATCH] lib-sieve: Fixed printing of hybrid command type. --- src/lib-sieve/sieve-commands.c | 18 ++++++++++++++++++ src/lib-sieve/sieve-commands.h | 4 ++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/lib-sieve/sieve-commands.c b/src/lib-sieve/sieve-commands.c index 67913f617..6c3f85862 100644 --- a/src/lib-sieve/sieve-commands.c +++ b/src/lib-sieve/sieve-commands.c @@ -296,6 +296,24 @@ const char *sieve_command_def_type_name case SCT_NONE: return "command of unspecified type (bug)"; case SCT_TEST: return "test"; case SCT_COMMAND: return "command"; + case SCT_HYBRID: return "command or test"; + default: + break; + } + return "??COMMAND-TYPE??"; +} + +const char *sieve_command_type_name + (const struct sieve_command *cmd) +{ + switch ( cmd->def->type ) { + case SCT_NONE: return "command of unspecified type (bug)"; + case SCT_TEST: return "test"; + case SCT_COMMAND: return "command"; + case SCT_HYBRID: + if ( cmd->ast_node->type == SAT_TEST ) + return "test"; + return "command"; default: break; } diff --git a/src/lib-sieve/sieve-commands.h b/src/lib-sieve/sieve-commands.h index 8638e1c4c..d175ba0e3 100644 --- a/src/lib-sieve/sieve-commands.h +++ b/src/lib-sieve/sieve-commands.h @@ -164,8 +164,6 @@ struct sieve_command { ( (cmd)->def == &(definition) ) #define sieve_command_identifier(cmd) \ ( (cmd)->def->identifier ) -#define sieve_command_type_name(cmd) \ - ( sieve_command_def_type_name((cmd)->def) ) #define sieve_commands_equal(cmd1, cmd2) \ ( (cmd1) != NULL && (cmd2) != NULL && (cmd1)->def == (cmd2)->def ) @@ -179,6 +177,8 @@ struct sieve_command *sieve_command_create const char *sieve_command_def_type_name (const struct sieve_command_def *cmd_def); +const char *sieve_command_type_name + (const struct sieve_command *cmd); struct sieve_command *sieve_command_prev (struct sieve_command *cmd); -- GitLab