From 396f79ca13a1af639e05a14cd8135745887e1d89 Mon Sep 17 00:00:00 2001 From: TAKAHASHI Tamotsu Date: Sat, 12 Feb 2005 19:54:51 +0000 Subject: [PATCH] Fix debian bug #275060 (editing on an imap server loses its flags). Remove trailing delimiter from IMAP folder names. --- imap/message.c | 5 ++++- imap/util.c | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/imap/message.c b/imap/message.c index 7af9cc00..7b39c06d 100644 --- a/imap/message.c +++ b/imap/message.c @@ -556,7 +556,10 @@ int imap_append_message (CONTEXT *ctx, MESSAGE *msg) rewind (fp); imap_munge_mbox_name (mbox, sizeof (mbox), mailbox); - snprintf (buf, sizeof (buf), "APPEND %s (\\Seen) {%lu}", mbox, (unsigned long)len); + snprintf (buf, sizeof (buf), "APPEND %s (\\Seen%s%s) {%lu}", mbox, + msg->flags.replied ? " \\Answered" : "", + msg->flags.flagged ? " \\Flagged" : "", + (unsigned long) len); imap_cmd_start (idata, buf); diff --git a/imap/util.c b/imap/util.c index 96c8caf8..5062786b 100644 --- a/imap/util.c +++ b/imap/util.c @@ -271,6 +271,7 @@ void imap_free_idata (IMAP_DATA** idata) { * in IMAP. Additionally, the filesystem converts multiple hierarchy * delimiters into a single one, ie "///" is equal to "/". IMAP servers * are not required to do this. + * Moreover, IMAP servers may dislike the path ending with the delimiter. */ char *imap_fix_path (IMAP_DATA *idata, char *mailbox, char *path, size_t plen) @@ -297,6 +298,8 @@ char *imap_fix_path (IMAP_DATA *idata, char *mailbox, char *path, } x++; } + if (x && path[--x] != idata->delim) + x++; path[x] = '\0'; return path; } -- 2.40.0