From: Aki Tuomi Date: Mon, 22 Feb 2016 16:20:59 +0000 (+0200) Subject: doveadm: Add kludge to support field array to fieldstr conversion X-Git-Tag: 2.2.22.rc1~116 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=778087c26fc528b58ef28c97d2941e599a20cf83;p=thirdparty%2Fdovecot%2Fcore.git doveadm: Add kludge to support field array to fieldstr conversion --- diff --git a/src/doveadm/doveadm-mail.c b/src/doveadm/doveadm-mail.c index 671a8693eb..362634d8dc 100644 --- a/src/doveadm/doveadm-mail.c +++ b/src/doveadm/doveadm-mail.c @@ -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 = { @@ -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;iv.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)