summaryrefslogtreecommitdiff
path: root/libmailutils
AgeCommit message (Collapse)AuthorFiles
2020-08-08New function: mu_strtosizeSergey Poznyakoff4
* include/mailutils/cstr.h (mu_strtosize): New proto. * libmailutils/string/strtosize.c: New file. * libmailutils/string/Makefile.am: 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/Makefile.am: Add new test. * libmailutils/tests/testsuite.at: Likewise. * libmailutils/tests/getdelim.at: 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/logstr.at: 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/readmesg.at: New test case. * libmailutils/tests/readmesg.c: New test program. * libmailutils/tests/Makefile.am: Add new tests. * libmailutils/tests/testsuite.at: Likewise. * mh/tests/mhl.at: Update expected output. * mh/tests/mhn.at: 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/Makefile.am: Add new test. * libmailutils/tests/testsuite.at: Likewise. * libmailutils/tests/recenv.c: Test program for the mu_message_reconstruct_envelope function * libmailutils/tests/recenv.at: 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/mimehdr.at: 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/content-type.at: Add new test case. * libmailutils/tests/conttype.c: ignore empty lines in input. * libmailutils/tests/mimehdr.at: 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/mimehdr.at: 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/Makefile.am: Likewise. * libmailutils/tests/list.at: 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/Makefile.am: Add new tests. * libmailutils/tests/testsuite.at: Likewise. * libmailutils/tests/content-type.at: New tests. * libmailutils/tests/conttype.c: Return 1 if at least one parse fails. * libmailutils/tests/mimehdr.at: 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/Makefile.am: 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.
2020-07-20Fix memory leak in property codeSergey Poznyakoff2
The property API contains a serious flaw that leads to memory leaks. The property initialization function (set by mu_property_set_init or similiar functions) is supposed to initialize the supported methods in mu_property_t, in particular _prop_done, which is responsible for releasing the resources allocated for the initdata object upon invocation of mu_property_destroy. However, the initialization function gets called only upon a read/write manipulation on the property. This means that unless at least one such operation is performed the _prop_done method will not be initialized and the resources (if any) allocated for the initial data object will never be released. This is true, in particular for the MH properties and assoc properties with I/O stream. Until the API is revamped, the following solution is implemented. The function mu_property_create_init calls the mu_property_init function if called with a non-NULL third argument (initdata). This ensures that it will be properly freed upon destroying the object. The use of low-level functions mu_property_set_init and mu_property_set_init_data requires the caller to call mu_property_init explicitly, if needed. * include/mailutils/property.h (mu_property_init): New proto. * libmailutils/property/create.c (_mu_property_init): Rename to mu_property_init. (mu_property_create_init): Call mu_property_init if initdata is not NULL. * libmailutils/property/propinv.c: Update call to mu_property_init.
2020-07-20Provide tests for auxiliary test utilitiesSergey Poznyakoff1
* configure.ac: Initialize testsuite in libproto/mbox * libproto/mbox/Makefile.am (SUBDIRS): Declare. * libproto/mbox/tests/Makefile.am: New file. * libproto/mbox/tests/atlocal.in: New file. * libproto/mbox/tests/testsuite.at: New file. * testsuite/ufms.at: Rename to libproto/mbox/tests/ufms.at * testsuite/ufms.c: Rename to libproto/mbox/tests/ufms.c * testsuite/.gitignore: Update. * testsuite/mockmail.at: New file. * testsuite/mockmail.c (main): Fix the state machine. * testsuite/mockmta.at: New file. * testsuite/mockmta.c: Fix typo in the comment. * testsuite/testsuite.at: Add new tests * testsuite/Makefile.am: Add new tests
2020-07-19Minor changesSergey Poznyakoff1
* testsuite/Makefile.am (cwdrepl_LDADD): Remove mailutils dependencies * testsuite/cwdrepl.c: Replace with a mu-independent version from wydawca. (http://git.gnu.org.ua/cgit/wydawca.git) * testsuite/mockmail.c: Fix indentation * mh/tests/comp.at: Remove trailing whitespace from the output. * mh/tests/forw.at: Likewise. * mh/tests/repl.at: Likewise.
2020-07-15smtp mailer: fix multiple open/close on the same mailerSergey Poznyakoff1
This fixes the operation of the smtp(s) mailer in the following context while (cond) { mu_mailer_open (mailer, ...); mu_mailer_send_message (mailer, msg, ...); mu_mailer_close (mailer); } * include/mailutils/mailer.h (mu_mailer_get_streamref) (mu_mailer_set_stream): Remove. * include/mailutils/sys/mailer.h (struct _mu_mailer): Remove stream. * libmailutils/mailer/mailer.c (mu_mailer_create): Don't reference stream. (mu_mailer_set_stream,mu_mailer_get_streamref): Remove. * libproto/mailer/smtp.c (struct _smtp_mailer): New members: tls and auth. (smtp_open): Open the stream and assign it. (_mailer_smtp_init): Create the struct _smtp_mailer object and save it in the mailer. (smtp_close): Close and destroy the carrier. * libproto/mailer/smtp_carrier.c (mu_smtp_set_carrier): Accept NULL as the carrier argument.
2020-07-15Fix memory leaks.Sergey Poznyakoff3
* libmailutils/sockaddr/free.c (mu_sockaddr_free): Free the address itself. * libmailutils/stream/message_stream.c (mu_message_from_stream_with_envelope): Envelope must be owned by the message. Change mu_envelope_create accordingly. (_env_msg_date, _env_msg_sender): Likewise. * libmailutils/url/destroy.c: Free url->portstr.
2020-07-09Fix memory leaksSergey Poznyakoff3
* libmailutils/diag/debug.c (mu_debug_log): Free buf. * libmailutils/mailer/progmailer.c (mu_progmailer_send): Call mu_stream_destroy (fix copy-paste error). * libmailutils/string/expvar.c (mu_str_expand): Save word[0], free the rest. * mail/mail.c (main): Free the result of mu_argcv_string. * mail/mail.h (compose_header_get): Return const ptr. * mail/mailline.c (ml_readline_internal): Free the buffer on EOF. * mail/reply.c (reply0): compose_header_get returns const char*. * mail/send.c (add_body): Don't increase stream reference count (follow-up to 45d54031). (compose_header_get): Return const char* (use mu_header_sget_value). (mail_send0): Always free buf. * mail/source.c (source_readline): Free buf on EOF. * mail/util.c (util_header_expand): Free mu_wordsplit.
2020-07-07BugfixesSergey Poznyakoff2
* libmailutils/stream/stream.c (_stream_read_unbuffered): Update pnread only on success. * libmailutils/string/muctype.c: Mark underscore as MU_CTYPE_HEADR
2020-07-06Fix assoc operation in case-insensitive mode.Sergey Poznyakoff1
* libmailutils/base/assoc.c (_mu_assoc): New member: hash. (mu_assoc_create): Set proper hashing function for case-insensitive operation.
2020-07-06Implement mu_stream_shift functionSergey Poznyakoff7
* include/mailutils/stream.h (mu_stream_shift): New proto. * libmailutils/stream/Makefile.am: Add new source. * libmailutils/stream/streamshift.c: New file. * libmailutils/tests/.gitignore: Update. * libmailutils/tests/Makefile.am: Add new tests. * libmailutils/tests/streamshift.at: New file. * libmailutils/tests/t-streamshift.c: New file. * libmailutils/tests/testsuite.at: Include new test.
2020-07-05BugfixSergey Poznyakoff1
* libmailutils/imapio/getline.c (mu_imapio_getline): Don't unquote literals.
2020-06-23Specify additional content-type parameters when creating multipart MIME objectsSergey Poznyakoff2
Preserve original parameters (excepting boundary) when processing multipart messages by decodemail. * decodemail/decodemail.c (message_decode): copy parameters from the original Content-Type. * include/mailutils/mime.h (mu_mime_create_multipart): Add third parameter: an assoc table of additional content-type parameters. (mu_mime_content_type_param): Rename to mu_mime_content_type_get_param. (mu_mime_content_type_set_param): New proto. * libmailutils/mime/mime.c: See above. (_mime_set_content_type): Preserve all parameters.
2020-06-22decodemain: set 7bit or 8bit transfer encoding on decoded parts.Sergey Poznyakoff2
* decodemail/decodemail.c (message_decode): Set 8bit or 7bit transfer encoding, depending on the character of the decoded stream. * include/mailutils/cstr.h (mu_mem_8bit_count): New proto. * include/mailutils/stream.h (MU_STREAM_STAT_IN8BIT) (MU_STREAM_STAT_OUT8BIT): New constants. * libmailutils/stream/stream.c (_stream_read,_stream_write): Set MU_STREAM_STAT_IN8BIT (MU_STREAM_STAT_OUT8BIT) if requested * libmailutils/string/strcount.c (mu_mem_8bit_count): New function.
2020-06-17Improve MIME parser and mime object creation. Preserve original ↵Sergey Poznyakoff2
content-type in decodemail * decodemail/decodemail.c: Preserve the content subtype of each message. * include/mailutils/mime.h (MU_MIME_CONTENT_TYPE_MULTIPART) (MU_MIME_CONTENT_SUBTYPE_MIXED) (MU_MIME_CONTENT_SUBTYPE_ALTERNATIVE) (MU_MIME_CONTENT_SUBTYPE_DIGEST): New defines. (mu_mime_create_multipart): New proto. (mu_mime_sget_content_type,mu_mime_aget_content_type) (mu_mime_sget_content_subtype,mu_mime_aget_content_subtype) (mu_mime_content_type_param): New protos. * include/mailutils/sys/mime.h (content_type): Change type. (boundary): Const now. Points to a string in content_type->param. * libmailutils/base/ctparse.c (format_param): Fix quoting. Insert additonal whitespace after each semicolon. * libmailutils/mime/mime.c: Use mu_content_type_t to represent the Content-Type header. (mu_mime_create_multipart): New function. (mu_mime_create): Use mu_mime_create_multipart to create new mime object. (mu_mime_sget_content_type,mu_mime_aget_content_type) (mu_mime_sget_content_subtype,mu_mime_aget_content_subtype) (mu_mime_content_type_param): New functions.
2020-06-16decodemail: don't recode charsets unless explicitly requestedSergey Poznyakoff1
* decodemail/decodemail.c: New options --charset and --recode (main): Recode messages only if requested from the command line. Don't add the Content-Disposition header. * include/mailutils/util.h (mu_content_type_format): New proto. * lib/mdecode.c (charset_setup): Return immediately if charset is NULL. * libmailutils/base/ctparse.c (mu_content_type_format): New function.
2020-06-15Fix long-standing memory leak in body.cSergey Poznyakoff3
* include/mailutils/body.h (mu_body_ref, mu_body_unref): New functions. * include/mailutils/sys/body.h (_mu_body): New member ref_count. * libmailutils/mailbox/body.c: Keep body and body stream objects alive for as long as their reference counters are not zero. Rewrite transport stream code. * libmailutils/tests/modmesg.c: Use MU_ASSERT.
2020-06-14Upgrade wordsplitSergey Poznyakoff1
2020-06-14Rewrite mime message parser.Sergey Poznyakoff1
* include/mailutils/sys/mime.h (MIME_STATE_BEGIN_LINE) (MIME_PARSER_HAVE_CR): Remove constants. (struct _mu_mime): Remove cur_buf and buf_size. * libmailutils/mime/mime.c (_mime_parse_mpart_message): Use mu_stream_getline instead of the handcrafted dual buffering scheme.
2020-06-14Fix memory leaks.Sergey Poznyakoff8
* libmailutils/base/amd.c (amd_message_stream_close): Use mu_stream_destroy instead of mu_stream_close. * libmailutils/base/ctparse.c (content_type_parse): Free value. * libmailutils/base/tilde.c (mu_tilde_expansion): Free proto. * libmailutils/cfg/driver.c (mu_config_destroy_container): Free refcount. * libmailutils/cfg/parser.y (mu_cfg_tree_postprocess): Destroy iterator. (mu_cfg_destroy_tree): Free the tree itself. * libmailutils/datetime/scantime.c (pop_input): Free the popped element. * libmailutils/mailer/mailer.c (send_fragments): Destroy mime after converting it to message. * libmailutils/mime/mimehdr.c (_mime_header_parse): Free ws after errors.
2020-06-06Use mu_coord_t in mailSergey Poznyakoff1
* include/mailutils/message.h (mu_coord_part_string): New proto. * libmailutils/base/coord.c (mu_coord_part_string): New function. * mail/mail.h (message_set): Remove npart and msg_part. Introduce mu_coord_t crd instead. All uses updated.
2020-06-05BugfixSergey Poznyakoff1
* libmailutils/base/coord.c (mu_coord_alloc): Return the allocated memory.
2020-06-04Remove placeholder (mapi) and dead (nntp) codeSergey Poznyakoff2
2020-06-02BugfixSergey Poznyakoff1
* libmailutils/base/coord.c (mu_coord_string): Reverse the partially built coordinate string. * mail/msgset.y (msgset_part_str): Likewise.
2020-06-02Improve message part iterator and readmsg outputSergey Poznyakoff4
* include/mailutils/message.h (mu_coord_t): New data type. (mu_coord_alloc, mu_coord_realloc) (mu_coord_dup, mu_coord_string): New protos. (mu_coord_length): New function. * libmailutils/base/Makefile.am: Add coord.c * libmailutils/base/coord.c: New file. * libmailutils/mime/mimeitr.c: Key returned by mu_iterator_current_kv is allocated in the struct mimeitr. Caller may not free it. (struct mimeitr): New member: coord. (getitem): Reallocate coord. (mimeitr_free): New function. (destroy): Use mimeitr_free. (itrdup): Duplicate coord (mu_message_get_iterator): Initialize coord. * libmailutils/tests/mimeitr.c: Use mu_coord_string to print the part coordinates. * readmsg/msglist.c (message_body_stream): New argument: unix_header. Install additional "FROM" encoding filter if it is set. (print_header): Special handling for "*" in the weedlist. (msgpart_str): Remove. Use mu_coord_string instead. (main): In mime decode mode, if -h (display all headers) is requested, ignore MIME headers, since after decoding they are no longer relevant.
2020-06-01readmsg: Implement searches in MIME messages. Decode MIME on output.Sergey Poznyakoff4
* configure.ac: Add UNISTRING_LIBS to MU_APP_LIBRARIES. * examples/Makefile.am: Link with $MU_APP_LIBRARIES instead of plain libmuaux.la. * mh/Makefile.am: Likewise. * imap4d/Makefile.am: Likewise. * imap4d/imap4d.h (unistr_downcase) (unistr_is_substring): Move prototypes to lib/muaux.h * imap4d/search.c (_scan_header): Use unistr_is_substring_dn instead of unistr_is_substring. * include/mailutils/message.h (mu_message_get_iterator): New prototype. * lib/Makefile.am: Add unistr_u8.c or unistr_c.c, depending on MU_COND_UNISTRING. * lib/muaux.h (unistr_downcase) (unistr_is_substring,unistr_is_substring_dn): New functions. * lib/unistr_c.c: New file (moved from /imap4d). * lib/unistr_u8.c: Likewise. * libmailutils/mime/Makefile.am: Add mimeitr.c * libmailutils/mime/mimeitr.c: New file. * libmailutils/tests/Makefile.am: Add mimeitr.c * libmailutils/tests/mimeitr.c: New file. * readmsg/msglist.c: Rewrite search in messages. * readmsg/readmsg.c: New options --glob, --regex, --ignorecase control message matching. * readmsg/readmsg.h (pattern_init,pattern_match) (pattern_free): New protos.
2020-05-29Fix stream buffer parameters on truncateSergey Poznyakoff1
* configure.ac: Version 3.9.90 * libmailutils/stream/stream.c (mu_stream_truncate): Update stream->offset, stream->level, and stream->pos, if needed.
2020-05-29mail: write command operates on message parts as well as on messagesSergey Poznyakoff3
Messages or message parts are decoded before being written to a disk file. * include/mailutils/cstr.h (mu_mem_c_count): New proto. * include/mailutils/stream.h (MU_STREAM_STAT_INLN) (MU_STREAM_STAT_OUTLN): New constants. * libmailutils/stream/stream.c (_stream_stat_incr) (_stream_seek): Rewrite as inline functions. (_stream_read, _stream_write): Rewrite as inline functions. Optionally count number of lines read/written. * libmailutils/string/strcount.c (mu_mem_c_count): New function. * libmailutils/tests/fltst.c: Update. * mail/decode.c (format_msgset): Remove. Use msgset_str instead. (print_message_body): New function. * mail/mail.h (msgset_part_str) (util_get_message_part): New protos. (msgset_str): New function. * mail/msgset.y: Change the message part syntax. Components are separated by dots, instead of being enclosed in brackets. Old syntax is still supported for compatibility. * mail/struct.c (show_part): Use msgset_str. * mail/testsuite/mail/read.exp: Fix expected strings. * mail/util.c (util_get_message_part): New function. * mail/write.c (mail_write): Write message part if requested. Decode the body if the Content-Transfer-Encoding header is set.

Return to:

Send suggestions and report system problems to the System administrator.