You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

multiple-fcc.patch 2.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. From: Antonio Radici <antonio@debian.org>
  2. Date: Tue, 4 Mar 2014 15:40:45 +0100
  3. Subject: multiple-fcc
  4. A patch that allows multiple FCC separated by commas,
  5. written by Omen Wild.
  6. Original website: http://www.mandarb.com/mutt/
  7. Bug asking for the inclusion: #586454
  8. Gbp-Pq: Topic mutt-patched
  9. ---
  10. protos.h | 1 +
  11. send.c | 2 +-
  12. sendlib.c | 30 ++++++++++++++++++++++++++++++
  13. 3 files changed, 32 insertions(+), 1 deletion(-)
  14. diff --git a/protos.h b/protos.h
  15. index 38c8c01..551b142 100644
  16. --- a/protos.h
  17. +++ b/protos.h
  18. @@ -362,6 +362,7 @@ int mutt_user_is_recipient (HEADER *);
  19. void mutt_update_num_postponed (void);
  20. int mutt_wait_filter (pid_t);
  21. int mutt_which_case (const char *);
  22. +int mutt_write_multiple_fcc (const char *path, HEADER *hdr, const char *msgid, int, char *);
  23. int mutt_write_fcc (const char *path, HEADER *hdr, const char *msgid, int, char *);
  24. int mutt_write_mime_body (BODY *, FILE *);
  25. int mutt_write_mime_header (BODY *, FILE *);
  26. diff --git a/send.c b/send.c
  27. index 18b9390..893c859 100644
  28. --- a/send.c
  29. +++ b/send.c
  30. @@ -1747,7 +1747,7 @@ full_fcc:
  31. * message was first postponed.
  32. */
  33. msg->received = time (NULL);
  34. - if (mutt_write_fcc (fcc, msg, NULL, 0, NULL) == -1)
  35. + if (mutt_write_multiple_fcc (fcc, msg, NULL, 0, NULL) == -1)
  36. {
  37. /*
  38. * Error writing FCC, we should abort sending.
  39. diff --git a/sendlib.c b/sendlib.c
  40. index 0f05298..9d83401 100644
  41. --- a/sendlib.c
  42. +++ b/sendlib.c
  43. @@ -2680,6 +2680,36 @@ static void set_noconv_flags (BODY *b, short flag)
  44. }
  45. }
  46. +/* Handle a Fcc with multiple, comma separated entries. */
  47. +int mutt_write_multiple_fcc (const char *path, HEADER *hdr, const char *msgid, int post, char *fcc) {
  48. + char fcc_tok[_POSIX_PATH_MAX];
  49. + char fcc_expanded[_POSIX_PATH_MAX];
  50. + char *tok = NULL;
  51. + int status;
  52. +
  53. + strfcpy(fcc_tok, path, _POSIX_PATH_MAX);
  54. +
  55. + tok = strtok(fcc_tok, ",");
  56. + dprint(1, (debugfile, "Fcc: initial mailbox = '%s'\n", tok));
  57. + /* mutt_expand_path already called above for the first token */
  58. + if((status = mutt_write_fcc (tok, hdr, NULL, 0, NULL)) != 0)
  59. + return status;
  60. +
  61. + while((tok = strtok(NULL, ",")) != NULL) {
  62. + if(*tok) {
  63. + /* Only call mutt_expand_path iff tok has some data */
  64. + dprint(1, (debugfile, "Fcc: additional mailbox token = '%s'\n", tok));
  65. + strfcpy(fcc_expanded, tok, sizeof(fcc_expanded));
  66. + mutt_expand_path(fcc_expanded, sizeof(fcc_expanded));
  67. + dprint(1, (debugfile, " Additional mailbox expanded = '%s'\n", fcc_expanded));
  68. + if((status = mutt_write_fcc (fcc_expanded, hdr, NULL, 0, NULL)) != 0)
  69. + return status;
  70. + }
  71. + }
  72. +
  73. + return 0;
  74. +}
  75. +
  76. int mutt_write_fcc (const char *path, HEADER *hdr, const char *msgid, int post, char *fcc)
  77. {
  78. CONTEXT f;