Commit 09be781f 09be781f34bd43f47f65eee4ce757e8c9ab742e6 by Sergey Poznyakoff

mu imap: implement copy command.

* mu/imap.c (com_copy): New function.
(print_list_item): Treat 0 separator as '/' to avoid preliminary
truncating the output.
1 parent e218f1ec
Showing 1 changed file with 15 additions and 1 deletions
......@@ -1074,6 +1074,15 @@ com_append (int argc, char **argv)
}
static int
com_copy (int argc, char **argv)
{
int status = mu_imap_copy (imap, uid_mode, argv[1], argv[2]);
if (status)
report_failure ("copy", status);
return 0;
}
static int
print_list_item (void *item, void *data)
{
struct mu_list_response *resp = item;
......@@ -1083,7 +1092,8 @@ print_list_item (void *item, void *data)
"%c%c %c %4d %s\n",
(resp->type & MU_FOLDER_ATTRIBUTE_DIRECTORY) ? 'd' : '-',
(resp->type & MU_FOLDER_ATTRIBUTE_FILE) ? 'f' : '-',
resp->separator,
resp->separator ?
resp->separator : MU_HIERARCHY_DELIMITER,
resp->level,
resp->name);
return 0;
......@@ -1220,6 +1230,10 @@ struct mutool_command imap_comtab[] = {
com_append,
N_("[-time DATETIME] [-flag FLAG] MAILBOX FILE"),
N_("append message text from FILE to MAILBOX") },
{ "copy", 3, 3, 0,
com_copy,
N_("MSGSET MAILBOX"),
N_("Copy messages from MSGSET to MAILBOX") },
{ "list", 3, 3, 0,
com_list,
N_("REF MBOX"),
......