path: root/libmailutils
AgeCommit message (Collapse)AuthorFiles
2020-11-26mboxrb: Keep timestamps in normalized formSergey Poznyakoff2
* 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/ Reflect the above changes.
2020-11-25Replace mbox format driver with mboxrbSergey Poznyakoff2
* NEWS: update * Revert 9763fd4a. * include/mailutils/registrar.h: Likewise. * libproto/ Likewise. * libmailutils/stream/stream.c (mu_stream_size): Fix size calculation in case of line and full buffering scheme. * libmailutils/stream/streamcpy.c (mu_stream_copy_nl): Change semantics. Ensure that the copied data ends with two newline characters. Append them if necessary. * testsuite/mbop.c: New commands: message_lines and message_size. * libproto/mbox/mboxrb.c (mboxrb_mailbox_init_stream): Always add MU_STREAM_READ permission. Use the same flags for mu_mapfile_stream_create and mu_file_stream_create. (mboxrb_rescan_unlocked): Count terminating newline as part of the message. (mailbox_append_message): Make sure each message ends with an empty line. (mboxrb_tracker_sync): Update mailbox mesg_count. (mboxrb_flush_temp): Truncate the temporary stream to the new size. (mboxrb_flush_unlocked): Clear all modifications only in FLUSH_UIDVALIDITY mode. (mboxrb_message_copy_with_uid): Fix message_end computation. Use mu_stream_copy_nl to copy message body. (mu_mboxrb_message_reconstruct): Update ref on return. * po/ Update. * mail/copy.c (append_to_file): Use mu_stream_stat_buffer to compute statistics. * mail/mail.c: Allow for opening read-only mailboxes. * libproto/mbox/tests/ Fix the expected byte count. * libproto/mbox/tests/ Likewise. * libproto/mbox/tests/ Add more tests. * mail/tests/ Fix the expected byte and line count. * mail/tests/ Likewise. * mail/testsuite/mail/read.exp: Likewise. * mail/testsuite/mail/tag.exp: Likewise. * mail/testsuite/mail/z.exp: Likewise. * mail/tests/ Don't use line count and size in comparison. * mail/testsuite/mail/write.exp: Use regexps instead of exact strings for the same reason. * pop3d/testsuite/pop3d/read.exp: Fix the expected byte count. * readmsg/tests/ Expect extra newline in output. * readmsg/tests/ Likewise. * readmsg/tests/ Likewise. * readmsg/tests/ Likewise. * readmsg/tests/ Likewise. * sieve/tests/ Fix the expected byte count. * sieve/tests/ Expect extra newline in output. * mh/inc.c (incmbx): Parse truncate and nomoveto URL parameters prior to opening the mailbox. If notruncate is requested, open the mailbox read-only. * mh/mh_format.c (str_compress_ws): Fix copying between overlapping memory regions. * libtests/ Remove lstuid tests. * libtests/ Likewise. * libtests/lstuid.c: Remove. * libtests/ Remove. * libtests/ Remove. * libtests/ Remove. * libtests/ Fix the expected byte count. * imap4d/tests/ Fix the expected byte count. * map4d/tests/ Likewise. * imap4d/tests/ Remove X-* headers and Status from the mbox prior to comparison. * imap4d/tests/ Likewise. * libproto/mbox: Remove old code. Replace it with mboxrb. * mail/tests/ Update lines/sizes. * mail/testsuite/mail/folder.exp: Likewise. * mail/testsuite/mail/tag.exp: Likewise. * mail/testsuite/mail/z.exp: Likewise. * mda/mda/tests/ Fix shell quoting. * mda/putmail/tests/ Remove extra newline from the expectation. Eliminate X-IMAPbase and X-UID from the resulting mailbox. * mda/tests/ Eliminate X-IMAPbase and X-UID from the output. * pop3d/testsuite/pop3d/read.exp: Fix expected lines/sizes * readmsg/tests/ Fix extra whitespace. * sieve/tests/ Eliminate X-IMAPbase and X-UID. Fix extra whitespace in the expected From_ line. * sieve/tests/ Likewise. * sieve/tests/ Likewise.
2020-11-23Implement mboxrb format (a replacement for the mbox used currently)Sergey Poznyakoff6
* New format: mboxrb * include/mailutils/filter.h (mu_fromrb_filter): New extern. * include/mailutils/registrar.h (mu_mboxrb_record): New extern. (mu_register_all_mbox_formats) (mu_register_local_mbox_formats): Add mu_mboxrb_record. * libmailutils/filter/filter.c (mu_filter_get_list): Add mu_fromrb_filter * libproto/ [MU_COND_SUPPORT_MBOXRB]: Add mboxrb * bootstrap.conf: Remove special handling for testsuite/maildir (fixes 1d846d2d92). * testsuite/mbop.c: Implement the -r (--read-only) option. * include/mailutils/sys/ Add mboxrb.h * include/mailutils/sys/mboxrb.h: New file. * libmailutils/filter/ (libfilter_la_SOURCES): Add fromrb.c * libmailutils/filter/fromrb.c: New file. * libmailutils/tests/ New file. * libmailutils/tests/ New file. * libmailutils/tests/ New file. * libproto/mboxrb/ New file. * libproto/mboxrb/mboxrb.c: New file. * libproto/mboxrb/message.c: New file. * libproto/mboxrb/tests/.gitignore: New file. * libproto/mboxrb/tests/ New file. * libproto/mboxrb/tests/ New file. * libproto/mboxrb/tests/ New file. * libproto/mboxrb/tests/ New file. * libproto/mboxrb/tests/ New file. * libproto/mboxrb/tests/ New file. * libproto/mboxrb/tests/ New file. * libproto/mboxrb/tests/ New file. * libproto/mboxrb/tests/ New file.
2020-11-19Make sure UIDs are monotonically increased in dotmail, mh, and maildir.Sergey Poznyakoff1
* include/mailutils/sys/amd.h (_MU_AMD_PROP_UIDNEXT): New define. (MU_AMD_PROP): Remove. (MU_AMD_F_PROP): New flag. (_amd_data): New member: flags. Remove next_uid (amd_reset_uidvalidity): Change return type. (amd_update_uidnext,amd_alloc_uid): New protos. * include/mailutils/sys/dotmail.h (mu_dotmail_mailbox): New member uidvalidity_changed. * libmailutils/base/amd.c (_amd_prop_create): Set MU_AMD_F_PROP flag if the prop file exists. (amd_initial_scan): New function. (amd_get_uidvalidity, amd_set_uidvalidity) (amd_uidnext): Rewrite using amd_initial_scan. (amd_reset_uidvalidity): Return int. (amd_update_uidnext,amd_alloc_uid): New functions. * libproto/dotmail/dotmail.c (dotmail_close): Flush UID parameters if uidvalidity_changed is set. (dotmail_flush): Take three-state mode as its third argument. (dotmail_flush_unlocked): Likewise. If operating in FLUSH_UIDVALIDITY mode, clear all other modifications to the messages in the mailbox. Clear uidvalidity_changed on success. (dotmail_expunge, dotmail_sync): Update call to dotmail_flush. (dotmail_alloc_next_uid): Set uidvalidity_changed. (dotmail_rescan_unlocked): Check if the assigned UID is greater than the previously assigned one and less than the UIDNEXT value. Raise uidvalidity_changed if UIDs were re-allocated. (mu_dotmail_mailbox_uid_setup): Set uidvalidity_scanned. * libproto/dotmail/tests/ Add new test. * libproto/dotmail/tests/ Likewise. * libproto/dotmail/tests/ New test. * libproto/maildir/mbox.c: Use amd_update_uidnext to synchronize the computed and predicted uidnext value. (maildir_next_uid): Remove. * libproto/maildir/tests/ Add new test. * libproto/maildir/tests/ Likewise. * libproto/maildir/tests/ New test. * libproto/mh/mbox.c (_mh_next_seq): Remove function. (mh_scan0): Use amd_update_uidnext to synchronize the computed and predicted uidnext value. * libproto/mh/tests/ Add new test. * libproto/mh/tests/ Likewise. * libproto/mh/tests/ New test.
2020-11-17New mailutils subcommand: maildir_fixupSergey Poznyakoff1
The subcommand converts names in maildirs created by earlier versions of mailutils to the new format. * NEWS: Update. * doc/texinfo/programs/mailutils.texi: Document maildir_fixup * mu/libexec/ Build maildir_fixup subcommand. * mu/libexec/maildir_fixup.c: New file. * mu/libexec/mu.h (common_options): New extern. * include/mailutils/cli.h (MU_CLI_OPTION_CONF_PROGNAME): New constant. * libmailutils/cli/simple.c (MU_CLI_OPTION_PROG_NAME) (MU_CLI_OPTION_PROG_NAME) (MU_CLI_OPTION_PROG_DOC) (MU_CLI_OPTION_BUG_ADDRESS) (MU_CLI_OPTION_PACKAGE_URL) (MU_CLI_OPTION_EXTRA_INFO) (MU_CLI_OPTION_HELP_HOOK) (MU_CLI_OPTION_VERSION_HOOK) (MU_CLI_OPTION_PROG_DOC_HOOK) (MU_CLI_OPTION_NEGATION) (MU_CLI_OPTION_SPECIAL_ARGS): Allow for NULL argument. (MU_CLI_OPTION_CONF_PROGNAME): New code
2020-11-17sortm: reset the uidvalidity of the modified mailboxSergey Poznyakoff2
* include/mailutils/mailbox.h (mu_mailbox_uidvalidity_reset): New proto. * include/mailutils/sys/mailbox.h (_mu_mailbox): Replace the _uidvalidity member with two function pointers: _get_uidvalidity and _set_uidvalidity. * libmailutils/mailbox/mailbox.c (mu_mailbox_uidvalidity_reset): New function. * libmailutils/base/amd.c: Initialize the two methods. * libproto/dotmail/dotmail.c: Likewise. * libproto/mbox/mbox.c: Likewise. * libproto/imap/mbox.c: Initialize the _get_uidvalidity field. * mh/sortm.c: Reset the uidvalidity on success. * mh/tests/ Check that the uidvalidity changed after sorting
2020-11-16Fix message append notifications for maildir, mh, and dotmail.Sergey Poznyakoff1
* testsuite/mbop.c: Implement notification mode. * comsat/tests/ Fix mh qid. * libproto/dotmail/dotmail.c (dotmail_append_message): Lock the monitor before and unlock it after the operation. * libproto/dotmail/tests/ New file. * libproto/dotmail/tests/ Add * libproto/dotmail/tests/ Include * include/mailutils/sys/amd.h (cur_msg_file_name): Change signature. * libmailutils/base/amd.c: Use amd->cur_msg_file_name with 0 as its second argument to get qid. * libproto/maildir/mbox.c (maildir_cur_message_name): Take three argument, second one specifying whether an absolute or relative filename is requested. All uses changed. * libproto/maildir/tests/ New file. * libproto/maildir/tests/ Add * libproto/maildir/tests/ Include * libproto/mh/mbox.c (_mh_cur_message_name): Take three argument, second one specifying whether an absolute or relative filename is requested. All uses changed. * libproto/mh/tests/ New file. * libproto/mh/tests/ Add * libproto/mh/tests/ Include
2020-11-16Write testsuite for mh mailbox librarySergey Poznyakoff1
* libmailutils/base/amd.c (amd_get_attr_flags): Scan the message if AMD does not report MU_AMD_STATUS capability. * libproto/mh/mbox.c (mh_qfetch): Fix, * libproto/mh/ (SUBDIRS): Add tests. * libproto/mh/tests/.gitignore: New file. * libproto/mh/tests/ New file. * libproto/mh/tests/ New file. * libproto/mh/tests/ New file. * libproto/mh/tests/ New file. * libproto/mh/tests/ New file. * libproto/mh/tests/ New file. * libproto/mh/tests/ New file. * libproto/mh/tests/ New file. * libproto/mh/tests/ New file. * libproto/mh/tests/ New file. * libproto/mh/tests/ New file. * libproto/mh/tests/ New file. * libproto/mh/tests/ New file. * libproto/mh/tests/ New file.
2020-11-15Rename mu_string_to_flags to mu_attribute_string_to_flagsSergey Poznyakoff3
* include/mailutils/attribute.h (mu_attribute_string_to_flags): New proto. (mu_string_to_flags): Mark as deprecated. (mu_attribute_flags_to_string): New proto. * libmailutils/mailbox/attribute.c (mu_string_to_flags): Rename to mu_attribute_string_to_flags. (mu_attribute_flags_to_string): New function. * libmailutils/base/amd.c: Use mu_attribute_string_to_flags instead of mu_string_to_flags. * libmailutils/mailbox/msgscan.c: Likewise. * libproto/dotmail/message.c: Likewise. * libproto/pop/mbox.c: Likewise.
2020-11-15Implement the MU_ATTRIBUTE_FORWARDED attribute flag.Sergey Poznyakoff1
* include/mailutils/attribute.h (MU_ATTRIBUTE_FORWARDED): New constant. (mu_attribute_is_forwarded, mu_attribute_set_forwarded) (mu_attribute_unset_forwarded): New prototypes. (MU_STATUS_BUF_SIZE): Update definition. * libmailutils/mailbox/attribute.c (mu_attribute_is_forwarded) (mu_attribute_set_forwarded) (mu_attribute_unset_forwarded): New functions. * libproto/maildir/mbox.c (info_map): Implement the 'P' flag.
2020-11-15AMD API: provide function for resetting the uidvalidity value.Sergey Poznyakoff1
* include/mailutils/sys/amd.h (amd_reset_uidvalidity): New proto. * libmailutils/base/amd.c (amd_reset_uidvalidity): New function. * libproto/maildir/mbox.c (maildir_scan_unlocked): Use amd_reset_uidvalidity.
2020-11-15Improve mbop interfaceSergey Poznyakoff1
* testsuite/mbop.c: Use mu_cli_simple for option handling. Use the -m option to pass the mailbox file name (or URL). Mark qget as not requiring message selection.
2020-11-15More maildir testsSergey Poznyakoff2
* .gitignore: Update. * include/mailutils/sys/amd.h (MU_AMD_IMAPBASE): Remove. * libmailutils/base/amd.c (amd_scan_message): Remove obsolete code. * libproto/maildir/mbox.c (maildir_message_cmp): Bugfixes. * testsuite/ Add mbop.c to distribution. * testsuite/mbop.c: Implement qget. * testsuite/mbox2dir.c (maildir_generate_name): Fix typo. (main): Skip From_ line before copying. * libmailutils/tests/ (wsp_SOURCES): Remove. * libproto/maildir/tests/ Add new tests. * libproto/maildir/tests/ New file. * libproto/maildir/tests/ New file. * libproto/maildir/tests/ New file. * libproto/maildir/tests/ Update. * libproto/maildir/tests/ New file. * libproto/maildir/tests/ New file. * libproto/maildir/tests/ New file. * libproto/maildir/tests/ New file. * libproto/maildir/tests/ Include new tests. * libproto/maildir/tests/ New file. * libproto/maildir/tests/ New file.
2020-11-14Maildir testsuite coreSergey Poznyakoff1
* libmailutils/tests/tesh.c (mu_tesh_read_and_eval): Print fixed prompt if attached to a terminal. * libproto/maildir/ (SUBDIRS): Add tests. * libproto/maildir/mbox.c (flags_to_info): Be sure to format each flag only once. (maildir_scan_unlocked): Save updated properties. * testsuite/.gitignore: Add mbox2dir. * testsuite/ Build mbox2dir. * testsuite/mbop.c: New file. * testsuite/mbox2dir.c: New file. * libproto/maildir/tests/.gitignore: New file. * libproto/maildir/tests/ New file. * libproto/maildir/tests/ New file. * libproto/maildir/tests/ New file. * libproto/maildir/tests/ New file. * libproto/maildir/tests/ New file. * libproto/maildir/tests/ New file.
2020-11-12Don't assume any special meaning of the X-Imapbase header in the library.Sergey Poznyakoff2
This starts a series of commits whose purpose is to clean up the mess with the uid and uidvalidity attributes. The way these attributes are stored depends on the mailbox type. The libmailutils library contained some historical left-overs that assumed that the X-Imapbase header of the first message in the mailbox contained the value of the uidvalidity and next uid. These left-overs are removed. * include/mailutils/message.h (mu_message_scan): Remove uidvalidity. * libmailutils/mailbox/msgscan.c: Remove special handling for the X-Imapbase header. * libmailutils/base/amd.c (_amd_message_save) (amd_scan_message): Remove special handling for X-Imapbase.
2020-11-10Fix Savane bug #56428Sergey Poznyakoff6
* NEWS: Update. * Version 3.10.90 * include/mailutils/cstr.h (mu_version_string_parse) (mu_version_string_cmp): New protos. * libmailutils/string/ (libstring_la_SOURCES): Add version.c. * libmailutils/string/version.c: New file. * include/mailutils/sys/amd.h (_amd_message): Remove the orig_flags member. All uses changed. (MU_AMD_PROP): New capability. * include/mailutils/url.h (MU_AUTODETECT_ACCURACY_MAX): New constant. * libmailutils/base/amd.c (_amd_prop_create): Raise MU_AMD_PROP if the prop file exists. * libmailutils/base/schemeauto.c: New values for the MU_AUTODETECT_ACCURACY environment variable: default, fast, and max. * libmailutils/property/mhprop.c (_mh_prop_fill): Fix diagnostic message. * libproto/maildir/mbox.c: Fix incorrect letter to attribute mapping. * libproto/mh/mbox.c: Remove uses of orig_flags. * libmailutils/base/registrar.c (mu_registrar_lookup_url): Fall back to the default registrar if the url doesn't contain explicit scheme, the file it references does not exist, and the default record is a local one.
2020-11-09Fix mapping of the \Seen IMAP attribute.Sergey Poznyakoff1
* include/mailutils/attribute.h: Document message attributes. * libmailutils/imapio/flags.c (_imap4_attrlist): \Seen corresponds to MU_ATTRIBUTE_READ.
2020-10-01Rewrite amd_msg_bsearch without recursionSergey Poznyakoff1
2020-10-01BugfixSergey Poznyakoff1
* libmailutils/base/amd.c (amd_msg_lookup): Always store the index of the memory slot, as described in the comment. This was broken in 1274d937 in a fit of overcorrectness.
2020-09-28Fix last resort return for message_envelope_sender.Sergey Poznyakoff1
* libmailutils/mailbox/msgenv.c (message_envelope_sender): Fix conditional. Use mu_get_user_email instead of tinkering with mu_auth_data. * sieve/tests/ Fix expected output.
2020-09-05Fix parsing of IMAP ranges with the lower value less than the actual message ↵Sergey Poznyakoff1
set minimum * libmailutils/msgset/parse.c (get_msgnum): Make sure the returned is in the [minval,maxval] interval.
2020-08-19libmailutils/tests: Use MU_CHECK for simple testsSergey Poznyakoff12
* testsuite/ (MU_CHECK): Remove superfluous quoting. * libmailutils/tests/ New file. * libmailutils/tests/ New file. * libmailutils/tests/ Minor change. * libmailutils/tests/ Remove. * libmailutils/tests/ Remove. * libmailutils/tests/ Remove. * libmailutils/tests/ Remove. * libmailutils/tests/ Remove. * libmailutils/tests/ Remove. * libmailutils/tests/ Remove. * libmailutils/tests/ Remove. * libmailutils/tests/ Remove. * libmailutils/tests/ Update. * libmailutils/tests/ Update.
2020-08-18libmailutils/tests tools: use mu_cli_simple for option handlingSergey Poznyakoff23
2020-08-14Bugfixes.Sergey Poznyakoff2
* libmailutils/stream/mapfile_stream.c (_mapfile_open): For MU_STREAM_WRITE set open flags to O_RDWR. This is required for the remapping code to work. Without it mmap with MAP_SHARED falls with EACCESS. * libmailutils/stream/stream.c (mu_stream_close): Improve error checking.
2020-08-11Allow the caller to unref messages obtained from the mailboxSergey Poznyakoff3
* include/mailutils/sys/message.h (struct _mu_message): New member: _detach. * libmailutils/mailbox/msgref.c (_mu_message_free): Detach message from the owning object. * libmailutils/base/amd.c (_amd_attach_message): Provide the _detach method. * libproto/dotmail/message.c (mu_dotmail_message_get): Initialize the _detach member. * libproto/imap/mbox.c (_imap_mbx_get_message): Likewise. * libproto/mbox/mbox.c (new_message): Likewise. * libproto/pop/mbox.c (pop_create_message): Likewise. * libmailutils/stream/temp_stream.c (temp_stream_write): Tempfile stream is created fully buffered. Free the buffer before reinitializing. * lib/mdecode.c (message_body_stream): Change error message for MU_ERR_NOENT. * decodemail/decodemail.c (main): Unref the original message to decrease memory usage.
2020-08-09Implement temporary streams.Sergey Poznyakoff7
A temporary stream functions as a memory stream until its size reaches a preconfigured threshold value. Once it is reached, the stream storage is automatically converted to a temporary file, and all data written so far are transferred to the new storage. If the temporary file cannot be created, the stream continues to operate in memory-based mode. This stream type is intended to decrease the number of used file descriptors. * include/mailutils/sys/ Add temp_stream.h * include/mailutils/sys/temp_stream.h: New file. * include/mailutils/stream.h (mu_temp_file_threshold_size): New extern. (mu_temp_stream_create): New proto. * libmailutils/stream/ Add temp_stream.c. * libmailutils/stream/temp_stream.c: New file. * libmailutils/string/ Add strtosize.c * libmailutils/tests/.gitignore: Update. * libmailutils/tests/ * libmailutils/tests/strtoc.c: Add tests for mu_c_hsize. * libmailutils/tests/temp_stream.c: New test program. * libmailutils/tests/ Test the temp_stream functionality. * testsuite/ (MU_CHECK): New macro. * libmailutils/mailbox/body.c (body_get_transport): Use mu_temp_stream_create.
2020-08-08New function: mu_strtosizeSergey Poznyakoff4
* include/mailutils/cstr.h (mu_strtosize): New proto. * libmailutils/string/strtosize.c: New file. * libmailutils/string/ Add strtosize.c * libmailutils/string/str_to_c.c: Implement conversions for mu_c_hsize. * include/mailutils/util.h (mu_c_hsize): New mu_c_type, * libmailutils/tests/strtoc.c: Add tests for mu_c_hsize. * libmu_auth/ldap.c: Use mu_strtosize to parse quota. * mda/lib/mailquota.c: Likewise.
2020-08-08Bugfix in MIME parserSergey Poznyakoff1
* libmailutils/mime/mime.c: Rewrite boundary matcher as a separate function.
2020-08-07stream API: remove the readdelim methodSergey Poznyakoff11
The method is superfluous as the API itself provides the necessary functionality. Besides, it interacted poorly with positioning in buffered streams. * include/mailutils/sys/stream.h (struct _mu_stream): Remove the readdelim method. * libmailutils/stream/stream.c (mu_stream_readdelim) (mu_stream_getdelim): Remove uses of the readdelim method. * libmailutils/tests/.gitignore: Update. * libmailutils/tests/ Add new test. * libmailutils/tests/ Likewise. * libmailutils/tests/ New test. * libmailutils/tests/stream-getdelim.c: New test program. * libmailutils/base/amd.c: Remove readdelim implementation. * libmailutils/mailbox/msgstream.c: Likewise. * libmailutils/stream/iostream.c: Likewise. * libmailutils/stream/streamref.c: Likewise. * libmailutils/stream/xscript-stream.c: Likewise. * libproto/pop/pop3_stream.c: Likewise. * mail/decode.c (mime_descend): Handle errors from mu_message_unencapsulate graciously. On failure, treat message/rfc822 as text/plain.
2020-08-07BugfixesSergey Poznyakoff1
* libmailutils/stream/temp_file_stream.c (mu_temp_file_stream_create): Fix return value. * decodemail/decodemail.c (message_decode): Split to two subfunctions to improve error recovery. * include/mailutils/sys/body.h: Fix typo.
2020-08-06decodemail: make sure each message has the final newline on its ownSergey Poznyakoff1
* include/mailutils/stream.h (mu_stream_copy_wcb) (mu_stream_copy_nl): New protos. * libmailutils/stream/streamcpy.c (mu_stream_copy_wcb) (mu_stream_copy_nl): New functions. * libproto/mbox/mbox.c (append_message_to_stream): Use mu_stream_copy_nl. * decodemail/decodemail.c (hdr_print, body_print): Remove. (message_store_stdout): Use message stream instead of piping header and body separately. Use mu_stream_copy_nl to ensure the message has a final newline.
2020-08-05logstream: introduce optional prefix.Sergey Poznyakoff3
The prefix, if set, is output at the beginning of each line, after the location and before the severity. It can be used to provide additional information about the diagnostics, such as, e.g. the number or UID of the message. The decodemail utility makes use of the new feature. * include/mailutils/log.h (MU_LOGMODE_PREFIX): New define. * include/mailutils/stream.h (MU_IOCTL_LOGSTREAM_SET_LOCUS_RANGE) (MU_IOCTL_LOGSTREAM_SET_PREFIX): New defines. * include/mailutils/sys/logstream.h (_mu_log_stream): New member: prefix. * libmailutils/stream/logstream.c (_log_write): Output the prefix. (_log_done): Dereference the prefix. (_log_ctl): Handle MU_IOCTL_LOGSTREAM_SET_LOCUS_RANGE and MU_IOCTL_LOGSTREAM_SET_PREFIX. * libmailutils/tests/logstr.c: New test: prefix. * libmailutils/tests/ Test log prefix functionality. * decodemail/decodemail.c: Remove crd_error. Use logstream prefix to display message part locations.
2020-08-05Assorted fixesSergey Poznyakoff5
* libmailutils/mailbox/body.c (mu_body_size): Don't unref the transport stream. This fixes a bug introduced in 45d54031f4. * decodemail/decodemail.c (message_decode): Additional error-checking. * libmailutils/cfg/parser.y (split_cfg_path): Free the mu_wordsplit object on error. * libmu_sieve/extensions/spamd.c (spamd_read_line): Fix the argument to free. * doc/texinfo/programs/decodemail.texi: Remove a techically incorrect passage. * examples/sa.c: Initialize the urlstr variable. * libmailutils/base/amd.c (amd_msg_lookup): Store the value in *pret only if returning success. (amd_body_stream_seek): Check the return value from amd_body_size. * libmailutils/base/permstr.c (mu_readlink): Fix the uninitialized variable. * libmailutils/base/symlink.c (mu_readlink) Store the value in *plen only on success.
2020-08-03HousekeepingSergey Poznyakoff1
2020-08-02Provide fallback methods for restoring the envelope date.Sergey Poznyakoff2
* libmailutils/mailbox/msgenv.c (message_envelope_date): Try Received, X-Envelope-Date, and Date headers, in that order. * libmailutils/datetime/scantime.c (mu_scan_datetime): Timezone defaults to UTC.
2020-08-01New function to reconstruct message envelope from the headers.Sergey Poznyakoff6
* include/mailutils/sys/message_stream.h (_mu_message_stream): Reorganize structure. * libmailutils/base/amd.c: Use mu_message_reconstruct_envelope instead of the amd-specific envelope functions. * libmailutils/stream/message_stream.c: Likewise. * libmailutils/tests/ New test case. * libmailutils/tests/readmesg.c: New test program. * libmailutils/tests/ Add new tests. * libmailutils/tests/ Likewise. * mh/tests/ Update expected output. * mh/tests/ Likewise. * testsuite/mh/mbox1/: Fix timestamps in X-Envelope-Date * testsuite/mh/teaparty/: Likewise.
2020-08-01New function for reconstructing the message envelope from its headers.Sergey Poznyakoff7
* libmailutils/address/parse822.c (mu_parse822_route_addr): Accept <local-part-only> if the default domain is set. * include/mailutils/message.h (mu_message_reconstruct_envelope): New prototype. * libmailutils/mailbox/msgenv.c (message_envelope_sender): Try each candidate header in turn until a valid email is extracted or run out of headers. In the latter case, use the current user login name as the email. (mu_message_reconstruct_envelope): New function. * libmailutils/tests/ Add new test. * libmailutils/tests/ Likewise. * libmailutils/tests/recenv.c: Test program for the mu_message_reconstruct_envelope function * libmailutils/tests/ New test.
2020-08-01MIME-related fices in decodemailSergey Poznyakoff1
* decodemail/decodemail.c (message_decode): Initialize ismime to 0. * libmailutils/mime/mimehdr.c (parse_param): Silently ignore duplicated parameters.
2020-07-30BugfixesSergey Poznyakoff1
* libmailutils/base/ctparse.c (content_type_parse): Initialize rc. * decodemail/decodemail.c (message_decode): Use the MU_CONTENT_TYPE_PARAM flag. * lib/mdecode.c: Likewise.
2020-07-29Relax syntax rules for parsing Content-Type headers.Sergey Poznyakoff1
* decodemail/decodemail.c (qstring_format): Account for s==NULL (message_decode): Use MU_CONTENT_TYPE_RELAXED when parsing content types. * doc/texinfo/programs/decodemail.texi: Document handling of partial content types. * include/mailutils/util.h (MU_CONTENT_TYPE_STRICT) (MU_CONTENT_TYPE_RELAXED) (MU_CONTENT_TYPE_PARAM): New constants. (mu_content_type_parse_ext): New function. * lib/mdecode.c (text_mime_cmp): Implement comparison of partial content types (missing subtype). (message_body_stream): Use MU_CONTENT_TYPE_RELAXED. * libmailutils/base/ctparse.c (content_type_parse): Take additional argument (flags). Modify parsing algorithm depending on its value. (mu_content_type_parse_ext): New function. (mu_content_type_parse): Rewrite as a wrapper over mu_content_type_parse_ext. (mu_content_type_destroy): Account for subtype==NULL.
2020-07-25decodemail: double-quote decoded personal parts of email addressesSergey Poznyakoff1
* decodemail/decodemail.c: Take care to double-quote decoded personal parts of email addresses. * libmailutils/address/parse822.c (mu_parse822_quoted_string): Don't skip 8-bit characters.
2020-07-25Improve error tolerance when parsing MIME structured headersSergey Poznyakoff4
* include/mailutils/assoc.h (mu_assoc_set_mark) (mu_assoc_head_set_mark, mu_assoc_tail_set_mark) (mu_assoc_pop, mu_assoc_shift) (mu_assoc_sweep_unset, mu_assoc_pull): New protos. * libmailutils/base/assoc.c: New functions (see above). * libmailutils/mime/mimehdr.c (parse_param): Mark last installed element for sweeping. When seeing a semicolon, unmark it. Return MU_ERR_PARSE on errors. On success, install the created parameter in the assoc array. (_mime_header_parse): Change type of the subset parameter. Attempt error recovery on parse errors. If it succeeds, sweep out the last installed parameter. If subset is specified, use mu_assoc_pull to populate it from the created assoc. (mu_mime_header_parse_subset) (mu_mime_param_assoc_create): Update invocations of _mime_header_parse. * libmailutils/tests/ Test error tolerance. * libmailutils/tests/mimehdr.c: Use mu_cli_simple to parse command line. Treat positional arguments as names of the parameters to retain on output.
2020-07-24decodemail: print error location (message.part) with diagnosticsSergey Poznyakoff1
* decodemail/decodemail.c (message_decode): Take three arguments: the message(part), its location as a pointer to mu_coord_t object and dimension, meaning number of slots used in the latter. Use crd_error for diagnostics. (crd_error): New function. Display error message prefixed with the location of the message part it belongs to. * libmailutils/base/coord.c (mu_coord_realloc): Update the stored dimension.
2020-07-23Minor fixes in base64 and inline-comment filtersSergey Poznyakoff3
* libmailutils/diag/errors (MU_ERR_BASE64): New error code. * libmailutils/filter/base64.c (_base64_decoder): Stop decoding and return failure if padding length gets greater than 3 * libmailutils/filter/inline-comment.c (_ilcmt_decoder): Make sure proper error code is set.
2020-07-23Relax sytnax requirements for MIME structured headers.Sergey Poznyakoff6
* libmailutils/base/ctparse.c (content_type_parse): Rewrite the value splitting on type and subtype. Allow for optional whitespace at both sides of "/". Both type and subtype can contain arbitrary characters (except for "/"). This is not right according to RFC 2045, but reportedly such cases exist in old mails. * libmailutils/mailbox/bodystruct.c (bodystructure_fill): Fix parsing of the Content-Type header. Fix storing the pointer to an automatic variable in assoc object. Unfold the Content-Disposition value. * libmailutils/mime/mimehdr.c (_mime_header_parse): Return in pvalue entire prefix part up to the first semicolon, with leading and trailing whitespace removed. Allow for both output parameters to be NULL. * libmailutils/tests/ Add new test case. * libmailutils/tests/conttype.c: ignore empty lines in input. * libmailutils/tests/ Change mimehdr16 and mimehdr17 tests: this syntax is accepted by the relaxed rules of the modified parser.
2020-07-23Fixes in MIME structured header parserSergey Poznyakoff2
* libmailutils/mime/mimehdr.c (parse_param): Allow for whitespace surrounding =. * libmailutils/tests/ More tests
2020-07-23Add missing file.Sergey Poznyakoff1
* libmailutils/tests/listsort.c: New file.
2020-07-22Fix list sortSergey Poznyakoff4
* include/mailutils/sys/list.h (_mu_list_null) (_mu_list_init): New functions. * libmailutils/list/sort.c (_list_qsort): Fix pivot selection and list merging. * libmailutils/tests/.gitignore: Add listsort. * libmailutils/tests/ Likewise. * libmailutils/tests/ Check sorting large lists.
2020-07-22Stricter parsing of structured MIME headersSergey Poznyakoff10
The mu_content_type_parse function allowed for missing /subtype, which caused grief in case of blatantly invalid inputs. * decodemail/decodemail.c (message_decode): Handle mu_content_type_parse failures racefully: return a reference to the input message. Improve diagnostics. * lib/mdecode.c (message_body_stream): Improve diagnostics. * libmailutils/base/assoc.c (merge_sort): Bugfix: accept empty input list. * libmailutils/base/ctparse.c (content_type_parse): Require that both type and subtype be present. * libmailutils/mime/mimehdr.c (_mime_header_parse): Move parameter parsing to a separate function. Do better syntax checking. * libmailutils/tests/ Add new tests. * libmailutils/tests/ Likewise. * libmailutils/tests/ New tests. * libmailutils/tests/conttype.c: Return 1 if at least one parse fails. * libmailutils/tests/ Add tests for invalid inputs. * libmailutils/tests/mimehdr.c: Better diagnostics.
2020-07-20New simplified interface to command line option parser.Sergey Poznyakoff4
* include/mailutils/cli.h (MU_CLI_OPTION_): New constants. (mu_cli_simple): New proto. * libmailutils/cli/simple.c: New file. * libmailutils/cli/ Add new source. * libmailutils/cli/cli.c (mu_cli_ext): Take into account po_special_flags in hints. Honor MU_PARSEOPT_HELP_HOOK and MU_PARSEOPT_EXIT_ERROR set in hints. * libmailutils/opt/opt.c (parseopt_init): Fix improper use of MU_PARSEOPT_PACKAGE_URL instead of MU_PARSEOPT_DATA.

Return to:

Send suggestions and report system problems to the System administrator.