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.
Showing
1 changed file
with
15 additions
and
1 deletions
... | @@ -1074,6 +1074,15 @@ com_append (int argc, char **argv) | ... | @@ -1074,6 +1074,15 @@ com_append (int argc, char **argv) |
1074 | } | 1074 | } |
1075 | 1075 | ||
1076 | static int | 1076 | static int |
1077 | com_copy (int argc, char **argv) | ||
1078 | { | ||
1079 | int status = mu_imap_copy (imap, uid_mode, argv[1], argv[2]); | ||
1080 | if (status) | ||
1081 | report_failure ("copy", status); | ||
1082 | return 0; | ||
1083 | } | ||
1084 | |||
1085 | static int | ||
1077 | print_list_item (void *item, void *data) | 1086 | print_list_item (void *item, void *data) |
1078 | { | 1087 | { |
1079 | struct mu_list_response *resp = item; | 1088 | struct mu_list_response *resp = item; |
... | @@ -1083,7 +1092,8 @@ print_list_item (void *item, void *data) | ... | @@ -1083,7 +1092,8 @@ print_list_item (void *item, void *data) |
1083 | "%c%c %c %4d %s\n", | 1092 | "%c%c %c %4d %s\n", |
1084 | (resp->type & MU_FOLDER_ATTRIBUTE_DIRECTORY) ? 'd' : '-', | 1093 | (resp->type & MU_FOLDER_ATTRIBUTE_DIRECTORY) ? 'd' : '-', |
1085 | (resp->type & MU_FOLDER_ATTRIBUTE_FILE) ? 'f' : '-', | 1094 | (resp->type & MU_FOLDER_ATTRIBUTE_FILE) ? 'f' : '-', |
1086 | resp->separator, | 1095 | resp->separator ? |
1096 | resp->separator : MU_HIERARCHY_DELIMITER, | ||
1087 | resp->level, | 1097 | resp->level, |
1088 | resp->name); | 1098 | resp->name); |
1089 | return 0; | 1099 | return 0; |
... | @@ -1220,6 +1230,10 @@ struct mutool_command imap_comtab[] = { | ... | @@ -1220,6 +1230,10 @@ struct mutool_command imap_comtab[] = { |
1220 | com_append, | 1230 | com_append, |
1221 | N_("[-time DATETIME] [-flag FLAG] MAILBOX FILE"), | 1231 | N_("[-time DATETIME] [-flag FLAG] MAILBOX FILE"), |
1222 | N_("append message text from FILE to MAILBOX") }, | 1232 | N_("append message text from FILE to MAILBOX") }, |
1233 | { "copy", 3, 3, 0, | ||
1234 | com_copy, | ||
1235 | N_("MSGSET MAILBOX"), | ||
1236 | N_("Copy messages from MSGSET to MAILBOX") }, | ||
1223 | { "list", 3, 3, 0, | 1237 | { "list", 3, 3, 0, |
1224 | com_list, | 1238 | com_list, |
1225 | N_("REF MBOX"), | 1239 | N_("REF MBOX"), | ... | ... |
-
Please register or sign in to post a comment