Append to INBOX if an explicit path wasn't supplied.
Showing
1 changed file
with
15 additions
and
9 deletions
... | @@ -889,16 +889,22 @@ imap_append_message0 (mailbox_t mailbox, message_t msg) | ... | @@ -889,16 +889,22 @@ imap_append_message0 (mailbox_t mailbox, message_t msg) |
889 | url_get_path (mailbox->url, NULL, 0, &n); | 889 | url_get_path (mailbox->url, NULL, 0, &n); |
890 | if (n == 0) | 890 | if (n == 0) |
891 | { | 891 | { |
892 | free (abuf); | 892 | if (!(path = strdup ("INBOX"))) |
893 | return EINVAL; | 893 | { |
894 | free (abuf); | ||
895 | return ENOMEM; | ||
896 | } | ||
894 | } | 897 | } |
895 | path = calloc (n + 1, sizeof (*path)); | 898 | else |
896 | if (path == NULL) | ||
897 | { | 899 | { |
898 | free (abuf); | 900 | path = calloc (n + 1, sizeof (*path)); |
899 | return ENOMEM; | 901 | if (path == NULL) |
902 | { | ||
903 | free (abuf); | ||
904 | return ENOMEM; | ||
905 | } | ||
906 | url_get_path (mailbox->url, path, n + 1, NULL); | ||
900 | } | 907 | } |
901 | url_get_path (mailbox->url, path, n + 1, NULL); | ||
902 | } | 908 | } |
903 | 909 | ||
904 | /* FIXME: we need to get the envelope_date and use it. | 910 | /* FIXME: we need to get the envelope_date and use it. |
... | @@ -928,7 +934,7 @@ imap_append_message0 (mailbox_t mailbox, message_t msg) | ... | @@ -928,7 +934,7 @@ imap_append_message0 (mailbox_t mailbox, message_t msg) |
928 | CHECK_EAGAIN (f_imap, status); | 934 | CHECK_EAGAIN (f_imap, status); |
929 | MAILBOX_DEBUG0 (mailbox, MU_DEBUG_PROT, f_imap->buffer); | 935 | MAILBOX_DEBUG0 (mailbox, MU_DEBUG_PROT, f_imap->buffer); |
930 | /* If we did not receive the continuation token, it is an error | 936 | /* If we did not receive the continuation token, it is an error |
931 | bail out. */ | 937 | bail out. */ |
932 | if (f_imap->buffer[0] != '+') | 938 | if (f_imap->buffer[0] != '+') |
933 | { | 939 | { |
934 | status = EACCES; | 940 | status = EACCES; |
... | @@ -970,7 +976,7 @@ imap_append_message0 (mailbox_t mailbox, message_t msg) | ... | @@ -970,7 +976,7 @@ imap_append_message0 (mailbox_t mailbox, message_t msg) |
970 | MAILBOX_DEBUG0 (m_imap->mailbox, MU_DEBUG_PROT, f_imap->buffer); | 976 | MAILBOX_DEBUG0 (m_imap->mailbox, MU_DEBUG_PROT, f_imap->buffer); |
971 | 977 | ||
972 | default: | 978 | default: |
973 | /* mu_error ("imap_append: unknow state\n"); */ | 979 | /* mu_error ("imap_append: unknown state\n"); */ |
974 | break; | 980 | break; |
975 | } | 981 | } |
976 | f_imap->state = IMAP_NO_STATE; | 982 | f_imap->state = IMAP_NO_STATE; | ... | ... |
-
Please register or sign in to post a comment