Commit 94326c8a 94326c8a286ed1060b0a2bf159a8770a7db00a3f by Wojciech Polak

Fix movemail --uidl.

* mailbox/message.c (mu_message_get_uidl): Do not remove angle brackets
from X-UIDL header.
1 parent 9cd3a9ff
...@@ -570,7 +570,8 @@ mu_message_get_uid (mu_message_t msg, size_t *puid) ...@@ -570,7 +570,8 @@ mu_message_get_uid (mu_message_t msg, size_t *puid)
570 } 570 }
571 571
572 int 572 int
573 mu_message_get_uidl (mu_message_t msg, char *buffer, size_t buflen, size_t *pwriten) 573 mu_message_get_uidl (mu_message_t msg, char *buffer, size_t buflen,
574 size_t *pwriten)
574 { 575 {
575 mu_header_t header = NULL; 576 mu_header_t header = NULL;
576 size_t n = 0; 577 size_t n = 0;
...@@ -591,29 +592,8 @@ mu_message_get_uidl (mu_message_t msg, char *buffer, size_t buflen, size_t *pwri ...@@ -591,29 +592,8 @@ mu_message_get_uidl (mu_message_t msg, char *buffer, size_t buflen, size_t *pwri
591 /* Be compatible with Qpopper ? qppoper saves the UIDL in "X-UIDL". 592 /* Be compatible with Qpopper ? qppoper saves the UIDL in "X-UIDL".
592 We generate a chksum and save it in the header. */ 593 We generate a chksum and save it in the header. */
593 mu_message_get_header (msg, &header); 594 mu_message_get_header (msg, &header);
594 status = mu_header_get_value (header, "X-UIDL", buffer, buflen, &n); 595 status = mu_header_get_value_unfold (header, "X-UIDL", buffer, buflen, &n);
595 if (status == 0 && n > 0) 596 if (status != 0 || n == 0)
596 {
597 /* FIXME: Is this necessary ? I did not see so far a x-uidl message
598 that broken i.e.
599 X-UIDL: <abaceekeke\n
600 jakdkjaja>
601 */
602 /* We need to collapse the header if it was mutiline. e points to the
603 last char meaning in a C string that's '\0', s to the start. We also
604 remove the spesky '<' '>' if they are around. */
605 char *s, *e;
606 for (s = buffer, e = buffer + n; s <= e; s++)
607 {
608 if (mu_isspace ((unsigned char)*s) || *s == '<' || *s == '>')
609 {
610 memmove (s, s + 1, e - (s + 1));
611 e -= 1;
612 *e = '\0';
613 }
614 }
615 }
616 else
617 { 597 {
618 size_t uid = 0; 598 size_t uid = 0;
619 struct mu_md5_ctx md5context; 599 struct mu_md5_ctx md5context;
...@@ -644,6 +624,7 @@ mu_message_get_uidl (mu_message_t msg, char *buffer, size_t buflen, size_t *pwri ...@@ -644,6 +624,7 @@ mu_message_get_uidl (mu_message_t msg, char *buffer, size_t buflen, size_t *pwri
644 mu_header_set_value (header, "X-UIDL", buf, 1); 624 mu_header_set_value (header, "X-UIDL", buf, 1);
645 buflen--; /* leave space for the NULL. */ 625 buflen--; /* leave space for the NULL. */
646 strncpy (buffer, buf, buflen)[buflen] = '\0'; 626 strncpy (buffer, buf, buflen)[buflen] = '\0';
627 status = 0;
647 } 628 }
648 return status; 629 return status;
649 } 630 }
......