368 |
action_delete(mesgs, args); |
action_delete(mesgs, args); |
369 |
break; |
break; |
370 |
case FILTER_ACTION_COPY: |
case FILTER_ACTION_COPY: |
371 |
info("%d message%s copied to mailbox %s.\n", cnt, plural(cnt), |
info("%d message%s copied to mailbox \"%s\".\n", cnt, plural(cnt), |
372 |
destmbox); |
destmbox); |
373 |
action_copy(mesgs, apply_namespace(destmbox, namesp.prefix, |
action_copy(mesgs, apply_namespace(destmbox, namesp.prefix, |
374 |
namesp.delim), args); |
namesp.delim), args); |
375 |
break; |
break; |
376 |
case FILTER_ACTION_MOVE: |
case FILTER_ACTION_MOVE: |
377 |
info("%d message%s moved to mailbox %s.\n", cnt, plural(cnt), |
info("%d message%s moved to mailbox \"%s\".\n", cnt, plural(cnt), |
378 |
destmbox); |
destmbox); |
379 |
action_move(mesgs, apply_namespace(destmbox, namesp.prefix, |
action_move(mesgs, apply_namespace(destmbox, namesp.prefix, |
380 |
namesp.delim), args); |
namesp.delim), args); |
428 |
*/ |
*/ |
429 |
int action_copy(char *mesgs, char *destmbox, char *args) |
int action_copy(char *mesgs, char *destmbox, char *args) |
430 |
{ |
{ |
431 |
|
int r = 0; |
432 |
const char *delim = " "; |
const char *delim = " "; |
433 |
char *tok, *mcp, *m, *acp = NULL, *occur; |
char *tok, *mcp, *m, *acp = NULL, *occur; |
434 |
|
|
444 |
if (*args) |
if (*args) |
445 |
fetch_response(imap_fetch(tok, acp, 0)); |
fetch_response(imap_fetch(tok, acp, 0)); |
446 |
|
|
447 |
if (copy_response(imap_copy(tok, destmbox)) == RESPONSE_TRYCREATE) |
if ((r = copy_response(imap_copy(tok, destmbox))) == RESPONSE_TRYCREATE) |
448 |
if (!server_response(imap_create(destmbox))) |
if (!server_response(imap_create(destmbox))) |
449 |
copy_response(imap_copy(tok, destmbox)); |
r = copy_response(imap_copy(tok, destmbox)); |
450 |
} |
} |
451 |
|
|
452 |
xfree(mcp); |
xfree(mcp); |
454 |
if (*args) |
if (*args) |
455 |
xfree(acp); |
xfree(acp); |
456 |
|
|
457 |
return 0; |
return r; |
458 |
} |
} |
459 |
|
|
460 |
|
|
463 |
*/ |
*/ |
464 |
int action_move(char *mesgs, char *destmbox, char *args) |
int action_move(char *mesgs, char *destmbox, char *args) |
465 |
{ |
{ |
466 |
action_copy(mesgs, destmbox, args); |
if (!action_copy(mesgs, destmbox, args)) |
467 |
action_delete(mesgs, "\0"); |
action_delete(mesgs, "\0"); |
468 |
|
|
469 |
/* CLOSE -> SELECT much faster than EXPUNGE -> SELECT */ |
/* CLOSE -> SELECT much faster than EXPUNGE -> SELECT */ |
470 |
/* server_response(imap_expunge()); */ |
/* server_response(imap_expunge()); */ |