From e36f871cf0692328a44eddfff02d1fd9399280b7 Mon Sep 17 00:00:00 2001 From: Christoph Berg Date: Mon, 31 May 2010 00:18:42 +0200 Subject: [PATCH 1/1] Add upstream/573823-imap_internal_date --- debian/changelog | 7 +- debian/patches/series | 1 + .../upstream/573823-imap_internal_date | 76 +++++++++++++++++++ 3 files changed, 82 insertions(+), 2 deletions(-) create mode 100644 debian/patches/upstream/573823-imap_internal_date diff --git a/debian/changelog b/debian/changelog index 526fb51..fb7af1d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,8 +8,11 @@ mutt (1.5.20-8~unrel) unreleased; urgency=low * Switch to tokyocabinet (Closes: #530670) * Instead of trying to maintain the PATCHES file, put "quilt applied" output there. - * Fix segfaults with ssh tunnels, patch 228671-pipe-mime.patch updated. - Thanks Nikolaus Schulz (Closes: #569279) + * debian/patches: + + Update upstream/228671-pipe-mime.patch: Fix segfaults with ssh tunnels. + Thanks Nikolaus Schulz (Closes: #569279) + + Add upstream/573823-imap_internal_date: Set internaldate of messages + appended to IMAP mailboxes (Closes: #573823) -- Christoph Berg Sun, 30 May 2010 23:20:21 +0200 diff --git a/debian/patches/series b/debian/patches/series index 0389f2f..05cea5a 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -59,6 +59,7 @@ upstream/228671-pipe-mime.patch upstream/383769-score-match.patch upstream/547739-manual-typos.patch upstream/311296-rand-mktemp.patch +upstream/573823-imap_internal_date misc/hyphen-as-minus.patch #misc/manpage-typos.patch diff --git a/debian/patches/upstream/573823-imap_internal_date b/debian/patches/upstream/573823-imap_internal_date new file mode 100644 index 0000000..76d6c80 --- /dev/null +++ b/debian/patches/upstream/573823-imap_internal_date @@ -0,0 +1,76 @@ +changeset: 5949:b2b97c7a2ae6 +branch: HEAD +user: Brendan Cully +date: Fri Jun 26 21:47:34 2009 -0700 +summary: Set internaldate of messages appended to IMAP mailboxes + +--- a/imap/imap_private.h ++++ b/imap/imap_private.h +@@ -70,6 +70,9 @@ + #define IMAP_CMD_PASS (1<<1) + #define IMAP_CMD_QUEUE (1<<2) + ++/* length of "DD-MMM-YYYY HH:MM:SS +ZZzz" (null-terminated) */ ++#define IMAP_DATELEN 27 ++ + enum + { + IMAP_FATAL = 1, +@@ -281,6 +284,7 @@ char* imap_get_qualifier (char* buf); + int imap_mxcmp (const char* mx1, const char* mx2); + char* imap_next_word (char* s); + time_t imap_parse_date (char* s); ++void imap_make_date (char* buf, time_t timestamp); + void imap_qualify_path (char *dest, size_t len, IMAP_MBOX *mx, char* path); + void imap_quote_string (char* dest, size_t slen, const char* src); + void imap_unquote_string (char* s); +--- a/imap/message.c ++++ b/imap/message.c +@@ -600,6 +600,7 @@ int imap_append_message (CONTEXT *ctx, M + char buf[LONG_STRING]; + char mbox[LONG_STRING]; + char mailbox[LONG_STRING]; ++ char internaldate[IMAP_DATELEN]; + size_t len; + progress_t progressbar; + size_t sent; +@@ -641,12 +642,14 @@ int imap_append_message (CONTEXT *ctx, M + M_PROGRESS_SIZE, NetInc, len); + + imap_munge_mbox_name (mbox, sizeof (mbox), mailbox); +- snprintf (buf, sizeof (buf), "APPEND %s (%s%s%s%s%s) {%lu}", mbox, ++ imap_make_date (internaldate, msg->received); ++ snprintf (buf, sizeof (buf), "APPEND %s (%s%s%s%s%s) \"%s\" {%lu}", mbox, + msg->flags.read ? "\\Seen" : "", + msg->flags.read && (msg->flags.replied || msg->flags.flagged) ? " " : "", + msg->flags.replied ? "\\Answered" : "", + msg->flags.replied && msg->flags.flagged ? " " : "", + msg->flags.flagged ? "\\Flagged" : "", ++ internaldate, + (unsigned long) len); + + imap_cmd_start (idata, buf); +--- a/imap/util.c ++++ b/imap/util.c +@@ -577,6 +577,21 @@ time_t imap_parse_date (char *s) + return (mutt_mktime (&t, 0) + tz); + } + ++/* format date in IMAP style: DD-MMM-YYYY HH:MM:SS +ZZzz. ++ * Caller should provide a buffer of IMAP_DATELEN bytes */ ++void imap_make_date (char *buf, time_t timestamp) ++{ ++ struct tm* tm = localtime (×tamp); ++ time_t tz = mutt_local_tz (timestamp); ++ ++ tz /= 60; ++ ++ snprintf (buf, IMAP_DATELEN, "%02d-%s-%d %02d:%02d:%02d %+03d%02d", ++ tm->tm_mday, Months[tm->tm_mon], tm->tm_year + 1900, ++ tm->tm_hour, tm->tm_min, tm->tm_sec, ++ (int) tz / 60, (int) abs (tz) % 60); ++} ++ + /* imap_qualify_path: make an absolute IMAP folder target, given IMAP_MBOX + * and relative path. */ + void imap_qualify_path (char *dest, size_t len, IMAP_MBOX *mx, char* path) -- 2.43.0