Commit 3af8e43d 3af8e43d65527e7723ed0950a7c8d979a794508b by Sergey Poznyakoff

(save_fcc): Handle comma-delimited folder lists in Fcc lines.

1 parent 3280d3ec
...@@ -253,7 +253,7 @@ save_fcc (mu_message_t msg) ...@@ -253,7 +253,7 @@ save_fcc (mu_message_t msg)
253 { 253 {
254 mu_header_t hdr; 254 mu_header_t hdr;
255 size_t count = 0, i; 255 size_t count = 0, i;
256 char buf[512]; 256 char buf[512], *fcc;
257 257
258 if (mu_message_get_header (msg, &hdr)) 258 if (mu_message_get_header (msg, &hdr))
259 return; 259 return;
...@@ -267,13 +267,20 @@ save_fcc (mu_message_t msg) ...@@ -267,13 +267,20 @@ save_fcc (mu_message_t msg)
267 mu_mailbox_t mbox; 267 mu_mailbox_t mbox;
268 268
269 mu_header_get_field_name (hdr, i, buf, sizeof buf, NULL); 269 mu_header_get_field_name (hdr, i, buf, sizeof buf, NULL);
270 if (strcasecmp (buf, MU_HEADER_FCC) == 0) 270 if (strcasecmp (buf, MU_HEADER_FCC) == 0
271 && mu_header_aget_field_value (hdr, i, &fcc) == 0)
271 { 272 {
272 if (mu_header_get_field_value (hdr, i, buf, sizeof buf, NULL)) 273 int i, argc;
273 continue; 274 char **argv;
274 if (mu_mailbox_create_default (&mbox, buf)) 275
276 mu_argcv_get (fcc, ",", NULL, &argc, &argv);
277 for (i = 0; i < argc; i += 2)
278 {
279 if (mu_mailbox_create_default (&mbox, argv[i]))
275 continue; /*FIXME: error message?? */ 280 continue; /*FIXME: error message?? */
276 if (mu_mailbox_open (mbox, MU_STREAM_RDWR|MU_STREAM_CREAT|MU_STREAM_APPEND) == 0) 281 if (mu_mailbox_open (mbox,
282 MU_STREAM_RDWR | MU_STREAM_CREAT
283 | MU_STREAM_APPEND) == 0)
277 { 284 {
278 mu_mailbox_append_message (mbox, msg); 285 mu_mailbox_append_message (mbox, msg);
279 mu_mailbox_flush (mbox, 0); 286 mu_mailbox_flush (mbox, 0);
...@@ -281,6 +288,9 @@ save_fcc (mu_message_t msg) ...@@ -281,6 +288,9 @@ save_fcc (mu_message_t msg)
281 mu_mailbox_close (mbox); 288 mu_mailbox_close (mbox);
282 mu_mailbox_destroy (&mbox); 289 mu_mailbox_destroy (&mbox);
283 } 290 }
291 mu_argcv_free (argc, argv);
292 free (fcc);
293 }
284 } 294 }
285 } 295 }
286 296
......