Skip to content

Commit

Permalink
doveadm: Add kludge to support field array to fieldstr conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
cmouse authored and sirainen committed Feb 22, 2016
1 parent 676d560 commit 778087c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/doveadm/doveadm-mail.c
Expand Up @@ -885,6 +885,7 @@ doveadm_cmd_ver2_to_mail_cmd_wrapper(const struct doveadm_cmd_ver2* cmd,
{
struct doveadm_mail_cmd_context *ctx;
const char *wildcard_user;
const char *fieldstr;
ARRAY_TYPE(const_string) pargv;
int i;
struct doveadm_mail_cmd mail_cmd = {
Expand All @@ -895,7 +896,7 @@ doveadm_cmd_ver2_to_mail_cmd_wrapper(const struct doveadm_cmd_ver2* cmd,

ctx->iterate_all_users = FALSE;
wildcard_user = NULL;
t_array_init(&pargv, 8);
p_array_init(&pargv, ctx->pool, 8);

for(i=0;i<argc;i++) {
if (!argv[i].value_set)
Expand All @@ -922,6 +923,13 @@ doveadm_cmd_ver2_to_mail_cmd_wrapper(const struct doveadm_cmd_ver2* cmd,
} else if (ctx->v.parse_arg != NULL && argv[i].short_opt != '\0') {
optarg = (char*)argv[i].value.v_string;
ctx->v.parse_arg(ctx, argv[i].short_opt);
} else if (strcmp(argv[i].name, "field") == 0) {
/* mailbox status, fetch: convert an array into a
single space-separated parameter (alternative to
fieldstr) */
fieldstr = p_array_const_string_join(ctx->pool,
&argv[i].value.v_array, " ");
array_append(&pargv, &fieldstr, 1);
} else if ((argv[i].flags & CMD_PARAM_FLAG_POSITIONAL) != 0) {
/* feed this into pargv */
if (argv[i].type == CMD_PARAM_ARRAY)
Expand Down

0 comments on commit 778087c

Please sign in to comment.