1. 24 Jan, 2017 3 commits
  2. 23 Jan, 2017 2 commits
    • Sergey Poznyakoff authored
    • * imap4d/list.c (refinfo) <refptr>: const pointer.
      (list_fun): Don't insert spurious delimiter between the
      prefix and the value.
      (list_ref): New static function.  Actually list a normalized ref/wcard
      pair.
      (imap4d_list): Correctly handle wildcard part starting with
      namespace prefixes
      * imap4d/namespace.c (prefix_translate_name): If a prefix ends with
      a delimiter, allow its use without trailing delimiter in ref.   E.g.
      
        LIST "~" "%"
      
      for prefix "~/" is quite OK.
      * imap4d/tests/atlocal.in: Fix prefix declaration.
      Sergey Poznyakoff authored
  3. 22 Jan, 2017 4 commits
    • * imap4d/io.c (io_send_qstring): Fix condition
      * imap4d/list.c (list_fun): Use io_send_qstring to print names.
      * imap4d/lsub.c (imap4d_lsub): Likewise.
      Sergey Poznyakoff authored
    • * imap4d/namespace.c (namespace_init): Provide record for default
      "" prefix.
      Sergey Poznyakoff authored
    • Instead of translating names to full mailbox URLs, translate them
      to the filesystem pathname and record (mu_record_t) that should be
      used when creating the mailbox.  Never use mu_mailbox_create_default.
      
      This patch also fixes memory leaks in some functions (the return
      value from namespace_get_url was never freed).
      
      * imap4d/imap4d.h (namespace_get_url): Remove.
      (namespace_get_name): New proto.
      * imap4d/namespace.c (namespace_init): Always intialize the
      pfx->record member.  This requires that the default record be
      initialized.
      (namespace_get_url): Remove.
      (namespace_get_name): New function.
      
      * imap4d/create.c: Use namespace_get_name and
      mu_mailbox_create_from_record to create mailboxes.  Fix folder
      creation.
      * imap4d/append.c: Use namespace_get_name and
      mu_mailbox_create_from_record to create mailboxes.
      * imap4d/copy.c: Likewise.
      * imap4d/delete.c: Likewise.
      * imap4d/quota.c: Likewise.
      * imap4d/rename.c: Likewise.
      * imap4d/status.c: Likewise.
      Sergey Poznyakoff authored
    • * imap4d/list.c (list_fun): List matching directories.
      Sergey Poznyakoff authored
  4. 21 Jan, 2017 1 commit
  5. 20 Jan, 2017 2 commits
  6. 19 Jan, 2017 2 commits
    • * libmailutils/string/expvar.c (exp_shell): Fix out-of-buffer
      read when used without arguments.
      (mu_str_expand): Improve error handling.
      * libmailutils/tests/testsuite.at (MU_GENERIC_TEST_CMD): New
      macro.
      Include exp.at
      * libmailutils/tests/vexp.c: New file.
      * libmailutils/tests/Makefile.am: Build vexp. Add exp.at
      * libmailutils/tests/exp.at: New file.
      Sergey Poznyakoff authored
    • The functions are used wherever variables can be expected, most
      notably in configuration statements, such as ldap, namespace (imap4d),
      etc.  Apart from expanding variables it also provides command
      expansion $(command args...)
      
      The commands currently available are:
      
        domainpart ARG       splits its argument on the first occurrence of @
                             and returns the part after it.
        localpart ARG        splits its argument on the first occurrence of @
                             and returns the part before it.
        shell CMD ARG...     runs shell command CMD and returns its output
      
      * include/mailutils/cstr.h (mu_str_expand, mu_str_vexpand): New protos.
      * libmailutils/string/expvar.c: New file.
      * libmailutils/string/Makefile.am: Add expvar.c
      
      * libmailutils/tests/exp.c: New file.
      * libmailutils/tests/Makefile.am: Add exp.c
      
      * imap4d/imap4d.c (namespace_cfg_init): Fix docstring.
      * imap4d/namespace.c (namespace_translate_name): Use mu_str_expand.
      
      * libmailutils/mailbox/mbx_default.c (mu_construct_user_mailbox_url):
      Use mu_str_vexpand.
      * libmu_auth/ldap.c (_mu_ldap_search): Likewise.
      * libmu_auth/radius.c (_expand_query): Likewise.
      * libmu_auth/sql.c (mu_sql_expand_query): Likewise.
      
      * mu/shell.c (mutool_prompt_env): Remove.
      (shell_prompt): Rewrite
      (input_line_interactive): Use mu_str_expand.
      (mutool_shell_prompt_assoc): New function.
      * mu/mu.h (mutool_shell_prompt_assoc): New proto.
      * mu/imap.c (imap_prompt_env): Use mutool_shell_prompt_assoc.
      * mu/pop.c (pop_prompt_env): Likewise.
      * mu/smtp.c (smtp_prompt_env): Likewise.
      Sergey Poznyakoff authored
  7. 18 Jan, 2017 1 commit
  8. 17 Jan, 2017 2 commits
  9. 16 Jan, 2017 4 commits
    • * libmailutils/mime/attachment.c (mu_attachment_copy_from_stream)
      (mu_attachment_copy_from_file): Remove the encoding parameter.  Take
      the encoding to use from the value of the Content-Transfer-Encoding
      header.  Return EINVAL if it is not present.
      * include/mailutils/message.h (mu_attachment_copy_from_stream)
      (mu_attachment_copy_from_file): Change signature.  All uses changed.
      Sergey Poznyakoff authored
    • This also includes small bugfixes in the MIME library code.
      
      The --skip-empty-attachment option now affects the original
      body as well.  If the option is in effect, and the body is empty,
      it will not be included to the composed message.
      
      * libmailutils/mime/mime.c (_mime_body_stream_read): Return EOF
      if there are no parts in the message.
      (mu_mime_get_num_parts): If message is not multipart, report 1 part
      without setting mime->nmtp_parts.  Setting it caused coredump in
      other MIME functions (namely, in mu_mime_add_part.
      * mail/send.c (add_body): New function.  Adds original body to
      the MIME, honoring the --skip-empty-attachment option.
      * doc/texinfo/programs.texi: Update.
      Sergey Poznyakoff authored
    • * imap4d/id.c (eat_args): Log the client identity using the info channel.
      * imap4d/list.c: tiny change
      Sergey Poznyakoff authored
    • * libmailutils/cli/cli.c (mu_cli): Use "no-" prefix to indicate negation
      * mail/mail.c (skip_empty_attachments): New global.
      (mail_options): New option --skip-empty-attachments
      * mail/mail.h (skip_empty_attachments): New extern.
      * mail/send.c (atchinfo) <skip_empty>: New field.
      (send_attach_file): Initialize skip_empty
      (saveatt): Optionally skip empty attachments
      
      * NEWS: Mention the new option.
      * doc/texinfo/programs.texi: Document the new option.
      Sergey Poznyakoff authored
  10. 14 Jan, 2017 4 commits
  11. 13 Jan, 2017 2 commits
    • * mail/mail.c (default_encoding,default_content_type)
      (content_name,content_filename): New statics.
      (cli_attach): Use the value of --content-name option as the
      content-type name parameter.
      The "-" argument instructs the program to read attachment from
      stdin (eqv --attach-fd=0)
      (cli_attach_fd): New function.
      (mail_options): New options: --content-name, --content-filename,
      --attach-fd
      * mail/mail.h (send_attach_file_default): Remove.
      (send_attach_file): New proto.
      * mail/send.c (atchinfo): New fields: id, name, source.
      (atchinfo_free): Update.
      (default_encoding,default_content_type): Remove globals.
      (send_attach_file): Rewrite.
      (send_attach_file_default): Remove.
      (escape_list_attachments): Print attachment identifier instead
      of the file name, which can be NULL.
      (saveatt): Use mu_attachment_create and mu_attachment_copy_from_stream.
      
      * NEWS: Update.
      * doc/texinfo/programs.texi: Document the new options.
      Sergey Poznyakoff authored
    • * libmailutils/stream/nullstream.c (_nullstream_free_pattern): Always
      reset pattern and patsize.
      (mu_nullstream_create): Fix patsize.
      Sergey Poznyakoff authored
  12. 04 Jan, 2017 3 commits
    • * imap4d/list.c (refinfo) <pfxlen>: Remove.
      (list_fun): Change the algorithm for restoring the printable reference name.
      (imap4d_list): Use actual reference, not the prefix value.
      * imap4d/namespace.c: Fix handling of NS_OTHER prefixes.
      * imap4d/tests/list.at: Change the testcase.
      Sergey Poznyakoff authored
    • Sergey Poznyakoff authored
    • * imap4d/imap4d.c (imap4d_homedir)
      (modify_homedir, mailbox_mode): Remove.
      (imap4d_srv_param): New configuration statement "namespace"
      Remove statements: homedir, personal-namespace,
      shared-namespace, other-mailbox-mode, shared-mailbox-mode.
      * imap4d/imap4d.h (imap4d_homedir, modify_homedir)
      (mailbox_mode): Remove.
      (namespace, namespace_init_session, util_getfullpath)
      (namespace_getfullpath, namespace_checkfullpath): Remove.
      (namespace_prefix, namespace): New structs.
      (namespace_lookup, namespace_translate_name)
      (namespace_get_url, translate_delim): New protos.
      * imap4d/list.c (refinfo): Revamp.
      (list_fun): Rewrite.
      * imap4d/namespace.c: Rewrite from scratch.
      * imap4d/append.c: Use new namespace functions.
      * imap4d/util.c (util_getfullpath): Remove.
      
      * imap4d/copy.c: Likewise.
      * imap4d/create.c: Likewise.
      * imap4d/delete.c: Likewise.
      * imap4d/quota.c: Likewise.
      * imap4d/rename.c: Likewise.
      * imap4d/select.c: Likewise.
      * imap4d/status.c: Likewise.
      
      * imap4d/tests/atlocal.in (make_config): New function.
      * imap4d/tests/testsuite.at (IMAP4D_CONFIG)
      (IMAP4D_RUN): New functions.
      * imap4d/tests/list.at: Update tests 16, 17, 18, 19
      
      * imap4d/tests/IDEF0955.at: Use IMAP4D_RUN.
      * imap4d/tests/IDEF0956.at: Likewise.
      * imap4d/tests/append00.at: Likewise.
      * imap4d/tests/append01.at: Likewise.
      * imap4d/tests/create01.at: Likewise.
      * imap4d/tests/create02.at: Likewise.
      Sergey Poznyakoff authored
  13. 02 Jan, 2017 1 commit
  14. 01 Jan, 2017 1 commit
  15. 31 Dec, 2016 1 commit
    • …on in foreach iterator functions
      
      * libmailutils/diag/errors (MU_ERR_USER0-MU_ERR_USER7): New error constants.
      Reserved for user's purposes, such as breaking from foreach iterators.
      * libmaildutils/list/foreach.c (mu_list_foreach): Treat NULL list as a list
      of 0 elements.
      * libmailutils/list/foreachdir.c (mu_list_foreach_dir): Likewise.
      * imap4d/imap4d.h (imap4d_auth_result): Remap constants to MU_ERR_USER[0-2]
      * libmu_sieve/prog.c (mu_i_sv_lint_command): Use mu_list_locate with
      the default comparator.
      * mh/mh_list.c (_comp_name): Rewrite to match the definition of
      mu_list_comparator_t
      (mhl_format_run): Set _comp_name as comparator for the
      env.printed_fields list.
      (header_is_printed): Use mu_list_locate.
      
      * imap4d/authenticate.c: Use MU_ERR_USER0-MU_ERR_USER7 to indicate
      normal break condition in foreach iterators.
      * imap4d/imap4d.c: Likewise.
      * imap4d/namespace.c: Likewise.
      * libmailutils/auth/auth.c: Likewise.
      * libmailutils/cfg/driver.c: Likewise.
      * libmailutils/cfg/parser.y: Likewise.
      * libmailutils/server/acl.c: Likewise.
      * libmailutils/server/msrv.c: Likewise.
      * libmu_sieve/conf.c: Likewise.
      * libmu_sieve/load.c: Likewise.
      * libmu_sieve/sieve.l: Likewise.
      * libmu_sieve/strexp.c: Likewise.
      * libproto/imap/mbox.c: Likewise.
      * libproto/imap/search.c: Likewise.
      * mh/mh_format.c: Likewise.
      * mh/send.c: Likewise.
      * mh/sortm.c: Likewise.
      * mimeview/mimetypes.y: Likewise.
      * movemail/movemail.c: Likewise.
      Sergey Poznyakoff authored
  16. 28 Dec, 2016 3 commits
    • The mu_assoc_sort_r call sorts the elements of mu_assoc_t for
      subsequent iterative access.  Random access facilities remain
      undistrurbed.
      
      * include/mailutils/assoc.h (mu_assoc_comparator_t): New typedef.
      (mu_assoc_sort_r): New proto.
      * libmailutils/base/assoc.c (mu_assoc_sort_r): New function.
      * libmailutils/tests/mimehdr.c: Sort assoc elements prior to
      iteration.
      Sergey Poznyakoff authored
    • Correctly handle character set and language info embedded in
      parameter values, and eventual parameter value continuations
      as per RFC 2231, Section 3.
      
      * include/mailutils/assoc.h (mu_assoc_is_empty): New proto.
      * libmailutils/base/assoc.c (mu_assoc_is_empty): New function.
      
      * include/mailutils/mime.h (mu_mime_header_parse): Output charset is
      char const *.
      * libmailutils/mime/mimehdr.c (mu_mime_header_parse): Likewise.
      
      * include/mailutils/util.h (mu_content_type) <param>: Change type to
      mu_assoc_t
      (mu_param): Remove structure declaration.
      (mu_content_type_parse): Take an optional output charset.
      * libmailutils/base/ctparse.c (mu_content_type_parse): Rewrite using
      mu_mime_header_parse.
      
      * imap4d/fetch.c (send_parameter_list):  Rewrite using mu_mime_header_parse.
      (format_param): Use base64 for parameter values with explicit charsets.
      
      * libmailutils/tests/conttype.c: Reflect the changes to struct
      mu_content_type
      Sergey Poznyakoff authored
    • * include/mailutils/assoc.h (mu_assoc_action_t): New typedef.
      (mu_assoc_foreach): New function.
      * libmailutils/base/assoc.c (mu_assoc_foreach): New function.
      Sergey Poznyakoff authored
  17. 27 Dec, 2016 1 commit
    • * configure.ac (VI_REVISION): Increase.
      * include/mailutils/assoc.h (mu_assoc_create): Change prototype.
      (mu_assoc_ref,mu_assoc_ref_install)
      (mu_assoc_remove_ref): Remove.
      (mu_assoc_get): New proto.
      (mu_assoc_lookup,mu_assoc_lookup_ref): New proto.
      (mu_assoc_install_ref): New proto.
      (mu_assoc_set_free): Remove.
      (mu_assoc_set_destroy_item): Set proto.
      * include/mailutils/types.hin (mu_deallocator_t): New typedef.
      * include/mailutils/list.h (mu_list_destroy_item_t): Change definition.
      * libmailutils/base/assoc.c: Rewrite.  Link all entries in
      a doubly-linked list to preserve natural ordering during iterations.
      * libmailutils/base/mutil.c (mutil_parse_field_map): Update calls
      to assoc API.
      * libmailutils/cfg/driver.c (alloc_section_tab)
      (mu_create_canned_section,mu_create_canned_param)
      (mu_get_canned_container,parse_mapping)
      (mu_cfg_field_map): Likewise.
      * libmailutils/mime/mimehdr.c (_mu_mime_param_free): Free the pointer
      itself.
      (flush_param,mu_mime_param_assoc_create)
      (mu_mime_param_assoc_add)
      (_mime_header_parse)
      (mu_mimehdr_aget_decoded_param): Update calls to assoc API.
      (mu_mime_param_free): New function.
      * libmailutils/property/assocprop.c: Likewise.
      * libmu_sieve/environment.c: Likewise.
      * libmu_sieve/variables.c: Likewise.
      * libproto/imap/id.c: Likewise.
      * mail/alias.c: Likewise.
      * mail/testsuite/mail/alias.exp: Update ordering of expected output.
      * mu/imap.c (com_id): Update.
      
      * include/mailutils/mime.h (mu_rfc2047_decode_param): Change prototype.
      * libmailutils/base/rfc2047.c (mu_rfc2047_decode_param): Allocate
      returned value, instead of filling an already allocated structure.
      * libproto/imap/fetch.c: Reflect changes.
      Sergey Poznyakoff authored
  18. 26 Dec, 2016 1 commit
  19. 25 Dec, 2016 2 commits
    • * include/mailutils/message.h (mu_attachment_create)
      (mu_attachment_copy_from_stream)
      (mu_attachment_copy_from_file): New functions.
      * libmailutils/mime/attachment.c: Likewise.
      (mu_message_create_attachment): Rewrite using the three functions above.
      Sergey Poznyakoff authored
    • * libmailutils/string/strcount.c (mu_str_count): Take an array of
      (ASCII) characters to count occurrences of.  Optionally store individual
      counts in an array passed as the 3rd argument.
      * include/mailutils/cstr.h (mu_str_count): Change proto.
      (mu_c_str_escape, mu_c_str_escape_trans)
      (mu_c_str_unescape_inplace, mu_c_str_unescape)
      (mu_c_str_unescape_trans): New protos.
      * libmailutils/string/cstrescape.c: New file.
      * libmailutils/string/cstrunescape.c: New file.
      * libmailutils/string/Makefile.am: Add new files.
      Sergey Poznyakoff authored