diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2020-11-26 07:30:41 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2020-11-26 07:30:41 +0200 |
commit | 92ef2f82491ab16a9393fb7c83adaf2f1396e232 (patch) | |
tree | 0fd23a299e7e9483d63ac9dab1afd64d0dc172ca /include | |
parent | 1bcece404bf0ec7a2d2941511350e8f2a6f65736 (diff) | |
download | mailutils-92ef2f82491ab16a9393fb7c83adaf2f1396e232.tar.gz mailutils-92ef2f82491ab16a9393fb7c83adaf2f1396e232.tar.bz2 |
mboxrb: Keep timestamps in normalized form
* include/mailutils/datetime.h (mu_timezone_offset): New proto.
* libmailutils/datetime/scantime.c: New conversion: %Z (timezone
abbreviation).
* libmailutils/datetime/parsedate.y (mu_timezone_offset): New function.
Returns time offset in seconds corresponding to the given timezone
abbreviation.
* include/mailutils/sys/mboxrb.h (mu_mboxrb_hdr): Remove unneeded
enum.
(mu_mboxrb_message): Remove env_date_start,
New member "date" holds the string representation of the envelope
timestamp in normalized form - ctime(3), UTC.
* libproto/mbox/mboxrb.c (scan_message_finalize): New function.
(scan_message_begin): New function. When initializing the
message, timestamps in obsolete forms are converted to normalized
representation.
(mboxrb_rescan_unlocked): Use scan_message_finalize and
scan_message_begin.
* libproto/mbox/message.c (mboxrb_envelope_date): Get normalized
timestamp from the date member,
* libproto/mbox/tests/env.at: Reflect the above changes.
Diffstat (limited to 'include')
-rw-r--r-- | include/mailutils/datetime.h | 1 | ||||
-rw-r--r-- | include/mailutils/sys/mboxrb.h | 14 |
2 files changed, 5 insertions, 10 deletions
diff --git a/include/mailutils/datetime.h b/include/mailutils/datetime.h index dd346ac29..cd8e3369c 100644 --- a/include/mailutils/datetime.h +++ b/include/mailutils/datetime.h @@ -82,6 +82,7 @@ int mu_parse_date_dtl (const char *p, const time_t *now, int mu_parse_date (const char *p, time_t *rettime, const time_t *now); int mu_utc_offset (void); +int mu_timezone_offset (const char *buf, int *off); void mu_datetime_tz_local (struct mu_timezone *tz); void mu_datetime_tz_utc (struct mu_timezone *tz); time_t mu_datetime_to_utc (struct tm *timeptr, struct mu_timezone *tz); diff --git a/include/mailutils/sys/mboxrb.h b/include/mailutils/sys/mboxrb.h index 0e3af71e8..22574330a 100644 --- a/include/mailutils/sys/mboxrb.h +++ b/include/mailutils/sys/mboxrb.h @@ -18,27 +18,21 @@ #define _MAILUTILS_SYS_MBOX2_H # include <mailutils/types.h> - -enum mu_mboxrb_hdr - { - mu_mboxrb_hdr_status, - mu_mboxrb_hdr_x_imapbase, - mu_mboxrb_hdr_x_uid, - MU_MBOXRB_HDR_MAX - }; +# include <mailutils/datetime.h> struct mu_mboxrb_message { /* Offsets in the mailbox */ mu_off_t message_start; /* Start of message */ size_t from_length; /* Length of the From_ line */ - int env_sender_len; - int env_date_start; + int env_sender_len; /* Length of the sender email in the From_ line */ mu_off_t body_start; /* Start of body */ mu_off_t message_end; /* Offset of the last byte of the message */ /* Additional info */ unsigned long uid; /* IMAP-style uid. */ + char date[MU_DATETIME_FROM_LENGTH+1]; /* Envelope date in normalized form */ + unsigned body_lines_scanned:1; /* True if body_lines is initialized */ unsigned body_from_escaped:1; /* True if body is from-escaped (valid if body_lines_scanned is true) */ |